javascript - 获取lodash中存在的所有函数

标签 javascript node.js lodash

我需要从 lodash 获取所有功能。像

之类的东西
_.filter(Object.getOwnPropertyNames(_), val => _.iFunction(val))

最佳答案

我不确定您的用例是什么,但您可以这样做

const _ = require("lodash");

const functions = _.filter(Object.getOwnPropertyNames(_), val => {
  return _.isFunction(_[val])
});

console.log(functions);

关于javascript - 获取lodash中存在的所有函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60037951/

相关文章:

javascript - 如何在没有 Jquery 的情况下将 HTML5 视频快照附加到滚动 DIV

javascript - 错误 : The Content-Range header is missing in the HTTP Response

node.js - 几个小时后永远停止,没有任何错误

javascript - 如何使用lodash从bigArray中删除smallArray中的所有项目?

javascript - Chrome : Inspect elements that appear only when dragging

javascript - 使用 mongoose/MongoDB 中间件删除引用的文档(2021 年)

node.js - NPM 在网络共享文件夹上安装 UNC 路径错误

javascript - 迭代对象数组并过滤掉不匹配的对象

javascript - 在下划线模板三元中打印变量

javascript - 为什么 jquery 只注册一次点击?