pax_global_header00006660000000000000000000000064124717334130014517gustar00rootroot0000000000000052 comment=24570f40cf703aa85a526d3459c22a1dde1e094d integer-array-1.0.0/000077500000000000000000000000001247173341300142665ustar00rootroot00000000000000integer-array-1.0.0/.editorconfig000066400000000000000000000002511247173341300167410ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = falseinteger-array-1.0.0/.gitattributes000066400000000000000000000000141247173341300171540ustar00rootroot00000000000000* text=auto integer-array-1.0.0/.gitignore000066400000000000000000000013071247173341300162570ustar00rootroot00000000000000 # 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* integer-array-1.0.0/.jshintignore000066400000000000000000000001661247173341300167750ustar00rootroot00000000000000 # Directories # ############### build/ reports/ dist/ # Node.js # ########### /node_modules/ # Git # ####### .git* integer-array-1.0.0/.jshintrc000066400000000000000000000023471247173341300161210ustar00rootroot00000000000000{ "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": {} }integer-array-1.0.0/.npmignore000066400000000000000000000007621247173341300162720ustar00rootroot00000000000000 # 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 integer-array-1.0.0/.travis.yml000066400000000000000000000001111247173341300163700ustar00rootroot00000000000000language: node_js node_js: - "0.10" after_script: - npm run coverallsinteger-array-1.0.0/LICENSE000066400000000000000000000020671247173341300153000ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 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.integer-array-1.0.0/Makefile000066400000000000000000000033701247173341300157310ustar00rootroot00000000000000 ############# # VARIABLES # # Set the node.js environment to test: NODE_ENV ?= test # 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 integer-array-1.0.0/README.md000066400000000000000000000055171247173341300155550ustar00rootroot00000000000000Integer Array === [![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 integer array. ## Installation ``` bash $ npm install validate.io-integer-array ``` For use in the browser, use [browserify](https://github.com/substack/node-browserify). ## Usage ``` javascript var isIntegerArray = require( 'validate.io-integer-array' ); ``` #### isIntegerArray( value ) Validates if a `value` is an `integer array`. ``` javascript var arr = [ 1, 2, 3 ]; var bool = isIntegerArray( value ); // returns true ``` __Note__: the method will return `false` for an empty `array`. ## Examples ``` javascript var isIntegerArray = require( 'validate.io-integer-array' ); console.log( isIntegerArray( [1,5,3] ) ); // returns true console.log( isIntegerArray( [] ) ); // returns false console.log( isIntegerArray( ['1','2','3'] ) ); // 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 © 2015. Athan Reines. [npm-image]: http://img.shields.io/npm/v/validate.io-integer-array.svg [npm-url]: https://npmjs.org/package/validate.io-integer-array [travis-image]: http://img.shields.io/travis/validate-io/integer-array/master.svg [travis-url]: https://travis-ci.org/validate-io/integer-array [coveralls-image]: https://img.shields.io/coveralls/validate-io/integer-array/master.svg [coveralls-url]: https://coveralls.io/r/validate-io/integer-array?branch=master [dependencies-image]: http://img.shields.io/david/validate-io/integer-array.svg [dependencies-url]: https://david-dm.org/validate-io/integer-array [dev-dependencies-image]: http://img.shields.io/david/dev/validate-io/integer-array.svg [dev-dependencies-url]: https://david-dm.org/dev/validate-io/integer-array [github-issues-image]: http://img.shields.io/github/issues/validate-io/integer-array.svg [github-issues-url]: https://github.com/validate-io/integer-array/issues integer-array-1.0.0/TODO.md000066400000000000000000000000141247173341300153500ustar00rootroot00000000000000TODO ==== integer-array-1.0.0/examples/000077500000000000000000000000001247173341300161045ustar00rootroot00000000000000integer-array-1.0.0/examples/index.js000066400000000000000000000003571247173341300175560ustar00rootroot00000000000000'use strict'; var isIntegerArray = require( './../lib' ); console.log( isIntegerArray( [1,5,3] ) ); // returns true console.log( isIntegerArray( [] ) ); // returns false console.log( isIntegerArray( ['1','2','3'] ) ); // returns false integer-array-1.0.0/lib/000077500000000000000000000000001247173341300150345ustar00rootroot00000000000000integer-array-1.0.0/lib/index.js000066400000000000000000000016651247173341300165110ustar00rootroot00000000000000/** * * VALIDATE: integer-array * * * DESCRIPTION: * - Validates if a value is an integer array. * * * NOTES: * [1] * * * TODO: * [1] * * * LICENSE: * MIT * * Copyright (c) 2015. Athan Reines. * * * AUTHOR: * Athan Reines. kgryte@gmail.com. 2015. * */ 'use strict'; // MODULES // var isArray = require( 'validate.io-array' ), isInteger = require( 'validate.io-integer' ); // IS INTEGER ARRAY // /** * FUNCTION: isIntegerArray( value ) * Validates if a value is an integer array. * * @param {*} value - value to be validated * @returns {Boolean} boolean indicating if a value is an integer array */ function isIntegerArray( value ) { var len; if ( !isArray( value ) ) { return false; } len = value.length; if ( !len ) { return false; } for ( var i = 0; i < len; i++ ) { if ( !isInteger( value[i] ) ) { return false; } } return true; } // end FUNCTION isIntegerArray() // EXPORTS // module.exports = isIntegerArray; integer-array-1.0.0/package.json000066400000000000000000000027561247173341300165660ustar00rootroot00000000000000{ "name": "validate.io-integer-array", "version": "1.0.0", "description": "Validates if a value is an integer 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/integer-array.git" }, "keywords": [ "validate.io", "validate", "validation", "validator", "valid", "integer", "array", "integerarray", "is", "isintegerarray" ], "bugs": { "url": "https://github.com/validate-io/integer-array/issues" }, "dependencies": { "validate.io-array": "^1.0.3", "validate.io-integer": "^1.0.4" }, "devDependencies": { "chai": "1.x.x", "mocha": "1.x.x", "coveralls": "^2.11.1", "istanbul": "^0.3.0", "jshint": "2.x.x", "jshint-stylish": "^1.0.0" }, "licenses": [ { "type": "MIT", "url": "http://www.opensource.org/licenses/MIT" } ] } integer-array-1.0.0/test/000077500000000000000000000000001247173341300152455ustar00rootroot00000000000000integer-array-1.0.0/test/test.js000066400000000000000000000017501247173341300165650ustar00rootroot00000000000000/* global require, describe, it */ 'use strict'; // MODULES // var // Expectation library: chai = require( 'chai' ), // Module to be tested: isIntegerArray = require( './../lib' ); // VARIABLES // var expect = chai.expect, assert = chai.assert; // TESTS // describe( 'validate.io-integer-array', function tests() { it( 'should export a function', function test() { expect( isIntegerArray ).to.be.a( 'function' ); }); it( 'should positively validate', function test() { var bool; bool = isIntegerArray( [1,2,3] ); assert.ok( bool ); bool = isIntegerArray( [new Number(1) ] ); assert.ok( bool ); }); it( 'should negatively validate', function test() { var values = [ 5, '5', null, undefined, true, function(){}, [], {}, ['1','2','3'], [1,'2',3], [[],[]] ]; for ( var i = 0; i < values.length; i++ ) { assert.notOk( badValue( values[i] ) ); } function badValue( value ) { return isIntegerArray( value ); } }); });