UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

17 lines 694 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pairwise = pairwise; const toIterator_1 = require("./toIterator"); const PairwiseIterator_1 = require("./internal/PairwiseIterator"); /** * Return a new iterator of pairs (tuples) of the values in the input one. The number of pairs will always be one fewer * than the input. Will be empty if the input has fewer than two values. * @example * iter([1,2,3]).pairwise().toArray() // [[1,2], [2,3]] * iter([1]).pairwise().toArray() // [] */ function pairwise(arg) { return new PairwiseIterator_1.default((0, toIterator_1.default)(arg)); } exports.default = pairwise; //# sourceMappingURL=pairwise.js.map