Skip to content

Fallback when a value is not Number.

License

Notifications You must be signed in to change notification settings

value-fallback/NOVL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOVL

license npm npm Travis ESLint Gluons

Fallback when a value is not Number.

Installation

Via NPM:

NPM

npm install novl

Via Yarn:

yarn add novl

Usage

const novl = require('novl');

// When a value is not Number, it will return fallback value.
let a = novl(null, 0); // a = 0
let b = novl({}, 'x'); // b = 'x'

// When a value is Number, it will return that value.
let c = novl(NaN, 1); // c = NaN   😂
let d = novl(100, [0, 1, 2]); // d = 100

API

novl(value, fallbackValue)

value

A main value.

fallbackValue

A fallback value.