package/package.json000644 000765 000024 0000001645 13211612021013010 0ustar00000000 000000 { "name": "array-initial", "description": "Get all but the last element or last n elements of an array.", "version": "1.1.0", "homepage": "https://github.com/jonschlinkert/array-initial", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "repository": { "type": "git", "url": "git://github.com/jonschlinkert/array-initial.git" }, "bugs": { "url": "https://github.com/jonschlinkert/array-initial/issues" }, "license": "MIT", "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha -R spec" }, "devDependencies": { "mocha": "^2.0.0", "should": "^11.2.1" }, "dependencies": { "array-slice": "^1.0.0", "is-number": "^4.0.0" }, "keywords": [ "array", "fast", "first", "initial", "javascript", "js", "last", "rest", "util", "utility", "utils" ] } package/.npmignore000644 000765 000024 0000001074 13140413654012531 0ustar00000000 000000 # Numerous always-ignore extensions *.csv *.dat *.diff *.err *.gz *.log *.orig *.out *.pid *.rar *.rej *.seed *.swo *.swp *.vi *.yo-rc.json *.zip *~ .ruby-version lib-cov npm-debug.log # Always-ignore dirs /bower_components/ /node_modules/ /temp/ /tmp/ /vendor/ _gh_pages # OS or Editor folders *.esproj *.komodoproject .komodotools *.sublime-* ._* .cache .DS_Store .idea .project .settings .tmproj nbproject Thumbs.db # grunt-html-validation validation-status.json validation-report.json # misc TODO.md # npmignore test test.js .verb.md .gitattributes .editorconfig package/README.md000644 000765 000024 0000001611 13140413654012006 0ustar00000000 000000 # array-initial [![NPM version](https://badge.fury.io/js/array-initial.svg)](http://badge.fury.io/js/array-initial) > Get all but the last element or last n elements of an array. ## Install with [npm](npmjs.org) ```bash npm i array-initial --save ``` ## Usage ```js var initial = require('array-initial'); initial(['a', 'b', 'c', 'd', 'e', 'f']); //=> ['a', 'b', 'c', 'd', 'e'] initial(['a', 'b', 'c', 'd', 'e', 'f'], 1); //=> ['a', 'b', 'c', 'd', 'e'] initial(['a', 'b', 'c', 'd', 'e', 'f'], 2); //=> ['a', 'b', 'c', 'd'] ``` ## Author **Jon Schlinkert** + [github/jonschlinkert](https://github.com/jonschlinkert) + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright (c) 2014 Jon Schlinkert Released under the MIT license *** _This file was generated by [verb](https://github.com/assemble/verb) on December 12, 2014. To update, run `npm i -g verb && verb`._ package/index.js000644 000765 000024 0000001005 13140413654012171 0ustar00000000 000000 /*! * array-initial * * Copyright (c) 2014 Jon Schlinkert, contributors. * Licensed under the MIT license. */ var isNumber = require('is-number'); var slice = require('array-slice'); module.exports = function arrayInitial(arr, num) { if (!Array.isArray(arr)) { throw new Error('array-initial expects an array as the first argument.'); } if (arr.length === 0) { return null; } return slice(arr, 0, arr.length - (isNumber(num) ? num : 1)); }; package/.travis.yml000644 000765 000024 0000000204 13140415572012636 0ustar00000000 000000 sudo: false os: - linux - osx language: node_js node_js: - node - '8' - '7' - '6' - '5' - '4' - '0.12' - '0.10' package/.jshintrc000644 000765 000024 0000000403 13140413654012352 0ustar00000000 000000 { "esnext": true, "boss": true, "curly": true, "eqeqeq": true, "eqnull": true, "immed": true, "indent": 2, "latedef": true, "newcap": true, "noarg": true, "node": true, "sub": true, "undef": true, "unused": true, "mocha": true } package/LICENSE-MIT000644 000765 000024 0000002110 13140413654012156 0ustar00000000 000000 The MIT License (MIT) Copyright (c) 2014 Jon Schlinkert, contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.