@dannyfranca/handsome-helpers
    TypeScript icon, indicating that this package has built-in type declarations

    0.4.1 • Public • Published

    @dannyfranca/js-handsome-helpers

    npm version npm downloads Circle CI Codecov Dependencies Standard JS

    Time-saving helpers for JavaScript and TypeScript.

    Install

    npm install @dannyfranca/handsome-helpers

    Usage

    Default

    import helpers from '@dannyfranca/handsome-helpers'
     
    const opt = helpers.optionsFromString('x:foo|y:bar')
     
    console.log(opt) // { x: 'foo', y: 'bar' }

    or

    import anyMethod from '@dannyfranca/handsome-helpers/lib/helpers/anyMethod'

    Proxyed

    import helpers from '@dannyfranca/handsome-helpers/lib/proxyhelpers'
     
    // Works just right the defaults
    const opt = helpers.optionsFromString('x:foo|y:bar')
     
    console.log(opt) // { x: 'foo', y: 'bar' }

    But now you can add and merge your custom helpers

    Adding/Overwriting
    import helpers from '@dannyfranca/handsome-helpers/lib/proxyhelpers'
     
    // with chainable method $add
    helpers
        .$add('customHelper1', function(...args) {
          // ...
        })
        .$add('customHelper2', function(...args) {
          // ...
        })
        
    //directly
    helpers.customHelpers = function(...args) {
      // ...
    }
     
    //  Dont try to name with $, with throw an Error
    helpers.$customHelpers = function(...args) {
      // ...
    }
    Merging
    import helpers from '@dannyfranca/handsome-helpers/lib/proxyhelpers'
     
    helpers.$merge({
        customHelper() {
          // ...
        },
    // ...
    })

    Methods

    To see a list of use cases and expected results, look at the test folder.

    License

    MIT License

    Copyright (c) Danny França contato@dannyfranca.com

    Keywords

    none

    Install

    npm i @dannyfranca/handsome-helpers

    DownloadsWeekly Downloads

    2

    Version

    0.4.1

    License

    MIT

    Unpacked Size

    32.7 kB

    Total Files

    29

    Last publish

    Collaborators

    • dannyfranca