我正在尝试使用LoDash从数组中删除对象.
在server.js(NodeJS)中
var lodash = require('lodash')(); var rooms = [ { channel: 'room-a',name: 'test' },{ channel: 'room-b',name: 'test' } ]
我要尝试两个命令而不是工作:
var result = lodash.find(rooms,{channel: 'room-a',name:'test'}); var result = lodash.pull(rooms,lodash.find(rooms,name:'test'}));
在console.log(结果)中:
LodashWrapper { __wrapped__: undefined,__actions__: [ { func: [Function],args: [Object],thisArg: [Object] } ],__chain__: false,__index__: 0,__values__: undefined }
有人能帮我吗?谢谢!