@live-change/db-store-rbtree 0.5.8 → 0.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Store.js +4 -3
- package/package.json +3 -3
package/lib/Store.js
CHANGED
|
@@ -92,7 +92,7 @@ class RangeObservable extends ReactiveDao.ObservableList {
|
|
|
92
92
|
const id = object.id
|
|
93
93
|
if(this.range.gt && !(id > this.range.gt)) return
|
|
94
94
|
if(this.range.lt && !(id < this.range.lt)) return
|
|
95
|
-
if(!this.range.reverse) {
|
|
95
|
+
if(!this.range.reverse) { /// NOT REVERSED:
|
|
96
96
|
if(this.range.limit && this.list.length == this.range.limit) {
|
|
97
97
|
for(let i = 0, l = this.list.length; i < l; i++) {
|
|
98
98
|
if(this.list[i].id == id) {
|
|
@@ -110,14 +110,15 @@ class RangeObservable extends ReactiveDao.ObservableList {
|
|
|
110
110
|
} else {
|
|
111
111
|
this.putByField('id', object.id, object, false, oldObject)
|
|
112
112
|
}
|
|
113
|
-
} else {
|
|
113
|
+
} else { /// REVERSED:
|
|
114
114
|
if(this.range.limit && this.list.length == this.range.limit) {
|
|
115
|
-
for(let i = this.list.length-1; i >= 0; i--) {
|
|
115
|
+
for(let i = this.list.length - 1; i >= 0; i--) {
|
|
116
116
|
if(this.list[i].id == id) {
|
|
117
117
|
this.list.splice(i, 1, object)
|
|
118
118
|
this.fireObservers('putByField', 'id', id, object, true, oldObject)
|
|
119
119
|
return
|
|
120
120
|
} else if(this.list[i].id > id) {
|
|
121
|
+
if(i == this.list.length - 1) return // last element is bigger, do nothing
|
|
121
122
|
this.list.splice(i + 1, 0, object)
|
|
122
123
|
this.fireObservers('putByField', 'id', id, object, true, oldObject)
|
|
123
124
|
const popped = this.list.pop()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/db-store-rbtree",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
4
4
|
"description": "Database with observable data for live queries",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"tape": "^5.3.2"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@live-change/dao": "0.4.
|
|
27
|
+
"@live-change/dao": "0.4.10",
|
|
28
28
|
"@live-change/interval-tree": "^1.0.12",
|
|
29
29
|
"functional-red-black-tree": "^1.0.1"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "459aba0a8b3096f664d4820df8cac99a7ea0d26e"
|
|
32
32
|
}
|