From 8140cda623114b079a058d423b9f1259c3e36234 Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Sat, 19 Aug 2023 03:10:11 +0800 Subject: [PATCH] Fix negative Make word positive when making negative a negative number. --- packages/core/src/systems/en-US/short-count/stringify.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core/src/systems/en-US/short-count/stringify.ts b/packages/core/src/systems/en-US/short-count/stringify.ts index 2514838..25ff09d 100644 --- a/packages/core/src/systems/en-US/short-count/stringify.ts +++ b/packages/core/src/systems/en-US/short-count/stringify.ts @@ -324,6 +324,7 @@ export const mergeTokens = (tokens: string[], options?: MergeTokensOptions) => ( * Makes a negative string. * @param s - The string to make negative. */ -export const makeNegative = (s: string) => ( - `${NEGATIVE} ${s}` -); +export const makeNegative = (s: string) => { + const negativePrefix = `${NEGATIVE} `; + return s.startsWith(negativePrefix) ? s.slice(negativePrefix.length) : `${negativePrefix}${s}`; +};