Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return getTypeMapInt('-infinity');
}
if (value === Number.POSITIVE_INFINITY) {
return getTypeMapInt('infinity');
}
if (isNull(value) || isUndefined(value)) {
return getTypeMapInt('null');
}
if (value === DOCUMENT_ID) {
return getTypeMapInt('documentid');
}
if (isBoolean(value)) {
if (value === true) {
return getTypeMapInt('booleanTrue');
}
return getTypeMapInt('booleanFalse');
}
if (isNumber(value)) {
return getTypeMapInt('number', value);
}
if (isString(value)) {
if (value === '') {
return getTypeMapInt('stringEmpty');
}
return getTypeMapInt('string', value);
}
setCrashlyticsCollectionEnabled(enabled) {
if (!isBoolean(enabled)) {
throw new Error(
"firebase.crashlytics().setCrashlyticsCollectionEnabled(*) 'enabled' must be a boolean.",
);
}
this._isCrashlyticsCollectionEnabled = enabled;
return this.native.setCrashlyticsCollectionEnabled(enabled);
}
}
keepSynced(bool) {
if (!isBoolean(bool)) {
throw new Error(
"firebase.database().ref().keepSynced(*) 'bool' value must be a boolean value.",
);
}
return this._database.native.keepSynced(
this._generateQueryKey(),
this.path,
this._modifiers.toArray(),
bool,
);
}
export default function validateAdShowOptions(options) {
const out = {};
if (isUndefined(options)) {
return out;
}
if (!isObject(options)) {
throw new Error("'options' expected an object value");
}
if (hasOwnProperty(options, 'immersiveModeEnabled')) {
if (!isBoolean(options.immersiveModeEnabled)) {
throw new Error("'options.immersiveModeEnabled' expected a boolean value");
}
out.immersiveModeEnabled = options.immersiveModeEnabled;
}
return out;
}
}
if (settings.host === '') {
throw new Error(
"firebase.firestore().settings(*) 'settings.host' must not be an empty string.",
);
}
}
if (!isUndefined(settings.persistence) && !isBoolean(settings.persistence)) {
throw new Error(
"firebase.firestore().settings(*) 'settings.persistence' must be a boolean value.",
);
}
if (!isUndefined(settings.ssl) && !isBoolean(settings.ssl)) {
throw new Error("firebase.firestore().settings(*) 'settings.ssl' must be a boolean value.");
}
return this.native.settings(settings);
}
}
export default function validateAdRequestOptions(options) {
const out = {};
if (isUndefined(options)) {
return out;
}
if (!isObject(options)) {
throw new Error("'options' expected an object value");
}
if (hasOwnProperty(options, 'requestNonPersonalizedAdsOnly')) {
if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {
throw new Error("'options.requestNonPersonalizedAdsOnly' expected a boolean value");
}
out.requestNonPersonalizedAdsOnly = options.requestNonPersonalizedAdsOnly;
}
if (options.networkExtras) {
if (!isObject(options.networkExtras)) {
throw new Error("'options.networkExtras' expected an object of key/value pairs");
}
Object.entries(options.networkExtras).forEach(([key, value]) => {
if (!isString(value)) {
throw new Error(`'options.networkExtras' expected a string value for object key "${key}"`);
}
});
export default function buildNavigation(navigationParams) {
if (!isObject(navigationParams)) {
throw new Error("'dynamicLinksParams.navigation' must be an object.");
}
const params = {};
if (hasOwnProperty(navigationParams, 'forcedRedirectEnabled')) {
if (!isBoolean(navigationParams.forcedRedirectEnabled)) {
throw new Error("'dynamicLinksParams.navigation.forcedRedirectEnabled' must be a boolean.");
}
params.forcedRedirectEnabled = navigationParams.forcedRedirectEnabled;
}
return params;
}
const out = {};
if (isUndefined(options)) {
return out;
}
if (!isObject(options)) {
throw new Error("'options' must be an object.");
}
if (hasOwnProperty(options, 'merge') && hasOwnProperty(options, 'mergeFields')) {
throw new Error("'options' must not contain both 'merge' & 'mergeFields'.");
}
if (!isUndefined(options.merge)) {
if (!isBoolean(options.merge)) {
throw new Error("'options.merge' must be a boolean value.");
}
out.merge = true;
}
if (!isUndefined(options.mergeFields)) {
if (!isArray(options.mergeFields)) {
throw new Error("'options.mergeFields' must be an array.");
}
out.mergeFields = [];
for (let i = 0; i < options.mergeFields.length; i++) {
const field = options.mergeFields[i];
if (!isString(field) && !(field instanceof FirestoreFieldPath)) {
if (
requestConfiguration.maxAdContentRating !== MaxAdContentRating.G &&
requestConfiguration.maxAdContentRating !== MaxAdContentRating.PG &&
requestConfiguration.maxAdContentRating !== MaxAdContentRating.T &&
requestConfiguration.maxAdContentRating !== MaxAdContentRating.MA
) {
throw new Error(
"'requestConfiguration.maxAdContentRating' expected on of MaxAdContentRating.G, MaxAdContentRating.PG, MaxAdContentRating.T or MaxAdContentRating.MA",
);
}
out.maxAdContentRating = requestConfiguration.maxAdContentRating;
}
if (hasOwnProperty(requestConfiguration, 'tagForChildDirectedTreatment')) {
if (!isBoolean(requestConfiguration.tagForChildDirectedTreatment)) {
throw new Error(
"'requestConfiguration.tagForChildDirectedTreatment' expected a boolean value",
);
}
out.tagForChildDirectedTreatment = requestConfiguration.tagForChildDirectedTreatment;
}
if (hasOwnProperty(requestConfiguration, 'tagForUnderAgeOfConsent')) {
if (!isBoolean(requestConfiguration.tagForUnderAgeOfConsent)) {
throw new Error("'requestConfiguration.tagForUnderAgeOfConsent' expected a boolean value");
}
out.tagForUnderAgeOfConsent = requestConfiguration.tagForUnderAgeOfConsent;
}