@randajan/say 1.0.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/LICENSE +21 -0
- package/README.md +64 -0
- package/dist/cjs/index.cjs +107 -0
- package/dist/cjs/index.cjs.map +7 -0
- package/dist/esm/index.mjs +87 -0
- package/dist/esm/index.mjs.map +7 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-present Jan Randa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @randajan/say
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@randajan/say) [](https://standardjs.com)
|
|
4
|
+
|
|
5
|
+
A tiny, chainable phrase lookup helper for simple localization with fallbacks.
|
|
6
|
+
|
|
7
|
+
This project is a small toy for experimenting with callable objects and minimal translation tables.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @randajan/say
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Exports (CJS / ESM)
|
|
16
|
+
|
|
17
|
+
ESM:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import Say, { Say as SayClass } from "@randajan/say";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
CommonJS:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const Say = require("@randajan/say");
|
|
27
|
+
const { Say: SayClass } = require("@randajan/say");
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### `new Say(options)`
|
|
33
|
+
|
|
34
|
+
Creates a callable instance that can be invoked like a function: `say("phraseId", "en")`.
|
|
35
|
+
|
|
36
|
+
Options:
|
|
37
|
+
- `langs` (`string[]`): Ordered list of language codes.
|
|
38
|
+
- `translations` (`Record<string, string[]>`): Phrase table, where each entry aligns with `langs`.
|
|
39
|
+
- `defaultLang` (`string`): Default language to use when none is provided.
|
|
40
|
+
- `parent` (`Say | null`): Optional parent instance for fallback lookups.
|
|
41
|
+
|
|
42
|
+
### `say(phraseId, lang?)`
|
|
43
|
+
|
|
44
|
+
Returns the translation for `phraseId` in `lang` or the default language. Falls back to `parent` if not found.
|
|
45
|
+
|
|
46
|
+
### `bindLang(lang)`
|
|
47
|
+
|
|
48
|
+
Returns a new instance with `defaultLang` set to `lang`, keeping the same language list and parent chain.
|
|
49
|
+
|
|
50
|
+
### `extend({ defaultLang, langs, translations } = {})`
|
|
51
|
+
|
|
52
|
+
Creates a new instance that can override `defaultLang`, `langs`, or `translations` and chains the current instance as `parent`.
|
|
53
|
+
|
|
54
|
+
### `has(phraseId, lang?)`
|
|
55
|
+
|
|
56
|
+
Returns `true` if the phrase exists (including via fallback), otherwise `false`.
|
|
57
|
+
|
|
58
|
+
### `sayOr(phraseId, fallback, lang?)`
|
|
59
|
+
|
|
60
|
+
Returns the phrase if found; otherwise returns `fallback`.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.js
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
Say: () => Say,
|
|
23
|
+
default: () => index_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
var import_props = require("@randajan/props");
|
|
27
|
+
var makeLangIndex = (langs = []) => {
|
|
28
|
+
const idx = {};
|
|
29
|
+
for (let i = 0; i < langs.length; i++) idx[langs[i]] = i;
|
|
30
|
+
return idx;
|
|
31
|
+
};
|
|
32
|
+
var Say = class _Say extends Function {
|
|
33
|
+
/**
|
|
34
|
+
* @param {object} opts
|
|
35
|
+
* @param {string[]} opts.langs
|
|
36
|
+
* @param {Record<string, string[]>} opts.translations
|
|
37
|
+
* @param {string[]} opts.defaultLang
|
|
38
|
+
* @param {Say|null} opts.parent
|
|
39
|
+
*/
|
|
40
|
+
constructor({ defaultLang = null, langs = [], translations = {}, parent = null } = {}) {
|
|
41
|
+
super();
|
|
42
|
+
langs = langs ?? [];
|
|
43
|
+
translations = translations ?? {};
|
|
44
|
+
defaultLang = defaultLang ?? langs[0];
|
|
45
|
+
const _say = (...a) => _say.say(...a);
|
|
46
|
+
(0, import_props.solids)(_say, {
|
|
47
|
+
defaultLang,
|
|
48
|
+
langs,
|
|
49
|
+
langIndex: makeLangIndex(langs),
|
|
50
|
+
translations,
|
|
51
|
+
parent
|
|
52
|
+
});
|
|
53
|
+
console.log("h", _say.langIndex);
|
|
54
|
+
return Object.setPrototypeOf(_say, new.target.prototype);
|
|
55
|
+
}
|
|
56
|
+
_lookupHere(phraseId, lang) {
|
|
57
|
+
const i = this.langIndex[lang];
|
|
58
|
+
if (i == null) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const arr = this.translations?.[phraseId];
|
|
62
|
+
if (!Array.isArray(arr)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
return arr[i];
|
|
66
|
+
}
|
|
67
|
+
say(phraseId, lang) {
|
|
68
|
+
const effectiveLang = lang ?? this.defaultLang;
|
|
69
|
+
const here = this._lookupHere(phraseId, effectiveLang);
|
|
70
|
+
if (here != null) {
|
|
71
|
+
return here;
|
|
72
|
+
}
|
|
73
|
+
if (this.parent) {
|
|
74
|
+
return this.parent.say(phraseId, effectiveLang);
|
|
75
|
+
}
|
|
76
|
+
throw new Error(`Phrase '${phraseId}' not found (lang '${effectiveLang}').`);
|
|
77
|
+
}
|
|
78
|
+
bindLang(lang) {
|
|
79
|
+
return this.extend({ defaultLang: lang });
|
|
80
|
+
}
|
|
81
|
+
extend({ defaultLang, langs, translations } = {}) {
|
|
82
|
+
if (!langs) {
|
|
83
|
+
langs = this.langs;
|
|
84
|
+
} else if (!defaultLang) {
|
|
85
|
+
defaultLang = this.defaultLang;
|
|
86
|
+
}
|
|
87
|
+
console.log({ defaultLang, langs, translations }, { ...this });
|
|
88
|
+
return new _Say({ defaultLang, langs, translations, parent: this });
|
|
89
|
+
}
|
|
90
|
+
has(phraseId, lang) {
|
|
91
|
+
try {
|
|
92
|
+
this.say(phraseId, lang);
|
|
93
|
+
return true;
|
|
94
|
+
} catch {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
sayOr(phraseId, fallback, lang) {
|
|
99
|
+
try {
|
|
100
|
+
return this.say(phraseId, lang);
|
|
101
|
+
} catch {
|
|
102
|
+
return fallback;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var index_default = Say;
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.js"],
|
|
4
|
+
"sourcesContent": ["import { solids } from \"@randajan/props\";\n\nconst makeLangIndex = (langs = []) => {\n const idx = {};\n for (let i = 0; i < langs.length; i++) idx[langs[i]] = i;\n return idx;\n};\n\nexport class Say extends Function {\n /**\n * @param {object} opts\n * @param {string[]} opts.langs\n * @param {Record<string, string[]>} opts.translations\n * @param {string[]} opts.defaultLang\n * @param {Say|null} opts.parent\n */\n constructor({ defaultLang = null, langs = [], translations = {}, parent = null } = {}) {\n super();\n\n langs = langs ?? [];\n translations = translations ?? {};\n defaultLang = defaultLang ?? langs[0];\n\n // Important: keep prototype = Say so instance methods work\n const _say = (...a) => _say.say(...a);\n\n solids(_say, {\n defaultLang,\n langs,\n langIndex: makeLangIndex(langs),\n translations,\n parent\n });\n\n console.log(\"h\", _say.langIndex);\n\n return Object.setPrototypeOf(_say, new.target.prototype);\n }\n\n _lookupHere(phraseId, lang) {\n const i = this.langIndex[lang];\n if (i == null) { return; }\n const arr = this.translations?.[phraseId];\n if (!Array.isArray(arr)) { return; }\n return arr[i];\n }\n\n say(phraseId, lang) {\n const effectiveLang = lang ?? this.defaultLang;\n const here = this._lookupHere(phraseId, effectiveLang);\n\n if (here != null) { return here; }\n if (this.parent) { return this.parent.say(phraseId, effectiveLang); }\n\n throw new Error(`Phrase '${phraseId}' not found (lang '${effectiveLang}').`);\n }\n\n bindLang(lang) {\n return this.extend({defaultLang:lang});\n }\n\n extend({ defaultLang, langs, translations} = {}) {\n if (!langs) { langs = this.langs; }\n else if (!defaultLang) { defaultLang = this.defaultLang; }\n\n console.log({ defaultLang, langs, translations }, {...this});\n return new Say({defaultLang, langs, translations, parent:this});\n }\n\n has(phraseId, lang) {\n try {\n this.say(phraseId, lang);\n return true;\n } catch {\n return false;\n }\n }\n\n sayOr(phraseId, fallback, lang) {\n try {\n return this.say(phraseId, lang);\n } catch {\n return fallback;\n }\n }\n}\n\nexport default Say;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuB;AAEvB,IAAM,gBAAgB,CAAC,QAAQ,CAAC,MAAM;AAClC,QAAM,MAAM,CAAC;AACb,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,IAAK,KAAI,MAAM,CAAC,CAAC,IAAI;AACvD,SAAO;AACX;AAEO,IAAM,MAAN,MAAM,aAAY,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9B,YAAY,EAAE,cAAc,MAAM,QAAQ,CAAC,GAAG,eAAe,CAAC,GAAG,SAAS,KAAK,IAAI,CAAC,GAAG;AACnF,UAAM;AAEN,YAAQ,SAAS,CAAC;AAClB,mBAAe,gBAAgB,CAAC;AAChC,kBAAc,eAAe,MAAM,CAAC;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AI,UAAU,MAAM;AAChB,QAAI;AACA,WAAK,IAAI,UAAU,IAAI;AACvB,aAAO;AAAA,IACX,QAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AAAA,EAEA,MAAM,UAAU,UAAU,MAAM;AAC5B,QAAI;AACA,aAAO,KAAK,IAAI,UAAU,IAAI;AAAA,IAClC,QAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AACJ;AAEA,IAAO,gBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// src/index.js
|
|
2
|
+
import { solids } from "@randajan/props";
|
|
3
|
+
var makeLangIndex = (langs = []) => {
|
|
4
|
+
const idx = {};
|
|
5
|
+
for (let i = 0; i < langs.length; i++) idx[langs[i]] = i;
|
|
6
|
+
return idx;
|
|
7
|
+
};
|
|
8
|
+
var Say = class _Say extends Function {
|
|
9
|
+
/**
|
|
10
|
+
* @param {object} opts
|
|
11
|
+
* @param {string[]} opts.langs
|
|
12
|
+
* @param {Record<string, string[]>} opts.translations
|
|
13
|
+
* @param {string[]} opts.defaultLang
|
|
14
|
+
* @param {Say|null} opts.parent
|
|
15
|
+
*/
|
|
16
|
+
constructor({ defaultLang = null, langs = [], translations = {}, parent = null } = {}) {
|
|
17
|
+
super();
|
|
18
|
+
langs = langs ?? [];
|
|
19
|
+
translations = translations ?? {};
|
|
20
|
+
defaultLang = defaultLang ?? langs[0];
|
|
21
|
+
const _say = (...a) => _say.say(...a);
|
|
22
|
+
solids(_say, {
|
|
23
|
+
defaultLang,
|
|
24
|
+
langs,
|
|
25
|
+
langIndex: makeLangIndex(langs),
|
|
26
|
+
translations,
|
|
27
|
+
parent
|
|
28
|
+
});
|
|
29
|
+
console.log("h", _say.langIndex);
|
|
30
|
+
return Object.setPrototypeOf(_say, new.target.prototype);
|
|
31
|
+
}
|
|
32
|
+
_lookupHere(phraseId, lang) {
|
|
33
|
+
const i = this.langIndex[lang];
|
|
34
|
+
if (i == null) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const arr = this.translations?.[phraseId];
|
|
38
|
+
if (!Array.isArray(arr)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
return arr[i];
|
|
42
|
+
}
|
|
43
|
+
say(phraseId, lang) {
|
|
44
|
+
const effectiveLang = lang ?? this.defaultLang;
|
|
45
|
+
const here = this._lookupHere(phraseId, effectiveLang);
|
|
46
|
+
if (here != null) {
|
|
47
|
+
return here;
|
|
48
|
+
}
|
|
49
|
+
if (this.parent) {
|
|
50
|
+
return this.parent.say(phraseId, effectiveLang);
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`Phrase '${phraseId}' not found (lang '${effectiveLang}').`);
|
|
53
|
+
}
|
|
54
|
+
bindLang(lang) {
|
|
55
|
+
return this.extend({ defaultLang: lang });
|
|
56
|
+
}
|
|
57
|
+
extend({ defaultLang, langs, translations } = {}) {
|
|
58
|
+
if (!langs) {
|
|
59
|
+
langs = this.langs;
|
|
60
|
+
} else if (!defaultLang) {
|
|
61
|
+
defaultLang = this.defaultLang;
|
|
62
|
+
}
|
|
63
|
+
console.log({ defaultLang, langs, translations }, { ...this });
|
|
64
|
+
return new _Say({ defaultLang, langs, translations, parent: this });
|
|
65
|
+
}
|
|
66
|
+
has(phraseId, lang) {
|
|
67
|
+
try {
|
|
68
|
+
this.say(phraseId, lang);
|
|
69
|
+
return true;
|
|
70
|
+
} catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
sayOr(phraseId, fallback, lang) {
|
|
75
|
+
try {
|
|
76
|
+
return this.say(phraseId, lang);
|
|
77
|
+
} catch {
|
|
78
|
+
return fallback;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var index_default = Say;
|
|
83
|
+
export {
|
|
84
|
+
Say,
|
|
85
|
+
index_default as default
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.js"],
|
|
4
|
+
"sourcesContent": ["import { solids } from \"@randajan/props\";\n\nconst makeLangIndex = (langs = []) => {\n const idx = {};\n for (let i = 0; i < langs.length; i++) idx[langs[i]] = i;\n return idx;\n};\n\nexport class Say extends Function {\n /**\n * @param {object} opts\n * @param {string[]} opts.langs\n * @param {Record<string, string[]>} opts.translations\n * @param {string[]} opts.defaultLang\n * @param {Say|null} opts.parent\n */\n constructor({ defaultLang = null, langs = [], translations = {}, parent = null } = {}) {\n super();\n\n langs = langs ?? [];\n translations = translations ?? {};\n defaultLang = defaultLang ?? langs[0];\n\n // Important: keep prototype = Say so instance methods work\n const _say = (...a) => _say.say(...a);\n\n solids(_say, {\n defaultLang,\n langs,\n langIndex: makeLangIndex(langs),\n translations,\n parent\n });\n\n console.log(\"h\", _say.langIndex);\n\n return Object.setPrototypeOf(_say, new.target.prototype);\n }\n\n _lookupHere(phraseId, lang) {\n const i = this.langIndex[lang];\n if (i == null) { return; }\n const arr = this.translations?.[phraseId];\n if (!Array.isArray(arr)) { return; }\n return arr[i];\n }\n\n say(phraseId, lang) {\n const effectiveLang = lang ?? this.defaultLang;\n const here = this._lookupHere(phraseId, effectiveLang);\n\n if (here != null) { return here; }\n if (this.parent) { return this.parent.say(phraseId, effectiveLang); }\n\n throw new Error(`Phrase '${phraseId}' not found (lang '${effectiveLang}').`);\n }\n\n bindLang(lang) {\n return this.extend({defaultLang:lang});\n }\n\n extend({ defaultLang, langs, translations} = {}) {\n if (!langs) { langs = this.langs; }\n else if (!defaultLang) { defaultLang = this.defaultLang; }\n\n console.log({ defaultLang, langs, translations }, {...this});\n return new Say({defaultLang, langs, translations, parent:this});\n }\n\n has(phraseId, lang) {\n try {\n this.say(phraseId, lang);\n return true;\n } catch {\n return false;\n }\n }\n\n sayOr(phraseId, fallback, lang) {\n try {\n return this.say(phraseId, lang);\n } catch {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,IAAI,UAAU,aAAa;AAAA,IAAG;AAEpE,UAAM,IAAI,MAAM,WAAW,QAAQ,sBAAsB,aAAa,KAAK;AAAA,EAC/E;AAAA,EAEA,SAAS,MAAM;AACX,WAAO,KAAK,OAAO,EAAC,aAAY,KAAI,CAAC;AAAA,EACzC;AAAA,EAEA,OAAO,EAAE,aAAa,OAAO,aAAY,IAAI,CAAC,GAAG;AAC7C,QAAI,CAAC,OAAO;AAAE,cAAQ,KAAK;AAAA,IAAO,WACzB,CAAC,aAAa;AAAE,oBAAc,KAAK;AAAA,IAAa;AAEzD,YAAQ,IAAI,EAAE,aAAa,OAAO,aAAa,GAAG,EAAC,GAAG,KAAI,CAAC;AAC3D,WAAO,IAAI,KAAI,EAAC,aAAa,OAAO,cAAc,QAAO,KAAI,CAAC;AAAA,EAClE;AAAA,EAEA,IAAI,UAAU,MAAM;AAChB,QAAI;AACA,WAAK,IAAI,UAAU,IAAI;AACvB,aAAO;AAAA,IACX,QAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AAAA,EAEA,MAAM,UAAU,UAAU,MAAM;AAC5B,QAAI;AACA,aAAO,KAAK,IAAI,UAAU,IAAI;AAAA,IAClC,QAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AACJ;AAEA,IAAO,gBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@randajan/say",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Tiny, chainable phrase lookup helper for simple localization with fallbacks.",
|
|
5
|
+
"repository": "randajan/say",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/cjs/index.cjs",
|
|
8
|
+
"module": "dist/esm/index.mjs",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/esm/index.mjs",
|
|
12
|
+
"require": "./dist/cjs/index.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@randajan/simple-lib": "^3.3.0"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"i18n",
|
|
26
|
+
"localization",
|
|
27
|
+
"translation",
|
|
28
|
+
"phrases",
|
|
29
|
+
"language",
|
|
30
|
+
"lookup",
|
|
31
|
+
"fallback",
|
|
32
|
+
"chainable",
|
|
33
|
+
"minimal",
|
|
34
|
+
"tiny"
|
|
35
|
+
],
|
|
36
|
+
"homepage": "https://github.com/randajan/say",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/randajan/say/issues"
|
|
39
|
+
},
|
|
40
|
+
"author": {
|
|
41
|
+
"name": "Jan Randa",
|
|
42
|
+
"email": "jnranda@gmail.com",
|
|
43
|
+
"url": "https://www.linkedin.com/in/randajan/"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@randajan/props": "^0.1.4"
|
|
47
|
+
}
|
|
48
|
+
}
|