graph-builder
Version:
A graph builder library for modeling abstract graph structures.
26 lines • 961 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var Iterators;
(function (Iterators) {
/**
* Returns a view containing the result of applying `function` to each element of
* `fromIterator`.
*
* <p>The returned iterator supports `remove()` if `fromIterator` does. After a
* successful `remove()` call, `fromIterator` no longer contains the corresponding
* element.
*/
Iterators.transform = (fromIterator, mapper) => ({
next: () => {
const result = fromIterator.next();
return Object.assign({}, result, { value: result.value !== undefined ? mapper(result.value) : result.value });
}
});
Iterators.concat = (a, b) => ({
next: () => {
const result = a.next();
return (result.done) ? b.next() : result;
}
});
})(Iterators = exports.Iterators || (exports.Iterators = {}));
//# sourceMappingURL=Iterators.js.map