The essential news about content management systems and mobile technology. Powered by Perfect Publisher and XT Search for Algolia.
The News Site publishes posts to the following channels: Facebook, Instagram, Twitter, Telegram, Web Push, Tumblr, and Blogger.
Read more https://mijosoft.com/blog/mijosef-14-released-canonical-urls
Beam (GitHub: darach / beam-js, License: MIT, npm: beam) by Darach Ennis is a module for performing computation on streamed data.
Beams are like streams, in that they support pipes but are lightweight and work with in memory types without buffering, copying, parsing.
Beams have some interesting properties:
I’ve taken one of Darach’s basic examples and interleaved it with comments to explain the major concepts. The goal is to pipe numbers through an operator that can square numbers.
First, load the module and create a sink.
var Beam = require('beam');
var sink = Beam.Sink();
sink.on('data', function(data) {
console.log('d:', data);
});
Sinks emit a 'data'
event whenever data is received, so they can be used to capture results. Operators can be used to transform data – this example just squares each value:
var square = Beam.Operator.transform(function(x) { return x * x; });
Sources can be connected to sinks with pipe
, much like streams:
var source = Beam.Source();
source.pipe(square).pipe(sink);
Values can be sent to a source with push
:
for (var i = 0; i <= 10; i++) {
source.push(i);
}
This example introduces sinks, sources, and operators, but it doesn’t even scratch the surface of what Darach is aiming for with Beams. The next step is to define a filter and declare a pipe that uses it:
var even = Beam.Operator.filter(function(x) { return x % 2 == 0; });
source.pipe(even).pipe(square).pipe(sink);
Now only even numbers will be squared. The Beams module also has built-in functions, which you can find in Beam.bifs
. These are operators and filters that you can use to filter and compare values in beams:
var mod2 = source.pipe(b.mod(2))
mod2.pipe(b.eq(0)).pipe(sink1);
mod2.pipe(b.eq(1)).pipe(sink2);
To see all of the defined Bifs
, see _beam_bifs.js.
Read more https://feedproxy.google.com/~r/dailyjs/~3/ZVuvSUUJ_SQ/beams
Read more https://feeds.joomla.org/~r/JoomlaExtensionsUpdated/~3/mlAo5P9HiSg/20061
Read more https://feeds.joomla.org/~r/JoomlaExtensionsUpdated/~3/ML8EVSiKbiE/24727
Read more https://feeds.joomla.org/~r/JoomlaExtensions/~3/I1atfeR15bU/25311
Page 909 of 1309