diff options
Diffstat (limited to 'src/PursLoader/Plugin.js')
-rw-r--r-- | src/PursLoader/Plugin.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/PursLoader/Plugin.js b/src/PursLoader/Plugin.js new file mode 100644 index 0000000..90feb33 --- /dev/null +++ b/src/PursLoader/Plugin.js | |||
@@ -0,0 +1,20 @@ | |||
1 | 'use strict'; | ||
2 | |||
3 | // module PursLoader.Plugin | ||
4 | |||
5 | function getFn(nothing, just, map, key) { | ||
6 | var value = map.get(key); | ||
7 | return value === undefined ? nothing : just(value); | ||
8 | } | ||
9 | exports.getFn = getFn; | ||
10 | |||
11 | function dependenciesOfFn(left, right, graph, node) { | ||
12 | try { | ||
13 | var dependencies = graph.dependenciesOf(node); | ||
14 | return right(dependencies); | ||
15 | } | ||
16 | catch (error) { | ||
17 | return left(error); | ||
18 | } | ||
19 | } | ||
20 | exports.dependenciesOfFn = dependenciesOfFn; | ||