Skip to content

Commit

Permalink
is.existy(window) test & docu
Browse files Browse the repository at this point in the history
  • Loading branch information
evdama committed Mar 21, 2022
1 parent 8304976 commit 31ad329
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -583,6 +583,9 @@ is.existy(null)
is.not.existy(undefined)
=> true

is.existy(window)
=> false // true inside a web browser, false on Node.js or in case of Server-side rendering (SSR)

is.all.existy(null, ['foo'])
=> false

Expand Down
3 changes: 3 additions & 0 deletions test/test.js
Expand Up @@ -250,6 +250,9 @@
it('should return false if given value is undefined', () => {
expect(is.existy(undefined)).to.be.false
})
it('should return false for Node.js and SSR, true for web browsers', () => {
expect(is.existy(window)).to.be.false
})
it('should return true if given value is not null or undefined', () => {
expect(is.existy('test')).to.be.true
})
Expand Down

0 comments on commit 31ad329

Please sign in to comment.