File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { FluentResource } from "./resource.js";
4
4
import { FluentValue , FluentNone , FluentFunction } from "./types.js" ;
5
5
import { Message , Term , Pattern } from "./ast.js" ;
6
6
import { NUMBER , DATETIME } from "./builtins.js" ;
7
- import { getMemoizerForLocale } from "./memoizer.js" ;
7
+ import { getMemoizerForLocale , IntlCache } from "./memoizer.js" ;
8
8
9
9
export type TextTransform = ( text : string ) => string ;
10
10
@@ -23,12 +23,7 @@ export class FluentBundle {
23
23
public _functions : Record < string , FluentFunction > ;
24
24
public _useIsolating : boolean ;
25
25
public _transform : TextTransform ;
26
- public _intls = new WeakMap <
27
- | typeof Intl . NumberFormat
28
- | typeof Intl . DateTimeFormat
29
- | typeof Intl . PluralRules ,
30
- Record < string , Intl . NumberFormat | Intl . DateTimeFormat | Intl . PluralRules >
31
- > ( ) ;
26
+ public _intls : IntlCache ;
32
27
33
28
/**
34
29
* Create an instance of `FluentBundle`.
Original file line number Diff line number Diff line change 1
- type IntlCache = WeakMap <
1
+ export type IntlCache = Map <
2
2
| typeof Intl . NumberFormat
3
3
| typeof Intl . DateTimeFormat
4
4
| typeof Intl . PluralRules ,
@@ -11,7 +11,7 @@ export function getMemoizerForLocale(locales: string | string[]): IntlCache {
11
11
const stringLocale = Array . isArray ( locales ) ? locales . join ( " " ) : locales ;
12
12
let memoizer = cache . get ( stringLocale ) ;
13
13
if ( memoizer === undefined ) {
14
- memoizer = new WeakMap ( ) ;
14
+ memoizer = new Map ( ) ;
15
15
cache . set ( stringLocale , memoizer ) ;
16
16
}
17
17
You can’t perform that action at this time.
0 commit comments