You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
429 B
JavaScript
22 lines
429 B
JavaScript
"use strict";
|
|
|
|
const pipe = require("@promistream/pipe");
|
|
const map = require("@promistream/map");
|
|
const buffer = require("@promistream/buffer");
|
|
|
|
module.exports = function join(joinValue) {
|
|
let firstValueProcessed = false;
|
|
|
|
return pipe([
|
|
map((value) => {
|
|
if (firstValueProcessed === false) {
|
|
firstValueProcessed = true;
|
|
return [ value ];
|
|
} else {
|
|
return [ joinValue, value ];
|
|
}
|
|
}),
|
|
buffer()
|
|
]);
|
|
};
|