Entries is a list of key-value pairs, with unique keys.

📦 Node.js,
🌐 Web,
📜 Files,
📰 Docs,
📘 Wiki.

All functions except `from*()`

take entries as 1st parameter, and expect it
to be iterable. It does not need to be an array. **Entries** are returned
by `Array`

, `Object`

, `Set`

, `Map`

.

This package is available in *Node.js* and *Web* formats. The web format
is exposed as `extra_entries`

standalone variable and can be loaded from
jsDelivr CDN.

Stability: Experimental.

`const entries = require('extra-entries');`

// import * as entries from "extra-entries";

// import * as entries from "https://unpkg.com/extra-entries/index.mjs"; (deno)

var x = [['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]];

[...entries.filter(x, v => v % 2 === 1)];

// [ [ 'a', 1 ], [ 'c', 3 ], [ 'e', 5 ] ]

var x = [['a', 1], ['b', 2], ['c', -3], ['d', -4]];

entries.some(x, v => v > 10);

// false

var x = [['a', 1], ['b', 2], ['c', -3], ['d', -4]];

entries.min(x);

// [ 'd', -4 ]

var x = [['a', 1], ['b', 2], ['c', 3]];

[...entries.subsets(x)].map(a => [...a]);

// [

// [],

// [ [ 'a', 1 ] ],

// [ [ 'b', 2 ] ],

// [ [ 'a', 1 ], [ 'b', 2 ] ],

// [ [ 'c', 3 ] ],

// [ [ 'a', 1 ], [ 'c', 3 ] ],

// [ [ 'b', 2 ], [ 'c', 3 ] ],

// [ [ 'a', 1 ], [ 'b', 2 ], [ 'c', 3 ] ]

// ]

Property | Description |
---|---|

is | Checks if value is entries. |

get | Gets value at key. |

set | Sets value at key. |

remove | Deletes an entry. |

swap | Exchanges two values. |

size | Gets size of entries. |

head | Gets first entry. |

take | Keeps first n entries only. |

shift | Removes first entry. |

fromLists | Creates entries from lists. |

concat | Appends entries from maps, preferring last. |

flat | Flattens nested entries to given depth. |

chunk | Breaks entries into chunks of given size. |

filterAt | Gets entries with given keys. |

map | Updates values based on map function. |

filter | Keeps entries which pass a test. |

reduce | Reduces values to a single value. |

range | Finds smallest and largest entries. |

count | Counts values which satisfy a test. |

partition | Segregates values by test result. |

cartesianProduct | Lists cartesian product of entries. |

some | Checks if any value satisfies a test. |

zip | Combines matching entries from all entries. |

union | Gives entries present in any entries. |

intersection | Gives entries present in both entries. |

difference | Gives entries not present in another. |

symmetricDifference | Gives entries not present in both entries. |

isDisjoint | Checks if entries have no common keys. |

key | Picks an arbitrary key. |

value | Picks an arbitrary value. |

entry | Picks an arbitrary entry. |

subset | Gives an arbitrary subset. |

isEmpty | Checks if entries is empty. |

isEqual | Checks if two maps are equal. |

compare | Compares two entries. |

find | Finds a value passing a test. |

search | Finds key of an entry passing a test. |

scanWhile | Finds key of first entry not passing a test. |

Generated using TypeDoc