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.8 to 0.1.9

2

lists.js

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

// Data.List Set Operations
l.nub = function(xs) {
l.nub = l.uniq = l.unique = function(xs) {
return l.nubBy(xs, function(x,y){ return x==y })

@@ -390,0 +390,0 @@ }

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

@@ -24,3 +24,4 @@ "main": "lists.js",

"underscore",
"prelude"
"prelude",
"lodash"
],

@@ -27,0 +28,0 @@ "author": "Kurt Medley <kurtdmedley@gmail.com>",

@@ -158,9 +158,9 @@ # [ l [ i [ s ] t ] s ]

* [`unwords`](#unwords) : [str] -> str
* nub : Eq a => [a] -> [a]
* delete : Eq a => a -> [a] -> [a]
* difference || diff : Eq a => [a] -> [a] -> [a]
* union : Eq a => [a] -> [a] -> [a]
* intersect : Eq a => [a] -> [a] -> [a]
* sort : Ord a => [a] -> [a]
* insert : Ord a => a -> [a] -> [a]
* [`nub`](#nub) || [`uniq`](#nub) || [`unique`](#nub) : [num|str]|str -> [num|str]
* [`delete`](#delete) : x -> [x] -> [x]
* [`difference`](#difference) || [`diff`](#difference) : [num|str]|str -> [num|str]|str -> [x]
* [`union`](#union) : [num|str]|str -> [num|str]|str -> [x]|str
* [`intersect`](#intersect) : [num|str]|str -> [num|str]|str -> [x]
* [`sort`](#sort) : [x] -> [x]
* [`insert`](#insert) : x -> [x] -> [x]

@@ -171,3 +171,3 @@ -----

* nubBy : (a -> a -> Bool) -> [a] -> [a]
* [`nubBy`](#nubBy) : f -> [x] -> [x]
* deleteBy : (a -> a -> Bool) -> a -> [a] -> [a]

@@ -1230,1 +1230,137 @@ * deleteFirstsBy : (a -> a -> Bool) -> [a] -> [a] -> [a]

------
<a name='nub'/>
### nub || uniq || unique : [num|str]|str -> [num|str]
------
**Description**: Remove duplicates from a String or an Array of Numbers and/or Strings. Keep the first occurence of each element.
**Signature Definition**: Give arg 1 a String or an Array of Numbers and/or Strings. Get an Array of Numbers and/or Strings.
**Example Usage**:
```js
lists.nub("abbc"); /* ["a","b","c"] */
lists.nub([1,2,"a","b","a",1]); /* [1,2,"a","b"] */
lists.nub([1,2,2,3]); /* [1,2,3] */
```
------
<a name='delete'/>
### delete : x -> [x] -> [x]
------
**Description**: Return an Array of Variables from the result of removing the first occurence of a Variable from an Array of Variables. Does not work with Objects.
**Signature Definition**: Give arg 1 a Variable. Give arg 2 an Array of Variables. Get an Array of Variables.
**Example Usage**:
```js
lists.delete('a','bab'); /* ["b","b"] */
lists.delete([1],[[1,2],[1]]); /* [[1,2]] */
lists.delete(1,[2,1,2,1]); /* [2,2,1] */
```
------
<a name='delete'/>
### delete : x -> [x] -> [x]
------
**Description**: Return an Array of Variables from the result of removing the first occurence of a Variable from an Array of Variables. Does not work with Objects.
**Signature Definition**: Give arg 1 a Variable. Give arg 2 an Array of Variables. Get an Array of Variables.
**Example Usage**:
```js
lists.delete('a','bab'); /* ["b","b"] */
lists.delete([1],[[1,2],[1]]); /* [[1,2]] */
lists.delete(1,[2,1,2,1]); /* [2,2,1] */
```
------
<a name='difference'/>
### difference || diff : [num|str]|str -> [num|str]|str -> [x]
------
**Description**: Return an Array of Variables whose elements are the difference between Argument 1 and Argument 2.
**Signature Definition**: Give arg 1 a String or an Array of Numbers and/or Strings. Give arg 2 a String or an Array of Numbers and/or Strings. Get an Array of Variables.
**Example Usage**:
```js
lists.difference(['acd',1],['acd']); /* [1] */
lists.difference('acd','ab'); /* ["c","d"] */
lists.difference([1,2],[1,2]); /* [] */
```
------
<a name='union'/>
### union : [num|str]|str -> [num|str]|str -> [x]|str
------
**Description**: Return an Array of Variables whose elements are the union between Argument 1 and Argument 2.
**Signature Definition**: Give arg 1 a String or an Array of Numbers and/or Strings. Give arg 2 a String or an Array of Numbers and/or Strings. Get an Array of Variables or a String.
**Example Usage**:
```js
lists.union("a","b"); /* "ab" */
lists.union([1,4,'a'],[1,3,'b']); /* [1,4,"a",3,"b"] */
```
------
<a name='intersect'/>
### intersect : [num|str]|str -> [num|str]|str -> [x]
------
**Description**: Return an Array of Variables whose elements are the intersection between Argument 1 and Argument 2.
**Signature Definition**: Give arg 1 a String or an Array of Numbers and/or Strings. Give arg 2 a String or an Array of Numbers and/or Strings. Get an Array of Variables.
**Example Usage**:
```js
lists.intersect('a','ba'); /* ["a"] */
lists.intersect([1,4,'a'],[1,3,'b']); /* [1] */
```
------
<a name='sort'/>
### sort : [x] -> [x]
------
**Description**: Return an Array of Variables that are sorted by the Ordering Function lists.compare.
**Signature Definition**: Give arg 1 an Array of Variables. Get an Array of Variables.
**Example Usage**:
```js
lists.sort('acb'); /* ["a","b","c"] */
lists.sort([[3,4],[1,2]]); /* [[1,2],[3,4]] */
lists.sort([2,1,-1,1]); /* [-1,1,1,2] */
```
------
<a name='insert'/>
### insert : x -> [x] -> [x]
------
**Description**: Inserts an element into the first position of the Array of Variables where the element is less than or equal (defined by lists.compare) to the Variable from the Array it is being compared to.
**Signature Definition**: Give arg 1 a Variable. Give arg 2 an Array of Variables. Get an Array of Variables.
**Example Usage**:
```js
lists.insert(1,[2,1,2]); /* [1,2,1,2] */
lists.insert(4,[1,3,5,7,9]); /* [1,3,4,5,7,9] */
```
------
<a name='nubBy'/>
### nubBy : f -> [x] -> [x]
------
**Description**: Remove duplicates from an Array of Variables based on a user supplied Function defintion of equality. Keep the first occurence of each element.
**Signature Definition**: Give arg 1 a Function. Give arg 2 an Array of Variables. Get an Array of Variables.
**Example Usage**:
```js
lists.nubBy([8,7,5,3,2], function(x,y) { return x + y == 10 }); /* [8,7,5] */
lists.nubBy(["query=string, another=string","query=string, hey=man"], function(x,y) {
return x.split(',')[0] == y.split(',')[0]; // define equality on query=string
}); /* ["query=string, another=string"] */
lists.nubBy([{a:1},{a:1, b:2},{b:2}], function(obj1, obj2) {
return obj1.b == obj2.b; // define equality on the b property
}); /* [{a:1},{a:1, b: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