@leyyo/localization 1.1.2 → 1.1.3

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.
Files changed (57) hide show
  1. package/dist/base/base-localization.handler.js +7 -7
  2. package/dist/base/index.d.ts +2 -2
  3. package/dist/base/index.js +2 -2
  4. package/dist/config/index.d.ts +2 -2
  5. package/dist/config/index.js +2 -2
  6. package/dist/config/index.types.d.ts +1 -1
  7. package/dist/config/localization.config.js +28 -10
  8. package/dist/country/country.handler.js +1 -1
  9. package/dist/country/country.map.js +251 -251
  10. package/dist/country/index.d.ts +2 -2
  11. package/dist/country/index.js +2 -2
  12. package/dist/exchange/exchange.handler.js +1 -1
  13. package/dist/exchange/exchange.map.js +35 -4
  14. package/dist/exchange/index.d.ts +2 -2
  15. package/dist/exchange/index.js +2 -2
  16. package/dist/index.d.ts +11 -11
  17. package/dist/index.foretell.js +9 -9
  18. package/dist/index.js +11 -11
  19. package/dist/index.loader.js +3 -3
  20. package/dist/internal.d.ts +1 -1
  21. package/dist/internal.js +3 -2
  22. package/dist/language/index.d.ts +2 -2
  23. package/dist/language/index.js +2 -2
  24. package/dist/language/language.handler.js +4 -4
  25. package/dist/language/language.map.js +184 -184
  26. package/dist/literal/browser-type.d.ts +1 -1
  27. package/dist/literal/browser-type.js +1 -9
  28. package/dist/literal/country-code.d.ts +1 -1
  29. package/dist/literal/country-code.js +253 -11
  30. package/dist/literal/cpu-architecture.d.ts +1 -1
  31. package/dist/literal/cpu-architecture.js +17 -17
  32. package/dist/literal/device-type.d.ts +1 -1
  33. package/dist/literal/device-type.js +8 -8
  34. package/dist/literal/engine-type.d.ts +1 -1
  35. package/dist/literal/engine-type.js +20 -20
  36. package/dist/literal/exchange-code.d.ts +1 -1
  37. package/dist/literal/exchange-code.js +151 -13
  38. package/dist/literal/index.d.ts +9 -9
  39. package/dist/literal/index.js +9 -9
  40. package/dist/literal/language-code.d.ts +1 -1
  41. package/dist/literal/language-code.js +184 -26
  42. package/dist/literal/locale-code.d.ts +1 -1
  43. package/dist/literal/locale-code.js +196 -18
  44. package/dist/literal/timezone-code.d.ts +1 -1
  45. package/dist/literal/timezone-code.js +602 -102
  46. package/dist/locale/index.d.ts +2 -2
  47. package/dist/locale/index.js +2 -2
  48. package/dist/locale/locale.handler.js +5 -5
  49. package/dist/locale/locale.map.js +83 -83
  50. package/dist/parser/index.d.ts +2 -2
  51. package/dist/parser/index.js +2 -2
  52. package/dist/parser/localization.parser.js +33 -31
  53. package/dist/timezone/index.d.ts +2 -2
  54. package/dist/timezone/index.js +2 -2
  55. package/dist/timezone/timezone.handler.js +8 -1
  56. package/dist/timezone/timezone.map.js +602 -602
  57. package/package.json +21 -21
