pax_global_header00006660000000000000000000000064125316747060014525gustar00rootroot0000000000000052 comment=db2a3f3c05f7ce61d260e053396edb9eb88b5007 array-1.0.6/000077500000000000000000000000001253167470600126475ustar00rootroot00000000000000array-1.0.6/.editorconfig000066400000000000000000000002511253167470600153220ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = falsearray-1.0.6/.gitattributes000066400000000000000000000000141253167470600155350ustar00rootroot00000000000000* text=auto array-1.0.6/.gitignore000066400000000000000000000013071253167470600146400ustar00rootroot00000000000000 # Directories # ############### reports/ build/ # Compiled source # ################### *.com *.class *.dll *.exe *.o *.so # Packages # ############ # it's better to unpack these files and commit the raw source # git has its own built in compression methods *.7z *.dmg *.gz *.iso *.jar *.rar *.tar *.zip # Logs and databases # ###################### *.log *.sql *.sqlite # OS generated files # ###################### .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon? ehthumbs.db Thumbs.db Desktop.ini # Temporary files # ################### *~ # Node.js # ########### /node_modules/ # Matlab # ########## # Windows default autosave extension *.asv # Compiled MEX binaries (all platforms) *.mex* array-1.0.6/.jshintignore000066400000000000000000000001661253167470600153560ustar00rootroot00000000000000 # Directories # ############### build/ reports/ dist/ # Node.js # ########### /node_modules/ # Git # ####### .git* array-1.0.6/.jshintrc000066400000000000000000000023471253167470600145020ustar00rootroot00000000000000{ "bitwise": false, "camelcase": false, "curly": true, "eqeqeq": true, "es3": false, "forin": true, "freeze": true, "immed": true, "indent": 4, "latedef": "nofunc", "newcap": true, "noarg": true, "noempty": false, "nonbsp": true, "nonew": true, "plusplus": false, "quotmark": "single", "undef": true, "unused": true, "strict": true, "maxparams": 10, "maxdepth": 5, "maxstatements": 100, "maxcomplexity": false, "maxlen": 1000, "asi": false, "boss": false, "debug": false, "eqnull": false, "esnext": false, "evil": false, "expr": false, "funcscope": false, "globalstrict": false, "iterator": false, "lastsemic": false, "laxbreak": false, "laxcomma": false, "loopfunc": false, "maxerr": 1000, "moz": false, "multistr": false, "notypeof": false, "proto": false, "scripturl": false, "shadow": false, "sub": true, "supernew": false, "validthis": false, "noyield": false, "browser": true, "browserify": true, "couch": false, "devel": true, "dojo": false, "jasmine": false, "jquery": false, "mocha": true, "mootools": false, "node": true, "nonstandard": false, "prototypejs": false, "qunit": false, "rhino": false, "shelljs": false, "worker": false, "wsh": false, "yui": false, "globals": {} }array-1.0.6/.npmignore000066400000000000000000000007621253167470600146530ustar00rootroot00000000000000 # Files # ######### Makefile README.md TODO.md # Directories # ############### build/ docs/ examples/ reports/ support/ test/ benchmark/ # Node.js # ########### .npmignore /node_modules/ # Logs # ######## *.log # OS generated files # ###################### .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon? ehthumbs.db Thumbs.db Desktop.ini # Temporary files # ################### *~ # Git # ####### .git* # Utilities # ############# .jshintrc .jshintignore .travis.yml .editorconfig array-1.0.6/.travis.yml000066400000000000000000000002221253167470600147540ustar00rootroot00000000000000language: node_js node_js: - '0.12' - '0.11' - '0.10' - 'iojs' before_install: - npm update -g npm after_script: - npm run coveralls array-1.0.6/LICENSE000066400000000000000000000020751253167470600136600ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014-2015 Athan Reines. 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. array-1.0.6/Makefile000066400000000000000000000035501253167470600143120ustar00rootroot00000000000000 ############# # VARIABLES # # Set the node.js environment to test: NODE_ENV ?= test # Kernel name: KERNEL ?= $(shell uname -s) ifeq ($(KERNEL), Darwin) OPEN ?= open else OPEN ?= xdg-open endif # NOTES # NOTES ?= 'TODO|FIXME|WARNING|HACK|NOTE' # MOCHA # MOCHA ?= ./node_modules/.bin/mocha _MOCHA ?= ./node_modules/.bin/_mocha MOCHA_REPORTER ?= spec # ISTANBUL # ISTANBUL ?= ./node_modules/.bin/istanbul ISTANBUL_OUT ?= ./reports/coverage ISTANBUL_REPORT ?= lcov ISTANBUL_LCOV_INFO_PATH ?= $(ISTANBUL_OUT)/lcov.info ISTANBUL_HTML_REPORT_PATH ?= $(ISTANBUL_OUT)/lcov-report/index.html # JSHINT # JSHINT ?= ./node_modules/.bin/jshint JSHINT_REPORTER ?= ./node_modules/jshint-stylish/stylish.js # FILES # # Source files: SOURCES ?= lib/*.js # Test files: TESTS ?= test/*.js ########### # TARGETS # # NOTES # .PHONY: notes notes: grep -Ern $(NOTES) $(SOURCES) $(TESTS) # UNIT TESTS # .PHONY: test test-mocha test: test-mocha test-mocha: node_modules NODE_ENV=$(NODE_ENV) \ NODE_PATH=$(NODE_PATH_TEST) \ $(MOCHA) \ --reporter $(MOCHA_REPORTER) \ $(TESTS) # CODE COVERAGE # .PHONY: test-cov test-istanbul-mocha test-cov: test-istanbul-mocha test-istanbul-mocha: node_modules NODE_ENV=$(NODE_ENV) \ NODE_PATH=$(NODE_PATH_TEST) \ $(ISTANBUL) cover \ --dir $(ISTANBUL_OUT) \ --report $(ISTANBUL_REPORT) \ $(_MOCHA) -- \ --reporter $(MOCHA_REPORTER) \ $(TESTS) # COVERAGE REPORT # .PHONY: view-cov view-istanbul-report view-cov: view-istanbul-report view-istanbul-report: $(OPEN) $(ISTANBUL_HTML_REPORT_PATH) # LINT # .PHONY: lint lint-jshint lint: lint-jshint lint-jshint: node_modules $(JSHINT) \ --reporter $(JSHINT_REPORTER) \ ./ # NODE # # Installing node_modules: .PHONY: install install: npm install # Clean node: .PHONY: clean-node clean-node: rm -rf node_modules # CLEAN # .PHONY: clean clean: rm -rf build array-1.0.6/README.md000066400000000000000000000050311253167470600141250ustar00rootroot00000000000000Array === [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url] > Validates if a value is an array. ## Installation ``` bash $ npm install validate.io-array ``` For use in the browser, use [browserify](https://github.com/substack/node-browserify). ## Usage ``` javascript var isArray = require( 'validate.io-array' ); ``` #### isArray( value ) Validates if a value is an `array`. ``` javascript var value = []; var bool = isArray( value ); // returns true ``` ## Examples ``` javascript var isArray = require( 'validate.io-array' ); console.log( isArray( [ 1, 2, 3, 4 ] ) ); // returns true console.log( isArray( {} ) ); // returns false ``` To run the example code from the top-level application directory, ``` bash $ node ./examples/index.js ``` ## Tests ### Unit Unit tests use the [Mocha](http://mochajs.org) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory: ``` bash $ make test ``` All new feature development should have corresponding unit tests to validate correct functionality. ### Test Coverage This repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory: ``` bash $ make test-cov ``` Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report, ``` bash $ make view-cov ``` --- ## License [MIT license](http://opensource.org/licenses/MIT). ## Copyright Copyright © 2014-2015. Athan Reines. [npm-image]: http://img.shields.io/npm/v/validate.io-array.svg [npm-url]: https://npmjs.org/package/validate.io-array [travis-image]: http://img.shields.io/travis/validate-io/array/master.svg [travis-url]: https://travis-ci.org/validate-io/array [coveralls-image]: https://img.shields.io/coveralls/validate-io/array/master.svg [coveralls-url]: https://coveralls.io/r/validate-io/array?branch=master [dependencies-image]: http://img.shields.io/david/validate-io/array.svg [dependencies-url]: https://david-dm.org/validate-io/array [dev-dependencies-image]: http://img.shields.io/david/dev/validate-io/array.svg [dev-dependencies-url]: https://david-dm.org/dev/validate-io/array [github-issues-image]: http://img.shields.io/github/issues/validate-io/array.svg [github-issues-url]: https://github.com/validate-io/array/issues array-1.0.6/TODO.md000066400000000000000000000000141253167470600137310ustar00rootroot00000000000000TODO ==== array-1.0.6/examples/000077500000000000000000000000001253167470600144655ustar00rootroot00000000000000array-1.0.6/examples/index.js000066400000000000000000000002221253167470600161260ustar00rootroot00000000000000'use strict'; var isArray = require( './../lib' ); console.log( isArray( [] ) ); // returns true console.log( isArray( {} ) ); // returns falsearray-1.0.6/lib/000077500000000000000000000000001253167470600134155ustar00rootroot00000000000000array-1.0.6/lib/index.js000066400000000000000000000005771253167470600150730ustar00rootroot00000000000000'use strict'; /** * FUNCTION: isArray( value ) * Validates if a value is an array. * * @param {*} value - value to be validated * @returns {Boolean} boolean indicating whether value is an array */ function isArray( value ) { return Object.prototype.toString.call( value ) === '[object Array]'; } // end FUNCTION isArray() // EXPORTS // module.exports = Array.isArray || isArray; array-1.0.6/package.json000066400000000000000000000024671253167470600151460ustar00rootroot00000000000000{ "name": "validate.io-array", "version": "1.0.6", "description": "Validates if a value is an array.", "author": { "name": "Athan Reines", "email": "kgryte@gmail.com" }, "contributors": [ { "name": "Athan Reines", "email": "kgryte@gmail.com" } ], "scripts": { "test": "./node_modules/.bin/mocha", "test-cov": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec", "coveralls": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coveralls/coverage --report lcovonly -- -R spec && cat ./reports/coveralls/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./reports/coveralls" }, "main": "./lib", "repository": { "type": "git", "url": "git://github.com/validate-io/array.git" }, "keywords": [ "validate.io", "validate", "validation", "validator", "valid", "array", "is", "isarray", "type", "check" ], "bugs": { "url": "https://github.com/validate-io/array/issues" }, "dependencies": {}, "devDependencies": { "chai": "2.x.x", "coveralls": "^2.11.1", "istanbul": "^0.3.0", "jshint": "2.x.x", "jshint-stylish": "^1.0.0", "mocha": "2.x.x", "proxyquire": "^1.4.0" }, "license": "MIT" } array-1.0.6/test/000077500000000000000000000000001253167470600136265ustar00rootroot00000000000000array-1.0.6/test/test.js000066400000000000000000000024341253167470600151460ustar00rootroot00000000000000/* global describe, it, require */ 'use strict'; // MODULES // var // Expectation library: chai = require( 'chai' ), // Proxy module dependencies: proxyquire = require( 'proxyquire' ), // Module to be tested: isArray = require( './../lib' ); // VARIABLES // var expect = chai.expect, assert = chai.assert; // TESTS // describe( 'validate.io-array', function tests() { it( 'should export a function', function test() { expect( isArray ).to.be.a( 'function' ); }); it( 'should positively validate', function test() { assert.ok( isArray( [] ) ); assert.ok( isArray( new Array( 10 ) ) ); }); it( 'should negatively validate', function test() { var values = [ 5, {}, true, '5', null, NaN, function(){}, undefined ]; for ( var i = 0; i < values.length; i++ ) { assert.ok( !isArray( values[i] ) ); } }); it( 'should include a polyfill for Array.isArray', function test() { var fcn = Array.isArray, isArray, values; Array.isArray = undefined; isArray = proxyquire( './../lib', {} ); values = [ 5, {}, true, '5', null, NaN, function(){}, undefined ]; for ( var i = 0; i < values.length; i++ ) { assert.ok( !isArray( values[i] ) ); } assert.ok( isArray( [] ) ); Array.isArray = fcn; }); });