toxic-utils
    TypeScript icon, indicating that this package has built-in type declarations

    0.4.3 • Public • Published

    toxic-utils

    Build Status Coverage Status npm dependency Status devDependency Status Greenkeeper badge

    utils collection

    get started

    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]

    doc

    genTraversalHandler

    src/index.js:8-20

    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

    deepClone

    src/index.js:27-32

    deeply clone an object

    Parameters

    • source (Array | Object) if you pass in other type, it will throw an error

    Returns clone-target the new Object

    deepAssign

    src/index.js:38-50

    merge multiple objects

    Parameters

    • args ...Object [description]

    Returns merge-object [description]

    camelize

    src/index.js:57-63

    camelize any string, e.g hello world -> helloWorld

    Parameters

    Returns string camelize string

    hypenate

    src/index.js:69-71

    hypenate any string e.g hello world -> hello-world

    Parameters

    • str string only accept string

    Returns string

    bind

    src/index.js:78-90

    bind the function with some context. we have some fallback strategy here

    Parameters

    • fn function the function which we need to bind the context on
    • context any the context object

    Returns Function

    uuid

    src/index.js:95-97

    generate an uuid

    Returns string

    S4

    src/index.js:101-103

    generate an random number which length is 4

    Returns string

    rand

    src/index.js:108-114

    generate an random number with specific length

    Parameters

    Returns string

    getDeepProperty

    src/index.js:119-147

    get an deep property

    Parameters

    • obj any
    • keys (string | Array<string>)
    • $2 any (optional, default {})
      • $2.throwError (optional, default false)
      • $2.backup

    Keywords

    Install

    npm i toxic-utils

    DownloadsWeekly Downloads

    480

    Version

    0.4.3

    License

    MIT

    Unpacked Size

    107 kB

    Total Files

    20

    Last publish

    Collaborators

    • toxicjohann