Example 1 — Deferred push
Mutations wait until commit (or unwrap).
var array = [1, 2];
var wrapped = _(array).push(3);
JSON.stringify(array);
// → "[1,2]"
wrapped = wrapped.commit();
JSON.stringify(array);
// → "[1,2,3]" How It Works
- Queue.
.push(3)is pending on the wrapper. - Before. The original
arrayis still[1, 2]. - Flush.
.commit()runs the queue (via.value()under the hood). - After.
arrayis[1, 2, 3]and you still have a wrapper.

