UNPKG

@react-native-ohos/realm

Version:

Realm by MongoDB is an offline-first mobile database: an alternative to SQLite and key-value stores

38 lines 1.45 kB
"use strict"; //////////////////////////////////////////////////////////////////////////// // // Copyright 2022 Realm Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////// Object.defineProperty(exports, "__esModule", { value: true }); exports.JSONCacheMap = void 0; const symbols_1 = require("./symbols"); /** @internal */ class JSONCacheMap extends Map { add(object, value) { const tableKey = object[symbols_1.OBJECT_INTERNAL].table.key; let cachedMap = this.get(tableKey); if (!cachedMap) { cachedMap = new Map(); this.set(tableKey, cachedMap); } cachedMap.set(object._objectKey(), value); } find(object) { return this.get(object[symbols_1.OBJECT_INTERNAL].table.key)?.get(object._objectKey()); } } exports.JSONCacheMap = JSONCacheMap; //# sourceMappingURL=JSONCacheMap.js.map