git ssb

1+

Matt McKegg / mutant



Tree: 01e9e1d516a0bcf09d486425ab7cba0f919f5a1a

Files: 01e9e1d516a0bcf09d486425ab7cba0f919f5a1a / for-each-pair.js

489 bytesRaw
1var isObservable = require('./is-observable')
2var resolve = require('./resolve')
3
4module.exports = function forEachPair (source, fn) {
5 if (source) {
6 if (isObservable(source) && source.keys && source.get) {
7 resolve(source.keys).forEach(function (key) {
8 fn(key, source.get(key))
9 })
10 } else {
11 var values = resolve(source)
12 if (values) {
13 Object.keys(values).forEach(function (key) {
14 fn(key, values[key])
15 })
16 }
17 }
18 }
19}
20

Built with git-ssb-web