git ssb

16+

Dominic / patchbay



Commit e011bd5b98dd02ca18961e374977a17784ad659b

clone if you are gonna mutate opts object

Dominic Tarr committed on 10/12/2016, 2:39:33 PM
Parent: b8b3160361f94ba38bb14788f0aee273b4d1bc99

Files changed

util.jschanged
util.jsView
@@ -4,14 +4,20 @@
44 function get (obj, path) {
55 if(!obj) return undefined
66 if('string' === typeof path) return obj[path]
77 if(Array.isArray(path)) {
8- for(var i = 0; i < path.length; i++)
8 + for(var i = 0; obj && i < path.length; i++)
99 obj = obj[path[i]]
1010 return obj
1111 }
1212 }
1313
14 +function clone (obj) {
15 + var _obj = {}
16 + for(var k in obj) _obj[k] = obj[k]
17 + return _obj
18 +}
19 +
1420 exports.next = function (createStream, opts, property, range) {
1521
1622 range = range || (opts.reverse ? 'lt' : 'gt')
1723 property = property || 'timestamp'
@@ -24,9 +30,9 @@
2430 if(value == null) return
2531 last = null
2632 }
2733 return pull(
28- createStream(opts),
34 + createStream(clone(opts)),
2935 pull.through(function (msg) {
3036 count ++
3137 if(!msg.sync) {
3238 last = msg
@@ -40,4 +46,9 @@
4046 )
4147 })
4248 }
4349
50 +
51 +
52 +
53 +
54 +

Built with git-ssb-web