Comparing version 0.0.4 to 0.0.5
@@ -6,8 +6,8 @@ // gen-pasta.js | ||
// | ||
function arrify (arr) { | ||
return Array.prototype.slice.apply(arr) | ||
function slice (ar, start, end) { | ||
return Array.prototype.slice.call(ar, start, end) | ||
} | ||
function log () { | ||
if (console && console.log) console.log(arrify(arguments)) | ||
if (console && console.log) console.log(slice(arguments)) | ||
} | ||
@@ -52,5 +52,8 @@ | ||
, first: first | ||
, list: list | ||
, flatten: flatten | ||
, arrify: arrify | ||
, slice: slice | ||
, combine: combine | ||
// Depricated names | ||
, arrify: slice | ||
} | ||
@@ -57,0 +60,0 @@ |
{ "name": "gen-pasta" | ||
, "version": "0.0.4" | ||
, "version": "0.0.5" | ||
, "author": "Nick Niemeir <nick.niemeir@gmail.com> (http://nrn.io)" | ||
@@ -4,0 +4,0 @@ , "main": "gen-pasta.js" |
@@ -11,5 +11,5 @@ #General Pasta | ||
##arrify(obj) | ||
##slice(obj[, start, end]) | ||
Take an array like object and return a real array. | ||
Take an array like object and return a real array. Optional start/end. | ||
@@ -16,0 +16,0 @@ ##combine(obj1, obj2) |
@@ -5,12 +5,17 @@ var p = require('../gen-pasta')() | ||
test('General', function (t) { | ||
t.plan(16) | ||
t.doesNotThrow(p.log, 'Log does not throw') | ||
t.equal((function () { | ||
return p.arrify(arguments) | ||
})(1, 2, 3).join() | ||
, [1, 2, 3].join() | ||
t.same((function () { | ||
return p.slice(arguments) | ||
})(1, 2, 3) | ||
, [1, 2, 3] | ||
, 'Turn array like objects into arrays' | ||
) | ||
t.same((function () { | ||
return p.slice(arguments, 1, 2) | ||
})(1, 2, 3) | ||
, [ 2 ] | ||
, 'Turn array like objects into arrays, w/ start/end' | ||
) | ||
@@ -43,3 +48,4 @@ t.equal(p.last([1, 2, 3]), 3, 'Last element') | ||
t.end() | ||
}) | ||
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
4657
86