@awayfl/avm2
Version:
Virtual machine for executing AS3 code
13 lines (12 loc) • 326 B
text/typescript
/**
* Same as |axCoerceString| except for returning "null" instead of |null| for
* |null| or |undefined|, and calls |toString| instead of (implicitly) |valueOf|.
*/
export function axCoerceName(x): string {
if (typeof x === 'string') {
return x;
} else if (x == undefined) {
return 'null';
}
return x.toString();
}