extremely in a prototype stage
The goal of this library is to make collection manipulation way more expresive and less error prone.
npm run build
node index.js
Given the array
var collection = [
{
"name": "beto",
"age": 35,
"type": "student",
},
{
"name": "mama",
"type": "teacher",
},
{
"name": "dude",
"age": 20,
"type": "teacher",
},
{
"name": "david",
"age": 19,
"type": "teacher",
}
]
collection.extract.age
// [35, undefined, 20, 19]
collection.filterBy.age;
[
{
"name": "beto",
"age": 35,
"type": "student",
},
{
"name": "dude",
"age": 20,
"type": "teacher",
},
{
"name": "david",
"age": 19,
"type": "teacher",
}
]
collection.filterBy.age.greaterThan(19);
[{
"name": "beto",
"age": 35,
"type": "student",
},
{
"name": "dude",
"age": 20,
"type": "teacher",
}]
collection.filterBy.type.equal("student");
[{
"name": "beto",
"age": 35,
"type": "student",
}]
MIT