Lodash 过滤掉数组中的 falsy(假值)值
index.ts
import * as _ from "lodash";
const list: Array<any> = ["", false, 0, NaN, undefined, null, 1];
const arr = _.compact(list);
console.log(arr); // [1]
index.ts
import * as _ from "lodash";
const list: Array<any> = ["", false, 0, NaN, undefined, null, 1];
const arr = _.compact(list);
console.log(arr); // [1]