JSPM

obvl

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q33740F
  • License MIT

Fallback when a value is not Object.

Package Exports

  • obvl

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (obvl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OBVL

license npm npm Travis ESLint Gluons

Fallback when a value is not Object.

Installation

Via NPM:

NPM

npm install obvl

Via Yarn:

yarn add obvl

Usage

const obvl = require('obvl');

// When a value is not Object, it will return fallback value.
let a = obvl(null, 0); // a = 0
let b = obvl([1, 2, 3], 'x'); // b = 'x'

// When a value is Object, it will return that value.
let c = obvl({ a: 1, b: 2, c: 3 }, 1); // c = { a: 1, b: 2, c: 3 }
let d = obvl(new Object(), [1, 2, 3]); // d = Object {  }

API

obvl(value, fallbackValue)

value

A main value.

fallbackValue

A fallback value.