Skip to content

Commit

Permalink
[UPDATE] use validate.io modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Mar 20, 2015
1 parent ef1751b commit d39b065
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/index.js
Expand Up @@ -30,7 +30,8 @@

// MODULES //

var isInteger = require( 'validate.io-integer' );
var isNumber = require( 'validate.io-number-primitive' ),
isNonNegativeInteger = require( 'validate.io-nonnegative-integer' );


// LOGSPACE //
Expand All @@ -50,16 +51,16 @@ function logspace( a, b, len ) {
tmp,
d;

if ( typeof a !== 'number' || a !== a ) {
if ( !isNumber( a ) ) {
throw new TypeError( 'logspace()::invalid input argument. Exponent of start value must be numeric. Value: `' + a + '`.' );
}
if ( typeof b !== 'number' || b !== b ) {
if ( !isNumber( b ) ) {
throw new TypeError( 'logspace()::invalid input argument. Exponent of stop value must be numeric. Value: `' + b + '`.' );
}
if ( arguments.length < 3 ) {
len = 10;
} else {
if ( !isInteger( len ) || len < 0 ) {
if ( !isNonNegativeInteger( len ) ) {
throw new TypeError( 'logspace()::invalid input argument. Length must be a positive integer. Value: `' + len + '`.' );
}
if ( len === 0 ) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -43,7 +43,8 @@
"url": "https://github.com/compute-io/logspace/issues"
},
"dependencies": {
"validate.io-integer": "^1.0.1"
"validate.io-nonnegative-integer": "^1.0.0",
"validate.io-number-primitive": "^1.0.0"
},
"devDependencies": {
"chai": "2.x.x",
Expand Down

0 comments on commit d39b065

Please sign in to comment.