@mostfeatured/dbi 0.1.22 → 0.1.23

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/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "tslib": "^2.6.3"
13
13
  },
14
14
  "name": "@mostfeatured/dbi",
15
- "version": "0.1.22",
15
+ "version": "0.1.23",
16
16
  "main": "dist/index.js",
17
17
  "type": "commonjs",
18
18
  "private": false,
@@ -40,15 +40,19 @@ export class DBILocale<TNamespace extends NamespaceEnums> {
40
40
  return _.get(this._data as any, path) as string || null;
41
41
  }
42
42
  format(path: string, ...args: any[]): string {
43
- const value = this.get(path);
43
+ let value = this.get(path);
44
44
  if (!value) {
45
45
  const defaultLocale = this.dbi.locale(this.dbi.config.defaults.locale.name);
46
46
  if (!defaultLocale) return this.dbi.config.defaults.locale.invalidPath({
47
47
  locale: this,
48
48
  path,
49
49
  });
50
- return defaultLocale.format(path, ...args);
50
+ value = defaultLocale.get(path);
51
51
  }
52
+ if (!value) return this.dbi.config.defaults.locale.invalidPath({
53
+ locale: this,
54
+ path,
55
+ });
52
56
  return stuffs.mapReplace(value, args.map((t, i) => [new RegExp(`\\{${i}(;[^}]+)?\\}`, "g"), t]));
53
57
  }
54
58
  }