@@ -8,7 +8,14 @@ import {
88 NOT_REOSLVED ,
99 MISSING_RESOLVE_VALUE
1010} from './context'
11- import { warn , isString , isBoolean , isPlainObject , isNumber } from '../utils'
11+ import {
12+ warn ,
13+ isString ,
14+ isBoolean ,
15+ isPlainObject ,
16+ isNumber ,
17+ isEmptyObject
18+ } from '../utils'
1219
1320/**
1421 * # number
@@ -44,9 +51,9 @@ import { warn, isString, isBoolean, isPlainObject, isNumber } from '../utils'
4451 * number(context, value, { key: 'currenty', part: true })
4552 *
4653 * // orverride context.numberFormats[locale] options with functino options
47- * number(cnotext, value, 'currency', { currency : 'EUR ' })
48- * number(cnotext, value, 'currency', 'ja-JP', { currency : 'EUR ' })
49- * number(context, value, { key: 'currenty', part: true }, { currency : 'EUR '})
54+ * number(cnotext, value, 'currency', { year : '2-digit ' })
55+ * number(cnotext, value, 'currency', 'ja-JP', { year : '2-digit ' })
56+ * number(context, value, { key: 'currenty', part: true }, { year : '2-digit '})
5057 */
5158
5259export type NumberOptions = {
@@ -142,7 +149,11 @@ export function number(
142149 return unresolving ? NOT_REOSLVED : key
143150 }
144151
145- const id = `${ targetLocale } __${ key } __${ JSON . stringify ( orverrides ) } `
152+ let id = `${ targetLocale } __${ key } `
153+ if ( ! isEmptyObject ( orverrides ) ) {
154+ id = `${ id } __${ JSON . stringify ( orverrides ) } `
155+ }
156+
146157 let formatter = _numberFormatters . get ( id )
147158 if ( ! formatter ) {
148159 formatter = new Intl . NumberFormat (
0 commit comments