parent
10dcbcf45d
commit
72494c4411
|
@ -230,7 +230,7 @@ function recursivelyProcessProviders(records: Map<any, Record>, provider: Static
|
|||
let scope: string|null = null;
|
||||
if (provider) {
|
||||
provider = resolveForwardRef(provider);
|
||||
if (provider instanceof Array) {
|
||||
if (Array.isArray(provider)) {
|
||||
// if we have an array recurse into the array
|
||||
for (let i = 0; i < provider.length; i++) {
|
||||
scope = recursivelyProcessProviders(records, provider[i]) || scope;
|
||||
|
@ -359,7 +359,7 @@ function computeDeps(provider: StaticProvider): DependencyRecord[] {
|
|||
for (let i = 0; i < providerDeps.length; i++) {
|
||||
let options = OptionFlags.Default;
|
||||
let token = resolveForwardRef(providerDeps[i]);
|
||||
if (token instanceof Array) {
|
||||
if (Array.isArray(token)) {
|
||||
for (let j = 0, annotations = token; j < annotations.length; j++) {
|
||||
const annotation = annotations[j];
|
||||
if (annotation instanceof Optional || annotation == Optional) {
|
||||
|
|
|
@ -227,7 +227,7 @@ export function formatError(
|
|||
text: string, obj: any, injectorErrorName: string, source: string | null = null): string {
|
||||
text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.substr(2) : text;
|
||||
let context = stringify(obj);
|
||||
if (obj instanceof Array) {
|
||||
if (Array.isArray(obj)) {
|
||||
context = obj.map(stringify).join(' -> ');
|
||||
} else if (typeof obj === 'object') {
|
||||
let parts = <string[]>[];
|
||||
|
|
|
@ -189,7 +189,7 @@ function _normalizeProviders(
|
|||
} else if (b && typeof b == 'object' && (b as any).provide !== undefined) {
|
||||
res.push(b as NormalizedProvider);
|
||||
|
||||
} else if (b instanceof Array) {
|
||||
} else if (Array.isArray(b)) {
|
||||
_normalizeProviders(b, res);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -11,7 +11,7 @@ export function stringify(token: any): string {
|
|||
return token;
|
||||
}
|
||||
|
||||
if (token instanceof Array) {
|
||||
if (Array.isArray(token)) {
|
||||
return '[' + token.map(stringify).join(', ') + ']';
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class SomeComponent {
|
|||
function createModule(options: CreateModuleOptions): Type<any>;
|
||||
function createModule(providersOrOptions: any[] | CreateModuleOptions | undefined): Type<any> {
|
||||
let options: CreateModuleOptions = {};
|
||||
if (providersOrOptions instanceof Array) {
|
||||
if (Array.isArray(providersOrOptions)) {
|
||||
options = {providers: providersOrOptions};
|
||||
} else {
|
||||
options = providersOrOptions || {};
|
||||
|
|
|
@ -48,7 +48,7 @@ function removeMetadata(metadata: StringMap, remove: any, references: Map<any, s
|
|||
const removeObjects = new Set<string>();
|
||||
for (const prop in remove) {
|
||||
const removeValue = remove[prop];
|
||||
if (removeValue instanceof Array) {
|
||||
if (Array.isArray(removeValue)) {
|
||||
removeValue.forEach(
|
||||
(value: any) => { removeObjects.add(_propHashKey(prop, value, references)); });
|
||||
} else {
|
||||
|
@ -58,7 +58,7 @@ function removeMetadata(metadata: StringMap, remove: any, references: Map<any, s
|
|||
|
||||
for (const prop in metadata) {
|
||||
const propValue = metadata[prop];
|
||||
if (propValue instanceof Array) {
|
||||
if (Array.isArray(propValue)) {
|
||||
metadata[prop] = propValue.filter(
|
||||
(value: any) => !removeObjects.has(_propHashKey(prop, value, references)));
|
||||
} else {
|
||||
|
@ -73,7 +73,7 @@ function addMetadata(metadata: StringMap, add: any) {
|
|||
for (const prop in add) {
|
||||
const addValue = add[prop];
|
||||
const propValue = metadata[prop];
|
||||
if (propValue != null && propValue instanceof Array) {
|
||||
if (propValue != null && Array.isArray(propValue)) {
|
||||
metadata[prop] = propValue.concat(addValue);
|
||||
} else {
|
||||
metadata[prop] = addValue;
|
||||
|
|
Loading…
Reference in New Issue