Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make lift update on undefined #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion module/lift/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module.exports = function(f /* , streams */) {
var streams = Array.prototype.slice.call(arguments, 1);
var vals = [];
return flyd.combine(function() {
var self = arguments[arguments.length - 2];
for (var i = 0; i < streams.length; ++i) vals[i] = streams[i]();
return f.apply(null, vals);
self(f.apply(null, vals));
}, streams);
};
9 changes: 9 additions & 0 deletions module/lift/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,13 @@ describe('lift', function() {
a(3); c(3);
assert.equal(sum(), a() + b() + c() + d() + e());
});
it('updates on undefined', function() {
var and = function(x, y) { return x && y; };
var x = stream(true);
var y = stream(true);
var s = lift(and, x, y);
assert.equal(s(), true);
x(undefined);
assert.equal(s(), undefined);
});
});