浏览代码

Removes ?? from interpolation to support web

main
Eric Amodio 4 年前
父节点
当前提交
a64a53e29f
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      src/system/string.ts

+ 2
- 2
src/system/string.ts 查看文件

@ -114,7 +114,7 @@ export function getTokensFromTemplate(template: string) {
}
// eslint-disable-next-line no-template-curly-in-string
const tokenSanitizeReplacement = "$${this.$1 ?? ''}";
const tokenSanitizeReplacement = "$${$1=this.$1,($1 == null ? '' : $1)}";
const interpolationMap = new Map<string, Function>();
export function interpolate(template: string, context: object | undefined): string {
@ -138,7 +138,7 @@ const AsyncFunction = Object.getPrototypeOf(async function () {
const tokenSanitizeReplacementAsync =
// eslint-disable-next-line no-template-curly-in-string
"$${$1=this.$1,($1 != null && typeof $1.then === 'function' ? await $1 : $1) ?? ''}";
"$${$1=this.$1,($1 == null ? '' : typeof $1.then === 'function' ? (($1 = await $1),$1 == null ? '' : $1) : $1)}";
const interpolationAsyncMap = new Map<string, typeof AsyncFunction>();

正在加载...
取消
保存