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

extra-lists

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-lists

Lists is a pair of key list and value list, with unique keys.

  • 2.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
increased by25%
Maintainers
1
Weekly downloads
 
Created
Source

Lists is a pair of key list and value list, with unique keys. :running: :vhs: :package: :moon: :ledger:

Methods as separate packages:

  • @extra-lists/find: use rollup to bundle this es module.
  • @extra-lists/find.min: use in browser (browserify, uglify-js).

In this fourth Crust of Rust video, we cover smart pointers and interior mutability, by re-implementing the Cell, RefCell, and Rc types from the standard library. As part of that, we cover when those types are useful, how they work, and what the equivalent thread-safe versions of these types are. In the process, we go over some of the finer details of Rust's ownership model, and the UnsafeCell type. (1)

Stability: Experimental.

const lists = require('extra-lists');
// import * as lists from 'extra-lists';
// import * as lists from 'https://unpkg.com/extra-lists@2.1.0/index.mjs'; (deno)

var x = [['a', 'b', 'c', 'd', 'e'], [1, 2, 3, 4, 5]];
lists.filter(x, v => v % 2 === 1);
// [ [ 'a', 'c', 'e' ], [ 1, 3, 5 ] ]

var x = [['a', 'b', 'c', 'd'], [1, 2, -3, -4]];
lists.some(x, v => v > 10);
// false

var x = [['a', 'b', 'c', 'd'], [1, 2, -3, -4]];
lists.min(x);
// [ 'd', -4 ]

var x = [['a', 'b', 'c'], [1, 2, 3]];
[...lists.subsets(x)].map(a => [[...a[0]], [...a[1]]]);
// [
//   [ [], [] ],
//   [ [ 'a' ], [ 1 ] ],
//   [ [ 'b' ], [ 2 ] ],
//   [ [ 'a', 'b' ], [ 1, 2 ] ],
//   [ [ 'c' ], [ 3 ] ],
//   [ [ 'a', 'c' ], [ 1, 3 ] ],
//   [ [ 'b', 'c' ], [ 2, 3 ] ],
//   [ [ 'a', 'b', 'c' ], [ 1, 2, 3 ] ]
// ]

reference

MethodAction
isChecks if value is lists.
getGets value at key.
setSets value at key.
removeDeletes an entry.
swapExchanges two values.
sizeGets size of lists.
headGets first entry.
takeKeeps first n entries only.
shiftRemoves first entry.
fromEntriesCreates lists from entries.
concatAppends entries from all lists.
flatFlattens nested lists to given depth.
chunkBreaks lists into chunks of given size.
filterAtGets lists with given keys.
mapUpdates values based on map function.
filterKeeps entries which pass a test.
reduceReduces values to a single value.
rangeFinds smallest and largest entries.
countCounts values which satisfy a test.
partitionSegregates values by test result.
cartesianProductLists cartesian product of lists.
someChecks if any value satisfies a test.
zipCombines matching entries from all lists.
unionGives lists present in any lists.
intersectionGives entries present in both lists.
differenceGives entries of lists not present in another.
symmetricDifferenceGives entries not present in both lists.
isDisjointChecks if lists have no common keys.
keyPicks an arbitrary key.
valuePicks an arbitrary value.
entryPicks an arbitrary entry.
subsetPicks an arbitrary submap.
isEmptyChecks if lists is empty.
isEqualChecks if two lists are equal.
compareCompares two lists.
findFinds a value passing a test.
searchFinds key of an entry passing a test.
scanWhileFinds key of first entry not passing a test.

nodef

Keywords

FAQs

Package last updated on 28 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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