MisskeyPagesで値が0の変数が表示されない問題を修正

This commit is contained in:
syuilo
2019-04-29 11:08:35 +09:00
parent e86d0007c6
commit c886c09cdb
2 changed files with 9 additions and 4 deletions

View File

@ -316,8 +316,10 @@ export class AiScript {
@autobind
private interpolate(str: string, values: { name: string, value: any }[]) {
return str.replace(/\{(.+?)\}/g, match =>
(this.getVariableValue(match.slice(1, -1).trim(), values) || '').toString());
return str.replace(/\{(.+?)\}/g, match => {
const v = this.getVariableValue(match.slice(1, -1).trim(), values);
return v == null ? 'NULL' : v.toString();
});
}
@autobind