lodash-mix
Some lodash mixins I've collected - for node and the browser.
npm install lodash-mix
bower install lodash-mix
To use in the browser, include lodash before including this library. Feel free to use this as a basis for your own mixins or contribute additions.
mixins
_.format
_// produces 'Other people are good plumbers' _// produces '/categ/books/034038204X' _// produces '/categ/books/034038204X'
_.uuid
_// generates an RFC 4122 compliant version 4 uuid
_.isUuid
_// produces true|false. Validates an RFC 4122 compliant version 4 uuid
_.immutableMerge
_// produces {a:1 , b:2} without mutating the input objects
_.upsert
var base = id: 1 data: 2 id: 2 data: 3 id: 3 data: nested: 4;var matcher = id: 3 data: nested: 4var newElement = id: 3 data: 5_;// produces [{id: 1, data: 2}, {id: 2, data: 3}, {id: 3, data: 5}]
_.compactObject
_// produces {b: 4, c: {d: null}} removing properties with falsy values _// produces {b: 4, c: {}} removing nested properties with falsy values
_.ordinal
_// produces 'nd'
tests
Tests run in node and the browser. Browserify and tape must be installed globally.
Execute from the command line
npm install -g tapetape test/**/*.js