chore(facade): add enum index lookup support

This commit is contained in:
Matias Niemelä
2016-03-08 16:38:50 -08:00
committed by Alex Eagle
parent 8e3e45097a
commit b691da26af
3 changed files with 27 additions and 2 deletions

View File

@ -54,6 +54,11 @@ dynamic deserializeEnum(num val, Map<num, dynamic> values) {
return values[val];
}
String resolveEnumToken(enumValue, val) {
// turn Enum.Token -> Token
return val.toString().replaceFirst(new RegExp('^.+\\.'),'');
}
class StringWrapper {
static String fromCharCode(int code) {
return new String.fromCharCode(code);

View File

@ -195,6 +195,10 @@ export function deserializeEnum(val, values: Map<number, any>): any {
return val;
}
export function resolveEnumToken(enumValue, val): string {
return enumValue[val];
}
export class StringWrapper {
static fromCharCode(code: number): string { return String.fromCharCode(code); }
@ -468,4 +472,4 @@ export function isPrimitive(obj: any): boolean {
export function hasConstructor(value: Object, type: Type): boolean {
return value.constructor === type;
}
}