Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (appArg === void 0) { appArg = app(); }
// @ts-ignore
if (typeof appArg[name] !== 'function') {
// Invalid argument.
// This happens in the following case: firebase.storage('gs:/')
throw ERROR_FACTORY.create("invalid-app-argument" /* INVALID_APP_ARGUMENT */, {
appName: name
});
}
// Forward service instance lookup to the FirebaseApp.
// @ts-ignore
return appArg[name]();
}
// ... and a container for service-level properties.
if (serviceProperties !== undefined) {
util.deepExtend(serviceNamespace, serviceProperties);
}
// Monkey-patch the serviceNamespace onto the firebase namespace
// @ts-ignore
namespace[name] = serviceNamespace;
// Patch the FirebaseAppImpl prototype
// @ts-ignore
firebaseAppImpl.prototype[name] =
// TODO: The eslint disable can be removed and the 'ignoreRestArgs'
// option added to the no-explicit-any rule when ESlint releases it.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var serviceFxn = this._getService.bind(this, name);
if (appArg === void 0) { appArg = app(); }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (typeof appArg[componentName] !== 'function') {
// Invalid argument.
// This happens in the following case: firebase.storage('gs:/')
throw ERROR_FACTORY.create("invalid-app-argument" /* INVALID_APP_ARGUMENT */, {
appName: componentName
});
}
// Forward service instance lookup to the FirebaseApp.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return appArg[componentName]();
};
// ... and a container for service-level properties.
if (component.serviceProps !== undefined) {
util.deepExtend(serviceNamespace, component.serviceProps);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
namespace[componentName] = serviceNamespace;
// Patch the FirebaseAppImpl prototype
// eslint-disable-next-line @typescript-eslint/no-explicit-any
firebaseAppImpl.prototype[componentName] =
// TODO: The eslint disable can be removed and the 'ignoreRestArgs'
// option added to the no-explicit-any rule when ESlint releases it.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var serviceFxn = this._getService.bind(this, componentName);
return serviceFxn.apply(this, component.multipleInstances ? args : []);
if (appArg === void 0) { appArg = app(); }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (typeof appArg[componentName] !== 'function') {
// Invalid argument.
// This happens in the following case: firebase.storage('gs:/')
throw ERROR_FACTORY.create("invalid-app-argument" /* INVALID_APP_ARGUMENT */, {
appName: componentName
});
}
// Forward service instance lookup to the FirebaseApp.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return appArg[componentName]();
};
// ... and a container for service-level properties.
if (component.serviceProps !== undefined) {
deepExtend(serviceNamespace, component.serviceProps);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
namespace[componentName] = serviceNamespace;
// Patch the FirebaseAppImpl prototype
// eslint-disable-next-line @typescript-eslint/no-explicit-any
firebaseAppImpl.prototype[componentName] =
// TODO: The eslint disable can be removed and the 'ignoreRestArgs'
// option added to the no-explicit-any rule when ESlint releases it.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var serviceFxn = this._getService.bind(this, componentName);
return serviceFxn.apply(this, component.multipleInstances ? args : []);
function serviceNamespace(appArg = app()) {
// @ts-ignore
if (typeof appArg[name] !== 'function') {
// Invalid argument.
// This happens in the following case: firebase.storage('gs:/')
throw ERROR_FACTORY.create("invalid-app-argument" /* INVALID_APP_ARGUMENT */, {
appName: name
});
}
// Forward service instance lookup to the FirebaseApp.
// @ts-ignore
return appArg[name]();
}
// ... and a container for service-level properties.
if (serviceProperties !== undefined) {
deepExtend(serviceNamespace, serviceProperties);
}
// Monkey-patch the serviceNamespace onto the firebase namespace
// @ts-ignore
namespace[name] = serviceNamespace;
// Patch the FirebaseAppImpl prototype
// @ts-ignore
firebaseAppImpl.prototype[name] =
// TODO: The eslint disable can be removed and the 'ignoreRestArgs'
// option added to the no-explicit-any rule when ESlint releases it.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function (...args) {
const serviceFxn = this._getService.bind(this, name);
return serviceFxn.apply(this, allowMultipleInstances ? args : []);
};
return serviceNamespace;
}
extendApp(props) {
// Copy the object onto the FirebaseAppImpl prototype
deepExtend(this, props);
}
/**
function extendNamespace(props) {
deepExtend(namespace, props);
}
return namespace;
function extendNamespace(props) {
util.deepExtend(namespace, props);
}
return namespace;
function extendNamespace(props: { [prop: string]: unknown }): void {
deepExtend(namespace, props);
}