Files: 4792f8c59a98c02045a1e6f1c7d9811d4abf18ef / plugs.js
431 bytesRaw
1 | exports.first = function first(plug) { |
2 | return function () { |
3 | var args = [].slice.call(arguments) |
4 | for(var i = 0; i < plug.length; i++) { |
5 | var val = plug[i].apply(null, args) |
6 | if(val) return val |
7 | } |
8 | } |
9 | } |
10 | |
11 | exports.map = function (plug) { |
12 | return function () { |
13 | var args = [].slice.call(arguments) |
14 | return plug.map(function (fn) { |
15 | if(fn) return fn.apply(null, args) |
16 | }).filter(Boolean) |
17 | } |
18 | } |
19 | |
20 | |
21 | |
22 | |
23 | |
24 |
Built with git-ssb-web