@frctl/list

Simple immutable object collections.

Stats

StarsIssuesVersionUpdatedCreatedSize
@frctl/list
2.1.15 years ago5 years agoMinified + gzip package size for @frctl/list in KB

Readme

List

List is an array-like object collection class for NodeJS, with flexible find/filter/sortBy/difference methods and more.

Build Status NPM Version

The .push(),.pop(),.shift(), and .unshift() methods all mutate the list itself. All other methods (including sort methods) return a new copy of the list.

const List = require('@frctl/list');

const characters = new List([
    {name: 'mickey', type: 'mouse', disney: true},
    {name: 'jerry', type: 'mouse', disney: false},
    {name: 'mighty', type: 'mouse', disney: false},
    {name: 'pluto', type: 'dog', disney: true},
    {name: 'odie', type: 'dog', disney: false},
]);

const mice = characters.filter('type', 'mouse');

const disneyDogs = characters.filter({
    type: 'dog',
    disney: true,
});

const mickey = characters.find(char => char.name === 'mickey');

const otherDogs = characters.difference(disneyDogs);

Install

npm i @frctl/list --save

Usage

Full API docs to come. For now see the tests for further usage info.

Install

Installation using Yarn is recommended.

yarn add @frctl/list

Requirements

List requires Node >= v6.0

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.