You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
307 B
15 lines
307 B
export default function pairs(values, pairof = pair) {
|
|
const pairs = [];
|
|
let previous;
|
|
let first = false;
|
|
for (const value of values) {
|
|
if (first) pairs.push(pairof(previous, value));
|
|
previous = value;
|
|
first = true;
|
|
}
|
|
return pairs;
|
|
}
|
|
|
|
export function pair(a, b) {
|
|
return [a, b];
|
|
}
|
|
|