1 | 'use strict';
|
2 | var _insert = require('./_insert');
|
3 | var checkNew = require('./checkNew');
|
4 | module.exports = insert;
|
5 | function insert(self, id, bbox, nodeID, height, store) {
|
6 | store = store || self.store;
|
7 | return addRecord(self, id, bbox, store).then(function () {
|
8 | return _insert(self, id, bbox, nodeID, height, store);
|
9 | });
|
10 | }
|
11 |
|
12 | function addRecord(self, id, bbox, store) {
|
13 | var newID = '$' + id;
|
14 | return store.get(newID).catch(function () {
|
15 | return [];
|
16 | }).then(function (bboxen) {
|
17 | bboxen.push(bbox);
|
18 | return store.put(newID, bboxen);
|
19 | });
|
20 | } |
\ | No newline at end of file |