UNPKG

557 BJavaScriptView Raw
1'use strict';
2var _insert = require('./_insert');
3var checkNew = require('./checkNew');
4module.exports = insert;
5function 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
12function 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