@u27n/js 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.d.ts +3 -3
- package/dist/core.js +2 -2
- package/package.json +1 -1
- package/src/core.ts +4 -4
package/dist/core.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ export interface LocaleImports {
|
|
|
3
3
|
default: unknown[];
|
|
4
4
|
}>;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface U27nOptions {
|
|
7
7
|
source: string;
|
|
8
8
|
locales: LocaleImports;
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
10
|
+
export declare class U27n {
|
|
11
11
|
#private;
|
|
12
|
-
constructor(options:
|
|
12
|
+
constructor(options: U27nOptions | U27n);
|
|
13
13
|
load(locale: string): Promise<void>;
|
|
14
14
|
get locale(): string;
|
|
15
15
|
set locale(value: string);
|
package/dist/core.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class U27n {
|
|
2
2
|
#kernel;
|
|
3
3
|
#locale;
|
|
4
4
|
#data;
|
|
5
5
|
constructor(options) {
|
|
6
|
-
this.#kernel = options instanceof
|
|
6
|
+
this.#kernel = options instanceof U27n ? options.#kernel : {
|
|
7
7
|
s: options.source,
|
|
8
8
|
i: options.locales,
|
|
9
9
|
p: new Map(),
|
package/package.json
CHANGED
package/src/core.ts
CHANGED
|
@@ -14,18 +14,18 @@ interface Kernel {
|
|
|
14
14
|
d: Map<string, unknown[]>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export interface
|
|
17
|
+
export interface U27nOptions {
|
|
18
18
|
source: string;
|
|
19
19
|
locales: LocaleImports;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export class
|
|
22
|
+
export class U27n {
|
|
23
23
|
#kernel: Kernel;
|
|
24
24
|
#locale: string | undefined;
|
|
25
25
|
#data: unknown[] | undefined;
|
|
26
26
|
|
|
27
|
-
constructor(options:
|
|
28
|
-
this.#kernel = options instanceof
|
|
27
|
+
constructor(options: U27nOptions | U27n) {
|
|
28
|
+
this.#kernel = options instanceof U27n ? options.#kernel : {
|
|
29
29
|
s: options.source,
|
|
30
30
|
i: options.locales,
|
|
31
31
|
p: new Map(),
|