surrsoft
9/27/2019 - 2:59 PM

lodash, Lang, isEmpty

lodash, Lang, isEmpty

"use strict";

/* jshint esversion: 6 */

//-------------------------------------------------------------------------------------------------

const _ = require('lodash');
const util = require('util');

const arr = ['',
    ' ',
    null,
    undefined,
    NaN,
    0,
    -0,
    +0,
    -1,
    1,
    {},
    { a: 1 },
    [],
    ['x'],
    [''],
    ['0'],
    ['1'],
    [[]],
    function () {
    }
];

function fn(_arr) {
    _arr.forEach((val) => {
        const x = _.isEmpty(val);
        console.log(`val |${util.inspect(val)}| is ${x}`);
    });
}

fn(arr);