File tree 1 file changed +4
-15
lines changed
1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -7,29 +7,18 @@ module.exports = modifierFactory
7
7
// Turn `callback` into a child-modifier accepting a parent. See
8
8
// `array-iterate` for more info.
9
9
function modifierFactory ( callback ) {
10
- return iteratorFactory ( wrapperFactory ( callback ) )
11
- }
12
-
13
- // Turn `callback` into a `iterator' accepting a parent.
14
- function iteratorFactory ( callback ) {
15
10
return iterator
16
11
17
12
function iterator ( parent ) {
18
- var children = parent && parent . children
19
-
20
- if ( ! children ) {
13
+ if ( ! parent || ! parent . children ) {
21
14
throw new Error ( 'Missing children in `parent` for `modifier`' )
22
15
}
23
16
24
- iterate ( children , callback , parent )
17
+ iterate ( parent . children , iteratee , parent )
25
18
}
26
- }
27
-
28
- // Pass the context as the third argument to `callback`.
29
- function wrapperFactory ( callback ) {
30
- return wrapper
31
19
32
- function wrapper ( value , index ) {
20
+ // Pass the context as the third argument to `callback`.
21
+ function iteratee ( value , index ) {
33
22
return callback ( value , index , this )
34
23
}
35
24
}
You can’t perform that action at this time.
0 commit comments