Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

empty

v1.0.0arrow_drop_down
v1.0.0
v0.0.1
STATUS
Passing
DOWNLOADS
1,114
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
2 years ago
SIZE
545 B
determines whether `obj` reference is empty (empty array, empty object and/or falsy values)
2 contributors
Use empty in your project ?
Copied
npm i @bit/bit.utils.validation.empty
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
revert changes
reload
toggle layout
maximize
empty([]); // => true
empty({}); // => true
empty(1); // => false
empty(""); // => false
empty("foo"); // => false
empty(false); // => true
modifieddraft
chevron_left
chevron_right
empty (
name:*
) : boolean

determines whether obj reference is empty (empty array, empty object and/or falsy values)

Example
empty([]) // => true
 empty({}) // => true
 empty(1) // => false
 empty('') // => false
 empty('foo') // => false
 empty(false) // => true
Argument
name: *
Returns
boolean

Test Summary

#empty() should return true as an empty array was passed

Pass

#empty() should return true as an empty object was passed

Pass

#empty() should return true as an empty string was passed

Pass

#empty() should return false as string foo was passed

Pass

#empty() should return false as [1] was passed

Pass

#empty() should return false as { a: 1 } was passed

Pass