chore(facade): add enum index lookup support
This commit is contained in:

committed by
Alex Eagle

parent
8e3e45097a
commit
b691da26af
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user