extra-array
Advanced tools
Comparing version 2.0.11 to 2.0.12
48
fresh.js
@@ -6,3 +6,3 @@ // PURE FUNCTIONS | ||
* Gets first element of array. | ||
* @param {array} x array | ||
* @param {Array} x array | ||
* @returns {*} first element | ||
@@ -16,3 +16,3 @@ */ | ||
* Gets last element of array. | ||
* @param {array} x array | ||
* @param {Array} x array | ||
* @returns {*} last element | ||
@@ -26,4 +26,4 @@ */ | ||
* Gets elements after head of array. | ||
* @param {array} x array | ||
* @returns {array} elements after head | ||
* @param {Array} x array | ||
* @returns {Array} elements after head | ||
*/ | ||
@@ -36,4 +36,4 @@ function tail(x) { | ||
* Gets elements before last element of array. | ||
* @param {array} x array | ||
* @returns {array} elements before last | ||
* @param {Array} x array | ||
* @returns {Array} elements before last | ||
*/ | ||
@@ -46,3 +46,3 @@ function init(x) { | ||
* Gets largest element, as per compare function. | ||
* @param {array} x array | ||
* @param {Array} x array | ||
* @param {function?} fn compare function (a, b) | ||
@@ -61,3 +61,3 @@ * @returns {*} largest element | ||
* Gets least element, as per compare function. | ||
* @param {array} x array | ||
* @param {Array} x array | ||
* @param {function?} fn compare function (a, b) | ||
@@ -75,7 +75,27 @@ * @returns {*} least element | ||
/** | ||
* Gets prefix of desired length from array. | ||
* @param {Array} x array | ||
* @param {number} n prefix length | ||
* @returns {Array} prefix | ||
*/ | ||
function take(x, n) { | ||
return x.slice(0, n); | ||
} | ||
/** | ||
* Gets elements after prefix from array. | ||
* @param {Array} x array | ||
* @param {number} n prefix length | ||
* @returns {Array} suffix | ||
*/ | ||
function drop(x, n) { | ||
return x.slice(n); | ||
} | ||
/** | ||
* Splits array to elements which do, and dont satify the filter. | ||
* @param {array} x array | ||
* @param {Array} x array | ||
* @param {function} fn filter function (elem, index, array) | ||
* @param {object?} ths this argument | ||
* @returns {array} pair of arrays [satisfy, dont_satisfy] | ||
* @returns {Array} pair of arrays [satisfy, dont_satisfy] | ||
*/ | ||
@@ -93,6 +113,6 @@ function partition(x, fn, ths=null) { | ||
* Combines values from n arrays, with a function. | ||
* @param {array} xs n arrays | ||
* @param {Array} xs n arrays | ||
* @param {function} fn combine function (a, b, c, ...) | ||
* @param {object?} ths this argument | ||
* @returns {array} combined values | ||
* @returns {Array} combined values | ||
*/ | ||
@@ -122,3 +142,3 @@ function zip(xs, fn, ths=null) { | ||
* Appends arrays to end to input array! | ||
* @param {array} x input array | ||
* @param {Array} x input array | ||
* @param {...array} ys arrays to append | ||
@@ -139,4 +159,6 @@ * @returns input array (modified!) | ||
exports.min = min; | ||
exports.take = take; | ||
exports.drop = drop; | ||
exports.partition = partition; | ||
exports.zip = zip; | ||
exports.append = append; |
{ | ||
"name": "extra-array", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"description": "Standard utility methods for Array.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
22343
573