@scalar/helpers 0.0.8 → 0.0.10

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 (36) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/array/is-defined.d.ts.map +1 -1
  3. package/dist/dom/freeze-at-top.d.ts.map +1 -1
  4. package/dist/dom/freeze-element.d.ts.map +1 -1
  5. package/dist/dom/scroll-to-id.d.ts.map +1 -1
  6. package/dist/file/json2xml.d.ts +5 -1
  7. package/dist/file/json2xml.d.ts.map +1 -1
  8. package/dist/file/json2xml.js +35 -22
  9. package/dist/file/json2xml.js.map +2 -2
  10. package/dist/general/has-modifier.d.ts +7 -0
  11. package/dist/general/has-modifier.d.ts.map +1 -0
  12. package/dist/general/has-modifier.js +9 -0
  13. package/dist/general/has-modifier.js.map +7 -0
  14. package/dist/http/can-method-have-body.d.ts.map +1 -1
  15. package/dist/http/http-info.d.ts.map +1 -1
  16. package/dist/http/is-http-method.d.ts.map +1 -1
  17. package/dist/http/normalize-http-method.d.ts.map +1 -1
  18. package/dist/object/object-keys.d.ts.map +1 -1
  19. package/dist/object/object-replace.d.ts.map +1 -1
  20. package/dist/object/omit-undefined-values.d.ts.map +1 -1
  21. package/dist/regex/find-variables.d.ts.map +1 -1
  22. package/dist/regex/regex-helpers.d.ts +2 -0
  23. package/dist/regex/regex-helpers.d.ts.map +1 -1
  24. package/dist/regex/regex-helpers.js +2 -0
  25. package/dist/regex/regex-helpers.js.map +2 -2
  26. package/dist/string/camel-to-title.d.ts.map +1 -1
  27. package/dist/string/capitalize.d.ts.map +1 -1
  28. package/dist/string/create-hash.d.ts.map +1 -1
  29. package/dist/string/iterate-title.d.ts.map +1 -1
  30. package/dist/testing/measure.d.ts.map +1 -1
  31. package/dist/testing/sleep.d.ts.map +1 -1
  32. package/dist/url/is-relative-path.d.ts.map +1 -1
  33. package/dist/url/make-url-absolute.d.ts.map +1 -1
  34. package/dist/url/merge-urls.d.ts +3 -1
  35. package/dist/url/merge-urls.d.ts.map +1 -1
  36. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @scalar/helpers
2
2
 
3
+ ## 0.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 821717b: refactor: schema rendering
8
+
9
+ ## 0.0.9
10
+
11
+ ### Patch Changes
12
+
13
+ - 98c55d0: feat: better xml rendering
14
+ - 0e747c7: fix: initial scroll to id lands in random positions
15
+
3
16
  ## 0.0.8
4
17
 
