New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@mojule/list

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mojule/list

list

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

list

List factory - work in progress

Don't use list when your data is already in arrays - use list when you're dealing with iterables/generators and want array-like comprehensions like filter, map, forEach, find, some etc.

You can also use it as an immutable collection if that's your thing, all functions return a new list rather than mutate an existing one.

list is not super performant inside hot code - V8 does not optimize generator functions - use arrays if you need very high performance - code is somewhat optimised but still slow compared to arrays. Further optimization is likely possible, PRs welcome.

Install

npm install @mojule/list

Example

Notes (work in progress)

Creates "lists" from any underlying iterable

Live, if the underlying data source changes, so do any derived lists:

const arr = [ 1, 2, 3 ]

const list = List( arr )

const filtered = list.filter( n => n % 2 === 0 )

console.log( Array.from( filtered ) ) // [ 2 ]

arr.push( 4 )

console.log( Array.from( filtered ) ) // [ 2, 4 ]

Can also be used to create new immutable lists:

const list1 = List( 1, 2, 3 )
const list2 = List( 4, 5, 6 )
const list3 = list1.concat( list2 )

FAQs

Package last updated on 14 Aug 2017

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