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]
原文地址:https://www.cnblogs.com/aisowe/p/15250054.html