Miss any of our Open RFC calls?Watch the recordings here! »

not-available

1.1.1 • Public • Published

not-available

Converts empty object,empty array, empty string,NaN,null or undefined into the string "N/A" else return the input as-is.

const NA = require("not-available")
console.log('true => ' + NA(true)) // true
console.log('false => ' + NA(false)) // false
console.log('Empty object => ' + NA({})) // N/A
console.log('Empty Array => ' + NA([])) // N/A
console.log('0 => ' + NA(0)) // 0
console.log('NaN => ' + NA(NaN)) // N/A
console.log('Empty string => ' + NA('')) // N/A
console.log('undefined => ' + NA(undefined)) // N/A
console.log('null => ' + NA(null)) // N/A
console.log('Object => ', NA({a:'b'})) // {a:'b'}
console.log('Array => ' + NA(['a'])) // a

Install

npm i not-available

DownloadsWeekly Downloads

2

Version

1.1.1

License

ISC

Unpacked Size

2.23 kB

Total Files

4

Last publish

Collaborators

  • avatar