extra-array
Advanced tools
Comparing version 2.0.7 to 2.0.8
23
fresh.js
@@ -25,3 +25,3 @@ /** | ||
function tail(x) { | ||
return a.slice(1); | ||
return x.slice(1); | ||
} | ||
@@ -39,8 +39,13 @@ | ||
/** | ||
* Returns corresponding values from n arrays. | ||
* @param {array} xs n arrays | ||
* @returns {array} array of corresponding values | ||
* Gets largest element, as per compare function. | ||
* @param {array} x array | ||
* @param {function?} fn compare function (a, b) | ||
* @returns {*} largest element | ||
*/ | ||
function zip(xs) { | ||
return zipWith(xs ,args); | ||
function max(x, fn) { | ||
if(!fn) return Math.max.apply(null, x); | ||
var a = undefined; | ||
for(var e of x) | ||
a = fn(a, e)<0? e:a; | ||
return a; | ||
} | ||
@@ -55,3 +60,4 @@ | ||
*/ | ||
function zipWith(xs, fn, ths=null) { | ||
function zip(xs, fn, ths=null) { | ||
fn = fn||args; | ||
var a = [], A = 0; | ||
@@ -67,3 +73,2 @@ for(var r=0, R=xs.length; r<R; r++) | ||
} | ||
function args() { | ||
@@ -76,3 +81,3 @@ return arguments; | ||
exports.init = init; | ||
exports.max = max; | ||
exports.zip = zip; | ||
exports.zipWith = zipWith; |
{ | ||
"name": "extra-array", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "Standard utility methods for Array.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,1 +1,7 @@ | ||
cons | ||
uncons | ||
intersperse | ||
intercalate | ||
xor | ||
@@ -2,0 +8,0 @@ xorBy |
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
20592
505
102