fcf.empty() function
Package: fcf-framework-core
File: fcf-framework-core:fcf.js
Available from version: 2.0.2
Checks if the object is empty. The following are considered empty: all empty iterables, fieldless objects (except
Arguments
- Test value
Result
- Returns true if the argument is empty
Example: Function application
console.log(`"" : `, fcf.empty(""));
console.log(`"1": `, fcf.empty("1"));
console.log(`null: `, fcf.empty(null));
console.log(`{}: `, fcf.empty({}));
console.log(`{v: 1}: `, fcf.empty({v: 1}));
console.log(`[]: `, fcf.empty([]));
console.log(`[1]: `, fcf.empty([1]));
console.log(`NodeList0: `, fcf.empty(document.querySelectorAll("non_existent_tag")));
console.log(`NodeList1: `, fcf.empty(document.querySelectorAll("body")));
console.log(`Map: `, fcf.empty(new Map()));
let notEmptyMap = new Map();
notEmptyMap.set("k1", 1);
console.log(`Map({k1:1}): `, fcf.empty(notEmptyMap));
console.log(`Set: `, fcf.empty(new Set()));
let notEmptySet = new Set();
notEmptySet.add("k1");
console.log(`Set(["k1"]): `, fcf.empty(notEmptySet));
Output:
"" : true
"1": false
null: true
{}: true
{v: 1}: false
[]: true
[1]: false
NodeList0: true
NodeList1: false
Map: true
Map({k1:1}): false
Set: true
Set(["k1"]): false