was.js

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 23  →  ?path2? @ 25
/trunk/lib/lambda/aggregators.js
@@ -3,6 +3,7 @@
/*************************************************************************/
/* fuss/lambda_calculus/functional_programming/aggregators @ grimore.org */
/*************************************************************************/
// Vanilla ES6 JavaScript
function wasSwitch(q, d, ...c) {
if(c.length % 2 !== 0) {
throw "Pairs of predicates expected for cases";
@@ -25,8 +26,6 @@
}
});
}
 
// Vanilla ES6 JavaScript
if (!Array.prototype.switch) {
Array.prototype.switch = wasSwitch;
}
@@ -36,7 +35,10 @@
switch: wasSwitch
});
}
// Node.JS
module.exports = {
 
/*************************************************************************/
/* Node.JS package export. */
/*************************************************************************/
module.exports.lambda.aggregators = {
switch: wasSwitch
};