1 | const nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
2 |
|
3 |
|
4 | const add1 = x => x + 1
|
5 | const sub1 = x => x - 1
|
6 | const doubleIt = x => x * 2
|
7 | const add = (x, y) => x + y
|
8 |
|
9 | async function concat (xs, val) {
|
10 | var x = await xs
|
11 | return x.concat(val)
|
12 | }
|
13 |
|
14 | async function useNew (accumulator, newValue) {
|
15 | return newValue
|
16 | }
|
17 |
|
18 | async function delay (accumulator, newValue) {
|
19 | await new Promise((resolve) => {
|
20 | setTimeout(() => resolve(), 1000)
|
21 | })
|
22 | return newValue
|
23 | }
|
24 |
|
25 | module.exports = {
|
26 | nums,
|
27 | add1,
|
28 | sub1,
|
29 | doubleIt,
|
30 | add,
|
31 | concat,
|
32 | useNew,
|
33 | delay
|
34 | }
|