inferred-types 0.50.12 → 0.50.13

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 (41) hide show
  1. package/dist/index.cjs +68 -1
  2. package/dist/index.js +58 -1
  3. package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
  4. package/dist/runtime/literals/stripChars.js +1 -1
  5. package/dist/runtime/literals/stripSurround.d.ts +2 -2
  6. package/dist/runtime/literals/stripSurround.d.ts.map +1 -1
  7. package/dist/runtime/literals/stripSurround.js +1 -1
  8. package/dist/runtime/runtime-types/asToken.d.ts.map +1 -1
  9. package/dist/runtime/runtime-types/asToken.js +0 -6
  10. package/dist/runtime/tsconfig.tsbuildinfo +1 -1
  11. package/dist/runtime/type-guards/geo/index.d.ts +4 -0
  12. package/dist/runtime/type-guards/geo/index.d.ts.map +1 -0
  13. package/dist/runtime/type-guards/geo/index.js +3 -0
  14. package/dist/runtime/type-guards/geo/isIso3166Alpha2.d.ts +46 -0
  15. package/dist/runtime/type-guards/geo/isIso3166Alpha2.d.ts.map +1 -0
  16. package/dist/runtime/type-guards/{countries → geo}/isIso3166Alpha2.js +36 -0
  17. package/dist/runtime/type-guards/geo/isUsState.d.ts +4 -0
  18. package/dist/runtime/type-guards/geo/isUsState.d.ts.map +1 -0
  19. package/dist/runtime/type-guards/geo/isUsState.js +10 -0
  20. package/dist/runtime/type-guards/geo/isZipCode.d.ts +23 -0
  21. package/dist/runtime/type-guards/geo/isZipCode.d.ts.map +1 -0
  22. package/dist/runtime/type-guards/geo/isZipCode.js +40 -0
  23. package/dist/runtime/type-guards/index.d.ts +1 -1
  24. package/dist/runtime/type-guards/index.d.ts.map +1 -1
  25. package/dist/runtime/type-guards/index.js +1 -1
  26. package/dist/runtime/type-guards/retail.d.ts +6 -1
  27. package/dist/runtime/type-guards/retail.d.ts.map +1 -1
  28. package/dist/runtime/type-guards/retail.js +7 -0
  29. package/dist/types/runtime-types/Shape.d.ts +2 -2
  30. package/dist/types/runtime-types/Shape.d.ts.map +1 -1
  31. package/dist/types/string-literals/character-sets/retail-urls.d.ts +4 -0
  32. package/dist/types/string-literals/character-sets/retail-urls.d.ts.map +1 -1
  33. package/dist/types/string-literals/geo/zip.d.ts +3 -3
  34. package/dist/types/string-literals/geo/zip.d.ts.map +1 -1
  35. package/dist/types/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +1 -1
  37. package/dist/runtime/type-guards/countries/index.d.ts +0 -2
  38. package/dist/runtime/type-guards/countries/index.d.ts.map +0 -1
  39. package/dist/runtime/type-guards/countries/index.js +0 -1
  40. package/dist/runtime/type-guards/countries/isIso3166Alpha2.d.ts +0 -21
  41. package/dist/runtime/type-guards/countries/isIso3166Alpha2.d.ts.map +0 -1
