@aurelia/kernel
Advanced tools
Comparing version 0.1.1-dev.20180908 to 0.1.1-dev.20180912
@@ -159,3 +159,3 @@ import { PLATFORM } from './platform'; | ||
case 4 /* array */: | ||
return this.state[0].get(handler, requestor); | ||
return this.state[0].resolve(handler, requestor); | ||
case 5 /* alias */: | ||
@@ -229,3 +229,2 @@ return handler.get(this.state); | ||
register(...params) { | ||
const resolvers = this.resolvers; | ||
for (let i = 0, ii = params.length; i < ii; ++i) { | ||
@@ -237,8 +236,14 @@ const current = params[i]; | ||
else { | ||
Object.keys(current).forEach(key => { | ||
const value = current[key]; | ||
if (value.register) { | ||
const keys = Object.keys(current); | ||
for (let j = 0, jj = keys.length; j < jj; ++j) { | ||
const value = current[keys[j]]; | ||
// note: we could remove this if-branch and call this.register directly | ||
// - the extra check is just a perf tweak to create fewer unnecessary arrays by the spread operator | ||
if (isRegistry(value)) { | ||
value.register(this); | ||
} | ||
}); | ||
else { | ||
this.register(value); | ||
} | ||
} | ||
} | ||
@@ -254,7 +259,7 @@ } | ||
} | ||
else if (resolver instanceof Resolver && resolver.strategy === 4) { | ||
else if (result instanceof Resolver && result.strategy === 4 /* array */) { | ||
result.state.push(resolver); | ||
} | ||
else { | ||
resolvers.set(key, new Resolver(key, 4, [result, resolver])); | ||
resolvers.set(key, new Resolver(key, 4 /* array */, [result, resolver])); | ||
} | ||
@@ -360,3 +365,3 @@ return resolver; | ||
} | ||
const resolver = new Resolver(keyAsValue, 1, keyAsValue); | ||
const resolver = new Resolver(keyAsValue, 1 /* singleton */, keyAsValue); | ||
handler.resolvers.set(keyAsValue, resolver); | ||
@@ -407,3 +412,5 @@ return resolver; | ||
export function validateKey(key) { | ||
if (key === null || key === undefined) { | ||
// note: design:paramTypes which will default to Object if the param types cannot be statically analyzed by tsc | ||
// this check is intended to properly report on that problem - under no circumstance should Object be a valid key anyway | ||
if (key === null || key === undefined || key === Object) { | ||
throw Reporter.error(5); | ||
@@ -413,3 +420,3 @@ } | ||
function buildAllResponse(resolver, handler, requestor) { | ||
if (resolver instanceof Resolver && resolver.strategy === 4) { | ||
if (resolver instanceof Resolver && resolver.strategy === 4 /* array */) { | ||
const state = resolver.state; | ||
@@ -464,3 +471,4 @@ let i = state.length; | ||
]; | ||
const fallbackInvoker = { | ||
/*@internal*/ | ||
export const fallbackInvoker = { | ||
invoke: invokeWithDynamicDependencies, | ||
@@ -467,0 +475,0 @@ invokeWithDynamicDependencies |
@@ -25,24 +25,20 @@ const camelCaseLookup = {}; | ||
camelCase(input) { | ||
// benchmark: http://jsben.ch/lCFIe | ||
// benchmark: http://jsben.ch/qIz4Z | ||
let value = camelCaseLookup[input]; | ||
if (value !== undefined) { | ||
if (value !== undefined) | ||
return value; | ||
} | ||
let char = input.charCodeAt(0); // make first char toLower | ||
if (char > 64 && char < 91) { // 65-90 = A-Z | ||
value = fromCharCode(char + 32); // 32 is the offset between lower case and upper case char codes | ||
} | ||
else { | ||
value = fromCharCode(char); | ||
} | ||
for (let i = 1, ii = input.length; i < ii; ++i) { | ||
char = input.charCodeAt(i); | ||
if (char === 45 /*-*/ || char === 46 /*.*/ || char === 95 /*_*/) { | ||
const next = input.charCodeAt(++i); | ||
if (next > 96 && next < 123) { // 97-122 = a-z | ||
value += fromCharCode(next - 32); // make char following a separator toUpper | ||
continue; | ||
} | ||
value = ''; | ||
let first = true; | ||
let sep = false; | ||
let char; | ||
for (let i = 0, ii = input.length; i < ii; ++i) { | ||
char = input.charAt(i); | ||
if (char === '-' || char === '.' || char === '_') { | ||
sep = true; // skip separators | ||
} | ||
value += fromCharCode(char); | ||
else { | ||
value = value + (first ? char.toLowerCase() : (sep ? char.toUpperCase() : char)); | ||
sep = false; | ||
} | ||
first = false; | ||
} | ||
@@ -52,24 +48,26 @@ return camelCaseLookup[input] = value; | ||
kebabCase(input) { | ||
// benchmark: http://jsben.ch/K6D8o | ||
// benchmark: http://jsben.ch/v7K9T | ||
let value = kebabCaseLookup[input]; | ||
if (value !== undefined) { | ||
if (value !== undefined) | ||
return value; | ||
value = ''; | ||
let first = true; | ||
let char, lower; | ||
for (let i = 0, ii = input.length; i < ii; ++i) { | ||
char = input.charAt(i); | ||
lower = char.toLowerCase(); | ||
value = value + (first ? lower : (char !== lower ? `-${lower}` : lower)); | ||
first = false; | ||
} | ||
let char = input.charCodeAt(0); // make first char toLower | ||
if (char > 64 && char < 91) { // 65-90 = A-Z | ||
value = fromCharCode(char + 32); // 32 is the offset between lower case and upper case char codes | ||
} | ||
else { | ||
value = fromCharCode(char); | ||
} | ||
for (let i = 1, ii = input.length; i < ii; ++i) { | ||
char = input.charCodeAt(i); | ||
if (char > 64 && char < 91) { | ||
value += `-${fromCharCode(char + 32)}`; | ||
continue; | ||
} | ||
value += fromCharCode(char); | ||
} | ||
return kebabCaseLookup[input] = value; | ||
}, | ||
toArray(input) { | ||
// benchmark: http://jsben.ch/xjsyF | ||
const len = input.length; | ||
const arr = Array(len); | ||
for (let i = 0; i < len; ++i) { | ||
arr[i] = input[i]; | ||
} | ||
return arr; | ||
}, | ||
requestAnimationFrame(callback) { | ||
@@ -76,0 +74,0 @@ return requestAnimationFrame(callback); |
@@ -159,3 +159,3 @@ import { PLATFORM } from './platform'; | ||
case 4 /* array */: | ||
return this.state[0].get(handler, requestor); | ||
return this.state[0].resolve(handler, requestor); | ||
case 5 /* alias */: | ||
@@ -229,3 +229,2 @@ return handler.get(this.state); | ||
register(...params) { | ||
const resolvers = this.resolvers; | ||
for (let i = 0, ii = params.length; i < ii; ++i) { | ||
@@ -237,8 +236,14 @@ const current = params[i]; | ||
else { | ||
Object.keys(current).forEach(key => { | ||
const value = current[key]; | ||
if (value.register) { | ||
const keys = Object.keys(current); | ||
for (let j = 0, jj = keys.length; j < jj; ++j) { | ||
const value = current[keys[j]]; | ||
// note: we could remove this if-branch and call this.register directly | ||
// - the extra check is just a perf tweak to create fewer unnecessary arrays by the spread operator | ||
if (isRegistry(value)) { | ||
value.register(this); | ||
} | ||
}); | ||
else { | ||
this.register(value); | ||
} | ||
} | ||
} | ||
@@ -254,7 +259,7 @@ } | ||
} | ||
else if (resolver instanceof Resolver && resolver.strategy === 4) { | ||
else if (result instanceof Resolver && result.strategy === 4 /* array */) { | ||
result.state.push(resolver); | ||
} | ||
else { | ||
resolvers.set(key, new Resolver(key, 4, [result, resolver])); | ||
resolvers.set(key, new Resolver(key, 4 /* array */, [result, resolver])); | ||
} | ||
@@ -360,3 +365,3 @@ return resolver; | ||
} | ||
const resolver = new Resolver(keyAsValue, 1, keyAsValue); | ||
const resolver = new Resolver(keyAsValue, 1 /* singleton */, keyAsValue); | ||
handler.resolvers.set(keyAsValue, resolver); | ||
@@ -407,3 +412,5 @@ return resolver; | ||
export function validateKey(key) { | ||
if (key === null || key === undefined) { | ||
// note: design:paramTypes which will default to Object if the param types cannot be statically analyzed by tsc | ||
// this check is intended to properly report on that problem - under no circumstance should Object be a valid key anyway | ||
if (key === null || key === undefined || key === Object) { | ||
throw Reporter.error(5); | ||
@@ -413,3 +420,3 @@ } | ||
function buildAllResponse(resolver, handler, requestor) { | ||
if (resolver instanceof Resolver && resolver.strategy === 4) { | ||
if (resolver instanceof Resolver && resolver.strategy === 4 /* array */) { | ||
const state = resolver.state; | ||
@@ -464,3 +471,4 @@ let i = state.length; | ||
]; | ||
const fallbackInvoker = { | ||
/*@internal*/ | ||
export const fallbackInvoker = { | ||
invoke: invokeWithDynamicDependencies, | ||
@@ -467,0 +475,0 @@ invokeWithDynamicDependencies |
@@ -25,24 +25,20 @@ const camelCaseLookup = {}; | ||
camelCase(input) { | ||
// benchmark: http://jsben.ch/lCFIe | ||
// benchmark: http://jsben.ch/qIz4Z | ||
let value = camelCaseLookup[input]; | ||
if (value !== undefined) { | ||
if (value !== undefined) | ||
return value; | ||
} | ||
let char = input.charCodeAt(0); // make first char toLower | ||
if (char > 64 && char < 91) { // 65-90 = A-Z | ||
value = fromCharCode(char + 32); // 32 is the offset between lower case and upper case char codes | ||
} | ||
else { | ||
value = fromCharCode(char); | ||
} | ||
for (let i = 1, ii = input.length; i < ii; ++i) { | ||
char = input.charCodeAt(i); | ||
if (char === 45 /*-*/ || char === 46 /*.*/ || char === 95 /*_*/) { | ||
const next = input.charCodeAt(++i); | ||
if (next > 96 && next < 123) { // 97-122 = a-z | ||
value += fromCharCode(next - 32); // make char following a separator toUpper | ||
continue; | ||
} | ||
value = ''; | ||
let first = true; | ||
let sep = false; | ||
let char; | ||
for (let i = 0, ii = input.length; i < ii; ++i) { | ||
char = input.charAt(i); | ||
if (char === '-' || char === '.' || char === '_') { | ||
sep = true; // skip separators | ||
} | ||
value += fromCharCode(char); | ||
else { | ||
value = value + (first ? char.toLowerCase() : (sep ? char.toUpperCase() : char)); | ||
sep = false; | ||
} | ||
first = false; | ||
} | ||
@@ -52,24 +48,26 @@ return camelCaseLookup[input] = value; | ||
kebabCase(input) { | ||
// benchmark: http://jsben.ch/K6D8o | ||
// benchmark: http://jsben.ch/v7K9T | ||
let value = kebabCaseLookup[input]; | ||
if (value !== undefined) { | ||
if (value !== undefined) | ||
return value; | ||
value = ''; | ||
let first = true; | ||
let char, lower; | ||
for (let i = 0, ii = input.length; i < ii; ++i) { | ||
char = input.charAt(i); | ||
lower = char.toLowerCase(); | ||
value = value + (first ? lower : (char !== lower ? `-${lower}` : lower)); | ||
first = false; | ||
} | ||
let char = input.charCodeAt(0); // make first char toLower | ||
if (char > 64 && char < 91) { // 65-90 = A-Z | ||
value = fromCharCode(char + 32); // 32 is the offset between lower case and upper case char codes | ||
} | ||
else { | ||
value = fromCharCode(char); | ||
} | ||
for (let i = 1, ii = input.length; i < ii; ++i) { | ||
char = input.charCodeAt(i); | ||
if (char > 64 && char < 91) { | ||
value += `-${fromCharCode(char + 32)}`; | ||
continue; | ||
} | ||
value += fromCharCode(char); | ||
} | ||
return kebabCaseLookup[input] = value; | ||
}, | ||
toArray(input) { | ||
// benchmark: http://jsben.ch/xjsyF | ||
const len = input.length; | ||
const arr = Array(len); | ||
for (let i = 0; i < len; ++i) { | ||
arr[i] = input[i]; | ||
} | ||
return arr; | ||
}, | ||
requestAnimationFrame(callback) { | ||
@@ -76,0 +74,0 @@ return requestAnimationFrame(callback); |
@@ -21,3 +21,5 @@ System.register(["./platform", "./reporter"], function (exports_1, context_1) { | ||
function validateKey(key) { | ||
if (key === null || key === undefined) { | ||
// note: design:paramTypes which will default to Object if the param types cannot be statically analyzed by tsc | ||
// this check is intended to properly report on that problem - under no circumstance should Object be a valid key anyway | ||
if (key === null || key === undefined || key === Object) { | ||
throw reporter_1.Reporter.error(5); | ||
@@ -28,3 +30,3 @@ } | ||
function buildAllResponse(resolver, handler, requestor) { | ||
if (resolver instanceof Resolver && resolver.strategy === 4) { | ||
if (resolver instanceof Resolver && resolver.strategy === 4 /* array */) { | ||
const state = resolver.state; | ||
@@ -215,3 +217,3 @@ let i = state.length; | ||
case 4 /* array */: | ||
return this.state[0].get(handler, requestor); | ||
return this.state[0].resolve(handler, requestor); | ||
case 5 /* alias */: | ||
@@ -284,3 +286,2 @@ return handler.get(this.state); | ||
register(...params) { | ||
const resolvers = this.resolvers; | ||
for (let i = 0, ii = params.length; i < ii; ++i) { | ||
@@ -292,8 +293,14 @@ const current = params[i]; | ||
else { | ||
Object.keys(current).forEach(key => { | ||
const value = current[key]; | ||
if (value.register) { | ||
const keys = Object.keys(current); | ||
for (let j = 0, jj = keys.length; j < jj; ++j) { | ||
const value = current[keys[j]]; | ||
// note: we could remove this if-branch and call this.register directly | ||
// - the extra check is just a perf tweak to create fewer unnecessary arrays by the spread operator | ||
if (isRegistry(value)) { | ||
value.register(this); | ||
} | ||
}); | ||
else { | ||
this.register(value); | ||
} | ||
} | ||
} | ||
@@ -309,7 +316,7 @@ } | ||
} | ||
else if (resolver instanceof Resolver && resolver.strategy === 4) { | ||
else if (result instanceof Resolver && result.strategy === 4 /* array */) { | ||
result.state.push(resolver); | ||
} | ||
else { | ||
resolvers.set(key, new Resolver(key, 4, [result, resolver])); | ||
resolvers.set(key, new Resolver(key, 4 /* array */, [result, resolver])); | ||
} | ||
@@ -415,3 +422,3 @@ return resolver; | ||
} | ||
const resolver = new Resolver(keyAsValue, 1, keyAsValue); | ||
const resolver = new Resolver(keyAsValue, 1 /* singleton */, keyAsValue); | ||
handler.resolvers.set(keyAsValue, resolver); | ||
@@ -500,6 +507,7 @@ return resolver; | ||
]); | ||
fallbackInvoker = { | ||
/*@internal*/ | ||
exports_1("fallbackInvoker", fallbackInvoker = { | ||
invoke: invokeWithDynamicDependencies, | ||
invokeWithDynamicDependencies | ||
}; | ||
}); | ||
} | ||
@@ -506,0 +514,0 @@ }; |
@@ -32,24 +32,20 @@ System.register([], function (exports_1, context_1) { | ||
camelCase(input) { | ||
// benchmark: http://jsben.ch/lCFIe | ||
// benchmark: http://jsben.ch/qIz4Z | ||
let value = camelCaseLookup[input]; | ||
if (value !== undefined) { | ||
if (value !== undefined) | ||
return value; | ||
} | ||
let char = input.charCodeAt(0); // make first char toLower | ||
if (char > 64 && char < 91) { // 65-90 = A-Z | ||
value = fromCharCode(char + 32); // 32 is the offset between lower case and upper case char codes | ||
} | ||
else { | ||
value = fromCharCode(char); | ||
} | ||
for (let i = 1, ii = input.length; i < ii; ++i) { | ||
char = input.charCodeAt(i); | ||
if (char === 45 /*-*/ || char === 46 /*.*/ || char === 95 /*_*/) { | ||
const next = input.charCodeAt(++i); | ||
if (next > 96 && next < 123) { // 97-122 = a-z | ||
value += fromCharCode(next - 32); // make char following a separator toUpper | ||
continue; | ||
} | ||
value = ''; | ||
let first = true; | ||
let sep = false; | ||
let char; | ||
for (let i = 0, ii = input.length; i < ii; ++i) { | ||
char = input.charAt(i); | ||
if (char === '-' || char === '.' || char === '_') { | ||
sep = true; // skip separators | ||
} | ||
value += fromCharCode(char); | ||
else { | ||
value = value + (first ? char.toLowerCase() : (sep ? char.toUpperCase() : char)); | ||
sep = false; | ||
} | ||
first = false; | ||
} | ||
@@ -59,24 +55,26 @@ return camelCaseLookup[input] = value; | ||
kebabCase(input) { | ||
// benchmark: http://jsben.ch/K6D8o | ||
// benchmark: http://jsben.ch/v7K9T | ||
let value = kebabCaseLookup[input]; | ||
if (value !== undefined) { | ||
if (value !== undefined) | ||
return value; | ||
value = ''; | ||
let first = true; | ||
let char, lower; | ||
for (let i = 0, ii = input.length; i < ii; ++i) { | ||
char = input.charAt(i); | ||
lower = char.toLowerCase(); | ||
value = value + (first ? lower : (char !== lower ? `-${lower}` : lower)); | ||
first = false; | ||
} | ||
let char = input.charCodeAt(0); // make first char toLower | ||
if (char > 64 && char < 91) { // 65-90 = A-Z | ||
value = fromCharCode(char + 32); // 32 is the offset between lower case and upper case char codes | ||
} | ||
else { | ||
value = fromCharCode(char); | ||
} | ||
for (let i = 1, ii = input.length; i < ii; ++i) { | ||
char = input.charCodeAt(i); | ||
if (char > 64 && char < 91) { | ||
value += `-${fromCharCode(char + 32)}`; | ||
continue; | ||
} | ||
value += fromCharCode(char); | ||
} | ||
return kebabCaseLookup[input] = value; | ||
}, | ||
toArray(input) { | ||
// benchmark: http://jsben.ch/xjsyF | ||
const len = input.length; | ||
const arr = Array(len); | ||
for (let i = 0; i < len; ++i) { | ||
arr[i] = input[i]; | ||
} | ||
return arr; | ||
}, | ||
requestAnimationFrame(callback) { | ||
@@ -83,0 +81,0 @@ return requestAnimationFrame(callback); |
@@ -1,3 +0,4 @@ | ||
import { Constructable, IIndexable, Injectable } from './interfaces'; | ||
import { Constructable, IIndexable, Injectable, Primitive } from './interfaces'; | ||
export declare type ResolveCallback<T = any> = (handler?: IContainer, requestor?: IContainer, resolver?: IResolver) => T; | ||
export declare type Key<T> = InterfaceSymbol<T> | Primitive | IIndexable | Function; | ||
export declare type InterfaceSymbol<T> = (target: Injectable, property: string, index: number) => any; | ||
@@ -13,3 +14,3 @@ export interface IDefaultableInterfaceSymbol<T> extends InterfaceSymbol<T> { | ||
export interface IRegistration<T = any> { | ||
register(container: IContainer, key?: any): IResolver<T>; | ||
register(container: IContainer, key?: Key<T>): IResolver<T>; | ||
} | ||
@@ -23,5 +24,5 @@ export interface IFactory<T = any> { | ||
has(key: any, searchAncestors: boolean): boolean; | ||
get<T>(key: InterfaceSymbol<T> | any): T; | ||
get<T>(key: Key<T>): T; | ||
get<T extends Constructable>(key: T): InstanceType<T>; | ||
getAll<T>(key: InterfaceSymbol<T> | any): ReadonlyArray<T>; | ||
getAll<T>(key: Key<T>): ReadonlyArray<T>; | ||
getAll<T extends Constructable>(key: T): ReadonlyArray<InstanceType<T>>; | ||
@@ -34,7 +35,8 @@ } | ||
register(...params: (IRegistry | Record<string, Partial<IRegistry>>)[]): void; | ||
registerResolver<T>(key: InterfaceSymbol<T> | any, resolver: IResolver<T>): IResolver<T>; | ||
register(registry: IRegistry | Record<string, Partial<IRegistry>>): void; | ||
registerResolver<T>(key: Key<T>, resolver: IResolver<T>): IResolver<T>; | ||
registerResolver<T extends Constructable>(key: T, resolver: IResolver<InstanceType<T>>): IResolver<InstanceType<T>>; | ||
registerTransformer<T>(key: InterfaceSymbol<T> | any, transformer: (instance: T) => T): boolean; | ||
registerTransformer<T>(key: Key<T>, transformer: (instance: T) => T): boolean; | ||
registerTransformer<T extends Constructable>(key: T, transformer: (instance: InstanceType<T>) => T): boolean; | ||
getResolver<T>(key: InterfaceSymbol<T> | any, autoRegister?: boolean): IResolver<T> | null; | ||
getResolver<T>(key: Key<T>, autoRegister?: boolean): IResolver<T> | null; | ||
getResolver<T extends Constructable>(key: T, autoRegister?: boolean): IResolver<InstanceType<T>> | null; | ||
@@ -49,3 +51,3 @@ getFactory<T extends Constructable>(type: T): IFactory<InstanceType<T>>; | ||
callback(value: ResolveCallback<T>): IResolver; | ||
aliasTo(destinationKey: any): IResolver; | ||
aliasTo(destinationKey: Key<T>): IResolver; | ||
} | ||
@@ -55,3 +57,5 @@ export declare const DI: { | ||
getDesignParamTypes(target: any): any[]; | ||
getDependencies(type: Function): any[]; | ||
getDependencies(type: Function & { | ||
inject?: any; | ||
}): any[]; | ||
createInterface<T = any>(friendlyName?: string): IDefaultableInterfaceSymbol<T>; | ||
@@ -58,0 +62,0 @@ inject(...dependencies: any[]): (target: any, property?: string, descriptor?: number | PropertyDescriptor) => any; |
@@ -9,2 +9,3 @@ export declare const PLATFORM: { | ||
kebabCase(input: string): string; | ||
toArray<T = any>(input: ArrayLike<T>): T[]; | ||
requestAnimationFrame(callback: (time: number) => void): number; | ||
@@ -11,0 +12,0 @@ createTaskFlushRequester(onFlush: () => void): () => void; |
@@ -170,3 +170,3 @@ (function (factory) { | ||
case 4 /* array */: | ||
return this.state[0].get(handler, requestor); | ||
return this.state[0].resolve(handler, requestor); | ||
case 5 /* alias */: | ||
@@ -199,3 +199,3 @@ return handler.get(this.state); | ||
const dependencies = exports.DI.getDependencies(type); | ||
const invoker = exports.classInvokers[dependencies.length] || fallbackInvoker; | ||
const invoker = exports.classInvokers[dependencies.length] || exports.fallbackInvoker; | ||
return new Factory(type, invoker, dependencies); | ||
@@ -243,3 +243,2 @@ } | ||
register(...params) { | ||
const resolvers = this.resolvers; | ||
for (let i = 0, ii = params.length; i < ii; ++i) { | ||
@@ -251,8 +250,14 @@ const current = params[i]; | ||
else { | ||
Object.keys(current).forEach(key => { | ||
const value = current[key]; | ||
if (value.register) { | ||
const keys = Object.keys(current); | ||
for (let j = 0, jj = keys.length; j < jj; ++j) { | ||
const value = current[keys[j]]; | ||
// note: we could remove this if-branch and call this.register directly | ||
// - the extra check is just a perf tweak to create fewer unnecessary arrays by the spread operator | ||
if (isRegistry(value)) { | ||
value.register(this); | ||
} | ||
}); | ||
else { | ||
this.register(value); | ||
} | ||
} | ||
} | ||
@@ -268,7 +273,7 @@ } | ||
} | ||
else if (resolver instanceof Resolver && resolver.strategy === 4) { | ||
else if (result instanceof Resolver && result.strategy === 4 /* array */) { | ||
result.state.push(resolver); | ||
} | ||
else { | ||
resolvers.set(key, new Resolver(key, 4, [result, resolver])); | ||
resolvers.set(key, new Resolver(key, 4 /* array */, [result, resolver])); | ||
} | ||
@@ -374,3 +379,3 @@ return resolver; | ||
} | ||
const resolver = new Resolver(keyAsValue, 1, keyAsValue); | ||
const resolver = new Resolver(keyAsValue, 1 /* singleton */, keyAsValue); | ||
handler.resolvers.set(keyAsValue, resolver); | ||
@@ -422,3 +427,5 @@ return resolver; | ||
function validateKey(key) { | ||
if (key === null || key === undefined) { | ||
// note: design:paramTypes which will default to Object if the param types cannot be statically analyzed by tsc | ||
// this check is intended to properly report on that problem - under no circumstance should Object be a valid key anyway | ||
if (key === null || key === undefined || key === Object) { | ||
throw reporter_1.Reporter.error(5); | ||
@@ -429,3 +436,3 @@ } | ||
function buildAllResponse(resolver, handler, requestor) { | ||
if (resolver instanceof Resolver && resolver.strategy === 4) { | ||
if (resolver instanceof Resolver && resolver.strategy === 4 /* array */) { | ||
const state = resolver.state; | ||
@@ -480,3 +487,4 @@ let i = state.length; | ||
]; | ||
const fallbackInvoker = { | ||
/*@internal*/ | ||
exports.fallbackInvoker = { | ||
invoke: invokeWithDynamicDependencies, | ||
@@ -483,0 +491,0 @@ invokeWithDynamicDependencies |
@@ -36,24 +36,20 @@ (function (factory) { | ||
camelCase(input) { | ||
// benchmark: http://jsben.ch/lCFIe | ||
// benchmark: http://jsben.ch/qIz4Z | ||
let value = camelCaseLookup[input]; | ||
if (value !== undefined) { | ||
if (value !== undefined) | ||
return value; | ||
} | ||
let char = input.charCodeAt(0); // make first char toLower | ||
if (char > 64 && char < 91) { // 65-90 = A-Z | ||
value = fromCharCode(char + 32); // 32 is the offset between lower case and upper case char codes | ||
} | ||
else { | ||
value = fromCharCode(char); | ||
} | ||
for (let i = 1, ii = input.length; i < ii; ++i) { | ||
char = input.charCodeAt(i); | ||
if (char === 45 /*-*/ || char === 46 /*.*/ || char === 95 /*_*/) { | ||
const next = input.charCodeAt(++i); | ||
if (next > 96 && next < 123) { // 97-122 = a-z | ||
value += fromCharCode(next - 32); // make char following a separator toUpper | ||
continue; | ||
} | ||
value = ''; | ||
let first = true; | ||
let sep = false; | ||
let char; | ||
for (let i = 0, ii = input.length; i < ii; ++i) { | ||
char = input.charAt(i); | ||
if (char === '-' || char === '.' || char === '_') { | ||
sep = true; // skip separators | ||
} | ||
value += fromCharCode(char); | ||
else { | ||
value = value + (first ? char.toLowerCase() : (sep ? char.toUpperCase() : char)); | ||
sep = false; | ||
} | ||
first = false; | ||
} | ||
@@ -63,24 +59,26 @@ return camelCaseLookup[input] = value; | ||
kebabCase(input) { | ||
// benchmark: http://jsben.ch/K6D8o | ||
// benchmark: http://jsben.ch/v7K9T | ||
let value = kebabCaseLookup[input]; | ||
if (value !== undefined) { | ||
if (value !== undefined) | ||
return value; | ||
value = ''; | ||
let first = true; | ||
let char, lower; | ||
for (let i = 0, ii = input.length; i < ii; ++i) { | ||
char = input.charAt(i); | ||
lower = char.toLowerCase(); | ||
value = value + (first ? lower : (char !== lower ? `-${lower}` : lower)); | ||
first = false; | ||
} | ||
let char = input.charCodeAt(0); // make first char toLower | ||
if (char > 64 && char < 91) { // 65-90 = A-Z | ||
value = fromCharCode(char + 32); // 32 is the offset between lower case and upper case char codes | ||
} | ||
else { | ||
value = fromCharCode(char); | ||
} | ||
for (let i = 1, ii = input.length; i < ii; ++i) { | ||
char = input.charCodeAt(i); | ||
if (char > 64 && char < 91) { | ||
value += `-${fromCharCode(char + 32)}`; | ||
continue; | ||
} | ||
value += fromCharCode(char); | ||
} | ||
return kebabCaseLookup[input] = value; | ||
}, | ||
toArray(input) { | ||
// benchmark: http://jsben.ch/xjsyF | ||
const len = input.length; | ||
const arr = Array(len); | ||
for (let i = 0; i < len; ++i) { | ||
arr[i] = input[i]; | ||
} | ||
return arr; | ||
}, | ||
requestAnimationFrame(callback) { | ||
@@ -87,0 +85,0 @@ return requestAnimationFrame(callback); |
{ | ||
"name": "@aurelia/kernel", | ||
"version": "0.1.1-dev.20180908", | ||
"version": "0.1.1-dev.20180912", | ||
"main": "dist/umd/index.js", | ||
@@ -76,3 +76,2 @@ "types": "dist/types/index.d.ts", | ||
"tslint-microsoft-contrib": "^5.1.0", | ||
"tslint-no-unused-expression-chai": "^0.1.3", | ||
"typescript": "^3.0.1", | ||
@@ -83,3 +82,3 @@ "webpack": "^4.16.3", | ||
}, | ||
"gitHead": "76d1aa3af248c435dd6e895a1758f7cf06d07cf4" | ||
"gitHead": "823cb66be03eff320351e68cdb66815dcf86dd81" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
193953
36
2665