Sanife -- Swiss Army Knife
Slight and Elegance Function Utils.
Usage
# install $ npm install sanife
// ES6 Module // COMMONJSconst _ =
Util List
get
lodash like get
but slighter and powerful
const foo = bar: 233 _ // 233 // more exampleconst apple = color: txt: 'red' rgb: '#00ffff' _ // #00ffff const people = name: 'tom' age: 18 _ // tom_ // tom
set
lodash like set
but slighter and powerful
const item = {}_ // class: [{ names: ['oops'] }]
pick
lodash like pick
but slighter and powerful
const item = a: 'a' b: c: 'c' e: f: 'f' _ // {a: 'a', c: 'c'}_ // {f: 'f'}
contains
Detect whether:
- array contains spec item
- object contains spec key
const list = 1 2 3_ // true_ // false const item = name: 'tom' age: 22 _ // true
remove
Remove
- item from array
- subString from string
_ // [1, 3]_ // 114741
Base
first
const list = 1 2 3_ // 1
last
const list = 1 2 3_ // 3
noop
_ // do nothing
hasOwnProperty
Shortcut for Object.prototype.hasOwnProperty
isType
All kind of slight type detection