This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(array){ | |
return array.reduce(function(a, b){ | |
return a.pipe(b); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
${2:${1:module}} = require('${1:module}')$0 | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>req</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.js</scope> | |
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
demethodize = Function.prototype.bind.bind(Function.prototype.call); | |
concat = demethodize(Array.prototype.concat); | |
curry = demethodize(Function.prototype.bind); | |
map = demethodize(Array.prototype.map); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pick(property){ | |
return (target) => target[property]; | |
} | |
function property(target){ | |
return (property) => target[property]; | |
} | |
function invoke(method, args){ | |
return (target) => target[method].apply(this, args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
demethodize = Function.prototype.bind.bind(Function.prototype.call); | |
slice = demethodize(Array.prototype.slice); | |
function limitTo(fn, limit){ | |
return () => fn.apply(this, slice(arguments, 0, limit)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function compose(f, g){ | |
return (...args) => f(g(...args)); | |
} | |
function identity(value){ | |
return value; | |
} | |
function process(...list){ | |
// something to do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mapReduce(map, reduce, zero){ | |
return function loop(from, to){ | |
if(from > to){ | |
return zero; | |
} | |
return reduce(map(from), loop(from + 1, to)); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filter(fn){ | |
var child = stream(); | |
child.changed = function(old, value){ | |
return fn(value); | |
}; | |
return child; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function TodoVM(model){ | |
this.title = observable(model.title); | |
this.completed = observable(model.observable) | |
} | |
filters = { | |
all: () => true, | |
active: (todo) => !todo.completed(), | |
completed: (todo) => todo.completed() | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider = typeof window === 'object' && window.performance || Date; | |
timestamp = typeof provider.now === 'function' ? provider.now.bind(provider) : function(){ return +new Date(); }; |
OlderNewer