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

lists

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lists - npm Package Compare versions

Comparing version 0.1.90 to 0.1.91

22

lists.js

@@ -391,3 +391,3 @@ (function() {

l.delete = function(x,xs) {
return l.deleteBy(xs, x, function(z,y) { return z.toString()==y.toString() })
return l.deleteBy(x, xs, function(z,y) { return z.toString()==y.toString() })
}

@@ -399,20 +399,20 @@ l.diff = l.difference = function(xs,ys) {

return l.notElem(x,ys)
})
});
}
l.union = function(xs,ys) {
return l.unionBy(xs,ys,function(x,y) { return x==y; })
return l.unionBy(xs,ys,function(x,y) { return x==y; });
}
l.intersect = function(xs,ys) {
return l.intersectBy(xs,ys,function(x,y) { return x==y; })
return l.intersectBy(xs,ys,function(x,y) { return x==y; });
}
// Ordered lists
l.sort = function(xs) {
return l.sortBy(xs,l.compare)
return l.sortBy(xs,l.compare);
}
l.insert = function(e, ls) {
return l.insertBy(e,ls,l.compare)
return l.insertBy(e,ls,l.compare);
}
// Data.List Generalized Functions
l.unionBy = function(xs, ys, eq) {
return xs.concat(l.foldl(l.nubBy(ys,eq),xs,l.part(l.deleteBy,_,_,eq)))
return xs.concat(l.foldl(l.nubBy(ys,eq),xs,l.flip(l.part(l.deleteBy,_,_,eq))));
}

@@ -422,3 +422,3 @@ l.intersectBy = function(xs,ys,eq) {

: l.nil(ys) ? []
: l.any(ys, l.part(eq,_,l.head(xs))) ? [l.head(xs)].concat(l.intersectBy(l.tail(xs),ys,eq))
: l.any(ys, l.part(eq,l.head(xs),_)) ? [l.head(xs)].concat(l.intersectBy(l.tail(xs),ys,eq))
: l.intersectBy(l.tail(xs),ys,eq)

@@ -435,3 +435,3 @@ }

l.deleteFirstsBy = function(xs,ys,eq) {
return l.foldl(xs,ys,l.part(l.deleteBy,_,_,eq))
return l.foldl(xs,ys,l.flip(l.part(l.deleteBy,_,_,eq)))
}

