Nightingale Posing Mischievously
Wondering what’s next for npm?Check out our public roadmap! »

is-not-boolean

1.0.0 • Public • Published

is-not-boolean Version Badge

License Downloads

npm badge

Is this value not a JS Boolean? This module works cross-realm/iframe, and despite ES6 @@toStringTag.

I made this just for fun. Don't be mad.

Example

// with jasmine
expect(isNotBoolean(new Boolean(42))).toBeFalsy()
expect(isNotBoolean(false)).toBeFalsy()
expect(isNotBoolean(Object(false))).toBeFalsy()
expect(isNotBoolean(true)).toBeFalsy()
expect(isNotBoolean(Object(true))).toBeFalsy()
 
expect(isNotBoolean(undefined)).toBeTruthy()
expect(isNotBoolean(null)).toBeTruthy()
expect(isNotBoolean('foo')).toBeTruthy()
expect(isNotBoolean(function () {})).toBeTruthy()
expect(isNotBoolean([])).toBeTruthy()
expect(isNotBoolean({})).toBeTruthy()
expect(isNotBoolean(/a/g)).toBeTruthy()
expect(isNotBoolean(new RegExp('a', 'g'))).toBeTruthy()
expect(isNotBoolean(new Date())).toBeTruthy()
expect(isNotBoolean(42)).toBeTruthy()
expect(isNotBoolean(NaN)).toBeTruthy()
expect(isNotBoolean(Infinity)).toBeTruthy()

Tests

Simply clone the repo, npm install, and run npm test

Install

npm i is-not-boolean

DownloadsWeekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

4.46 kB

Total Files

9

Last publish

Collaborators

  • avatar