inferred-types 0.55.17 → 0.55.18

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.
@@ -76,6 +76,8 @@ __export(index_exports, {
76
76
  HASH_TABLE_WIDE: () => HASH_TABLE_WIDE,
77
77
  HM_DNS: () => HM_DNS,
78
78
  HOME_DEPOT_DNS: () => HOME_DEPOT_DNS,
79
+ HTML_ATOMIC_TAGS: () => HTML_ATOMIC_TAGS,
80
+ HTML_BLOCK_TAGS: () => HTML_BLOCK_TAGS,
79
81
  IKEA_DNS: () => IKEA_DNS,
80
82
  IMAGE_FORMAT_LOOKUP: () => IMAGE_FORMAT_LOOKUP,
81
83
  INDIAN_NEWS: () => INDIAN_NEWS,
@@ -302,6 +304,7 @@ __export(index_exports, {
302
304
  handleDoneFn: () => handleDoneFn,
303
305
  hasCountryCode: () => hasCountryCode,
304
306
  hasDefaultValue: () => hasDefaultValue,
307
+ hasHtml: () => hasHtml,
305
308
  hasIndexOf: () => hasIndexOf,
306
309
  hasKeys: () => hasKeys,
307
310
  hasOverlappingKeys: () => hasOverlappingKeys,
@@ -309,6 +312,7 @@ __export(index_exports, {
309
312
  hasProtocolPrefix: () => hasProtocolPrefix,
310
313
  hasUrlPort: () => hasUrlPort,
311
314
  hasUrlQueryParameter: () => hasUrlQueryParameter,
315
+ hasValidHtml: () => hasValidHtml,
312
316
  hasWhiteSpace: () => hasWhiteSpace,
313
317
  idLiteral: () => idLiteral,
314
318
  idTypeGuard: () => idTypeGuard,
@@ -421,6 +425,7 @@ __export(index_exports, {
421
425
  isHexadecimal: () => isHexadecimal,
422
426
  isHmUrl: () => isHmUrl,
423
427
  isHomeDepotUrl: () => isHomeDepotUrl,
428
+ isHtml: () => isHtml,
424
429
  isHtmlElement: () => isHtmlElement,
425
430
  isIkeaUrl: () => isIkeaUrl,
426
431
  isIndexable: () => isIndexable,
@@ -564,6 +569,9 @@ __export(index_exports, {
564
569
  isUsPhoneNumber: () => isUsPhoneNumber,
565
570
  isUsStateAbbreviation: () => isUsStateAbbreviation,
566
571
  isUsStateName: () => isUsStateName,
572
+ isValidAtomicTag: () => isValidAtomicTag,
573
+ isValidBlockTag: () => isValidBlockTag,
574
+ isValidHtml: () => isValidHtml,
567
575
  isVariable: () => isVariable,
568
576
  isVisa: () => isVisa,
569
577
  isVisaMastercard: () => isVisaMastercard,
@@ -1213,6 +1221,120 @@ var HASH_TABLE_CHAR = {
1213
1221
  ...HASH_TABLE_SPECIAL
1214
1222
  };
1215
1223
  var HASH_TABLE_OTHER = "999";
1224
+ var HTML_BLOCK_TAGS = [
1225
+ "a",
1226
+ "abbr",
1227
+ "address",
1228
+ "article",
1229
+ "aside",
1230
+ "b",
1231
+ "bdi",
1232
+ "bdo",
1233
+ "blockquote",
1234
+ "body",
1235
+ "button",
1236
+ "canvas",
1237
+ "caption",
1238
+ "cite",
1239
+ "code",
1240
+ "colgroup",
1241
+ "data",
1242
+ "datalist",
1243
+ "dd",
1244
+ "del",
1245
+ "details",
1246
+ "dfn",
1247
+ "dialog",
1248
+ "div",
1249
+ "dl",
1250
+ "dt",
1251
+ "em",
1252
+ "fieldset",
1253
+ "figcaption",
1254
+ "figure",
1255
+ "footer",
1256
+ "form",
1257
+ "h1",
1258
+ "h2",
1259
+ "h3",
1260
+ "h4",
1261
+ "h5",
1262
+ "h6",
1263
+ "head",
1264
+ "header",
1265
+ "html",
1266
+ "i",
1267
+ "iframe",
1268
+ "ins",
1269
+ "kbd",
1270
+ "label",
1271
+ "legend",
1272
+ "li",
1273
+ "main",
1274
+ "map",
1275
+ "mark",
1276
+ "menu",
1277
+ "meter",
1278
+ "nav",
1279
+ "noscript",
1280
+ "object",
1281
+ "ol",
1282
+ "optgroup",
1283
+ "option",
1284
+ "output",
1285
+ "p",
1286
+ "picture",
1287
+ "pre",
1288
+ "progress",
1289
+ "q",
1290
+ "rp",
1291
+ "rt",
1292
+ "ruby",
1293
+ "s",
1294
+ "samp",
1295
+ "script",
1296
+ "section",
1297
+ "select",
1298
+ "small",
1299
+ "span",
1300
+ "strong",
1301
+ "style",
1302
+ "sub",
1303
+ "summary",
1304
+ "sup",
1305
+ "svg",
1306
+ "table",
1307
+ "tbody",
1308
+ "td",
1309
+ "template",
1310
+ "textarea",
1311
+ "tfoot",
1312
+ "th",
1313
+ "thead",
1314
+ "time",
1315
+ "title",
1316
+ "tr",
1317
+ "u",
1318
+ "ul",
1319
+ "var",
1320
+ "video"
1321
+ ];
1322
+ var HTML_ATOMIC_TAGS = [
1323
+ "area",
1324
+ "base",
1325
+ "br",
1326
+ "col",
1327
+ "embed",
1328
+ "hr",
1329
+ "img",
1330
+ "input",
1331
+ "link",
1332
+ "meta",
1333
+ "param",
1334
+ "source",
1335
+ "track",
1336
+ "wbr"
1337
+ ];
1216
1338
  var MIME_TYPES = [
1217
1339
  // Application MIME Types
1218
1340
  "application/json",
@@ -3622,6 +3744,120 @@ var HASH_TABLE_CHAR2 = {
3622
3744
  ...HASH_TABLE_ALPHA_UPPER2,
3623
3745
  ...HASH_TABLE_SPECIAL2
3624
3746
  };
3747
+ var HTML_BLOCK_TAGS2 = [
3748
+ "a",
3749
+ "abbr",
3750
+ "address",
3751
+ "article",
3752
+ "aside",
3753
+ "b",
3754
+ "bdi",
3755
+ "bdo",
3756
+ "blockquote",
3757
+ "body",
3758
+ "button",
3759
+ "canvas",
3760
+ "caption",
3761
+ "cite",
3762
+ "code",
3763
+ "colgroup",
3764
+ "data",
3765
+ "datalist",
3766
+ "dd",
3767
+ "del",
3768
+ "details",
3769
+ "dfn",
3770
+ "dialog",
3771
+ "div",
3772
+ "dl",
3773
+ "dt",
3774
+ "em",
3775
+ "fieldset",
3776
+ "figcaption",
3777
+ "figure",
3778
+ "footer",
3779
+ "form",
3780
+ "h1",
3781
+ "h2",
3782
+ "h3",
3783
+ "h4",
3784
+ "h5",
3785
+ "h6",
3786
+ "head",
3787
+ "header",
3788
+ "html",
3789
+ "i",
3790
+ "iframe",
3791
+ "ins",
3792
+ "kbd",
3793
+ "label",
3794
+ "legend",
3795
+ "li",
3796
+ "main",
3797
+ "map",
3798
+ "mark",
3799
+ "menu",
3800
+ "meter",
3801
+ "nav",
3802
+ "noscript",
3803
+ "object",
3804
+ "ol",
3805
+ "optgroup",
3806
+ "option",
3807
+ "output",
3808
+ "p",
3809
+ "picture",
3810
+ "pre",
3811
+ "progress",
3812
+ "q",
3813
+ "rp",
3814
+ "rt",
3815
+ "ruby",
3816
+ "s",
3817
+ "samp",
3818
+ "script",
3819
+ "section",
3820
+ "select",
3821
+ "small",
3822
+ "span",
3823
+ "strong",
3824
+ "style",
3825
+ "sub",
3826
+ "summary",
3827
+ "sup",
3828
+ "svg",
3829
+ "table",
3830
+ "tbody",
3831
+ "td",
3832
+ "template",
3833
+ "textarea",
3834
+ "tfoot",
3835
+ "th",
3836
+ "thead",
3837
+ "time",
3838
+ "title",
3839
+ "tr",
3840
+ "u",
3841
+ "ul",
3842
+ "var",
3843
+ "video"
3844
+ ];
3845
+ var HTML_ATOMIC_TAGS2 = [
3846
+ "area",
3847
+ "base",
3848
+ "br",
3849
+ "col",
3850
+ "embed",
3851
+ "hr",
3852
+ "img",
3853
+ "input",
3854
+ "link",
3855
+ "meta",
3856
+ "param",
3857
+ "source",
3858
+ "track",
3859
+ "wbr"
3860
+ ];
3625
3861
  var ISO3166_12 = [
3626
3862
  { name: "Afghanistan", alpha2: "AF", countryCode: "004", alpha3: "AFG" },
3627
3863
  { name: "Albania", alpha2: "AL", countryCode: "008", alpha3: "ALB" },
@@ -6439,6 +6675,88 @@ function startsWith(startingWith) {
6439
6675
  return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
6440
6676
  };
6441
6677
  }
6678
+ function hasHtml(val) {
6679
+ if (typeof val !== "string")
6680
+ return false;
6681
+ const htmlTagRegex = /.*<(\w+)>.*/;
6682
+ return !!htmlTagRegex.test(val);
6683
+ }
6684
+ function hasValidHtml(val) {
6685
+ if (typeof val !== "string")
6686
+ return false;
6687
+ const trimmedVal = val.trim();
6688
+ const tagRegex = /<\/?(\w+)([^>]*)>/g;
6689
+ const stack = [];
6690
+ let match;
6691
+ match = tagRegex.exec(trimmedVal);
6692
+ while (match !== null) {
6693
+ const [, tagName] = match;
6694
+ const isClosingTag = match[0].startsWith("</");
6695
+ const isAtomicTag = HTML_ATOMIC_TAGS2.includes(tagName);
6696
+ if (isAtomicTag) {
6697
+ match = tagRegex.exec(trimmedVal);
6698
+ continue;
6699
+ }
6700
+ if (isClosingTag) {
6701
+ const lastTag = stack.pop();
6702
+ if (lastTag !== tagName) {
6703
+ return false;
6704
+ }
6705
+ } else {
6706
+ if (!HTML_BLOCK_TAGS2.includes(tagName)) {
6707
+ return false;
6708
+ }
6709
+ stack.push(tagName);
6710
+ }
6711
+ match = tagRegex.exec(trimmedVal);
6712
+ }
6713
+ return stack.length === 0 && tagRegex.test(trimmedVal);
6714
+ }
6715
+ function isValidBlockTag(val) {
6716
+ return isString(val) && HTML_BLOCK_TAGS2.includes(val.toLowerCase());
6717
+ }
6718
+ function isValidAtomicTag(val) {
6719
+ return isString(val) && HTML_ATOMIC_TAGS2.includes(val.toLowerCase());
6720
+ }
6721
+ function isHtml(val) {
6722
+ if (typeof val !== "string")
6723
+ return false;
6724
+ const trimmedVal = val.trim();
6725
+ const fullHtmlRegex = /^<(\w+).*<\/\1>$/;
6726
+ return fullHtmlRegex.test(trimmedVal);
6727
+ }
6728
+ function isValidHtml(val) {
6729
+ if (typeof val !== "string")
6730
+ return false;
6731
+ const trimmedVal = val.trim();
6732
+ const tagRegex = /<\/?(\w+)([^>]*)>/g;
6733
+ const stack = [];
6734
+ let match = tagRegex.exec(trimmedVal);
6735
+ while (match !== null) {
6736
+ const [, tagName] = match;
6737
+ const isClosingTag = match[0].startsWith("</");
6738
+ const isAtomicTag = HTML_ATOMIC_TAGS2.includes(tagName);
6739
+ if (isAtomicTag) {
6740
+ match = tagRegex.exec(trimmedVal);
6741
+ continue;
6742
+ }
6743
+ if (isClosingTag) {
6744
+ const lastTag = stack.pop();
6745
+ if (lastTag !== tagName) {
6746
+ return false;
6747
+ }
6748
+ } else {
6749
+ if (!HTML_BLOCK_TAGS2.includes(tagName)) {
6750
+ return false;
6751
+ }
6752
+ stack.push(tagName);
6753
+ }
6754
+ match = tagRegex.exec(trimmedVal);
6755
+ }
6756
+ const isBalanced = stack.length === 0;
6757
+ const validStructureRegex = /^<(\w+)[^>]*>[\s\S]*<\/\1>$/;
6758
+ return isBalanced && validStructureRegex.test(trimmedVal);
6759
+ }
6442
6760
  function isHtmlElement(val) {
6443
6761
  return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
6444
6762
  }
@@ -8715,6 +9033,8 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8715
9033
  HASH_TABLE_WIDE,
8716
9034
  HM_DNS,
8717
9035
  HOME_DEPOT_DNS,
9036
+ HTML_ATOMIC_TAGS,
9037
+ HTML_BLOCK_TAGS,
8718
9038
  IKEA_DNS,
8719
9039
  IMAGE_FORMAT_LOOKUP,
8720
9040
  INDIAN_NEWS,
@@ -8941,6 +9261,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8941
9261
  handleDoneFn,
8942
9262
  hasCountryCode,
8943
9263
  hasDefaultValue,
9264
+ hasHtml,
8944
9265
  hasIndexOf,
8945
9266
  hasKeys,
8946
9267
  hasOverlappingKeys,
@@ -8948,6 +9269,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8948
9269
  hasProtocolPrefix,
8949
9270
  hasUrlPort,
8950
9271
  hasUrlQueryParameter,
9272
+ hasValidHtml,
8951
9273
  hasWhiteSpace,
8952
9274
  idLiteral,
8953
9275
  idTypeGuard,
@@ -9060,6 +9382,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
9060
9382
  isHexadecimal,
9061
9383
  isHmUrl,
9062
9384
  isHomeDepotUrl,
9385
+ isHtml,
9063
9386
  isHtmlElement,
9064
9387
  isIkeaUrl,
9065
9388
  isIndexable,
@@ -9203,6 +9526,9 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
9203
9526
  isUsPhoneNumber,
9204
9527
  isUsStateAbbreviation,
9205
9528
  isUsStateName,
9529
+ isValidAtomicTag,
9530
+ isValidBlockTag,
9531
+ isValidHtml,
9206
9532
  isVariable,
9207
9533
  isVisa,
9208
9534
  isVisaMastercard,