Skip to content

Latest commit

History

History
31 lines (24 loc) 路 950 Bytes

README.md

File metadata and controls

31 lines (24 loc) 路 950 Bytes

NVL

license npm npm TSLint Travis

馃毊 Replace a blank value with fallback value.

Installation

npm install nvl
# Or Yarn
yarn add nvl

Usage

const nvl = require('nvl');

let notYet = void 0; // undefined
let nil = null;

nvl(notYet, true); // -> true
nvl(nil, 1); // -> 1
nvl([], [1]); // -> []
nvl({}, { a: 1, b: 2}); // -> {}
nvl(false, true); // -> false