Skip to content

Commit

Permalink
Allow accessing map directly for internal calls
Browse files Browse the repository at this point in the history
This helps with debugging (you don't have to step through ramda's curry while debugging)
  • Loading branch information
Einar Norðfjörð committed Jun 27, 2018
1 parent ca57c8b commit 1bde30c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ flyd.endsOn = function(endS, s) {
* var squaredNumbers = flyd.map(function(n) { return n*n; }, numbers);
*/
// Library functions use self callback to accept (null, undefined) update triggers.
flyd.map = curryN(2, function(f, s) {
function map(f, s) {
return combine(function(s, self) { self(f(s.val)); }, [s]);
})
}
flyd.map = curryN(2, map)

/**
* Chain a stream
Expand Down Expand Up @@ -385,7 +386,7 @@ flyd.curryN = curryN
* var numbers = flyd.stream(0);
* var squaredNumbers = numbers.map(function(n) { return n*n; });
*/
function boundMap(f) { return flyd.map(f, this); }
function boundMap(f) { return map(f, this); }

/**
* Returns the result of applying function `fn` to this stream
Expand Down Expand Up @@ -427,7 +428,7 @@ function chain(f, s) {
internalEnded(newS.end);

// Update self on call -- newS is never handed out so deps don't matter
last = flyd.map(own, newS);
last = map(own, newS);
}, [s]);

flyd.endsOn(flatEnd.end, flatStream);
Expand Down

0 comments on commit 1bde30c

Please sign in to comment.