|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
409 bytes
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = pairs;
|
|---|
| 7 | exports.pair = pair;
|
|---|
| 8 | function pairs(values, pairof = pair) {
|
|---|
| 9 | const pairs = [];
|
|---|
| 10 | let previous;
|
|---|
| 11 | let first = false;
|
|---|
| 12 | for (const value of values) {
|
|---|
| 13 | if (first) pairs.push(pairof(previous, value));
|
|---|
| 14 | previous = value;
|
|---|
| 15 | first = true;
|
|---|
| 16 | }
|
|---|
| 17 | return pairs;
|
|---|
| 18 | }
|
|---|
| 19 | function pair(a, b) {
|
|---|
| 20 | return [a, b];
|
|---|
| 21 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.