Skip to content
This repository has been archived by the owner on Aug 23, 2019. It is now read-only.

shannonmoeller-archive/collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collection.js

A basic JavaScript collection.

Installation

Server-side (Node.js):

$ npm install shannonmoeller/collection.js

Client-side (component(1)):

$ component install shannonmoeller/collection.js

API

Collection(array)

Create a new model which wraps around object.

var Collection = require('collection');
var foo = Collection([{ a: 1 }, { a: 2 }, { a: 3 }]);

.model

.filter(filterer)

.map(mapper)

.pluck(key):Array.<*>
.pluck(array):Array.&lt;Object&gt;

.sort(sorter)

.toJSON()

Returns the current state of the internal data as a plain object.

var foo = Collection([{ a: 1 }, { a: 2 }, { a: 3 }]);

foo.toJSON(); // [{ a: 1 }, { a: 2 }, { a: 3 }]

License

MIT

About

A basic JavaScript collection. **Unmaintained**

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published