File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
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,7 +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 : WeakMap < object , Record < string , object > > ;
26
+ public _intls : IntlCache ;
27
27
28
28
/**
29
29
* Create an instance of `FluentBundle`.
Original file line number Diff line number Diff line change 1
- type IntlCache = WeakMap < object , Record < string , object > > ;
1
+ export type IntlCache = Map < object , Record < string , object > > ;
2
2
3
3
const cache = new Map < string , IntlCache > ( ) ;
4
4
5
5
export function getMemoizerForLocale ( locales : string | string [ ] ) : IntlCache {
6
6
const stringLocale = Array . isArray ( locales ) ? locales . join ( " " ) : locales ;
7
7
let memoizer = cache . get ( stringLocale ) ;
8
8
if ( memoizer === undefined ) {
9
- memoizer = new WeakMap ( ) ;
9
+ memoizer = new Map ( ) ;
10
10
cache . set ( stringLocale , memoizer ) ;
11
11
}
12
12
You can’t perform that action at this time.
0 commit comments