package/dist/index.cjs CHANGED
@@ -295,6 +295,10 @@ __export(inferred_types_exports, {
295
295
  isContainer: () => isContainer,
296
296
  isContainerToken: () => isContainerToken,
297
297
  isCostCoUrl: () => isCostCoUrl,
298
+ isCountryAbbrev: () => isCountryAbbrev,
299
+ isCountryCode2: () => isCountryCode2,
300
+ isCountryCode3: () => isCountryCode3,
301
+ isCountryName: () => isCountryName,
298
302
  isCssAspectRatio: () => isCssAspectRatio,
299
303
  isCurrentMetric: () => isCurrentMetric,
300
304
  isCurrentUom: () => isCurrentUom,
@@ -382,6 +386,7 @@ __export(inferred_types_exports, {
382
386
  isRepoUrl: () => isRepoUrl,
383
387
  isResistance: () => isResistance,
384
388
  isResistanceUom: () => isResistanceUom,
389
+ isRetailUrl: () => isRetailUrl,
385
390
  isSameTypeOf: () => isSameTypeOf,
386
391
  isScalar: () => isScalar,
387
392
  isSemanticVersion: () => isSemanticVersion,
@@ -424,6 +429,8 @@ __export(inferred_types_exports, {
424
429
  isUrl: () => isUrl,
425
430
  isUrlPath: () => isUrlPath,
426
431
  isUrlSource: () => isUrlSource,
432
+ isUsStateAbbreviation: () => isUsStateAbbreviation,
433
+ isUsStateName: () => isUsStateName,
427
434
  isVoltageMetric: () => isVoltageMetric,
428
435
  isVoltageUom: () => isVoltageUom,
429
436
  isVolumeMetric: () => isVolumeMetric,
@@ -445,6 +452,9 @@ __export(inferred_types_exports, {
445
452
  isYouTubeVideoUrl: () => isYouTubeVideoUrl,
446
453
  isYouTubeVideosInPlaylist: () => isYouTubeVideosInPlaylist,
447
454
  isZaraUrl: () => isZaraUrl,
455
+ isZipCode: () => isZipCode,
456
+ isZipCode5: () => isZipCode5,
457
+ isZipPlus4: () => isZipPlus4,
448
458
  joinWith: () => joinWith,
449
459
  jsonValue: () => jsonValue,
450
460
  jsonValues: () => jsonValues,
@@ -3518,6 +3528,9 @@ var isWalmartUrl = (val) => {
3518
3528
  var isAmazonUrl = (val) => {
3519
3529
  return isString(val) && AMAZON_DNS.some((i) => val.startsWith(`https://${i}`));
3520
3530
  };
3531
+ var isRetailUrl = (val) => {
3532
+ return isAmazonUrl(val) || isWalgreensUrl(val) || isAppleUrl(val) || isMacysUrl(val) || isEbayUrl(val) || isHomeDepotUrl(val) || isTargetUrl(val) || isEtsyUrl(val) || isCostCoUrl(val) || isBestBuyUrl(val) || isWayfairUrl(val) || isNikeUrl(val) || isLowesUrl(val) || isIkeaUrl(val) || isDellUrl(val) || isHmUrl(val) || isZaraUrl(val) || isKrogersUrl(val) || isWalgreensUrl(val) || isCvsUrl(val) || isWholeFoodsUrl(val);
3533
+ };
3521
3534
 
3522
3535
  // src/runtime/type-guards/tokens/isAtomicToken.ts
3523
3536
  var isAtomicToken = (val) => {
@@ -3662,23 +3675,67 @@ var isHtmlElement = (val) => {
3662
3675
  return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
3663
3676
  };
3664
3677
 
3665
- // src/runtime/type-guards/countries/isIso3166Alpha2.ts
3678
+ // src/runtime/type-guards/geo/isIso3166Alpha2.ts
3666
3679
  var isIso3166Alpha2 = (val) => {
3667
3680
  const codes = ISO3166_1.map((i) => i["alpha2"]);
3668
3681
  return isString(val) && codes.includes(val);
3669
3682
  };
3683
+ var isCountryCode2 = (val) => {
3684
+ const codes = ISO3166_1.map((i) => i["alpha2"]);
3685
+ return isString(val) && codes.includes(val);
3686
+ };
3670
3687
  var isIso3166Alpha3 = (val) => {
3671
3688
  const codes = ISO3166_1.map((i) => i["alpha3"]);
3672
3689
  return isString(val) && codes.includes(val);
3673
3690
  };
3691
+ var isCountryCode3 = (val) => {
3692
+ const codes = ISO3166_1.map((i) => i["alpha3"]);
3693
+ return isString(val) && codes.includes(val);
3694
+ };
3674
3695
  var isIso3166CountryCode = (val) => {
3675
3696
  const codes = ISO3166_1.map((i) => i["countryCode"]);
3676
3697
  return isString(val) && codes.includes(val);
3677
3698
  };
3699
+ var isCountryAbbrev = (val) => {
3700
+ return isCountryCode2(val) || isCountryCode3(val);
3701
+ };
3678
3702
  var isIso3166CountryName = (val) => {
3679
3703
  const codes = ISO3166_1.map((i) => i["name"]);
3680
3704
  return isString(val) && codes.includes(val);
3681
3705
  };
3706
+ var isCountryName = (val) => {
3707
+ const codes = ISO3166_1.map((i) => i["name"]);
3708
+ return isString(val) && codes.includes(val);
3709
+ };
3710
+
3711
+ // src/runtime/type-guards/geo/isZipCode.ts
3712
+ var isZipCode5 = (val) => {
3713
+ if (isNumber(val)) {
3714
+ return isZipCode5(`${val}`);
3715
+ }
3716
+ return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
3717
+ };
3718
+ var isZipPlus4 = (val) => {
3719
+ if (isString(val)) {
3720
+ const first = retainWhile(val.trim(), ...NUMERIC_CHAR);
3721
+ const next = stripChars(val.trim().replace(first, "").trim(), "-");
3722
+ return first.length === 5 && next.length === 4 && isNumberLike(next);
3723
+ }
3724
+ return false;
3725
+ };
3726
+ var isZipCode = (val) => {
3727
+ return isZipCode5(val) || isZipPlus4(val);
3728
+ };
3729
+
3730
+ // src/runtime/type-guards/geo/isUsState.ts
3731
+ var ABBREV = US_STATE_LOOKUP.map((i) => i.abbrev);
3732
+ var NAME = US_STATE_LOOKUP.map((i) => i.name);
3733
+ var isUsStateAbbreviation = (val) => {
3734
+ return isString(val) && ABBREV.includes(val);
3735
+ };
3736
+ var isUsStateName = (val) => {
3737
+ return isString(val) && NAME.includes(val);
3738
+ };
3682
3739
 
3683
3740
  // src/runtime/type-guards/metrics/isUom.ts
3684
3741
  var isAreaUom = (val) => {
@@ -5132,6 +5189,10 @@ var asVueRef = (value) => ({
5132
5189
  isContainer,
5133
5190
  isContainerToken,
5134
5191
  isCostCoUrl,
5192
+ isCountryAbbrev,
5193
+ isCountryCode2,
5194
+ isCountryCode3,
5195
+ isCountryName,
5135
5196
  isCssAspectRatio,
5136
5197
  isCurrentMetric,
5137
5198
  isCurrentUom,
@@ -5219,6 +5280,7 @@ var asVueRef = (value) => ({
5219
5280
  isRepoUrl,
5220
5281
  isResistance,
5221
5282
  isResistanceUom,
5283
+ isRetailUrl,
5222
5284
  isSameTypeOf,
5223
5285
  isScalar,
5224
5286
  isSemanticVersion,
@@ -5261,6 +5323,8 @@ var asVueRef = (value) => ({
5261
5323
  isUrl,
5262
5324
  isUrlPath,
5263
5325
  isUrlSource,
5326
+ isUsStateAbbreviation,
5327
+ isUsStateName,
5264
5328
  isVoltageMetric,
5265
5329
  isVoltageUom,
5266
5330
  isVolumeMetric,
@@ -5282,6 +5346,9 @@ var asVueRef = (value) => ({
5282
5346
  isYouTubeVideoUrl,
5283
5347
  isYouTubeVideosInPlaylist,
5284
5348
  isZaraUrl,
5349
+ isZipCode,
5350
+ isZipCode5,
5351
+ isZipPlus4,
5285
5352
  joinWith,
5286
5353
  jsonValue,
5287
5354
  jsonValues,
package/dist/index.js CHANGED
@@ -2970,6 +2970,9 @@ var isWalmartUrl = (val) => {
2970
2970
  var isAmazonUrl = (val) => {
2971
2971
  return isString(val) && AMAZON_DNS.some((i) => val.startsWith(`https://${i}`));
2972
2972
  };
2973
+ var isRetailUrl = (val) => {
2974
+ return isAmazonUrl(val) || isWalgreensUrl(val) || isAppleUrl(val) || isMacysUrl(val) || isEbayUrl(val) || isHomeDepotUrl(val) || isTargetUrl(val) || isEtsyUrl(val) || isCostCoUrl(val) || isBestBuyUrl(val) || isWayfairUrl(val) || isNikeUrl(val) || isLowesUrl(val) || isIkeaUrl(val) || isDellUrl(val) || isHmUrl(val) || isZaraUrl(val) || isKrogersUrl(val) || isWalgreensUrl(val) || isCvsUrl(val) || isWholeFoodsUrl(val);
2975
+ };
2973
2976
 
2974
2977
  // src/runtime/type-guards/tokens/isAtomicToken.ts
2975
2978
  var isAtomicToken = (val) => {
@@ -3114,23 +3117,67 @@ var isHtmlElement = (val) => {
3114
3117
  return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
3115
3118
  };
3116
3119
 
3117
- // src/runtime/type-guards/countries/isIso3166Alpha2.ts
3120
+ // src/runtime/type-guards/geo/isIso3166Alpha2.ts
3118
3121
  var isIso3166Alpha2 = (val) => {
3119
3122
  const codes = ISO3166_1.map((i) => i["alpha2"]);
3120
3123
  return isString(val) && codes.includes(val);
3121
3124
  };
3125
+ var isCountryCode2 = (val) => {
3126
+ const codes = ISO3166_1.map((i) => i["alpha2"]);
3127
+ return isString(val) && codes.includes(val);
3128
+ };
3122
3129
  var isIso3166Alpha3 = (val) => {
3123
3130
  const codes = ISO3166_1.map((i) => i["alpha3"]);
3124
3131
  return isString(val) && codes.includes(val);
3125
3132
  };
3133
+ var isCountryCode3 = (val) => {
3134
+ const codes = ISO3166_1.map((i) => i["alpha3"]);
3135
+ return isString(val) && codes.includes(val);
3136
+ };
3126
3137
  var isIso3166CountryCode = (val) => {
3127
3138
  const codes = ISO3166_1.map((i) => i["countryCode"]);
3128
3139
  return isString(val) && codes.includes(val);
3129
3140
  };
3141
+ var isCountryAbbrev = (val) => {
3142
+ return isCountryCode2(val) || isCountryCode3(val);
3143
+ };
3130
3144
  var isIso3166CountryName = (val) => {
3131
3145
  const codes = ISO3166_1.map((i) => i["name"]);
3132
3146
  return isString(val) && codes.includes(val);
3133
3147
  };
3148
+ var isCountryName = (val) => {
3149
+ const codes = ISO3166_1.map((i) => i["name"]);
3150
+ return isString(val) && codes.includes(val);
3151
+ };
3152
+
3153
+ // src/runtime/type-guards/geo/isZipCode.ts
3154
+ var isZipCode5 = (val) => {
3155
+ if (isNumber(val)) {
3156
+ return isZipCode5(`${val}`);
3157
+ }
3158
+ return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
3159
+ };
3160
+ var isZipPlus4 = (val) => {
3161
+ if (isString(val)) {
3162
+ const first = retainWhile(val.trim(), ...NUMERIC_CHAR);
3163
+ const next = stripChars(val.trim().replace(first, "").trim(), "-");
3164
+ return first.length === 5 && next.length === 4 && isNumberLike(next);
3165
+ }
3166
+ return false;
3167
+ };
3168
+ var isZipCode = (val) => {
3169
+ return isZipCode5(val) || isZipPlus4(val);
3170
+ };
3171
+
3172
+ // src/runtime/type-guards/geo/isUsState.ts
3173
+ var ABBREV = US_STATE_LOOKUP.map((i) => i.abbrev);
3174
+ var NAME = US_STATE_LOOKUP.map((i) => i.name);
3175
+ var isUsStateAbbreviation = (val) => {
3176
+ return isString(val) && ABBREV.includes(val);
3177
+ };
3178
+ var isUsStateName = (val) => {
3179
+ return isString(val) && NAME.includes(val);
3180
+ };
3134
3181
 
3135
3182
  // src/runtime/type-guards/metrics/isUom.ts
3136
3183
  var isAreaUom = (val) => {
@@ -4583,6 +4630,10 @@ export {
4583
4630
  isContainer,
4584
4631
  isContainerToken,
4585
4632
  isCostCoUrl,
4633
+ isCountryAbbrev,
4634
+ isCountryCode2,
4635
+ isCountryCode3,
4636
+ isCountryName,
4586
4637
  isCssAspectRatio,
4587
4638
  isCurrentMetric,
4588
4639
  isCurrentUom,
@@ -4670,6 +4721,7 @@ export {
4670
4721
  isRepoUrl,
4671
4722
  isResistance,
4672
4723
  isResistanceUom,
4724
+ isRetailUrl,
4673
4725
  isSameTypeOf,
4674
4726
  isScalar,
4675
4727
  isSemanticVersion,
@@ -4712,6 +4764,8 @@ export {
4712
4764
  isUrl,
4713
4765
  isUrlPath,
4714
4766
  isUrlSource,
4767
+ isUsStateAbbreviation,
4768
+ isUsStateName,
4715
4769
  isVoltageMetric,
4716
4770
  isVoltageUom,
4717
4771
  isVolumeMetric,
@@ -4733,6 +4787,9 @@ export {
4733
4787
  isYouTubeVideoUrl,
4734
4788
  isYouTubeVideosInPlaylist,
4735
4789
  isZaraUrl,
4790
+ isZipCode,
4791
+ isZipCode5,
4792
+ isZipPlus4,
4736
4793
  joinWith,
4737
4794
  jsonValue,
4738
4795
  jsonValues,