const foos = ko.observableArray([
{ id: 1, text: 'foo' },
{ id: 2, text: 'bar' },
{ id: 3, text: 'baz' },
{ id: 4, text: 'qux' }
]).extend({
_: true
})
const wantsOdds = ko.observable(true)
const flippedAndFilteredFoos = foos
._.map((foo) => {
foo.text = foo.text.split('').reverse().join('')
return foo
})
._.filter((foo) =>
foo.id % 2 === (wantsOdds() ? 1 : 0))
flippedAndFilteredFoos()
wantsOdds(false)
flippedAndFilteredFoos()