@@ -8,34 +8,34 @@ export class BaseLocalizationHandler {
8
8
  codes;
9
9
  /** @inheritDoc */
10
10
  has(code) {
11
- if (typeof code !== 'string') {
11
+ if (typeof code !== "string") {
12
12
  return false;
13
13
  }
14
14
  return this._raw[code] !== undefined;
15
15
  }
16
16
  /** @inheritDoc */
17
17
  getRaw(code) {
18
- if (typeof code !== 'string') {
18
+ if (typeof code !== "string") {
19
19
  return undefined;
20
20
  }
21
21
  return this._raw[code];
22
22
  }
23
23
  /** @inheritDoc */
24
24
  getName(code) {
25
- if (typeof code !== 'string') {
25
+ if (typeof code !== "string") {
26
26
  return undefined;
27
27
  }
28
28
  return this.getRaw(code)?.n ?? code;
29
29
  }
30
30
  /** @inheritDoc */
31
31
  getAll() {
32
- return this.codes.map(code => this.get(code));
32
+ return this.codes.map((code) => this.get(code));
33
33
  }
34
34
  /** @inheritDoc */
35
35
  getSelected(...codes) {
36
36
  return codes
37
- .filter(code => typeof code === 'string')
38
- .filter(code => this.codes.includes(code))
39
- .map(code => this.get(code));
37
+ .filter((code) => typeof code === "string")
38
+ .filter((code) => this.codes.includes(code))
39
+ .map((code) => this.get(code));
40
40
  }
41
41
  }
@@ -1,2 +1,2 @@
1
- export * from './index.types.js';
2
- export * from './base-localization.handler.js';
1
+ export * from "./index.types.js";
2
+ export * from "./base-localization.handler.js";
@@ -1,2 +1,2 @@
1
- export * from './index.types.js';
2
- export * from './base-localization.handler.js';
1
+ export * from "./index.types.js";
2
+ export * from "./base-localization.handler.js";
@@ -1,2 +1,2 @@
1
- export * from './index.types.js';
2
- export * from './localization.config.js';
1
+ export * from "./index.types.js";
2
+ export * from "./localization.config.js";
@@ -1,2 +1,2 @@
1
- export * from './index.types.js';
2
- export * from './localization.config.js';
1
+ export * from "./index.types.js";
2
+ export * from "./localization.config.js";
@@ -17,4 +17,4 @@ export interface LocalizationConfigLike {
17
17
  export type ReplacerLike<T extends string, V> = {
18
18
  [K in T]?: V;
19
19
  };
20
- export type LocalizationConfigOmit = Omit<LocalizationConfigLike, 'builder'>;
20
+ export type LocalizationConfigOmit = Omit<LocalizationConfigLike, "builder">;
@@ -1,19 +1,37 @@
1
1
  import { Builder } from "@leyyo/builder";
2
2
  class LocalizationConfig {
3
- authorizationKeys = ['authorization', 'api-key'];
4
- applicationKeys = ['application', 'x-application'];
5
- correlationKeys = ['x-correlation', 'x-correlation-id'];
6
- refererKeys = ['x-fwd-referer', 'x-fwd-referrer', 'x-referer', 'x-referrer', 'referer', 'referrer'];
7
- userAgentKeys = ['x-fwd-user-agent', 'x-user-agent', 'user-agent'];
8
- acceptLanguageKeys = ['x-fwd-accept-language', 'x-accept-language', 'accept-language'];
9
- ipAddressKeys = ['x-real-ip', 'x-client-ip', 'fastly-client-ip', 'true-client-ip', 'cf-connecting-ip', 'x-cluster-client-ip', 'x-forwarded-for'];
10
- applicationDelimiter = ':';
3
+ authorizationKeys = ["authorization", "api-key"];
4
+ applicationKeys = ["application", "x-application"];
5
+ correlationKeys = ["x-correlation", "x-correlation-id"];
6
+ refererKeys = [
7
+ "x-fwd-referer",
8
+ "x-fwd-referrer",
9
+ "x-referer",
10
+ "x-referrer",
11
+ "referer",
12
+ "referrer",
13
+ ];
14
+ userAgentKeys = ["x-fwd-user-agent", "x-user-agent", "user-agent"];
15
+ acceptLanguageKeys = [
16
+ "x-fwd-accept-language",
17
+ "x-accept-language",
18
+ "accept-language",
19
+ ];
20
+ ipAddressKeys = [
21
+ "x-real-ip",
22
+ "x-client-ip",
23
+ "fastly-client-ip",
24
+ "true-client-ip",
25
+ "cf-connecting-ip",
26
+ "x-cluster-client-ip",
27
+ "x-forwarded-for",
28
+ ];
29
+ applicationDelimiter = ":";
11
30
  countryReplacer = {};
12
31
  languageReplacer = {};
13
32
  localeReplacer = {};
14
33
  builder() {
15
- return Builder.build(this)
16
- .$setItem((key, value) => {
34
+ return Builder.build(this).$setItem((key, value) => {
17
35
  this[key] = value;
18
36
  });
19
37
  }
@@ -17,7 +17,7 @@ class CountryHandler extends BaseLocalizationHandler {
17
17
  }
18
18
  /** @inheritDoc */
19
19
  findByLanguage(languageCode) {
20
- if (typeof languageCode !== 'string') {
20
+ if (typeof languageCode !== "string") {
21
21
  return [];
22
22
  }
23
23
  const result = [];