UNPKG

@react-native-firebase/remote-config

Version:

React Native Firebase - React Native Firebase provides native integration with Remote Config, allowing you to change the appearance and/or functionality of your app without requiring an app update.

53 lines (51 loc) 1.35 kB
"use strict"; /* * Copyright (c) 2016-present Invertase Limited & Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this library 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. * */ // as per firebase web sdk specification const BOOL_VALUES = ['1', 'true', 't', 'yes', 'y', 'on']; export default class RemoteConfigValue { constructor({ value, source }) { this._value = value; this._source = source; } asBoolean() { if (this._source === 'static') { return false; } return BOOL_VALUES.includes(this._value.toLowerCase()); } asNumber() { if (this._source === 'static') { return 0; } const num = Number(this._value); if (Number.isNaN(num)) { return 0; } return num; } asString() { return this._value; } getSource() { return this._source; } } //# sourceMappingURL=RemoteConfigValue.js.map