5
18
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"is-defined.d.ts","sourceRoot":"","sources":["../../src/array/is-defined.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,KAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAC1C,CAAA"}
1
+ {"version":3,"file":"is-defined.d.ts","sourceRoot":"","sources":["../../src/array/is-defined.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,KAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAC1C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"freeze-at-top.d.ts","sourceRoot":"","sources":["../../src/dom/freeze-at-top.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,OAAQ,MAAM,eAyCrC,CAAA"}
1
+ {"version":3,"file":"freeze-at-top.d.ts","sourceRoot":"","sources":["../../src/dom/freeze-at-top.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,eAyCrC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"freeze-element.d.ts","sourceRoot":"","sources":["../../src/dom/freeze-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,YAAa,WAAW,eA4DjD,CAAA"}
1
+ {"version":3,"file":"freeze-element.d.ts","sourceRoot":"","sources":["../../src/dom/freeze-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,WAAW,eA4DjD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-to-id.d.ts","sourceRoot":"","sources":["../../src/dom/scroll-to-id.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,UAAU,OAAc,MAAM,UAAU,OAAO,kBAkC3D,CAAA"}
1
+ {"version":3,"file":"scroll-to-id.d.ts","sourceRoot":"","sources":["../../src/dom/scroll-to-id.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,IAAI,MAAM,EAAE,QAAQ,OAAO,kBAkC3D,CAAA"}
@@ -1,5 +1,9 @@
1
1
  /**
2
2
  * This function converts an object to XML.
3
3
  */
4
- export declare function json2xml(data: Record<string, any>, tab?: string): string;
4
+ export declare function json2xml(data: Record<string, any>, options?: {
5
+ indent?: string;
6
+ format?: boolean;
7
+ xmlDeclaration?: boolean;
8
+ }): string;
5
9
  //# sourceMappingURL=json2xml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"json2xml.d.ts","sourceRoot":"","sources":["../../src/file/json2xml.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,UAiD/D"}
1
+ {"version":3,"file":"json2xml.d.ts","sourceRoot":"","sources":["../../src/file/json2xml.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,cAAc,CAAC,EAAE,OAAO,CAAA;CACpB,UAyEP"}
@@ -1,45 +1,58 @@
1
- function json2xml(data, tab) {
2
- const toXml = (value, key, indentation) => {
1
+ function json2xml(data, options = {}) {
2
+ const { indent = " ", format = true, xmlDeclaration = true } = options;
3
+ const toXml = (value, key, currentIndent) => {
3
4
  let xml2 = "";
4
5
  if (Array.isArray(value)) {
5
6
  for (let i = 0, n = value.length; i < n; i++) {
6
- xml2 += indentation + toXml(value[i], key, indentation + " ") + "\n";
7
+ xml2 += toXml(value[i], key, currentIndent);
7
8
  }
8
- } else if (typeof value === "object") {
9
+ } else if (typeof value === "object" && value !== null) {
9
10
  let hasChild = false;
10
- xml2 += indentation + "<" + key;
11
- for (const m in value) {
12
- if (m.charAt(0) === "@") {
13
- xml2 += " " + m.substr(1) + '="' + value[m].toString() + '"';
14
- } else {
11
+ let attributes = "";
12
+ let children = "";
13
+ for (const attr in value) {
14
+ if (attr.charAt(0) === "@") {
15
+ attributes += " " + attr.substr(1) + '="' + value[attr].toString() + '"';
16
+ }
17
+ }
18
+ for (const child in value) {
19
+ if (child === "#text") {
20
+ children += value[child];
21
+ } else if (child === "#cdata") {
22
+ children += "<![CDATA[" + value[child] + "]]>";
23
+ } else if (child.charAt(0) !== "@") {
15
24
  hasChild = true;
25
+ children += toXml(value[child], child, currentIndent + indent);
16
26
  }
17
27
  }
18
- xml2 += hasChild ? ">" : "/>";
19
28
  if (hasChild) {
20
- for (const m in value) {
21
- if (m === "#text") {
22
- xml2 += value[m];
23
- } else if (m === "#cdata") {
24
- xml2 += "<![CDATA[" + value[m] + "]]>";
25
- } else if (m.charAt(0) !== "@") {
26
- xml2 += toXml(value[m], m, indentation + " ");
27
- }
28
- }
29
- xml2 += (xml2.charAt(xml2.length - 1) === "\n" ? indentation : "") + "</" + key + ">";
29
+ xml2 += currentIndent + "<" + key + attributes + ">\n";
30
+ xml2 += children;
31
+ xml2 += currentIndent + "</" + key + ">\n";
32
+ } else {
33
+ xml2 += currentIndent + "<" + key + attributes + "/>\n";
30
34
  }
31
35
  } else {
32
- xml2 += indentation + "<" + key + ">" + value.toString() + "</" + key + ">";
36
+ xml2 += currentIndent + "<" + key + ">" + (value?.toString() || "") + "</" + key + ">\n";
33
37
  }
34
38
  return xml2;
35
39
  };
36
40
  let xml = "";
41
+ if (xmlDeclaration) {
42
+ xml += '<?xml version="1.0" encoding="UTF-8"?>';
43
+ if (format) {
44
+ xml += "\n";
45
+ }
46
+ }
37
47
  for (const key in data) {
38
48
  if (Object.hasOwn(data, key)) {
39
49
  xml += toXml(data[key], key, "");
40
50
  }
41
51
  }
42
- return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, "");
52
+ if (format) {
53
+ return xml.trim();
54
+ }
55
+ return xml.replace(/\n/g, "").replace(/>\s+</g, "><").trim();
43
56
  }
44
57
  export {
45
58
  json2xml
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/file/json2xml.ts"],
4
- "sourcesContent": ["/**\n * This function converts an object to XML.\n */\nexport function json2xml(data: Record<string, any>, tab?: string) {\n const toXml = (value: any, key: string, indentation: string) => {\n let xml = ''\n\n if (Array.isArray(value)) {\n for (let i = 0, n = value.length; i < n; i++) {\n xml += indentation + toXml(value[i], key, indentation + '\\t') + '\\n'\n }\n } else if (typeof value === 'object') {\n let hasChild = false\n xml += indentation + '<' + key\n\n for (const m in value) {\n if (m.charAt(0) === '@') {\n xml += ' ' + m.substr(1) + '=\"' + value[m].toString() + '\"'\n } else {\n hasChild = true\n }\n }\n\n xml += hasChild ? '>' : '/>'\n\n if (hasChild) {\n for (const m in value) {\n if (m === '#text') {\n xml += value[m]\n } else if (m === '#cdata') {\n xml += '<![CDATA[' + value[m] + ']]>'\n } else if (m.charAt(0) !== '@') {\n xml += toXml(value[m], m, indentation + '\\t')\n }\n }\n xml += (xml.charAt(xml.length - 1) === '\\n' ? indentation : '') + '</' + key + '>'\n }\n } else {\n xml += indentation + '<' + key + '>' + value.toString() + '</' + key + '>'\n }\n return xml\n }\n\n let xml = ''\n\n for (const key in data) {\n if (Object.hasOwn(data, key)) {\n xml += toXml(data[key], key, '')\n }\n }\n\n return tab ? xml.replace(/\\t/g, tab) : xml.replace(/\\t|\\n/g, '')\n}\n"],
5
- "mappings": "AAGO,SAAS,SAAS,MAA2B,KAAc;AAChE,QAAM,QAAQ,CAAC,OAAY,KAAa,gBAAwB;AAC9D,QAAIA,OAAM;AAEV,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,eAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,IAAI,GAAG,KAAK;AAC5C,QAAAA,QAAO,cAAc,MAAM,MAAM,CAAC,GAAG,KAAK,cAAc,GAAI,IAAI;AAAA,MAClE;AAAA,IACF,WAAW,OAAO,UAAU,UAAU;AACpC,UAAI,WAAW;AACf,MAAAA,QAAO,cAAc,MAAM;AAE3B,iBAAW,KAAK,OAAO;AACrB,YAAI,EAAE,OAAO,CAAC,MAAM,KAAK;AACvB,UAAAA,QAAO,MAAM,EAAE,OAAO,CAAC,IAAI,OAAO,MAAM,CAAC,EAAE,SAAS,IAAI;AAAA,QAC1D,OAAO;AACL,qBAAW;AAAA,QACb;AAAA,MACF;AAEA,MAAAA,QAAO,WAAW,MAAM;AAExB,UAAI,UAAU;AACZ,mBAAW,KAAK,OAAO;AACrB,cAAI,MAAM,SAAS;AACjB,YAAAA,QAAO,MAAM,CAAC;AAAA,UAChB,WAAW,MAAM,UAAU;AACzB,YAAAA,QAAO,cAAc,MAAM,CAAC,IAAI;AAAA,UAClC,WAAW,EAAE,OAAO,CAAC,MAAM,KAAK;AAC9B,YAAAA,QAAO,MAAM,MAAM,CAAC,GAAG,GAAG,cAAc,GAAI;AAAA,UAC9C;AAAA,QACF;AACA,QAAAA,SAAQA,KAAI,OAAOA,KAAI,SAAS,CAAC,MAAM,OAAO,cAAc,MAAM,OAAO,MAAM;AAAA,MACjF;AAAA,IACF,OAAO;AACL,MAAAA,QAAO,cAAc,MAAM,MAAM,MAAM,MAAM,SAAS,IAAI,OAAO,MAAM;AAAA,IACzE;AACA,WAAOA;AAAA,EACT;AAEA,MAAI,MAAM;AAEV,aAAW,OAAO,MAAM;AACtB,QAAI,OAAO,OAAO,MAAM,GAAG,GAAG;AAC5B,aAAO,MAAM,KAAK,GAAG,GAAG,KAAK,EAAE;AAAA,IACjC;AAAA,EACF;AAEA,SAAO,MAAM,IAAI,QAAQ,OAAO,GAAG,IAAI,IAAI,QAAQ,UAAU,EAAE;AACjE;",
4
+ "sourcesContent": ["/**\n * This function converts an object to XML.\n */\nexport function json2xml(\n data: Record<string, any>,\n options: {\n indent?: string\n format?: boolean\n xmlDeclaration?: boolean\n } = {},\n) {\n const { indent = ' ', format = true, xmlDeclaration = true } = options\n\n const toXml = (value: any, key: string, currentIndent: string): string => {\n let xml = ''\n\n if (Array.isArray(value)) {\n for (let i = 0, n = value.length; i < n; i++) {\n xml += toXml(value[i], key, currentIndent)\n }\n } else if (typeof value === 'object' && value !== null) {\n let hasChild = false\n let attributes = ''\n let children = ''\n\n // Handle attributes (keys starting with @)\n for (const attr in value) {\n if (attr.charAt(0) === '@') {\n attributes += ' ' + attr.substr(1) + '=\"' + value[attr].toString() + '\"'\n }\n }\n\n // Handle children and special content\n for (const child in value) {\n if (child === '#text') {\n children += value[child]\n } else if (child === '#cdata') {\n children += '<![CDATA[' + value[child] + ']]>'\n } else if (child.charAt(0) !== '@') {\n hasChild = true\n children += toXml(value[child], child, currentIndent + indent)\n }\n }\n\n if (hasChild) {\n xml += currentIndent + '<' + key + attributes + '>\\n'\n xml += children\n xml += currentIndent + '</' + key + '>\\n'\n } else {\n xml += currentIndent + '<' + key + attributes + '/>\\n'\n }\n } else {\n xml += currentIndent + '<' + key + '>' + (value?.toString() || '') + '</' + key + '>\\n'\n }\n\n return xml\n }\n\n let xml = ''\n\n // Add XML declaration if requested\n if (xmlDeclaration) {\n xml += '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\n if (format) {\n xml += '\\n'\n }\n }\n\n // Convert data to XML\n for (const key in data) {\n if (Object.hasOwn(data, key)) {\n xml += toXml(data[key], key, '')\n }\n }\n\n // Format or compact the output\n if (format) {\n return xml.trim()\n }\n\n // Remove all newlines and extra spaces, but keep the XML declaration clean\n return xml.replace(/\\n/g, '').replace(/>\\s+</g, '><').trim()\n}\n"],
5
+ "mappings": "AAGO,SAAS,SACd,MACA,UAII,CAAC,GACL;AACA,QAAM,EAAE,SAAS,MAAM,SAAS,MAAM,iBAAiB,KAAK,IAAI;AAEhE,QAAM,QAAQ,CAAC,OAAY,KAAa,kBAAkC;AACxE,QAAIA,OAAM;AAEV,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,eAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,IAAI,GAAG,KAAK;AAC5C,QAAAA,QAAO,MAAM,MAAM,CAAC,GAAG,KAAK,aAAa;AAAA,MAC3C;AAAA,IACF,WAAW,OAAO,UAAU,YAAY,UAAU,MAAM;AACtD,UAAI,WAAW;AACf,UAAI,aAAa;AACjB,UAAI,WAAW;AAGf,iBAAW,QAAQ,OAAO;AACxB,YAAI,KAAK,OAAO,CAAC,MAAM,KAAK;AAC1B,wBAAc,MAAM,KAAK,OAAO,CAAC,IAAI,OAAO,MAAM,IAAI,EAAE,SAAS,IAAI;AAAA,QACvE;AAAA,MACF;AAGA,iBAAW,SAAS,OAAO;AACzB,YAAI,UAAU,SAAS;AACrB,sBAAY,MAAM,KAAK;AAAA,QACzB,WAAW,UAAU,UAAU;AAC7B,sBAAY,cAAc,MAAM,KAAK,IAAI;AAAA,QAC3C,WAAW,MAAM,OAAO,CAAC,MAAM,KAAK;AAClC,qBAAW;AACX,sBAAY,MAAM,MAAM,KAAK,GAAG,OAAO,gBAAgB,MAAM;AAAA,QAC/D;AAAA,MACF;AAEA,UAAI,UAAU;AACZ,QAAAA,QAAO,gBAAgB,MAAM,MAAM,aAAa;AAChD,QAAAA,QAAO;AACP,QAAAA,QAAO,gBAAgB,OAAO,MAAM;AAAA,MACtC,OAAO;AACL,QAAAA,QAAO,gBAAgB,MAAM,MAAM,aAAa;AAAA,MAClD;AAAA,IACF,OAAO;AACL,MAAAA,QAAO,gBAAgB,MAAM,MAAM,OAAO,OAAO,SAAS,KAAK,MAAM,OAAO,MAAM;AAAA,IACpF;AAEA,WAAOA;AAAA,EACT;AAEA,MAAI,MAAM;AAGV,MAAI,gBAAgB;AAClB,WAAO;AACP,QAAI,QAAQ;AACV,aAAO;AAAA,IACT;AAAA,EACF;AAGA,aAAW,OAAO,MAAM;AACtB,QAAI,OAAO,OAAO,MAAM,GAAG,GAAG;AAC5B,aAAO,MAAM,KAAK,GAAG,GAAG,KAAK,EAAE;AAAA,IACjC;AAAA,EACF;AAGA,MAAI,QAAQ;AACV,WAAO,IAAI,KAAK;AAAA,EAClB;AAGA,SAAO,IAAI,QAAQ,OAAO,EAAE,EAAE,QAAQ,UAAU,IAAI,EAAE,KAAK;AAC7D;",
6
6
  "names": ["xml"]
7
7
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Checks for the modifier key
3
+ *
4
+ * Which is meta on macOs and ctrl on linux/windows
5
+ */
6
+ export declare const hasModifier: (keydown: KeyboardEvent) => boolean;
7
+ //# sourceMappingURL=has-modifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-modifier.d.ts","sourceRoot":"","sources":["../../src/general/has-modifier.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,aAAa,YAGjD,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { isMacOS } from "./is-mac-os.js";
2
+ const hasModifier = (keydown) => {
3
+ const modifier = isMacOS() ? "metaKey" : "ctrlKey";
4
+ return keydown[modifier];
5
+ };
6
+ export {
7
+ hasModifier
8
+ };
9
+ //# sourceMappingURL=has-modifier.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/general/has-modifier.ts"],
4
+ "sourcesContent": ["import { isMacOS } from './is-mac-os'\n\n/**\n * Checks for the modifier key\n *\n * Which is meta on macOs and ctrl on linux/windows\n */\nexport const hasModifier = (keydown: KeyboardEvent) => {\n const modifier = isMacOS() ? 'metaKey' : 'ctrlKey'\n return keydown[modifier]\n}\n"],
5
+ "mappings": "AAAA,SAAS,eAAe;AAOjB,MAAM,cAAc,CAAC,YAA2B;AACrD,QAAM,WAAW,QAAQ,IAAI,YAAY;AACzC,SAAO,QAAQ,QAAQ;AACzB;",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"can-method-have-body.d.ts","sourceRoot":"","sources":["../../src/http/can-method-have-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,yCAAyC;AACzC,QAAA,MAAM,YAAY,oCAAqE,CAAA;AACvF,KAAK,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/C,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,WAAY,UAAU,KAAG,MAAM,IAAI,UACN,CAAA"}
1
+ {"version":3,"file":"can-method-have-body.d.ts","sourceRoot":"","sources":["../../src/http/can-method-have-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,yCAAyC;AACzC,QAAA,MAAM,YAAY,oCAAqE,CAAA;AACvF,KAAK,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/C,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,GAAI,QAAQ,UAAU,KAAG,MAAM,IAAI,UACN,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"http-info.d.ts","sourceRoot":"","sources":["../../src/http/http-info.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,QAAQ,MAAM,EAAE,CAAA;IAC5B,QAAQ,EAAE,sBAAsB,MAAM,GAAG,CAAA;IACzC,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDqB,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,iBAAiB,eAAgB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASnD,CAAA"}
1
+ {"version":3,"file":"http-info.d.ts","sourceRoot":"","sources":["../../src/http/http-info.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,QAAQ,MAAM,EAAE,CAAA;IAC5B,QAAQ,EAAE,sBAAsB,MAAM,GAAG,CAAA;IACzC,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDqB,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASnD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-http-method.d.ts","sourceRoot":"","sources":["../../src/http/is-http-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE7D,yFAAyF;AACzF,eAAO,MAAM,YAAY,YAAa,MAAM,GAAG,SAAS,KAAG,MAAM,IAAI,UAC+B,CAAA"}
1
+ {"version":3,"file":"is-http-method.d.ts","sourceRoot":"","sources":["../../src/http/is-http-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE7D,yFAAyF;AACzF,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,GAAG,SAAS,KAAG,MAAM,IAAI,UAC+B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-http-method.d.ts","sourceRoot":"","sources":["../../src/http/normalize-http-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAKhD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,YAAa,MAAM,KAAG,UAoBrD,CAAA"}
1
+ {"version":3,"file":"normalize-http-method.d.ts","sourceRoot":"","sources":["../../src/http/normalize-http-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAKhD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,UAoBrD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"object-keys.d.ts","sourceRoot":"","sources":["../../src/object/object-keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,OAAO,CAAC,KAAG,CAAC,MAAM,CAAC,CAAC,EAAqC,CAAA"}
1
+ {"version":3,"file":"object-keys.d.ts","sourceRoot":"","sources":["../../src/object/object-keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,EAAE,KAAK,CAAC,KAAG,CAAC,MAAM,CAAC,CAAC,EAAqC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"object-replace.d.ts","sourceRoot":"","sources":["../../src/object/object-replace.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,UAAU,CAAC,eAAe,CAAC,KAU7D,CAC7B,CAAA"}
1
+ {"version":3,"file":"object-replace.d.ts","sourceRoot":"","sources":["../../src/object/object-replace.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,CAAC,KAU7D,CAC7B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"omit-undefined-values.d.ts","sourceRoot":"","sources":["../../src/object/omit-undefined-values.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,QAAQ,CAAC,KAAG,CAkB/D,CAAA"}
1
+ {"version":3,"file":"omit-undefined-values.d.ts","sourceRoot":"","sources":["../../src/object/omit-undefined-values.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,KAAG,CAkB/D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"find-variables.d.ts","sourceRoot":"","sources":["../../src/regex/find-variables.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,MAAM,2BACiE,CAAA"}
1
+ {"version":3,"file":"find-variables.d.ts","sourceRoot":"","sources":["../../src/regex/find-variables.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,2BACiE,CAAA"}
@@ -5,6 +5,8 @@ export declare const REGEX: {
5
5
  readonly MULTIPLE_SLASHES: RegExp;
6
6
  readonly VARIABLES: RegExp;
7
7
  readonly PATH: RegExp;
8
+ /** Finds the name of the schema from the ref path */
9
+ readonly REF_NAME: RegExp;
8
10
  readonly TEMPLATE_VARIABLE: RegExp;
9
11
  };
10
12
  //# sourceMappingURL=regex-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"regex-helpers.d.ts","sourceRoot":"","sources":["../../src/regex/regex-helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK;IAChB,gCAAgC;;IAEhC,6EAA6E;;;;;CAKrE,CAAA"}
1
+ {"version":3,"file":"regex-helpers.d.ts","sourceRoot":"","sources":["../../src/regex/regex-helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK;IAChB,gCAAgC;;IAEhC,6EAA6E;;;;IAI7E,qDAAqD;;;CAG7C,CAAA"}
@@ -5,6 +5,8 @@ const REGEX = {
5
5
  MULTIPLE_SLASHES: /(?<!:)\/{2,}/g,
6
6
  VARIABLES: /{{((?:[^{}]|{[^{}]*})*)}}/g,
7
7
  PATH: /(?:{)([^{}]+)}(?!})/g,
8
+ /** Finds the name of the schema from the ref path */
9
+ REF_NAME: /\/([^\/]+)$/,
8
10
  TEMPLATE_VARIABLE: /{{\s*([^}\s]+?)\s*}}|{\s*([^}\s]+?)\s*}|:\b[\w.]+\b/g
9
11
  };
10
12
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/regex/regex-helpers.ts"],
4
- "sourcesContent": ["export const REGEX = {\n /** Checks for a valid scheme */\n PROTOCOL: /^(?:https?|ftp|file|mailto|tel|data|wss?)*:\\/\\//,\n /** Finds multiple slashes after the scheme to replace with a single slash */\n MULTIPLE_SLASHES: /(?<!:)\\/{2,}/g,\n VARIABLES: /{{((?:[^{}]|{[^{}]*})*)}}/g,\n PATH: /(?:{)([^{}]+)}(?!})/g,\n TEMPLATE_VARIABLE: /{{\\s*([^}\\s]+?)\\s*}}|{\\s*([^}\\s]+?)\\s*}|:\\b[\\w.]+\\b/g,\n} as const\n"],
5
- "mappings": "AAAO,MAAM,QAAQ;AAAA;AAAA,EAEnB,UAAU;AAAA;AAAA,EAEV,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,MAAM;AAAA,EACN,mBAAmB;AACrB;",
4
+ "sourcesContent": ["export const REGEX = {\n /** Checks for a valid scheme */\n PROTOCOL: /^(?:https?|ftp|file|mailto|tel|data|wss?)*:\\/\\//,\n /** Finds multiple slashes after the scheme to replace with a single slash */\n MULTIPLE_SLASHES: /(?<!:)\\/{2,}/g,\n VARIABLES: /{{((?:[^{}]|{[^{}]*})*)}}/g,\n PATH: /(?:{)([^{}]+)}(?!})/g,\n /** Finds the name of the schema from the ref path */\n REF_NAME: /\\/([^\\/]+)$/,\n TEMPLATE_VARIABLE: /{{\\s*([^}\\s]+?)\\s*}}|{\\s*([^}\\s]+?)\\s*}|:\\b[\\w.]+\\b/g,\n} as const\n"],
5
+ "mappings": "AAAO,MAAM,QAAQ;AAAA;AAAA,EAEnB,UAAU;AAAA;AAAA,EAEV,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,MAAM;AAAA;AAAA,EAEN,UAAU;AAAA,EACV,mBAAmB;AACrB;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"camel-to-title.d.ts","sourceRoot":"","sources":["../../src/string/camel-to-title.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,+BAKnB,CAAA"}
1
+ {"version":3,"file":"camel-to-title.d.ts","sourceRoot":"","sources":["../../src/string/camel-to-title.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,iBAAa,WAKpC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"capitalize.d.ts","sourceRoot":"","sources":["../../src/string/capitalize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU,0BAA6D,CAAA"}
1
+ {"version":3,"file":"capitalize.d.ts","sourceRoot":"","sources":["../../src/string/capitalize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,YAAQ,WAAiD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-hash.d.ts","sourceRoot":"","sources":["../../src/string/create-hash.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,UAAU,WAAY,MAAM,KAAG,MAe3C,CAAA"}
1
+ {"version":3,"file":"create-hash.d.ts","sourceRoot":"","sources":["../../src/string/create-hash.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,KAAG,MAe3C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"iterate-title.d.ts","sourceRoot":"","sources":["../../src/string/iterate-title.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,mBAAmB,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,yBAAqB,MAa3G,CAAA"}
1
+ {"version":3,"file":"iterate-title.d.ts","sourceRoot":"","sources":["../../src/string/iterate-title.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,iBAAiB,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,EAAE,kBAAgB,KAAG,MAa3G,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../src/testing/measure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,QAAQ,MAAM,MAAM,MAAM,CAAC,KAAG,CAW1D,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,QAAQ,MAAM,MAAM,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAWnF,CAAA"}
1
+ {"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../src/testing/measure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,MAAM,MAAM,EAAE,IAAI,MAAM,CAAC,KAAG,CAW1D,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,EAAE,MAAM,MAAM,EAAE,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAWnF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/testing/sleep.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,KAAK,OAAQ,MAAM,qBAA0C,CAAA"}
1
+ {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/testing/sleep.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,qBAA0C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-relative-path.d.ts","sourceRoot":"","sources":["../../src/url/is-relative-path.ts"],"names":[],"mappings":"AAEA;;IAEI;AACJ,eAAO,MAAM,cAAc,QAAS,MAAM,YAazC,CAAA"}
1
+ {"version":3,"file":"is-relative-path.d.ts","sourceRoot":"","sources":["../../src/url/is-relative-path.ts"],"names":[],"mappings":"AAEA;;IAEI;AACJ,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,YAazC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"make-url-absolute.d.ts","sourceRoot":"","sources":["../../src/url/make-url-absolute.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,QACrB,MAAM,2BAMR;IACD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,KACA,MA6BF,CAAA"}
1
+ {"version":3,"file":"make-url-absolute.d.ts","sourceRoot":"","sources":["../../src/url/make-url-absolute.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,KAAK,MAAM,EACX,yBAKG;IACD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACb,KACL,MA6BF,CAAA"}
@@ -11,5 +11,7 @@ export declare const combineUrlAndPath: (url: string, path: string) => string;
11
11
  * also optionally merges query params if you include urlSearchParams
12
12
  * This was re-written without using URL to support variables in the scheme
13
13
  */
14
- export declare const mergeUrls: (url: string, path: string, urlParams?: URLSearchParams, disableOriginPrefix?: boolean) => string;
14
+ export declare const mergeUrls: (url: string, path: string, urlParams?: URLSearchParams,
15
+ /** To disable prefixing the url with the origin or a scheme*/
16
+ disableOriginPrefix?: boolean) => string;
15
17
  //# sourceMappingURL=merge-urls.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-urls.d.ts","sourceRoot":"","sources":["../../src/url/merge-urls.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,cAAe,eAAe,EAAE,KAAG,eA6BhE,CAAA;AAED,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,QAAS,MAAM,QAAQ,MAAM,WAU1D,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,QACf,MAAM,QACL,MAAM,cACD,eAAe,0CAmC3B,CAAA"}
1
+ {"version":3,"file":"merge-urls.d.ts","sourceRoot":"","sources":["../../src/url/merge-urls.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,GAAG,QAAQ,eAAe,EAAE,KAAG,eA6BhE,CAAA;AAED,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,EAAE,MAAM,MAAM,WAU1D,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GACpB,KAAK,MAAM,EACX,MAAM,MAAM,EACZ,YAAW,eAAuC;AAClD,8DAA8D;AAC9D,6BAA2B,WAiC5B,CAAA"}
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "helpers",
15
15
  "js"
16
16
  ],
17
- "version": "0.0.8",
17
+ "version": "0.0.10",
18
18
  "engines": {
19
19
  "node": ">=20"
20
20
  },
@@ -80,7 +80,7 @@
80
80
  "devDependencies": {
81
81
  "vite": "6.1.6",
82
82
  "vitest": "^3.2.4",
83
- "@scalar/build-tooling": "0.2.6"
83
+ "@scalar/build-tooling": "0.2.7"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "scalar-build-esbuild",