Skip to content

Instantly share code, notes, and snippets.

@alexeyraspopov
Created June 1, 2014 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexeyraspopov/eaffd30d5e8f65e739b2 to your computer and use it in GitHub Desktop.
Save alexeyraspopov/eaffd30d5e8f65e739b2 to your computer and use it in GitHub Desktop.
function min(initial){
return map(function(value){
if(isNaN(initial) || value < initial){
initial = value;
}
return initial;
})
}
function accum(process, acc){
return map(function(value){
acc = process(acc, value);
return acc;
});
}
function getTargetValue(event){
return event.target.value;
}
function sum(a, b){
return a + b;
}
event(node, 'change')
.pipe(map(getTargetValue))
.pipe(accum(sum, 0))
// .pipe(list())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment