usemods-nuxt 1.2.0 → 1.3.0
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/README.md +4 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +12 -5
- package/dist/runtime/utils/formatters.mjs +1 -1
- package/dist/runtime/utils/modifiers.mjs +1 -1
- package/package.json +3 -2
- package/dist/runtime/plugin.d.ts +0 -2
- package/dist/runtime/plugin.mjs +0 -4
- package/dist/runtime/utils/README.txt +0 -2
- package/dist/runtime/utils/config.d.ts +0 -9
- package/dist/runtime/utils/config.mjs +0 -303
package/README.md
CHANGED
|
@@ -21,6 +21,10 @@ Auto-imported functions and modifiers for zippy Nuxt developers.
|
|
|
21
21
|
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
|
|
22
22
|
[nuxt-href]: https://nuxt.com
|
|
23
23
|
|
|
24
|
+
[](https://github.com/LittleFoxCompany/usemods/actions/workflows/ci.yml)
|
|
25
|
+
|
|
26
|
+
[](https://github.com/LittleFoxCompany/usemods/actions/workflows/github-code-scanning/codeql)
|
|
27
|
+
|
|
24
28
|
## Quick Setup
|
|
25
29
|
```bash
|
|
26
30
|
npx nuxi module add usemods-nuxt
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineNuxtModule,
|
|
1
|
+
import { defineNuxtModule, addImports } from '@nuxt/kit';
|
|
2
|
+
import * as utils from 'usemods';
|
|
2
3
|
|
|
3
4
|
const module = defineNuxtModule({
|
|
4
5
|
meta: {
|
|
@@ -9,10 +10,16 @@ const module = defineNuxtModule({
|
|
|
9
10
|
defaults: {
|
|
10
11
|
alias: []
|
|
11
12
|
},
|
|
12
|
-
setup(options
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
setup(options) {
|
|
14
|
+
const aliasMap = new Map(options.alias);
|
|
15
|
+
for (const name of Object.keys(utils)) {
|
|
16
|
+
const alias = aliasMap.has(name) ? aliasMap.get(name) : name;
|
|
17
|
+
addImports({
|
|
18
|
+
name,
|
|
19
|
+
as: alias,
|
|
20
|
+
from: "usemods"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
});
|
|
18
25
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { currencySymbols, numberUnderTwenty, numberTens, numberScales, formatTitleExceptions } from "./config
|
|
1
|
+
import { currencySymbols, numberUnderTwenty, numberTens, numberScales, formatTitleExceptions } from "./config";
|
|
2
2
|
export function formatNumber(number, options) {
|
|
3
3
|
const decimalPlaces = (number.toString().split(".")[1] || "").length;
|
|
4
4
|
const safeDecimals = Math.min(options?.decimals ?? decimalPlaces, decimalPlaces);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usemods-nuxt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Zippy little modifiers and utilities for your Nuxt app.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nuxt/kit": "^3.11.2"
|
|
34
|
+
"@nuxt/kit": "^3.11.2",
|
|
35
|
+
"usemods": "^1.3.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@nuxt/devtools": "^1.2.0",
|
package/dist/runtime/plugin.d.ts
DELETED
package/dist/runtime/plugin.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const currencySymbols: Map<string, string>;
|
|
2
|
-
export declare const configLocales: Set<string>;
|
|
3
|
-
export declare const configUnits: Set<string>;
|
|
4
|
-
export declare const unchangingPlurals: Set<string>;
|
|
5
|
-
export declare const irregularPlurals: Map<string, string>;
|
|
6
|
-
export declare const numberUnderTwenty: string[];
|
|
7
|
-
export declare const numberTens: string[];
|
|
8
|
-
export declare const numberScales: string[];
|
|
9
|
-
export declare const formatTitleExceptions: Set<string>;
|
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
export const currencySymbols = /* @__PURE__ */ new Map([
|
|
2
|
-
["en-US", "USD"],
|
|
3
|
-
// US Dollar
|
|
4
|
-
["en-GB", "GBP"],
|
|
5
|
-
// British Pound
|
|
6
|
-
["en-AU", "AUD"],
|
|
7
|
-
// Australian Dollar
|
|
8
|
-
["en-CA", "CAD"],
|
|
9
|
-
// Canadian Dollar
|
|
10
|
-
["en-NZ", "NZD"],
|
|
11
|
-
// New Zealand Dollar
|
|
12
|
-
["en-ZA", "ZAR"],
|
|
13
|
-
// South African Rand
|
|
14
|
-
["de-DE", "EUR"],
|
|
15
|
-
// Euro (Germany)
|
|
16
|
-
["fr-FR", "EUR"],
|
|
17
|
-
// Euro (France)
|
|
18
|
-
["es-ES", "EUR"],
|
|
19
|
-
// Euro (Spain)
|
|
20
|
-
["it-IT", "EUR"],
|
|
21
|
-
// Euro (Italy)
|
|
22
|
-
["pt-PT", "EUR"],
|
|
23
|
-
// Euro (Portugal)
|
|
24
|
-
["nl-NL", "EUR"],
|
|
25
|
-
// Euro (Netherlands)
|
|
26
|
-
["fi-FI", "EUR"],
|
|
27
|
-
// Euro (Finland)
|
|
28
|
-
["da-DK", "DKK"],
|
|
29
|
-
// Danish Krone
|
|
30
|
-
["sv-SE", "SEK"],
|
|
31
|
-
// Swedish Krona
|
|
32
|
-
["nb-NO", "NOK"],
|
|
33
|
-
// Norwegian Krone
|
|
34
|
-
["pl-PL", "PLN"],
|
|
35
|
-
// Polish Zloty
|
|
36
|
-
["tr-TR", "TRY"],
|
|
37
|
-
// Turkish Lira
|
|
38
|
-
["ru-RU", "RUB"],
|
|
39
|
-
// Russian Ruble
|
|
40
|
-
["ja-JP", "JPY"],
|
|
41
|
-
// Japanese Yen
|
|
42
|
-
["zh-CN", "CNY"],
|
|
43
|
-
// Chinese Yuan
|
|
44
|
-
["ko-KR", "KRW"],
|
|
45
|
-
// South Korean Won
|
|
46
|
-
["ar-SA", "SAR"],
|
|
47
|
-
// Saudi Riyal
|
|
48
|
-
["he-IL", "ILS"],
|
|
49
|
-
// Israeli Shekel
|
|
50
|
-
["id-ID", "IDR"],
|
|
51
|
-
// Indonesian Rupiah
|
|
52
|
-
["ms-MY", "MYR"],
|
|
53
|
-
// Malaysian Ringgit
|
|
54
|
-
["th-TH", "THB"],
|
|
55
|
-
// Thai Baht
|
|
56
|
-
["vi-VN", "VND"],
|
|
57
|
-
// Vietnamese Dong
|
|
58
|
-
["hi-IN", "INR"],
|
|
59
|
-
// Indian Rupee
|
|
60
|
-
["bn-IN", "INR"],
|
|
61
|
-
// Indian Rupee
|
|
62
|
-
["pa-IN", "INR"],
|
|
63
|
-
// Indian Rupee
|
|
64
|
-
["gu-IN", "INR"],
|
|
65
|
-
// Indian Rupee
|
|
66
|
-
["or-IN", "INR"],
|
|
67
|
-
// Indian Rupee
|
|
68
|
-
["ta-IN", "INR"],
|
|
69
|
-
// Indian Rupee
|
|
70
|
-
["te-IN", "INR"],
|
|
71
|
-
// Indian Rupee
|
|
72
|
-
["kn-IN", "INR"],
|
|
73
|
-
// Indian Rupee
|
|
74
|
-
["ml-IN", "INR"]
|
|
75
|
-
// Indian Rupee
|
|
76
|
-
]);
|
|
77
|
-
export const configLocales = /* @__PURE__ */ new Set([
|
|
78
|
-
"en-US",
|
|
79
|
-
// English (United States)
|
|
80
|
-
"en-GB",
|
|
81
|
-
// English (United Kingdom)
|
|
82
|
-
"en-CA",
|
|
83
|
-
// English (Canada)
|
|
84
|
-
"en-AU",
|
|
85
|
-
// English (Australia)
|
|
86
|
-
"fr-FR",
|
|
87
|
-
// French (France)
|
|
88
|
-
"es-ES",
|
|
89
|
-
// Spanish (Spain)
|
|
90
|
-
"de-DE",
|
|
91
|
-
// German (Germany)
|
|
92
|
-
"it-IT",
|
|
93
|
-
// Italian (Italy)
|
|
94
|
-
"ja-JP",
|
|
95
|
-
// Japanese (Japan)
|
|
96
|
-
"ko-KR",
|
|
97
|
-
// Korean (South Korea)
|
|
98
|
-
"zh-CN",
|
|
99
|
-
// Chinese (Simplified, China)
|
|
100
|
-
"zh-TW",
|
|
101
|
-
// Chinese (Traditional, Taiwan)
|
|
102
|
-
"pt-PT",
|
|
103
|
-
// Portuguese (Portugal)
|
|
104
|
-
"pt-BR",
|
|
105
|
-
// Portuguese (Brazil)
|
|
106
|
-
"ru-RU",
|
|
107
|
-
// Russian (Russia)
|
|
108
|
-
"nl-NL",
|
|
109
|
-
// Dutch (Netherlands)
|
|
110
|
-
"da-DK",
|
|
111
|
-
// Danish (Denmark)
|
|
112
|
-
"sv-SE",
|
|
113
|
-
// Swedish (Sweden)
|
|
114
|
-
"nb-NO",
|
|
115
|
-
// Norwegian Bokmål (Norway)
|
|
116
|
-
"fi-FI",
|
|
117
|
-
// Finnish (Finland)
|
|
118
|
-
"pl-PL",
|
|
119
|
-
// Polish (Poland)
|
|
120
|
-
"tr-TR",
|
|
121
|
-
// Turkish (Turkey)
|
|
122
|
-
"ar-SA",
|
|
123
|
-
// Arabic (Saudi Arabia)
|
|
124
|
-
"he-IL",
|
|
125
|
-
// Hebrew (Yiddish)
|
|
126
|
-
"id-ID",
|
|
127
|
-
// Indonesian (Indonesia)
|
|
128
|
-
"ms-MY",
|
|
129
|
-
// Malay (Malaysia)
|
|
130
|
-
"th-TH",
|
|
131
|
-
// Thai (Thailand)
|
|
132
|
-
"vi-VN"
|
|
133
|
-
// Vietnamese (Vietnam)
|
|
134
|
-
]);
|
|
135
|
-
export const configUnits = /* @__PURE__ */ new Set([
|
|
136
|
-
"acre",
|
|
137
|
-
"bit",
|
|
138
|
-
"byte",
|
|
139
|
-
"celsius",
|
|
140
|
-
"centimeter",
|
|
141
|
-
"day",
|
|
142
|
-
"degree",
|
|
143
|
-
"fahrenheit",
|
|
144
|
-
"fluid-ounce",
|
|
145
|
-
"foot",
|
|
146
|
-
"gallon",
|
|
147
|
-
"gigabit",
|
|
148
|
-
"gigabyte",
|
|
149
|
-
"gram",
|
|
150
|
-
"hectare",
|
|
151
|
-
"hour",
|
|
152
|
-
"inch",
|
|
153
|
-
"kilobit",
|
|
154
|
-
"kilobyte",
|
|
155
|
-
"kilogram",
|
|
156
|
-
"kilometer",
|
|
157
|
-
"liter",
|
|
158
|
-
"megabit",
|
|
159
|
-
"megabyte",
|
|
160
|
-
"meter",
|
|
161
|
-
"microsecond",
|
|
162
|
-
"mile",
|
|
163
|
-
"mile-scandinavian",
|
|
164
|
-
"milliliter",
|
|
165
|
-
"millimeter",
|
|
166
|
-
"millisecond",
|
|
167
|
-
"minute",
|
|
168
|
-
"month",
|
|
169
|
-
"nanosecond",
|
|
170
|
-
"ounce",
|
|
171
|
-
"percent",
|
|
172
|
-
"petabyte",
|
|
173
|
-
"pound",
|
|
174
|
-
"second",
|
|
175
|
-
"stone",
|
|
176
|
-
"terabit",
|
|
177
|
-
"terabyte",
|
|
178
|
-
"week",
|
|
179
|
-
"yard",
|
|
180
|
-
"year"
|
|
181
|
-
]);
|
|
182
|
-
export const unchangingPlurals = /* @__PURE__ */ new Set([
|
|
183
|
-
"sheep",
|
|
184
|
-
"fish",
|
|
185
|
-
"deer",
|
|
186
|
-
"hay",
|
|
187
|
-
"moose",
|
|
188
|
-
"series",
|
|
189
|
-
"species",
|
|
190
|
-
"aircraft",
|
|
191
|
-
"bison",
|
|
192
|
-
"buffalo",
|
|
193
|
-
"cod",
|
|
194
|
-
"elk",
|
|
195
|
-
"halibut",
|
|
196
|
-
"hovercraft",
|
|
197
|
-
"lego",
|
|
198
|
-
"mackerel",
|
|
199
|
-
"salmon",
|
|
200
|
-
"spacecraft",
|
|
201
|
-
"swine",
|
|
202
|
-
"trout",
|
|
203
|
-
"tuna"
|
|
204
|
-
]);
|
|
205
|
-
export const irregularPlurals = /* @__PURE__ */ new Map([
|
|
206
|
-
["addendum", "addenda"],
|
|
207
|
-
["agendum", "agenda"],
|
|
208
|
-
["alumnus", "alumni"],
|
|
209
|
-
["analysis", "analyses"],
|
|
210
|
-
["anathema", "anathemata"],
|
|
211
|
-
["appendix", "appendices"],
|
|
212
|
-
["axis", "axes"],
|
|
213
|
-
["bacterium", "bacteria"],
|
|
214
|
-
["basis", "bases"],
|
|
215
|
-
["cactus", "cacti"],
|
|
216
|
-
["cherub", "cherubim"],
|
|
217
|
-
["child", "children"],
|
|
218
|
-
["corrigendum", "corrigenda"],
|
|
219
|
-
["crisis", "crises"],
|
|
220
|
-
["criterion", "criteria"],
|
|
221
|
-
["curriculum", "curricula"],
|
|
222
|
-
["custom", "customs"],
|
|
223
|
-
["datum", "data"],
|
|
224
|
-
["diagnosis", "diagnoses"],
|
|
225
|
-
["dogma", "dogmata"],
|
|
226
|
-
["ellipsis", "ellipses"],
|
|
227
|
-
["elf", "elves"],
|
|
228
|
-
["erratum", "errata"],
|
|
229
|
-
["focus", "foci"],
|
|
230
|
-
["foot", "feet"],
|
|
231
|
-
["forum", "fora"],
|
|
232
|
-
["fungus", "fungi"],
|
|
233
|
-
["genus", "genera"],
|
|
234
|
-
["goose", "geese"],
|
|
235
|
-
["half", "halves"],
|
|
236
|
-
["hypothesis", "hypotheses"],
|
|
237
|
-
["index", "indices"],
|
|
238
|
-
["knife", "knives"],
|
|
239
|
-
["leaf", "leaves"],
|
|
240
|
-
["lemma", "lemmata"],
|
|
241
|
-
["life", "lives"],
|
|
242
|
-
["loaf", "loaves"],
|
|
243
|
-
["man", "men"],
|
|
244
|
-
["matrix", "matrices"],
|
|
245
|
-
["medium", "media"],
|
|
246
|
-
["memorandum", "memoranda"],
|
|
247
|
-
["millennium", "millennia"],
|
|
248
|
-
["mouse", "mice"],
|
|
249
|
-
["nucleus", "nuclei"],
|
|
250
|
-
["oasis", "oases"],
|
|
251
|
-
["ovum", "ova"],
|
|
252
|
-
["ox", "oxen"],
|
|
253
|
-
["parenthesis", "parentheses"],
|
|
254
|
-
["person", "people"],
|
|
255
|
-
["phenomenon", "phenomena"],
|
|
256
|
-
["potato", "potatoes"],
|
|
257
|
-
["radius", "radii"],
|
|
258
|
-
["schema", "schemata"],
|
|
259
|
-
["stimulus", "stimuli"],
|
|
260
|
-
["stigma", "stigmata"],
|
|
261
|
-
["stoma", "stomata"],
|
|
262
|
-
["stratum", "strata"],
|
|
263
|
-
["syllabus", "syllabi"],
|
|
264
|
-
["symposium", "symposia"],
|
|
265
|
-
["synthesis", "syntheses"],
|
|
266
|
-
["thesis", "theses"],
|
|
267
|
-
["tooth", "teeth"],
|
|
268
|
-
["tomato", "tomatoes"],
|
|
269
|
-
["vertex", "vertices"],
|
|
270
|
-
["wife", "wives"],
|
|
271
|
-
["woman", "women"]
|
|
272
|
-
]);
|
|
273
|
-
export const numberUnderTwenty = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"];
|
|
274
|
-
export const numberTens = ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"];
|
|
275
|
-
export const numberScales = ["", " thousand", " million", " billion", " trillion", " quadrillion", " quintillion"];
|
|
276
|
-
export const formatTitleExceptions = /* @__PURE__ */ new Set([
|
|
277
|
-
"a",
|
|
278
|
-
"an",
|
|
279
|
-
"to",
|
|
280
|
-
"the",
|
|
281
|
-
"for",
|
|
282
|
-
"and",
|
|
283
|
-
"nor",
|
|
284
|
-
"but",
|
|
285
|
-
"or",
|
|
286
|
-
"yet",
|
|
287
|
-
"so",
|
|
288
|
-
"in",
|
|
289
|
-
"is",
|
|
290
|
-
"it",
|
|
291
|
-
"than",
|
|
292
|
-
"on",
|
|
293
|
-
"at",
|
|
294
|
-
"with",
|
|
295
|
-
"under",
|
|
296
|
-
"above",
|
|
297
|
-
"from",
|
|
298
|
-
"of",
|
|
299
|
-
"although",
|
|
300
|
-
"because",
|
|
301
|
-
"since",
|
|
302
|
-
"unless"
|
|
303
|
-
]);
|