1.0.0 • Published 7 years ago

stvl v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

STVL

license npm npm Travis ESLint Gluons

Fallback when a value is not String.

Installation

Via NPM:

NPM

npm install stvl

Via Yarn:

yarn add stvl

Usage

const stvl = require('stvl');

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

// When a value is String, it will return that value.
let c = stvl('A', 1); // c = "A"
let d = stvl(`B`, [0, 1, 2]); // d = "B"

API

stvl(value, fallbackValue)

value

A main value.

fallbackValue

A fallback value.