UNPKG

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