From 04fa337fafcdb05940e96316abd9f7cb663b2bdf Mon Sep 17 00:00:00 2001 From: Ben Russell Date: Wed, 19 Jan 2022 15:56:44 -0600 Subject: [PATCH] Fixing bug that only allowed <= 9 formatting arguments --- src/common/common.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/common/common.ts b/src/common/common.ts index 111df72..3cb0eba 100644 --- a/src/common/common.ts +++ b/src/common/common.ts @@ -107,8 +107,7 @@ export function format(message: string, args: any[]): string { result = message; } else { - result = message.replace(/\{(\d+)\}/g, (match, rest) => { - let index = rest[0]; + result = message.replace(/{(\d+)}/g, (match, index) => { let arg = args[index]; let replacement = match; if (typeof arg === 'string') { @@ -133,4 +132,4 @@ export function loadMessageBundle(file?: string): LocalizeFunc { export function config(opts?: Options): LoadFunc { return RAL().config(opts); -} \ No newline at end of file +}