git ssb

16+

Dominic / patchbay



Tree: 9d629c55b19f5dc728643731fffb36dac23c0eca

Files: 9d629c55b19f5dc728643731fffb36dac23c0eca / 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