https://github.com/gluons/nvl
🚮 Replace a blank value with fallback value.
https://github.com/gluons/nvl
blank javascript null nvl
Last synced: about 1 year ago
JSON representation
🚮 Replace a blank value with fallback value.
- Host: GitHub
- URL: https://github.com/gluons/nvl
- Owner: gluons
- License: mit
- Created: 2016-12-03T13:18:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-13T17:10:46.000Z (over 5 years ago)
- Last Synced: 2025-02-15T06:27:11.442Z (about 1 year ago)
- Topics: blank, javascript, null, nvl
- Language: TypeScript
- Homepage: https://npm.im/nvl
- Size: 443 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NVL
[](https://github.com/gluons/NVL/blob/master/LICENSE)
[](https://www.npmjs.com/package/nvl)
[](https://www.npmjs.com/package/nvl)
[](https://github.com/gluons/tslint-config-gluons)
[](https://travis-ci.org/gluons/NVL)
🚮 Replace a blank value with fallback value.
## Installation
```bash
npm install nvl
# Or Yarn
yarn add nvl
```
## Usage
```javascript
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
```