@react-native-ohos/realm
Version:
Realm by MongoDB is an offline-first mobile database: an alternative to SQLite and key-value stores
50 lines • 1.86 kB
JavaScript
"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.getClassHelpers = exports.setClassHelpers = void 0;
const symbols_1 = require("./symbols");
/** @internal */
function setClassHelpers(constructor, value) {
// Store the properties map on the object class
Object.defineProperty(constructor, symbols_1.OBJECT_HELPERS, {
enumerable: false,
writable: false,
configurable: false,
value,
});
}
exports.setClassHelpers = setClassHelpers;
/**
* Get internal helpers.
* NOTE: This is a free function instead of a member of RealmObject to limit conflicts with user defined properties.
* @param arg The object or constructor to get a helpers for.
* @returns Helpers injected onto the class by the `ClassMap`.
* @internal
*/
function getClassHelpers(arg) {
const helpers = arg[symbols_1.OBJECT_HELPERS];
if (helpers) {
return helpers;
}
else {
throw new Error(`Expected INTERNAL_HELPERS to be set on the '${arg.name}' class`);
}
}
exports.getClassHelpers = getClassHelpers;
//# sourceMappingURL=ClassHelpers.js.map