active-lodash
v1.2.2
Published
A version of lodash customized to feel more like ActiveSupport (from Rails).
Downloads
12
Maintainers
Readme
active-lodash
A version of lodash customized to feel more like Ruby/Rails/ActiveSupport.
Features
custom, reduced, modern build of
lodash
non-destructive
merge
,assign
,extend
,defaults
anddefaultsDeep
.
(They are always returning a new object)present()
andpresence()
Does not extend prototypes.
(If you want that, have a look at rodash or activesupport)
Install
npm i -SE active-lodash
Usage
import f from 'active-lodash'
or
var f = require('active-lodash')
then
assert.equal((f(23).presence() || 42), 23)
assert.equal((f(null).presence() || 42), 42)
assert.equal(f.present({a: 1}), true)
assert.equal(f.present([1]), true)
assert.equal(f.present(true), true)
assert.equal(f.present(false), true)
assert.equal(f.present(function () {}), true)
assert.equal(f.present({}), false)
assert.equal(f.present([]), false)
assert.equal(f.present(undefined), false)
assert.equal(f.present(null), false)
(See tests for more Examples.)