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.27 to 2.0.28

15

fresh.js

@@ -152,17 +152,2 @@ // PURE FUNCTIONS

/**
* Removes duplicate elements.
* @param {Array} x array
* @param {function} fn compare function (a, b)
* @returns {Array} unique element array
*/
function nub(x, fn) {
var a = [];
x: for(var e of x) {
for(var f of a)
if(fn(e, f)===0) continue x;
a.push(e);
}
return a;
}

@@ -169,0 +154,0 @@ /**

2

package.json
{
"name": "extra-array",
"version": "2.0.27",
"version": "2.0.28",
"description": "Standard utility methods for Array.",

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

@@ -303,3 +303,3 @@ /**

/**
* Append arrays to the I!
* Append arrays to the end!
* @param {Array} x target (modified!)

@@ -382,3 +382,3 @@ * @param {...Array} ys arrays to append

/**
* Adds values to the I.
* Adds values to the end.
* @param {Array} x source

@@ -543,3 +543,40 @@ * @param {...any} vs values to add

/**
* Removes duplicate elements.
* @param {Array} x source
* @param {function?} fn compare function (a, b)
* @returns {Array} unique valued array
*/
function nub(x, fn) {
if(!fn) return Array.from(new Set(x));
var a = [];
x: for(var v of x) {
for(var w of a)
if(fn(v, w)===0) continue x;
a.push(v);
}
return a;
}
/**
* Removes duplicate elements based of map function (once per value).
* @param {Array} x source
* @param {function} fn map function (v, i, x)
* @param {object?} ths this argument
* @returns {Array} unique valued array
*/
function nubOn(x, fn, ths=null) {
var m = new Map(), i = -1;
for(var v of x) {
var w = fn.call(ths, v, ++i, x);
if(!m.has(w)) m.set(w, v);
}
return Array.from(m.values());
}
function searchl(x, fn, ths=null) {

@@ -546,0 +583,0 @@ for(var i=0, I=x.length; i<I; i++)

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