1.0.0 • Published 7 years ago
lodashify v1.0.0
Lodashify
A simple Javascript Proxy that lets you use lodash on any object with chaining!
... like, all jQuery kinda style.
const $ = require('lodashify');
var users = [
{ id: 899444, login: 'addaleax', active: true },
{ id: 110455, login: 'bengl', active: true },
{ id: 498775, login: 'MylesBorins', active: false },
{ id: 439929, login: 'jasnell', active: true },
]
var $results = $(users) // LODASHIFY!
.$filter(['active', false]) // filter to only Myles
.$set('0.cool', 100) // add a `cool` property to Myles
.$set('2.oh.the.places.we\'ll', 'go') // and some other random object
console.log($results)
// [ { id: 498775, login: 'MylesBorins', active: false, cool: 100 },
// ,
// { oh: { the: { places: { 'we\'ll': 'go' } } } } ]
You need a version of lodash installed in your project.
$ npm install lodash, lodashify
License
MIT
1.0.0
7 years ago