doublescore
Advanced tools
Comparing version 0.3.5 to 0.3.7
65
index.js
'use strict'; | ||
var iterate = require( './lib/iterate' ); | ||
var Clone = require( './lib/clone' ); | ||
@@ -9,30 +10,53 @@ var Close = require( './lib/close' ); | ||
module.exports = function( obj ) { | ||
var argsToArr = function ( args ) { | ||
return Array.prototype.slice.call( args ); | ||
}; | ||
module.exports = function () { | ||
var args = arguments; | ||
var iterateWrapper = function ( iterator ) { | ||
var myArgs = argsToArr( args ); | ||
console.error( 'args', args ); | ||
console.error( 'myArgs', myArgs ); | ||
myArgs.push( iterator ); | ||
return iterate.apply( iterate, myArgs ); | ||
}; | ||
iterateWrapper.total = function () { | ||
return iterate.total.apply( iterate, args ); | ||
}; | ||
iterateWrapper.flatten = function () { | ||
return iterate.flatten.apply( iterate, args ); | ||
}; | ||
return { | ||
clone: function() { | ||
return Clone.clone( obj ); | ||
iterate: iterateWrapper, | ||
clone: function () { | ||
return Clone.clone.apply( module.exports, args ); | ||
}, | ||
close: function() { | ||
return Close.close( obj ); | ||
close: function () { | ||
return Close.close.apply( module.exports, args ); | ||
}, | ||
getType: function() { | ||
return Types.getType( obj ); | ||
getType: function () { | ||
return Types.getType.apply( module.exports, args ); | ||
}, | ||
isArray: function() { | ||
return Types.isArray( obj ); | ||
isArray: function () { | ||
return Types.isArray.apply( module.exports, args ); | ||
}, | ||
isNumber: function() { | ||
return Types.isNumber( obj ); | ||
isNumber: function () { | ||
return Types.isNumber.apply( module.exports, args ); | ||
}, | ||
isObject: function() { | ||
return Types.isObject( obj ); | ||
isObject: function () { | ||
return Types.isObject.apply( module.exports, args ); | ||
}, | ||
mixin: function() { | ||
var args = [ obj ]; | ||
for ( var i in arguments ) { | ||
if ( arguments.hasOwnProperty( i ) ) { | ||
args.push( arguments[ i ] ); | ||
} | ||
mixin: function () { | ||
var myArgs = argsToArr( args ); | ||
for ( var i = 0; i < arguments.length; i++ ) { | ||
myArgs.push( arguments[ i ] ); | ||
} | ||
return Mixin.mixin.apply( module.exports, args ); | ||
return Mixin.mixin.apply( module.exports, myArgs ); | ||
} | ||
@@ -42,2 +66,3 @@ }; | ||
module.exports.iterate = iterate; | ||
module.exports.clone = Clone.clone; | ||
@@ -44,0 +69,0 @@ module.exports.close = Close.close; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var Close = module.exports = { | ||
module.exports = { | ||
close: function ( params ) { | ||
@@ -8,0 +8,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"author": "Anthony Hildoer <anthony@bluerival.com>", | ||
"version": "0.3.5", | ||
"version": "0.3.7", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
doublescore | ||
==================== | ||
A natively written, no external dependency utility library. | ||
These are the available utility functions. | ||
iterate() | ||
```javascript | ||
var __ = require( 'doublescore' ); | ||
__([0, { one: 1}, [2, 3] ]).iterate(function( value, index) { | ||
/** is called 4 times with the params value/index: | ||
* 0/[0] | ||
* 1/[1,'one'] | ||
* 2/[2, 0] | ||
* 3/[2, 1] | ||
*/ | ||
}); | ||
``` | ||
close() | ||
@@ -16,3 +39,3 @@ | ||
function do( params, done ) { | ||
function doSomething( params, done ) { | ||
@@ -67,5 +90,4 @@ // ensure done is called within 30 seconds, multiple calls ignored | ||
function doSomething ( params, done ) { | ||
function do( params, done ) { | ||
// sets defaults recursively | ||
@@ -105,3 +127,3 @@ params = __( { | ||
The usage for doublescore is patterned after other utility libraries like underscore. | ||
The usage for doublescore is patterned after other utility libraries like underscore. BUT, it is not interchangeable. | ||
@@ -108,0 +130,0 @@ |
@@ -87,4 +87,2 @@ 'use strict'; | ||
var expectedMessage = "Error: max callbacks 1 exceeded by call 2 after last calls: [{\"0\":null,\"1\":200}]\n at Context.<anonymous> (/Users/ahildoer/src/BlueRival/doublescore/test/close.js:#:3)\n at callFn (/Users/ahildoer/src/BlueRival/doublescore/node_modules/mocha/lib/runnable.js:286:21)\n at Test.Runnable.run (/Users/ahildoer/src/BlueRival/doublescore/node_modules/mocha/lib/runnable.js:279:7)\n at Runner.runTest (/Users/ahildoer/src/BlueRival/doublescore/node_modules/mocha/lib/runner.js:421:10)\n at /Users/ahildoer/src/BlueRival/doublescore/node_modules/mocha/lib/runner.js:528:12\n at next (/Users/ahildoer/src/BlueRival/doublescore/node_modules/mocha/lib/runner.js:341:14)\n at /Users/ahildoer/src/BlueRival/doublescore/node_modules/mocha/lib/runner.js:351:7\n at next (/Users/ahildoer/src/BlueRival/doublescore/node_modules/mocha/lib/runner.js:283:14)\n at Immediate._onImmediate (/Users/ahildoer/src/BlueRival/doublescore/node_modules/mocha/lib/runner.js:319:5)\n at processImmediate [as _immediateCallback] (timers.js:383:17)"; | ||
cb( null, 200 ); | ||
@@ -102,3 +100,4 @@ cb( null, 'hi' ); | ||
assert.strictEqual( calls, 1 ); | ||
assert.strictEqual( consoleMessage, expectedMessage ); | ||
assert.strictEqual( !!consoleMessage.match( | ||
/^Error: max callbacks 1 exceeded by call 2 after last calls: \[\{"0":null,"1":200\}\]\n at Context\./ ), true ); | ||
@@ -105,0 +104,0 @@ } ); |
'use strict'; | ||
require( './iterate' ); | ||
require( './close' ); | ||
@@ -4,0 +5,0 @@ require( './clone' ); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
51928
20
1557
152
0