bloem.js
Processing events and actions like Gardening in JavaScript.
bloem?
bloem in Dutch means flower in English. So, this library provide gradening like programming.
Let's install!
$ npm install --save bloem.js
or
$ bower install --save bloem.js
First example
var
fs = require('fs'),
bloem = require('bloem.js');
var
pomp = bloem.fromArray([1,2,3,4,5]);
var
filenameMaker = bloem.map(function filenameMaker(n) {
return 'file' + n + '.txt';
}),
hoos = pomp.connect(filenameMaker);
var
fileReader = bloem.map(function fileReader(filename, next) {
fs.readFile(filename, 'utf8', next);
});
hoos = hoos.connect(fileReader);
var
parseNum = bloem.map(function parseNum(s) {
return parseInt(s, 10);
}),
calcSum = bloem.reduce(function calcSum(sum, s) {
return sum + s;
}, 0);
hoos = hoos.connect(parseNum).connect(calcSum);
var
logger = bloem.forEach(function logger(s) {
console.log(s);
}),
tuin = hoos.connect(logger);
TODO
License
Copyright 2014-2015 TSUYUSATO Kitsune
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
lim itations under the License.