@@ -446,6 +446,6 @@ l.nubBy = function(ls, eq) {

}
l.deleteBy = function(xs, x, eq) {
l.deleteBy = function(x, xs, eq) {
return l.nil(xs) ? []
: eq(x,l.head(xs)) ? l.tail(xs)
: [l.head(xs)].concat(l.deleteBy(l.tail(xs), x, eq))
: [l.head(xs)].concat(l.deleteBy(x, l.tail(xs), eq))
}

@@ -452,0 +452,0 @@ // Data.List User-supplied comparison

{
"name": "lists",
"version": "0.1.90",
"version": "0.1.91",
"description": "A library of higher-order functions modeled after Haskell's Data.List module",

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

@@ -171,8 +171,8 @@ # [ l [ i [ s ] t ] s ]

* [`nubBy`](#nubBy) : [x] -> f -> [x]
* deleteBy : (a -> a -> Bool) -> a -> [a] -> [a]
* deleteFirstsBy : (a -> a -> Bool) -> [a] -> [a] -> [a]
* unionBy : (a -> a -> Bool) -> [a] -> [a] -> [a]
* intersectBy : (a -> a -> Bool) -> [a] -> [a] -> [a]
* groupBy : (a -> a -> Bool) -> [a] -> [[a]]
* sortBy : (a -> a -> Ordering) -> [a] -> [a]
* [`deleteBy`](#deleteBy) : x -> [x] -> f -> [x]
* [`deleteFirstsBy`](#deleteFirstsBy) : [x] -> [x] -> f -> [x]
* [`unionBy`](#unionBy) : [x] -> [x] -> f -> [x]
* [`intersectBy`](#intersectBy) : [x] -> [x] -> f -> [x]
* [`groupBy`](#groupBy) : [x] -> f -> [[x]]
* [`sortBy`](#sortBy) : [x] -> f -> [x]
* insertBy : (a -> a -> Ordering) -> a -> [a] -> [a]

@@ -1351,3 +1351,3 @@ * maximumBy : (a -> a -> Ordering) -> [a] -> a

**Signature Definition**: Give arg 1 a Function. Give arg 2 an Array of Variables. Get an Array of Variables.
**Signature Definition**: Give arg 1 an Array of Variables. Give arg 2 a Function. Get an Array of Variables.

@@ -1366,1 +1366,89 @@ **Example Usage**:

------
<a name='deleteBy'/>
### deleteBy : x -> [x] -> f -> [x]
------
**Description**: Return an Array of Variables from the result of removing the first occurence of a Variable that matches a user supplied Function definition of equality from an Array of Variables.
**Signature Definition**: Give arg 1 a Variable. Give arg 2 an Array of Variables. Give arg 3 a Fucntion. Get an Array of Variables.
**Example Usage**:
```js
lists.deleteBy(4, [6,8,10,12], function(arg1,y) { return y % arg1 == 0 }); /* [6,10,12] */
lists.deleteBy(2, [{a:2},{b:2,e:2},{c:2}], function(arg1, obj) { return lists.keys(obj).length == arg1 }); /* [{a:2},{c:2}] */
```
------
<a name='deleteFirstsBy'/>
### deleteFirstsBy : [x] -> [x] -> f -> [x]
------
**Description**: Return the first Array of Variables passed with the first occurence of each element from the second Array of Variables removed based on a user supplied Function definition of equality.
**Signature Definition**: Give arg 1 an Array of Variables. Give arg 2 an Array of Variables. Give arg 3 a Fucntion. Get an Array of Variables.
**Example Usage**:
```js
lists.deleteFirstsBy([1,2,3,4,3],[3], function(x,y) { return x==y }); /* [1,2,4,3] */
lists.deleteFirstsBy("baba","a", function(x,y) { return x==y }); /* ["b","b","a"] */
```
------
<a name='unionBy'/>
### unionBy : [x] -> [x] -> f -> [x]
------
**Description**: Return an Array of Variables as the union between Argument 1, Argument 2, and the user supplied Function definition of equality.
**Signature Definition**: Give arg 1 an Array of Variables. Give arg 2 an Array of Variables. Give arg 3 a Fucntion. Get an Array of Variables.
**Example Usage**:
```js
lists.unionBy([1,2,3,4],[4,6,9,10], function(x,y) { return x * 3 == y }); /* [1,2,3,4,4,10] */
lists.unionBy(["a","b","c"], ["d","e","f"], function(x,y) {
var same = y == 'd' ? 'a' : y;
return x == same; // "d" is the same as "a"
}); /* ["a","b","c","e","f"] */
```
------
<a name='intersectBy'/>
### intersectBy : [x] -> [x] -> f -> [x]
------
**Description**: Return an Array of Variables as the intersection between Argument 1, Argument 2, and the user supplied Function definition of equality.
**Signature Definition**: Give arg 1 an Array of Variables. Give arg 2 an Array of Variables. Give arg 3 a Fucntion. Get an Array of Variables.
**Example Usage**:
```js
lists.intersectBy([1,2,3,4],[4,8,12,16,20], function(x,y) { return x * x == y }); /* [2,4] */
```
------
<a name='groupBy'/>
### groupBy : [x] -> f -> [[x]]
------
**Description**: Return an Array of Variables where each nested Array is a group of equal elements. Equality is defined by the user supplied Function.
**Signature Definition**: Give arg 1 an Array of Variables. Give arg 2 a Fucntion. Get an Array of an Array of Variables.
**Example Usage**:
```js
lists.groupBy([1,2,3,4,5,6,7,8,9], function(x,y){ return ((x*y) % 3) == 0}); /* [[1],[2,3],[4],[5,6],[7],[8,9]] */
lists.groupBy([1,2,3,4,5,6,7,8,9], function(x,y){ return x + 1 == y}); /* [[1,2],[3,4],[5,6],[7,8],[9]] */
```
------
<a name='sortBy'/>
### sortBy : [x] -> f -> [x]
------
**Description**: Return an Array of Variables that are sorted based on the user supplied Ordering Function.
**Signature Definition**: Give arg 1 an Array of Variables. Give arg 2 a Fucntion. Get an Array of Variables.
**Example Usage**:
```js
function oddsFirst(x,y) {
return x % 2 == 1 ? 'LT' : 'GT'
}
lists.sortBy([1,2,3,4,5,6,7], oddsFirst); /* [1,3,5,7,6,4,2] */
```
------
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