@frctl/list

2.1.1 • Public • Published

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

Dependencies (6)

Dev Dependencies (3)

Package Sidebar

Install

npm i @frctl/list

Weekly Downloads

2

Version

2.1.1

License

MIT

Last publish

Collaborators

  • mihkeleidast
  • chapabu
  • tomdavies
  • allmarkedup
  • dkhuntrods