inferred-types 0.50.8 → 0.50.9
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/index.cjs +46 -18
- package/dist/index.js +42 -18
- package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/type-conversion/index.d.ts +1 -1
- package/dist/runtime/type-conversion/index.d.ts.map +1 -1
- package/dist/runtime/type-conversion/index.js +1 -1
- package/dist/runtime/type-conversion/lookupCountry.d.ts +32 -0
- package/dist/runtime/type-conversion/lookupCountry.d.ts.map +1 -0
- package/dist/runtime/type-conversion/lookupCountry.js +97 -0
- package/dist/runtime/type-guards/countries/isIso3166Alpha2.d.ts +5 -1
- package/dist/runtime/type-guards/countries/isIso3166Alpha2.d.ts.map +1 -1
- package/dist/runtime/type-guards/countries/isIso3166Alpha2.js +7 -0
- package/dist/types/string-literals/character-sets/Country.d.ts +40 -7
- package/dist/types/string-literals/character-sets/Country.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/runtime/type-conversion/lookupCountryName.d.ts +0 -15
- package/dist/runtime/type-conversion/lookupCountryName.d.ts.map +0 -1
- package/dist/runtime/type-conversion/lookupCountryName.js +0 -40
package/dist/index.cjs
CHANGED
|
@@ -345,6 +345,7 @@ __export(inferred_types_exports, {
|
|
|
345
345
|
isIso3166Alpha2: () => isIso3166Alpha2,
|
|
346
346
|
isIso3166Alpha3: () => isIso3166Alpha3,
|
|
347
347
|
isIso3166CountryCode: () => isIso3166CountryCode,
|
|
348
|
+
isIso3166CountryName: () => isIso3166CountryName,
|
|
348
349
|
isKrogersUrl: () => isKrogersUrl,
|
|
349
350
|
isLength: () => isLength,
|
|
350
351
|
isLikeRegExp: () => isLikeRegExp,
|
|
@@ -452,6 +453,9 @@ __export(inferred_types_exports, {
|
|
|
452
453
|
list: () => list,
|
|
453
454
|
literal: () => literal,
|
|
454
455
|
logicalReturns: () => logicalReturns,
|
|
456
|
+
lookupCountryAlpha2: () => lookupCountryAlpha2,
|
|
457
|
+
lookupCountryAlpha3: () => lookupCountryAlpha3,
|
|
458
|
+
lookupCountryCode: () => lookupCountryCode,
|
|
455
459
|
lookupCountryName: () => lookupCountryName,
|
|
456
460
|
lowercase: () => lowercase,
|
|
457
461
|
mergeObjects: () => mergeObjects,
|
|
@@ -3268,36 +3272,52 @@ var csv = (csv2, format = `string-numeric-tuple`) => {
|
|
|
3268
3272
|
return tuple3;
|
|
3269
3273
|
};
|
|
3270
3274
|
|
|
3271
|
-
// src/runtime/type-conversion/
|
|
3272
|
-
var
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
var jsonValues = (...val) => {
|
|
3276
|
-
return val.map((i) => jsonValue(i));
|
|
3275
|
+
// src/runtime/type-conversion/lookupCountry.ts
|
|
3276
|
+
var lookupAlpha2Code = (code, prop) => {
|
|
3277
|
+
const found = ISO3166_1.find((i) => i["alpha2"] === code);
|
|
3278
|
+
return found ? found[prop] : void 0;
|
|
3277
3279
|
};
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
var _a;
|
|
3282
|
-
return (_a = ISO3166_1.find((i) => i["alpha2"] === code)) == null ? void 0 : _a.name;
|
|
3280
|
+
var lookupAlpha3Code = (code, prop) => {
|
|
3281
|
+
const found = ISO3166_1.find((i) => i["alpha3"] === code);
|
|
3282
|
+
return found ? found[prop] : void 0;
|
|
3283
3283
|
};
|
|
3284
|
-
var
|
|
3285
|
-
|
|
3286
|
-
return
|
|
3284
|
+
var lookupName = (name, prop) => {
|
|
3285
|
+
const found = ISO3166_1.find((i) => i["name"] === name);
|
|
3286
|
+
return found ? found[prop] : void 0;
|
|
3287
3287
|
};
|
|
3288
|
-
var lookupNumericCode = (code) => {
|
|
3289
|
-
var _a;
|
|
3288
|
+
var lookupNumericCode = (code, prop) => {
|
|
3290
3289
|
let num = isNumber(code) ? `${code}` : code;
|
|
3291
3290
|
if (num.length === 1) {
|
|
3292
3291
|
num = `00${num}`;
|
|
3293
3292
|
} else if (num.length === 2) {
|
|
3294
3293
|
num = `0${num}`;
|
|
3295
3294
|
}
|
|
3296
|
-
|
|
3295
|
+
const found = ISO3166_1.find((i) => i["countryCode"] === num);
|
|
3296
|
+
return found ? found[prop] : void 0;
|
|
3297
3297
|
};
|
|
3298
3298
|
var lookupCountryName = (code) => {
|
|
3299
3299
|
const uc = uppercase(code);
|
|
3300
|
-
return isNumberLike(code) ? lookupNumericCode(code) : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc) : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc) : void 0;
|
|
3300
|
+
return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
|
|
3301
|
+
};
|
|
3302
|
+
var lookupCountryAlpha2 = (code) => {
|
|
3303
|
+
const uc = uppercase(code);
|
|
3304
|
+
return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
|
|
3305
|
+
};
|
|
3306
|
+
var lookupCountryAlpha3 = (token) => {
|
|
3307
|
+
const uc = uppercase(token);
|
|
3308
|
+
return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
|
|
3309
|
+
};
|
|
3310
|
+
var lookupCountryCode = (token) => {
|
|
3311
|
+
const uc = uppercase(token);
|
|
3312
|
+
return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
|
|
3313
|
+
};
|
|
3314
|
+
|
|
3315
|
+
// src/runtime/type-conversion/json.ts
|
|
3316
|
+
var jsonValue = (val) => {
|
|
3317
|
+
return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
|
|
3318
|
+
};
|
|
3319
|
+
var jsonValues = (...val) => {
|
|
3320
|
+
return val.map((i) => jsonValue(i));
|
|
3301
3321
|
};
|
|
3302
3322
|
|
|
3303
3323
|
// src/runtime/type-guards/hasWhitespace.ts
|
|
@@ -3623,6 +3643,10 @@ var isIso3166CountryCode = (val) => {
|
|
|
3623
3643
|
const codes = ISO3166_1.map((i) => i["countryCode"]);
|
|
3624
3644
|
return isString(val) && codes.includes(val);
|
|
3625
3645
|
};
|
|
3646
|
+
var isIso3166CountryName = (val) => {
|
|
3647
|
+
const codes = ISO3166_1.map((i) => i["name"]);
|
|
3648
|
+
return isString(val) && codes.includes(val);
|
|
3649
|
+
};
|
|
3626
3650
|
|
|
3627
3651
|
// src/runtime/type-guards/metrics/isUom.ts
|
|
3628
3652
|
var isAreaUom = (val) => {
|
|
@@ -5108,6 +5132,7 @@ var asVueRef = (value) => ({
|
|
|
5108
5132
|
isIso3166Alpha2,
|
|
5109
5133
|
isIso3166Alpha3,
|
|
5110
5134
|
isIso3166CountryCode,
|
|
5135
|
+
isIso3166CountryName,
|
|
5111
5136
|
isKrogersUrl,
|
|
5112
5137
|
isLength,
|
|
5113
5138
|
isLikeRegExp,
|
|
@@ -5215,6 +5240,9 @@ var asVueRef = (value) => ({
|
|
|
5215
5240
|
list,
|
|
5216
5241
|
literal,
|
|
5217
5242
|
logicalReturns,
|
|
5243
|
+
lookupCountryAlpha2,
|
|
5244
|
+
lookupCountryAlpha3,
|
|
5245
|
+
lookupCountryCode,
|
|
5218
5246
|
lookupCountryName,
|
|
5219
5247
|
lowercase,
|
|
5220
5248
|
mergeObjects,
|
package/dist/index.js
CHANGED
|
@@ -2726,36 +2726,52 @@ var csv = (csv2, format = `string-numeric-tuple`) => {
|
|
|
2726
2726
|
return tuple3;
|
|
2727
2727
|
};
|
|
2728
2728
|
|
|
2729
|
-
// src/runtime/type-conversion/
|
|
2730
|
-
var
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
var jsonValues = (...val) => {
|
|
2734
|
-
return val.map((i) => jsonValue(i));
|
|
2729
|
+
// src/runtime/type-conversion/lookupCountry.ts
|
|
2730
|
+
var lookupAlpha2Code = (code, prop) => {
|
|
2731
|
+
const found = ISO3166_1.find((i) => i["alpha2"] === code);
|
|
2732
|
+
return found ? found[prop] : void 0;
|
|
2735
2733
|
};
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
var _a;
|
|
2740
|
-
return (_a = ISO3166_1.find((i) => i["alpha2"] === code)) == null ? void 0 : _a.name;
|
|
2734
|
+
var lookupAlpha3Code = (code, prop) => {
|
|
2735
|
+
const found = ISO3166_1.find((i) => i["alpha3"] === code);
|
|
2736
|
+
return found ? found[prop] : void 0;
|
|
2741
2737
|
};
|
|
2742
|
-
var
|
|
2743
|
-
|
|
2744
|
-
return
|
|
2738
|
+
var lookupName = (name, prop) => {
|
|
2739
|
+
const found = ISO3166_1.find((i) => i["name"] === name);
|
|
2740
|
+
return found ? found[prop] : void 0;
|
|
2745
2741
|
};
|
|
2746
|
-
var lookupNumericCode = (code) => {
|
|
2747
|
-
var _a;
|
|
2742
|
+
var lookupNumericCode = (code, prop) => {
|
|
2748
2743
|
let num = isNumber(code) ? `${code}` : code;
|
|
2749
2744
|
if (num.length === 1) {
|
|
2750
2745
|
num = `00${num}`;
|
|
2751
2746
|
} else if (num.length === 2) {
|
|
2752
2747
|
num = `0${num}`;
|
|
2753
2748
|
}
|
|
2754
|
-
|
|
2749
|
+
const found = ISO3166_1.find((i) => i["countryCode"] === num);
|
|
2750
|
+
return found ? found[prop] : void 0;
|
|
2755
2751
|
};
|
|
2756
2752
|
var lookupCountryName = (code) => {
|
|
2757
2753
|
const uc = uppercase(code);
|
|
2758
|
-
return isNumberLike(code) ? lookupNumericCode(code) : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc) : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc) : void 0;
|
|
2754
|
+
return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
|
|
2755
|
+
};
|
|
2756
|
+
var lookupCountryAlpha2 = (code) => {
|
|
2757
|
+
const uc = uppercase(code);
|
|
2758
|
+
return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
|
|
2759
|
+
};
|
|
2760
|
+
var lookupCountryAlpha3 = (token) => {
|
|
2761
|
+
const uc = uppercase(token);
|
|
2762
|
+
return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
|
|
2763
|
+
};
|
|
2764
|
+
var lookupCountryCode = (token) => {
|
|
2765
|
+
const uc = uppercase(token);
|
|
2766
|
+
return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
|
|
2767
|
+
};
|
|
2768
|
+
|
|
2769
|
+
// src/runtime/type-conversion/json.ts
|
|
2770
|
+
var jsonValue = (val) => {
|
|
2771
|
+
return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
|
|
2772
|
+
};
|
|
2773
|
+
var jsonValues = (...val) => {
|
|
2774
|
+
return val.map((i) => jsonValue(i));
|
|
2759
2775
|
};
|
|
2760
2776
|
|
|
2761
2777
|
// src/runtime/type-guards/hasWhitespace.ts
|
|
@@ -3081,6 +3097,10 @@ var isIso3166CountryCode = (val) => {
|
|
|
3081
3097
|
const codes = ISO3166_1.map((i) => i["countryCode"]);
|
|
3082
3098
|
return isString(val) && codes.includes(val);
|
|
3083
3099
|
};
|
|
3100
|
+
var isIso3166CountryName = (val) => {
|
|
3101
|
+
const codes = ISO3166_1.map((i) => i["name"]);
|
|
3102
|
+
return isString(val) && codes.includes(val);
|
|
3103
|
+
};
|
|
3084
3104
|
|
|
3085
3105
|
// src/runtime/type-guards/metrics/isUom.ts
|
|
3086
3106
|
var isAreaUom = (val) => {
|
|
@@ -4565,6 +4585,7 @@ export {
|
|
|
4565
4585
|
isIso3166Alpha2,
|
|
4566
4586
|
isIso3166Alpha3,
|
|
4567
4587
|
isIso3166CountryCode,
|
|
4588
|
+
isIso3166CountryName,
|
|
4568
4589
|
isKrogersUrl,
|
|
4569
4590
|
isLength,
|
|
4570
4591
|
isLikeRegExp,
|
|
@@ -4672,6 +4693,9 @@ export {
|
|
|
4672
4693
|
list,
|
|
4673
4694
|
literal,
|
|
4674
4695
|
logicalReturns,
|
|
4696
|
+
lookupCountryAlpha2,
|
|
4697
|
+
lookupCountryAlpha3,
|
|
4698
|
+
lookupCountryCode,
|
|
4675
4699
|
lookupCountryName,
|
|
4676
4700
|
lowercase,
|
|
4677
4701
|
mergeObjects,
|