使用 Lodash 链和过滤器不返回过滤值
Using Lodash chain and filter not returning filtered value
我正在尝试使用 LoDash 过滤键 state === accepted
所在的对象。 quoteList
数组中有两个对象。 console.log 是 returning 数组中的 2 个对象;我期待它 return 1 个对象,其中 state === accepted
。我正在使用 chain
,因为一旦我开始工作,我将需要使用其他功能。
let quoteList = shipment.quotes
const QuoteSlides = _
.chain(quoteList)
.filter(['state', 'accepted'])
console.log(quoteList)
我正在尝试使用 LoDash 过滤键 state === accepted
所在的对象。 quoteList
数组中有两个对象。 console.log 是 returning 数组中的 2 个对象;我期待它 return 1 个对象,其中 state === accepted
。我正在使用 chain
,因为一旦我开始工作,我将需要使用其他功能。
let quoteList = shipment.quotes
const QuoteSlides = _
.chain(quoteList)
.filter(['state', 'accepted'])
console.log(quoteList)