Knockout dependency detection in chained lodash calls.
This project is maintained by DrSammyD
Knockout dependency detection in chained lodash (soon to be underscore as well) calls.
It's a simple extension of KnockoutJS which allows you to call lodash functions on observableArrays and observables.
var x = ko.observableArray([1,2,0,0,3,4,5]);
x._().filter().value();
//=>[1,2,3,4,5]
Now let's say you want to mutate your observableArray with the current value of your lodash calls
var x = ko.observableArray([1,2,0,0,3,4,5]);
x._().filter().mutate();
x();
//=>[1,2,3,4,5]
var x = ko.observableArray([1,2,0,0,3,4,5]);
var y = x._().filter().observe();
x([1,2,0,0,3]);
y();
//=>[1,2,3]
var x = ko.observableArray([1,2,3,4,5]);
var y = ko.observableArray([1]);
var z=x._().difference(y).observe();
z();
//=>[2,3,4,5]
But with another call
y([1,2]);
z();
//=>[3,4,5]
One thing to note. Lodash unwraps it's lodashWrapper class on certain calls. If you expect lodash to do this for one of your calls, make sure that you chain it.
Checkout this jsfiddle for more intersting behavior