utils collection
npm install toxic-utils --save
if you are using flow
, you should import our flow defination, by adding this to your .flowconfig
.
[ignore]
[include]
[libs]
./node_modules/toxic-utils/lib/index.flow.js
[options]
[lints]
the handler to generate an deep traversal handler
Parameters
fn
Function the function you wanna run when you reach in the deep property
Returns Function the handler
deeply clone an object
Parameters
Returns clone-target the new Object
merge multiple objects
Parameters
args
...Object [description]
Returns merge-object [description]
camelize any string, e.g hello world -> helloWorld
Parameters
Returns string camelize string
hypenate any string e.g hello world -> hello-world
Parameters
str
string only accept string
Returns string
bind the function with some context. we have some fallback strategy here
Parameters
fn
function the function which we need to bind the context oncontext
any the context object
Returns Function
generate an uuid
Returns string
generate an random number which length is 4
Returns string
generate an random number with specific length
Parameters
length
number
Returns string
get an deep property
Parameters