Merge branch 'master' into master_add_domElement

This commit is contained in:
Sindre Sorhus 2017-10-06 14:51:49 +07:00 committed by GitHub
commit 1cce236405
3 changed files with 41 additions and 0 deletions

View file

@ -171,4 +171,10 @@ is.domElement = x => {
is.infinite = x => x === Infinity || x === -Infinity;
const isEmptyStringOrArray = x => (is.string(x) || is.array(x)) && x.length === 0;
const isEmptyObject = x => !is.map(x) && !is.set(x) && is.object(x) && Object.keys(x).length === 0;
const isEmptyMapOrSet = x => (is.map(x) || is.set(x)) && x.size === 0;
is.empty = x => !x || isEmptyStringOrArray(x) || isEmptyObject(x) || isEmptyMapOrSet(x);
module.exports = is;