extra-array
Advanced tools
Comparing version 2.0.24 to 2.0.25
{ | ||
"name": "extra-array", | ||
"version": "2.0.24", | ||
"version": "2.0.25", | ||
"description": "Standard utility methods for Array.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -418,5 +418,22 @@ /** | ||
/** | ||
* Removes or replaces existing values. | ||
* @param {Array} x source | ||
* @param {number} i remove index | ||
* @param {number?} n no. of values to remove (def: all till end) | ||
* @param {...any} vs values to insert | ||
* @returns {Array} [0->i, vs, i+n->end] | ||
*/ | ||
function splice(x, i, n=x.length-i, ...vs) { | ||
var a = x.slice(0, i); | ||
for(var v of vs) | ||
a.push(v); | ||
for(var i=i+n, I=x.length; i<I; i++) | ||
a.push(x[i]); | ||
return a; | ||
} | ||
function searchl(x, fn, ths=null) { | ||
@@ -448,14 +465,2 @@ for(var i=0, I=x.length; i<I; i++) | ||
function splice(x, i, n=1, ...vs) { | ||
var a = x.slice(0, i); | ||
for(var v of vs) | ||
a.push(v); | ||
for(var i=i+n, I=x.length; i<I; i++) | ||
a.push(x[i]); | ||
return a; | ||
} | ||
/** | ||
@@ -462,0 +467,0 @@ * Splits source into values, which do / dont satisfy the filter. |
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
32724
1042