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