forked from ViacomInc/data-point
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreducer-args-acc-to-val-acc.output.js
72 lines (60 loc) · 1.31 KB
/
reducer-args-acc-to-val-acc.output.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* eslint-disable */
/* eslint-disable prettier */
// prettier-ignore
{
// first parameter is not named acc
function nonReducer1(foo) {
return foo.value
}
// last method is not a function
function nonReducer2(acc, next) {
return acc.locals
}
// reducers only have 2 params
function nonReducer3(acc, next, foo) {
return acc.locals
}
// not a reducer either
d.transform(1,2).then(acc => {
return {
a: acc.value,
b: acc.value[0],
c: acc.value.message.array[0].a,
d: `${acc.value.a}`
};
})
d.transform(1,2).then(acc => {
acc.value
})
// only references acc.value
function reducer(input) {
return {
a: input,
b: input[0],
c: input.message.array[0].a,
d: `${input.a}`
};
}
const exp1 = function reducer(input) {
return input;
}
const exp2 = input => {
return input;
}
const exp3 = a => b => input => {
return input;
}
// references any other property under acc
function reducerPromise(input, acc) {
return acc.locals
}
// references any other property under acc
function reducerNodeStyle(input, acc, next) {
next(input)
}
// valid reducer
const f = input = input => {
// should change value, and not throw error finding input as an identifier
return input.input;
}
}