humanize-bool

    0.0.2 • Public • Published

    Boolean Expression Evaluator for humans

    Installation

    // From NPM
    npm install humanize-bool --save
    
    // From Yarn
    yarn add humanize-bool 
    

    Usage

    import is from 'humanize-bool';

    Examples

    // Before
    
    if (val === 'cat' || val === 'dog' || val === 'car' || val === 'home') {
      // code here ...
    }
    
    // After
    
    if (is(val).any.equalsTo('cat', 'dog', 'car', 'home')) {
      // code here
    }
    // Before
    
    if (val === undefined || value === null) {
      // code here ...
    }
    
    // After
    
    if (is(val).undefined.or.null()) {
      // code here
    }
    // Before
    
    if (typeof val === null || typeof val === 'function') {
      // code here ...
    }
    
    // After
    
    if (is(val).type.null.or.func()) {
      // code here
    }
    // Before
    
    if (typeof val === 'string' || typeof val === 'number' || typeof val === 'symbol') {
      // code here ...
    }
    
    // After
    
    if (is(val).type.string.or.number.or.symbol()) {
      // code here
    }
    
    // OR
    
    if (is(val).type.any('string', 'number', 'symbol')) {
      // code here
    }

    Keywords

    none

    Install

    npm i humanize-bool

    DownloadsWeekly Downloads

    2

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    166 kB

    Total Files

    43

    Last publish

    Collaborators

    • robusgauli