Nostradamus Predicting Maelstroms
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    nesspublic

    ness

    Any value that is not null, undefined or false is true.

    Install

    npm install ness

    Examples

    Test for true or false:

    var ness = require('ness');
    var val;
     
    val = ness(0);
    val.test();  //=> true 
     
    val = ness('');
    val.test();  //=> true 
     
    val = ness(NaN);
    val.test();  //=> true 
     
    val = ness(false);
    val.test();  //=> false 
     
    val = ness(null);
    val.test();  //=> false 
     
    val = ness(undefined);
    val.test();  //=> false 

    Logical and:

    var ness = require('ness');
    var val;
     
    val = ness(false);
    val.and(undefined);  //=> false 
     
    val = ness(true);
    val.and(false);      //=> false 
     
    val = ness(0);
    val.and(true);       //=> true 

    Logical or:

    var ness = require('ness');
    var val;
     
    val = ness(NaN);
    val.or(false);          //=> true 
     
    val = ness(undefined);
    val.or('trueness');     //=> true 
     
    val = ness(null);
    val.or(false);          //=> false 

    Logical not:

    var ness = require('ness');
    var val;
     
    val = ness(true);
    val.not();  //=> false 
     
    val = ness(false);
    val.not();  //=> true 

    LICENSE

    MIT

    install

    npm i ness

    Downloadsweekly downloads

    3

    version

    0.0.0

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar