Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extra-array

Package Overview
Dependencies
Maintainers
1
Versions
856
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-array - npm Package Compare versions

Comparing version 2.0.14 to 2.0.15

27

fresh.js

@@ -65,2 +65,18 @@ // PURE FUNCTIONS

/**
* Lists all permutations.
* @param {array} x array
* @returns {Iterable} permutation ...
*/
function* permutations(x) {
if(x.length===0) yield [];
for(var i=x.length-1; i>=0; i--) {
var y = splice(x, i);
for(var p of permutations(y)) {
p.push(x[i]);
yield p;
}
}
}
/**
* Gets largest element, as per compare function.

@@ -198,2 +214,12 @@ * @param {Array} x array

function splice(x, i, n=1, ...es) {
var a = x.slice(0, i);
for(var e of es)
a.push(e);
for(var i=i+n, I=x.length; i<I; i++)
a.push(x[i]);
return a;
}
exports.head = head;

@@ -205,2 +231,3 @@ exports.last = last;

exports.tails = tails;
exports.permutations = permutations;
exports.max = max;

@@ -207,0 +234,0 @@ exports.min = min;

33

index.js

@@ -266,9 +266,2 @@ const exports0 = Array.isArray;

function append(arr) {
for(var i=1, j=arr.length, I=arguments.length; i<I; i++) {
for(var v of arguments[i])
arr[j++] = v;
}
return arr;
}
function repeatTo(arr, n=1, bgn=0, end=arr.length, z=[], z0=z.length) {

@@ -329,24 +322,4 @@ for(var h=0; h<n; h++) {

}
function any(arr, bgn=0, end=arr.length) {
for(var i=bgn; i<end; i++)
if(arr[i]) return true;
return false;
}
function allOf(arr, bgn=0, end=arr.length) {
for(var i=bgn; i<end; i++)
if(!arr[i]) return false;
return true;
}
function maxOf(arr, bgn=0, end=arr.length) {
var z = -Infinity;
for(var i=bgn; i<end; i++)
z = arr[i]>z? arr[i]:z;
return z;
}
function minOf(arr, bgn=0, end=arr.length) {
var z = Infinity;
for(var i=bgn; i<end; i++)
z = arr[i]<z? arr[i]:z;
return z;
}
// math
function sumOf(arr, bgn=0, end=arr.length) {

@@ -362,2 +335,4 @@ var z = 0;

}
// vector
function hammingDistance(a, b, a0=0, a1=a.length, b0=0, b1=b.length) {

@@ -364,0 +339,0 @@ var L = a1-a0, z = 0;

{
"name": "extra-array",
"version": "2.0.14",
"version": "2.0.15",
"description": "Standard utility methods for Array.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,25 @@ cons

intercalate
transpose
permutations
foldl1
foldr1
dropWhileEnd
insert
delete
sortOn
union
intersect
difference
subsequences
isSubsequenceOf
isInfixOf
isSuffixOf
isPrefixOf
group
stripPrefix
break
span
dropWhileEnd
splitAt
unfoldr

@@ -8,0 +30,0 @@ remove

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc