git ssb

16+

Dominic / patchbay



Tree: 251a4d7b1477eafd58a6093249e659cf49f23e0c

Files: 251a4d7b1477eafd58a6093249e659cf49f23e0c / util.js

400 bytesRaw
1function first (list, test) {
2 for(var i in list) {
3 var value = test(list[i], i, list)
4 if(value) return value
5 }
6}
7
8function decorate (list, value, caller) {
9 caller = caller || function (d,e,v) { return d(e, v) }
10
11 return list.reduce(function (element, decorator) {
12 return caller(decorator, element, value) || element
13 }, null)
14}
15
16exports.first = first
17
18exports.decorate = decorate
19

Built with git-ssb-web