Skip to content

KonradLinkowski/is-not-boolean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published