@stryke/url 0.3.25 → 0.3.27

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 (80) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -1
  3. package/dist/helpers.cjs +28 -1
  4. package/dist/helpers.mjs +26 -1
  5. package/dist/helpers.mjs.map +1 -1
  6. package/dist/index.cjs +5 -1
  7. package/dist/index.mjs +4 -1
  8. package/dist/json/src/storm-json.cjs +117 -1
  9. package/dist/json/src/storm-json.mjs +115 -1
  10. package/dist/json/src/storm-json.mjs.map +1 -1
  11. package/dist/json/src/utils/code-frames.cjs +77 -3
  12. package/dist/json/src/utils/code-frames.mjs +76 -3
  13. package/dist/json/src/utils/code-frames.mjs.map +1 -1
  14. package/dist/json/src/utils/parse-error.cjs +34 -1
  15. package/dist/json/src/utils/parse-error.mjs +33 -1
  16. package/dist/json/src/utils/parse-error.mjs.map +1 -1
  17. package/dist/json/src/utils/parse.cjs +45 -1
  18. package/dist/json/src/utils/parse.mjs +45 -1
  19. package/dist/json/src/utils/parse.mjs.map +1 -1
  20. package/dist/json/src/utils/stringify.cjs +67 -1
  21. package/dist/json/src/utils/stringify.mjs +67 -1
  22. package/dist/json/src/utils/stringify.mjs.map +1 -1
  23. package/dist/json/src/utils/strip-comments.cjs +86 -4
  24. package/dist/json/src/utils/strip-comments.mjs +86 -4
  25. package/dist/json/src/utils/strip-comments.mjs.map +1 -1
  26. package/dist/path/src/is-type.cjs +28 -1
  27. package/dist/path/src/is-type.mjs +28 -1
  28. package/dist/path/src/is-type.mjs.map +1 -1
  29. package/dist/path/src/join-paths.cjs +106 -1
  30. package/dist/path/src/join-paths.mjs +106 -1
  31. package/dist/path/src/join-paths.mjs.map +1 -1
  32. package/dist/path/src/regex.cjs +12 -1
  33. package/dist/path/src/regex.mjs +8 -1
  34. package/dist/path/src/regex.mjs.map +1 -1
  35. package/dist/path/src/slash.cjs +15 -1
  36. package/dist/path/src/slash.mjs +14 -1
  37. package/dist/path/src/slash.mjs.map +1 -1
  38. package/dist/storm-url.cjs +227 -1
  39. package/dist/storm-url.mjs +226 -1
  40. package/dist/storm-url.mjs.map +1 -1
  41. package/dist/type-checks/src/get-object-tag.cjs +15 -1
  42. package/dist/type-checks/src/get-object-tag.mjs +14 -1
  43. package/dist/type-checks/src/get-object-tag.mjs.map +1 -1
  44. package/dist/type-checks/src/is-empty.cjs +20 -1
  45. package/dist/type-checks/src/is-empty.mjs +20 -1
  46. package/dist/type-checks/src/is-empty.mjs.map +1 -1
  47. package/dist/type-checks/src/is-integer.cjs +14 -1
  48. package/dist/type-checks/src/is-integer.mjs +14 -1
  49. package/dist/type-checks/src/is-integer.mjs.map +1 -1
  50. package/dist/type-checks/src/is-null.cjs +12 -1
  51. package/dist/type-checks/src/is-null.mjs +11 -1
  52. package/dist/type-checks/src/is-null.mjs.map +1 -1
  53. package/dist/type-checks/src/is-number.cjs +18 -1
  54. package/dist/type-checks/src/is-number.mjs +17 -1
  55. package/dist/type-checks/src/is-number.mjs.map +1 -1
  56. package/dist/type-checks/src/is-object.cjs +19 -1
  57. package/dist/type-checks/src/is-object.mjs +19 -1
  58. package/dist/type-checks/src/is-object.mjs.map +1 -1
  59. package/dist/type-checks/src/is-plain-object.cjs +63 -1
  60. package/dist/type-checks/src/is-plain-object.mjs +63 -1
  61. package/dist/type-checks/src/is-plain-object.mjs.map +1 -1
  62. package/dist/type-checks/src/is-set-string.cjs +20 -1
  63. package/dist/type-checks/src/is-set-string.mjs +20 -1
  64. package/dist/type-checks/src/is-set-string.mjs.map +1 -1
  65. package/dist/type-checks/src/is-set.cjs +19 -1
  66. package/dist/type-checks/src/is-set.mjs +19 -1
  67. package/dist/type-checks/src/is-set.mjs.map +1 -1
  68. package/dist/type-checks/src/is-string.cjs +12 -1
  69. package/dist/type-checks/src/is-string.mjs +11 -1
  70. package/dist/type-checks/src/is-string.mjs.map +1 -1
  71. package/dist/type-checks/src/is-undefined.cjs +8 -1
  72. package/dist/type-checks/src/is-undefined.mjs +7 -1
  73. package/dist/type-checks/src/is-undefined.mjs.map +1 -1
  74. package/dist/types/src/base.cjs +6 -1
  75. package/dist/types/src/base.mjs +5 -1
  76. package/dist/types/src/base.mjs.map +1 -1
  77. package/dist/types.cjs +6 -1
  78. package/dist/types.mjs +5 -1
  79. package/dist/types.mjs.map +1 -1
  80. package/package.json +2 -2
@@ -1,2 +1,227 @@
1
- import{formatLocalePath as e,isValidURL as t}from"./helpers.mjs";import{isUndefined as n}from"./type-checks/src/is-undefined.mjs";import{StormJSON as r}from"./json/src/storm-json.mjs";import{joinPaths as i}from"./path/src/join-paths.mjs";import{isInteger as a}from"./type-checks/src/is-integer.mjs";import{isSetString as o}from"./type-checks/src/is-set-string.mjs";import{cleanDoubleSlashes as s,decode as c,isEqual as l,isNonEmptyURL as u,isRelative as d,isSamePath as f,isScriptProtocol as p,normalizeURL as m,parseAuth as h,parseHost as g,parsePath as _,parseQuery as v,parseURL as y,stringifyParsedURL as b,stringifyQuery as x}from"ufo";var S=class S{#e;#t;#n;#r;#i;#a;#o=[];#s;#c;constructor(n,r={decode:!0}){if(n&&!t(n))throw TypeError(`Invalid URL: ${n}`);this.#e=r;let i=y(this.#e.decode?c(n):n),a=h(i.auth);this.#t=a.username,this.#n=a.password;let s=g(i.host);this.#r=s.hostname,this.#i=s.port,this.#a=i.protocol,this.#s=i.hash||``,this.#c=v(i.search),this.#o=i.pathname?i.pathname.split(`/`).filter(Boolean):[],r.locale&&this.#o.unshift(e((o(r.locale)?r.locale:process.env.DEFAULT_LOCALE)||`en-us`))}set params(e){this.#c=e}get params(){return this.#c}get searchParams(){let e=new URLSearchParams;for(let[t,n]of Object.entries(this.params))e.append(t,n);return e}set searchParams(e){this.params=Object.fromEntries(e.entries())}set search(e){this.params=v(e)}get search(){let e=x(this.params);return e?e.startsWith(`?`)?e:`?${e}`:``}set hash(e){this.#s=e.startsWith(`#`)?e:`#${e}`}get hash(){return this.#s}set port(e){this.#i=!n(e)&&a(e)?`${e}`:``}get port(){return this.#i||``}set username(e){this.auth=`${e}:${this.#n}`}get username(){return this.#t||``}set password(e){this.auth=`${this.#t}:${e}`}get password(){return this.#n||``}set auth(e){let t=h(e);this.#t=t.username,this.#n=t.password}get auth(){return this.#t&&this.#n?`${this.#t}:${this.#n}`:this.#t?this.#t:this.#n?this.#n:``}set protocol(e){this.#a=e.endsWith(`:`)?e:e.endsWith(`://`)?e.slice(0,-2):`${e}:`}get protocol(){return this.#a||this.#e.defaultProtocol||`https:`}set hostname(e){this.#r=e}get hostname(){return this.#r}set host(e){let t=g(e);this.#r=t.hostname,this.#i=t.port}get host(){return this.#r&&this.#i?`${this.#r}:${this.#i}`:this.#r?this.#r:this.#i?this.#i:``}set paths(e){this.#o=e.filter(Boolean)}get paths(){return this.#o}set pathname(e){this.paths=s(e).split(`/`)}get pathname(){return`/${this.paths?i(...this.paths.map(e=>r.stringify(e))):``}`}set path(e){let t=_(e);this.pathname=t.pathname,this.search=t.search,this.#s=t.hash}get path(){return b({pathname:this.pathname,search:this.search,hash:this.hash})}get href(){return this.toString()}set href(e){let t=y(e);this.protocol=t.protocol||this.protocol,this.auth=t.auth||this.auth,this.host=t.host||this.host,this.pathname=t.pathname||this.pathname,this.search=t.search||this.search,this.hash=t.hash||this.hash}get origin(){return`${this.protocol}//${this.host}`}get isScriptProtocol(){return p(this.protocol)}get isRelative(){return d(this.toString())}get isNonEmptyURL(){return u(this.toString())}get __typename(){return`StormURL`}isSamePath(e){return f(this.path,e)}isEqual(e){return l(this.toString(),typeof e==`string`?e:e instanceof S?e.toString():b(e))}toParsed(){return{protocol:this.protocol,auth:this.auth,host:this.host,pathname:this.pathname,search:this.search,hash:this.hash}}toString(){return b(this.toParsed())}toEncoded(){return m(this.toString())}toJSON(){return r.stringify(this.toParsed())}};r.instance.registerCustom({isApplicable:e=>e.__typename===`StormURL`,serialize:e=>e.toEncoded(),deserialize:e=>new S(e,{decode:!0})},`StormURL`);export{S as StormURL};
1
+ import { formatLocalePath, isValidURL } from "./helpers.mjs";
2
+ import { isUndefined } from "./type-checks/src/is-undefined.mjs";
3
+ import { StormJSON } from "./json/src/storm-json.mjs";
4
+ import { joinPaths } from "./path/src/join-paths.mjs";
5
+ import { isInteger } from "./type-checks/src/is-integer.mjs";
6
+ import { isSetString } from "./type-checks/src/is-set-string.mjs";
7
+ import { cleanDoubleSlashes, decode, isEqual, isNonEmptyURL, isRelative, isSamePath, isScriptProtocol, normalizeURL, parseAuth, parseHost, parsePath, parseQuery, parseURL, stringifyParsedURL, stringifyQuery } from "ufo";
8
+
9
+ //#region src/storm-url.ts
10
+ /**
11
+ * A class used to build URLs
12
+ *
13
+ * @remarks
14
+ * This class is used to build URLs with a fluent API.
15
+ *
16
+ * The [UFO](https://github.com/unjs/ufo) library is used under the hood to parse and stringify URLs.
17
+ */
18
+ var StormURL = class StormURL {
19
+ #options;
20
+ /**
21
+ * A string containing the username specified before the domain name.
22
+ */
23
+ #username;
24
+ /**
25
+ * A string containing the password specified before the domain name.
26
+ */
27
+ #password;
28
+ /**
29
+ * A string containing the domain of the URL.
30
+ */
31
+ #hostname;
32
+ /**
33
+ * A string containing the port number of the URL.
34
+ */
35
+ #port;
36
+ /**
37
+ * A string containing the protocol scheme of the URL, including the final `:`.
38
+ */
39
+ #protocol;
40
+ /**
41
+ * The paths of the URL
42
+ */
43
+ #paths = [];
44
+ /**
45
+ * A string containing a `#` followed by the fragment identifier of the URL.
46
+ */
47
+ #hash;
48
+ /**
49
+ * The search parameters of the URL
50
+ */
51
+ #params;
52
+ constructor(initialURL, options = { decode: true }) {
53
+ if (initialURL && !isValidURL(initialURL)) throw new TypeError(`Invalid URL: ${initialURL}`);
54
+ this.#options = options;
55
+ const parsedURL = parseURL(this.#options.decode ? decode(initialURL) : initialURL);
56
+ const parsedAuth = parseAuth(parsedURL.auth);
57
+ this.#username = parsedAuth.username;
58
+ this.#password = parsedAuth.password;
59
+ const parsedHost = parseHost(parsedURL.host);
60
+ this.#hostname = parsedHost.hostname;
61
+ this.#port = parsedHost.port;
62
+ this.#protocol = parsedURL.protocol;
63
+ this.#hash = parsedURL.hash || "";
64
+ this.#params = parseQuery(parsedURL.search);
65
+ this.#paths = parsedURL.pathname ? parsedURL.pathname.split("/").filter(Boolean) : [];
66
+ if (options.locale) this.#paths.unshift(formatLocalePath((isSetString(options.locale) ? options.locale : process.env.DEFAULT_LOCALE) || "en-us"));
67
+ }
68
+ set params(value) {
69
+ this.#params = value;
70
+ }
71
+ get params() {
72
+ return this.#params;
73
+ }
74
+ get searchParams() {
75
+ const params = new URLSearchParams();
76
+ for (const [key, value] of Object.entries(this.params)) params.append(key, value);
77
+ return params;
78
+ }
79
+ set searchParams(value) {
80
+ this.params = Object.fromEntries(value.entries());
81
+ }
82
+ set search(value) {
83
+ this.params = parseQuery(value);
84
+ }
85
+ get search() {
86
+ const search = stringifyQuery(this.params);
87
+ return search ? search.startsWith("?") ? search : `?${search}` : "";
88
+ }
89
+ set hash(value) {
90
+ this.#hash = value.startsWith("#") ? value : `#${value}`;
91
+ }
92
+ get hash() {
93
+ return this.#hash;
94
+ }
95
+ set port(value) {
96
+ this.#port = !isUndefined(value) && isInteger(value) ? `${value}` : "";
97
+ }
98
+ get port() {
99
+ return this.#port || "";
100
+ }
101
+ set username(value) {
102
+ this.auth = `${value}:${this.#password}`;
103
+ }
104
+ get username() {
105
+ return this.#username || "";
106
+ }
107
+ set password(value) {
108
+ this.auth = `${this.#username}:${value}`;
109
+ }
110
+ get password() {
111
+ return this.#password || "";
112
+ }
113
+ set auth(value) {
114
+ const parsedAuth = parseAuth(value);
115
+ this.#username = parsedAuth.username;
116
+ this.#password = parsedAuth.password;
117
+ }
118
+ get auth() {
119
+ return this.#username && this.#password ? `${this.#username}:${this.#password}` : this.#username ? this.#username : this.#password ? this.#password : "";
120
+ }
121
+ set protocol(value) {
122
+ this.#protocol = value.endsWith(":") ? value : value.endsWith("://") ? value.slice(0, -2) : `${value}:`;
123
+ }
124
+ get protocol() {
125
+ return this.#protocol || this.#options.defaultProtocol || "https:";
126
+ }
127
+ set hostname(value) {
128
+ this.#hostname = value;
129
+ }
130
+ get hostname() {
131
+ return this.#hostname;
132
+ }
133
+ set host(value) {
134
+ const parsedHost = parseHost(value);
135
+ this.#hostname = parsedHost.hostname;
136
+ this.#port = parsedHost.port;
137
+ }
138
+ get host() {
139
+ return this.#hostname && this.#port ? `${this.#hostname}:${this.#port}` : this.#hostname ? this.#hostname : this.#port ? this.#port : "";
140
+ }
141
+ set paths(value) {
142
+ this.#paths = value.filter(Boolean);
143
+ }
144
+ get paths() {
145
+ return this.#paths;
146
+ }
147
+ set pathname(value) {
148
+ this.paths = cleanDoubleSlashes(value).split("/");
149
+ }
150
+ get pathname() {
151
+ return `/${this.paths ? joinPaths(...this.paths.map((path) => StormJSON.stringify(path))) : ""}`;
152
+ }
153
+ set path(value) {
154
+ const parsedPath = parsePath(value);
155
+ this.pathname = parsedPath.pathname;
156
+ this.search = parsedPath.search;
157
+ this.#hash = parsedPath.hash;
158
+ }
159
+ get path() {
160
+ return stringifyParsedURL({
161
+ pathname: this.pathname,
162
+ search: this.search,
163
+ hash: this.hash
164
+ });
165
+ }
166
+ get href() {
167
+ return this.toString();
168
+ }
169
+ set href(value) {
170
+ const parsedURL = parseURL(value);
171
+ this.protocol = parsedURL.protocol || this.protocol;
172
+ this.auth = parsedURL.auth || this.auth;
173
+ this.host = parsedURL.host || this.host;
174
+ this.pathname = parsedURL.pathname || this.pathname;
175
+ this.search = parsedURL.search || this.search;
176
+ this.hash = parsedURL.hash || this.hash;
177
+ }
178
+ get origin() {
179
+ return `${this.protocol}//${this.host}`;
180
+ }
181
+ get isScriptProtocol() {
182
+ return isScriptProtocol(this.protocol);
183
+ }
184
+ get isRelative() {
185
+ return isRelative(this.toString());
186
+ }
187
+ get isNonEmptyURL() {
188
+ return isNonEmptyURL(this.toString());
189
+ }
190
+ get __typename() {
191
+ return "StormURL";
192
+ }
193
+ isSamePath(path) {
194
+ return isSamePath(this.path, path);
195
+ }
196
+ isEqual(url) {
197
+ return isEqual(this.toString(), typeof url === "string" ? url : url instanceof StormURL ? url.toString() : stringifyParsedURL(url));
198
+ }
199
+ toParsed() {
200
+ return {
201
+ protocol: this.protocol,
202
+ auth: this.auth,
203
+ host: this.host,
204
+ pathname: this.pathname,
205
+ search: this.search,
206
+ hash: this.hash
207
+ };
208
+ }
209
+ toString() {
210
+ return stringifyParsedURL(this.toParsed());
211
+ }
212
+ toEncoded() {
213
+ return normalizeURL(this.toString());
214
+ }
215
+ toJSON() {
216
+ return StormJSON.stringify(this.toParsed());
217
+ }
218
+ };
219
+ StormJSON.instance.registerCustom({
220
+ isApplicable: (v) => v.__typename === "StormURL",
221
+ serialize: (v) => v.toEncoded(),
222
+ deserialize: (v) => new StormURL(v, { decode: true })
223
+ }, "StormURL");
224
+
225
+ //#endregion
226
+ export { StormURL };
2
227
  //# sourceMappingURL=storm-url.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"storm-url.mjs","names":["#options","decodeURL","#username","#password","#hostname","#port","#protocol","#hash","#params","#paths"],"sources":["../src/storm-url.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isInteger } from \"@stryke/type-checks/is-integer\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport type { ParsedURL } from \"ufo\";\nimport {\n cleanDoubleSlashes,\n decode as decodeURL,\n isEqual,\n isNonEmptyURL,\n isRelative,\n isSamePath,\n isScriptProtocol,\n normalizeURL,\n parseAuth,\n parseHost,\n parsePath,\n parseQuery,\n parseURL,\n stringifyParsedURL,\n stringifyQuery\n} from \"ufo\";\nimport { formatLocalePath, isValidURL } from \"./helpers\";\nimport type { StormURLInterface, StormURLOptions } from \"./types\";\n\n/**\n * A class used to build URLs\n *\n * @remarks\n * This class is used to build URLs with a fluent API.\n *\n * The [UFO](https://github.com/unjs/ufo) library is used under the hood to parse and stringify URLs.\n */\nexport class StormURL implements StormURLInterface, URL {\n #options: StormURLOptions;\n\n /**\n * A string containing the username specified before the domain name.\n */\n #username?: string;\n\n /**\n * A string containing the password specified before the domain name.\n */\n #password?: string;\n\n /**\n * A string containing the domain of the URL.\n */\n #hostname: string;\n\n /**\n * A string containing the port number of the URL.\n */\n #port?: string;\n\n /**\n * A string containing the protocol scheme of the URL, including the final `:`.\n */\n #protocol?: string;\n\n /**\n * The paths of the URL\n */\n #paths: string[] = [];\n\n /**\n * A string containing a `#` followed by the fragment identifier of the URL.\n */\n #hash: string;\n\n /**\n * The search parameters of the URL\n */\n #params: Record<string, any>;\n\n constructor(initialURL: string, options: StormURLOptions = { decode: true }) {\n if (initialURL && !isValidURL(initialURL)) {\n throw new TypeError(`Invalid URL: ${initialURL}`);\n }\n\n this.#options = options;\n\n const parsedURL = parseURL(\n this.#options.decode ? decodeURL(initialURL) : initialURL\n );\n\n const parsedAuth = parseAuth(parsedURL.auth);\n this.#username = parsedAuth.username;\n this.#password = parsedAuth.password;\n\n const parsedHost = parseHost(parsedURL.host);\n this.#hostname = parsedHost.hostname;\n this.#port = parsedHost.port;\n\n this.#protocol = parsedURL.protocol;\n this.#hash = parsedURL.hash || \"\";\n this.#params = parseQuery(parsedURL.search);\n\n this.#paths = parsedURL.pathname\n ? parsedURL.pathname.split(\"/\").filter(Boolean)\n : [];\n if (options.locale) {\n this.#paths.unshift(\n formatLocalePath(\n (isSetString(options.locale)\n ? options.locale\n : process.env.DEFAULT_LOCALE) || \"en-us\"\n )\n );\n }\n }\n\n public set params(value: Record<string, any>) {\n this.#params = value;\n }\n\n public get params(): Record<string, any> {\n return this.#params;\n }\n\n public get searchParams(): URLSearchParams {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(this.params)) {\n params.append(key, value);\n }\n return params;\n }\n\n public set searchParams(value: URLSearchParams) {\n this.params = Object.fromEntries(value.entries());\n }\n\n public set search(value: string) {\n this.params = parseQuery(value);\n }\n\n public get search(): string {\n const search = stringifyQuery(this.params);\n\n return search ? (search.startsWith(\"?\") ? search : `?${search}`) : \"\";\n }\n\n public set hash(value: string) {\n this.#hash = value.startsWith(\"#\") ? value : `#${value}`;\n }\n\n public get hash(): string {\n return this.#hash;\n }\n\n public set port(value: string | number) {\n this.#port = !isUndefined(value) && isInteger(value) ? `${value}` : \"\";\n }\n\n public get port(): string {\n return this.#port || \"\";\n }\n\n public set username(value: string) {\n this.auth = `${value}:${this.#password}`;\n }\n\n public get username(): string {\n return this.#username || \"\";\n }\n\n public set password(value: string) {\n this.auth = `${this.#username}:${value}`;\n }\n\n public get password(): string {\n return this.#password || \"\";\n }\n\n public set auth(value: string | undefined) {\n const parsedAuth = parseAuth(value);\n\n this.#username = parsedAuth.username;\n this.#password = parsedAuth.password;\n }\n\n public get auth(): string {\n return this.#username && this.#password\n ? `${this.#username}:${this.#password}`\n : this.#username\n ? this.#username\n : this.#password\n ? this.#password\n : \"\";\n }\n\n public set protocol(value: string) {\n this.#protocol = value.endsWith(\":\")\n ? value\n : value.endsWith(\"://\")\n ? value.slice(0, -2)\n : `${value}:`;\n }\n\n public get protocol(): string {\n return this.#protocol || this.#options.defaultProtocol || \"https:\";\n }\n\n public set hostname(value: string) {\n this.#hostname = value;\n }\n\n public get hostname(): string {\n return this.#hostname;\n }\n\n public set host(value: string | undefined) {\n const parsedHost = parseHost(value);\n this.#hostname = parsedHost.hostname;\n this.#port = parsedHost.port;\n }\n\n public get host(): string {\n return this.#hostname && this.#port\n ? `${this.#hostname}:${this.#port}`\n : this.#hostname\n ? this.#hostname\n : this.#port\n ? this.#port\n : \"\";\n }\n\n public set paths(value: any[]) {\n this.#paths = value.filter(Boolean);\n }\n\n public get paths(): any[] {\n return this.#paths;\n }\n\n public set pathname(value: string) {\n this.paths = cleanDoubleSlashes(value).split(\"/\");\n }\n\n public get pathname(): string {\n return `/${this.paths ? joinPaths(...this.paths.map(path => StormJSON.stringify(path))) : \"\"}`;\n }\n\n public set path(value: string) {\n const parsedPath = parsePath(value);\n this.pathname = parsedPath.pathname;\n this.search = parsedPath.search;\n this.#hash = parsedPath.hash;\n }\n\n public get path(): string {\n return stringifyParsedURL({\n pathname: this.pathname,\n search: this.search,\n hash: this.hash\n });\n }\n\n public get href(): string {\n return this.toString();\n }\n\n public set href(value: string) {\n const parsedURL = parseURL(value);\n this.protocol = parsedURL.protocol || this.protocol;\n this.auth = parsedURL.auth || this.auth;\n this.host = parsedURL.host || this.host;\n this.pathname = parsedURL.pathname || this.pathname;\n this.search = parsedURL.search || this.search;\n this.hash = parsedURL.hash || this.hash;\n }\n\n public get origin(): string {\n return `${this.protocol}//${this.host}`;\n }\n\n public get isScriptProtocol(): boolean {\n return isScriptProtocol(this.protocol);\n }\n\n public get isRelative(): boolean {\n return isRelative(this.toString());\n }\n\n public get isNonEmptyURL(): boolean {\n return isNonEmptyURL(this.toString());\n }\n\n // eslint-disable-next-line ts/naming-convention\n public get __typename() {\n return \"StormURL\";\n }\n\n public isSamePath(path: string): boolean {\n return isSamePath(this.path, path);\n }\n\n public isEqual(url: string | ParsedURL | StormURL): boolean {\n return isEqual(\n this.toString(),\n typeof url === \"string\"\n ? url\n : url instanceof StormURL\n ? url.toString()\n : stringifyParsedURL(url)\n );\n }\n\n public toParsed(): ParsedURL {\n return {\n protocol: this.protocol,\n auth: this.auth,\n host: this.host,\n pathname: this.pathname,\n search: this.search,\n hash: this.hash\n };\n }\n\n public toString(): string {\n return stringifyParsedURL(this.toParsed());\n }\n\n public toEncoded(): string {\n return normalizeURL(this.toString());\n }\n\n public toJSON(): string {\n return StormJSON.stringify(this.toParsed());\n }\n}\n\nStormJSON.instance.registerCustom<StormURL, string>(\n {\n isApplicable: (v): v is StormURL => v.__typename === \"StormURL\",\n serialize: v => v.toEncoded(),\n deserialize: v => new StormURL(v, { decode: true })\n },\n \"StormURL\"\n);\n"],"mappings":"ioBAoDA,IAAa,EAAb,MAAa,CAA2C,CACtD,GAKA,GAKA,GAKA,GAKA,GAKA,GAKA,GAAmB,EAAE,CAKrB,GAKA,GAEA,YAAY,EAAoB,EAA2B,CAAE,OAAQ,GAAM,CAAE,CAC3E,GAAI,GAAc,CAAC,EAAW,EAAW,CACvC,MAAU,UAAU,gBAAgB,IAAa,CAGnD,MAAA,EAAgB,EAEhB,IAAM,EAAY,EAChB,MAAA,EAAc,OAASC,EAAU,EAAW,CAAG,EAChD,CAEK,EAAa,EAAU,EAAU,KAAK,CAC5C,MAAA,EAAiB,EAAW,SAC5B,MAAA,EAAiB,EAAW,SAE5B,IAAM,EAAa,EAAU,EAAU,KAAK,CAC5C,MAAA,EAAiB,EAAW,SAC5B,MAAA,EAAa,EAAW,KAExB,MAAA,EAAiB,EAAU,SAC3B,MAAA,EAAa,EAAU,MAAQ,GAC/B,MAAA,EAAe,EAAW,EAAU,OAAO,CAE3C,MAAA,EAAc,EAAU,SACpB,EAAU,SAAS,MAAM,IAAI,CAAC,OAAO,QAAQ,CAC7C,EAAE,CACF,EAAQ,QACV,MAAA,EAAY,QACV,GACG,EAAY,EAAQ,OAAO,CACxB,EAAQ,OACR,QAAQ,IAAI,iBAAmB,QACpC,CACF,CAIL,IAAW,OAAO,EAA4B,CAC5C,MAAA,EAAe,EAGjB,IAAW,QAA8B,CACvC,OAAO,MAAA,EAGT,IAAW,cAAgC,CACzC,IAAM,EAAS,IAAI,gBACnB,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,KAAK,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AK,SAAS,IAAI,KAAK,OAGnC,IAAW,kBAA4B,CACrC,OAAO,EAAiB,KAAK,SAAS,CAGxC,IAAW,YAAsB,CAC/B,OAAO,EAAW,KAAK,UAAU,CAAC,CAGpC,IAAW,eAAyB,CAClC,OAAO,EAAc,KAAK,UAAU,CAAC,CAIvC,IAAW,YAAa,CACtB,MAAO,WAGT,WAAkB,EAAuB,CACvC,OAAO,EAAW,KAAK,KAAM,EAAK,CAGpC,QAAe,EAA6C,CAC1D,OAAO,EACL,KAAK,UAAU,CACf,OAAO,GAAQ,SACX,EACA,aAAe,EACb,EAAI,UAAU,CACd,EAAmB,EAAI,CAC9B,CAGH,UAA6B,CAC3B,MAAO,CACL,SAAU,KAAK,SACf,KAAM,KAAK,KACX,KAAM,KAAK,KACX,SAAU,KAAK,SACf,OAAQ,KAAK,OACb,KAAM,KAAK,KACZ,CAGH,UAA0B,CACxB,OAAO,EAAmB,KAAK,UAAU,CAAC,CAG5C,WAA2B,CACzB,OAAO,EAAa,KAAK,UAAU,CAAC,CAGtC,QAAwB,CACtB,OAAO,EAAU,UAAU,KAAK,UAAU,CAAC,GAI/C,EAAU,SAAS,eACjB,CACE,aAAe,GAAqB,EAAE,aAAe,WACrD,UAAW,GAAK,EAAE,WAAW,CAC7B,YAAa,GAAK,IAAI,EAAS,EAAG,CAAE,OAAQ,GAAM,CAAC,CACpD,CACD,WACD"}
1
+ {"version":3,"file":"storm-url.mjs","names":["#options","decodeURL","#username","#password","#hostname","#port","#protocol","#hash","#params","#paths"],"sources":["../src/storm-url.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isInteger } from \"@stryke/type-checks/is-integer\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport type { ParsedURL } from \"ufo\";\nimport {\n cleanDoubleSlashes,\n decode as decodeURL,\n isEqual,\n isNonEmptyURL,\n isRelative,\n isSamePath,\n isScriptProtocol,\n normalizeURL,\n parseAuth,\n parseHost,\n parsePath,\n parseQuery,\n parseURL,\n stringifyParsedURL,\n stringifyQuery\n} from \"ufo\";\nimport { formatLocalePath, isValidURL } from \"./helpers\";\nimport type { StormURLInterface, StormURLOptions } from \"./types\";\n\n/**\n * A class used to build URLs\n *\n * @remarks\n * This class is used to build URLs with a fluent API.\n *\n * The [UFO](https://github.com/unjs/ufo) library is used under the hood to parse and stringify URLs.\n */\nexport class StormURL implements StormURLInterface, URL {\n #options: StormURLOptions;\n\n /**\n * A string containing the username specified before the domain name.\n */\n #username?: string;\n\n /**\n * A string containing the password specified before the domain name.\n */\n #password?: string;\n\n /**\n * A string containing the domain of the URL.\n */\n #hostname: string;\n\n /**\n * A string containing the port number of the URL.\n */\n #port?: string;\n\n /**\n * A string containing the protocol scheme of the URL, including the final `:`.\n */\n #protocol?: string;\n\n /**\n * The paths of the URL\n */\n #paths: string[] = [];\n\n /**\n * A string containing a `#` followed by the fragment identifier of the URL.\n */\n #hash: string;\n\n /**\n * The search parameters of the URL\n */\n #params: Record<string, any>;\n\n constructor(initialURL: string, options: StormURLOptions = { decode: true }) {\n if (initialURL && !isValidURL(initialURL)) {\n throw new TypeError(`Invalid URL: ${initialURL}`);\n }\n\n this.#options = options;\n\n const parsedURL = parseURL(\n this.#options.decode ? decodeURL(initialURL) : initialURL\n );\n\n const parsedAuth = parseAuth(parsedURL.auth);\n this.#username = parsedAuth.username;\n this.#password = parsedAuth.password;\n\n const parsedHost = parseHost(parsedURL.host);\n this.#hostname = parsedHost.hostname;\n this.#port = parsedHost.port;\n\n this.#protocol = parsedURL.protocol;\n this.#hash = parsedURL.hash || \"\";\n this.#params = parseQuery(parsedURL.search);\n\n this.#paths = parsedURL.pathname\n ? parsedURL.pathname.split(\"/\").filter(Boolean)\n : [];\n if (options.locale) {\n this.#paths.unshift(\n formatLocalePath(\n (isSetString(options.locale)\n ? options.locale\n : process.env.DEFAULT_LOCALE) || \"en-us\"\n )\n );\n }\n }\n\n public set params(value: Record<string, any>) {\n this.#params = value;\n }\n\n public get params(): Record<string, any> {\n return this.#params;\n }\n\n public get searchParams(): URLSearchParams {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(this.params)) {\n params.append(key, value);\n }\n return params;\n }\n\n public set searchParams(value: URLSearchParams) {\n this.params = Object.fromEntries(value.entries());\n }\n\n public set search(value: string) {\n this.params = parseQuery(value);\n }\n\n public get search(): string {\n const search = stringifyQuery(this.params);\n\n return search ? (search.startsWith(\"?\") ? search : `?${search}`) : \"\";\n }\n\n public set hash(value: string) {\n this.#hash = value.startsWith(\"#\") ? value : `#${value}`;\n }\n\n public get hash(): string {\n return this.#hash;\n }\n\n public set port(value: string | number) {\n this.#port = !isUndefined(value) && isInteger(value) ? `${value}` : \"\";\n }\n\n public get port(): string {\n return this.#port || \"\";\n }\n\n public set username(value: string) {\n this.auth = `${value}:${this.#password}`;\n }\n\n public get username(): string {\n return this.#username || \"\";\n }\n\n public set password(value: string) {\n this.auth = `${this.#username}:${value}`;\n }\n\n public get password(): string {\n return this.#password || \"\";\n }\n\n public set auth(value: string | undefined) {\n const parsedAuth = parseAuth(value);\n\n this.#username = parsedAuth.username;\n this.#password = parsedAuth.password;\n }\n\n public get auth(): string {\n return this.#username && this.#password\n ? `${this.#username}:${this.#password}`\n : this.#username\n ? this.#username\n : this.#password\n ? this.#password\n : \"\";\n }\n\n public set protocol(value: string) {\n this.#protocol = value.endsWith(\":\")\n ? value\n : value.endsWith(\"://\")\n ? value.slice(0, -2)\n : `${value}:`;\n }\n\n public get protocol(): string {\n return this.#protocol || this.#options.defaultProtocol || \"https:\";\n }\n\n public set hostname(value: string) {\n this.#hostname = value;\n }\n\n public get hostname(): string {\n return this.#hostname;\n }\n\n public set host(value: string | undefined) {\n const parsedHost = parseHost(value);\n this.#hostname = parsedHost.hostname;\n this.#port = parsedHost.port;\n }\n\n public get host(): string {\n return this.#hostname && this.#port\n ? `${this.#hostname}:${this.#port}`\n : this.#hostname\n ? this.#hostname\n : this.#port\n ? this.#port\n : \"\";\n }\n\n public set paths(value: any[]) {\n this.#paths = value.filter(Boolean);\n }\n\n public get paths(): any[] {\n return this.#paths;\n }\n\n public set pathname(value: string) {\n this.paths = cleanDoubleSlashes(value).split(\"/\");\n }\n\n public get pathname(): string {\n return `/${this.paths ? joinPaths(...this.paths.map(path => StormJSON.stringify(path))) : \"\"}`;\n }\n\n public set path(value: string) {\n const parsedPath = parsePath(value);\n this.pathname = parsedPath.pathname;\n this.search = parsedPath.search;\n this.#hash = parsedPath.hash;\n }\n\n public get path(): string {\n return stringifyParsedURL({\n pathname: this.pathname,\n search: this.search,\n hash: this.hash\n });\n }\n\n public get href(): string {\n return this.toString();\n }\n\n public set href(value: string) {\n const parsedURL = parseURL(value);\n this.protocol = parsedURL.protocol || this.protocol;\n this.auth = parsedURL.auth || this.auth;\n this.host = parsedURL.host || this.host;\n this.pathname = parsedURL.pathname || this.pathname;\n this.search = parsedURL.search || this.search;\n this.hash = parsedURL.hash || this.hash;\n }\n\n public get origin(): string {\n return `${this.protocol}//${this.host}`;\n }\n\n public get isScriptProtocol(): boolean {\n return isScriptProtocol(this.protocol);\n }\n\n public get isRelative(): boolean {\n return isRelative(this.toString());\n }\n\n public get isNonEmptyURL(): boolean {\n return isNonEmptyURL(this.toString());\n }\n\n // eslint-disable-next-line ts/naming-convention\n public get __typename() {\n return \"StormURL\";\n }\n\n public isSamePath(path: string): boolean {\n return isSamePath(this.path, path);\n }\n\n public isEqual(url: string | ParsedURL | StormURL): boolean {\n return isEqual(\n this.toString(),\n typeof url === \"string\"\n ? url\n : url instanceof StormURL\n ? url.toString()\n : stringifyParsedURL(url)\n );\n }\n\n public toParsed(): ParsedURL {\n return {\n protocol: this.protocol,\n auth: this.auth,\n host: this.host,\n pathname: this.pathname,\n search: this.search,\n hash: this.hash\n };\n }\n\n public toString(): string {\n return stringifyParsedURL(this.toParsed());\n }\n\n public toEncoded(): string {\n return normalizeURL(this.toString());\n }\n\n public toJSON(): string {\n return StormJSON.stringify(this.toParsed());\n }\n}\n\nStormJSON.instance.registerCustom<StormURL, string>(\n {\n isApplicable: (v): v is StormURL => v.__typename === \"StormURL\",\n serialize: v => v.toEncoded(),\n deserialize: v => new StormURL(v, { decode: true })\n },\n \"StormURL\"\n);\n"],"mappings":";;;;;;;;;;;;;;;;;AAoDA,IAAa,WAAb,MAAa,SAA2C;CACtD;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA;;;;CAKA,SAAmB,EAAE;;;;CAKrB;;;;CAKA;CAEA,YAAY,YAAoB,UAA2B,EAAE,QAAQ,MAAM,EAAE;AAC3E,MAAI,cAAc,CAAC,WAAW,WAAW,CACvC,OAAM,IAAI,UAAU,gBAAgB,aAAa;AAGnD,QAAKA,UAAW;EAEhB,MAAM,YAAY,SAChB,MAAKA,QAAS,SAASC,OAAU,WAAW,GAAG,WAChD;EAED,MAAM,aAAa,UAAU,UAAU,KAAK;AAC5C,QAAKC,WAAY,WAAW;AAC5B,QAAKC,WAAY,WAAW;EAE5B,MAAM,aAAa,UAAU,UAAU,KAAK;AAC5C,QAAKC,WAAY,WAAW;AAC5B,QAAKC,OAAQ,WAAW;AAExB,QAAKC,WAAY,UAAU;AAC3B,QAAKC,OAAQ,UAAU,QAAQ;AAC/B,QAAKC,SAAU,WAAW,UAAU,OAAO;AAE3C,QAAKC,QAAS,UAAU,WACpB,UAAU,SAAS,MAAM,IAAI,CAAC,OAAO,QA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EAAE,WAAW;CAC7B,cAAa,MAAK,IAAI,SAAS,GAAG,EAAE,QAAQ,MAAM,CAAC;CACpD,EACD,WACD"}
@@ -1 +1,15 @@
1
- const e=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e);exports.getObjectTag=e;
1
+
2
+ //#region ../type-checks/src/get-object-tag.ts
3
+ /**
4
+ * Gets the `toStringTag` of `obj`.
5
+ *
6
+ * @param value - The obj to query.
7
+ * @returns Returns the `toStringTag`.
8
+ */
9
+ const getObjectTag = (value) => {
10
+ if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
11
+ return Object.prototype.toString.call(value);
12
+ };
13
+
14
+ //#endregion
15
+ exports.getObjectTag = getObjectTag;
@@ -1,2 +1,15 @@
1
- const e=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e);export{e as getObjectTag};
1
+ //#region ../type-checks/src/get-object-tag.ts
2
+ /**
3
+ * Gets the `toStringTag` of `obj`.
4
+ *
5
+ * @param value - The obj to query.
6
+ * @returns Returns the `toStringTag`.
7
+ */
8
+ const getObjectTag = (value) => {
9
+ if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
10
+ return Object.prototype.toString.call(value);
11
+ };
12
+
13
+ //#endregion
14
+ export { getObjectTag };
2
15
  //# sourceMappingURL=get-object-tag.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-object-tag.mjs","names":[],"sources":["../../../../type-checks/src/get-object-tag.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Gets the `toStringTag` of `obj`.\n *\n * @param value - The obj to query.\n * @returns Returns the `toStringTag`.\n */\nexport const getObjectTag = (value: unknown): string => {\n if (value == null) {\n return value === undefined ? \"[object Undefined]\" : \"[object Null]\";\n }\n return Object.prototype.toString.call(value);\n};\n"],"mappings":"AAwBA,MAAa,EAAgB,GACvB,GAAS,KACJ,IAAU,IAAA,GAAY,qBAAuB,gBAE/C,OAAO,UAAU,SAAS,KAAK,EAAM"}
1
+ {"version":3,"file":"get-object-tag.mjs","names":[],"sources":["../../../../type-checks/src/get-object-tag.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Gets the `toStringTag` of `obj`.\n *\n * @param value - The obj to query.\n * @returns Returns the `toStringTag`.\n */\nexport const getObjectTag = (value: unknown): string => {\n if (value == null) {\n return value === undefined ? \"[object Undefined]\" : \"[object Null]\";\n }\n return Object.prototype.toString.call(value);\n};\n"],"mappings":";;;;;;;AAwBA,MAAa,gBAAgB,UAA2B;AACtD,KAAI,SAAS,KACX,QAAO,UAAU,SAAY,uBAAuB;AAEtD,QAAO,OAAO,UAAU,SAAS,KAAK,MAAM"}
@@ -1 +1,20 @@
1
- const e=require(`./is-undefined.cjs`),t=require(`./is-null.cjs`),n=n=>{try{return e.isUndefined(n)||t.isNull(n)}catch{return!1}};exports.isEmpty=n;
1
+ const require_is_undefined = require('./is-undefined.cjs');
2
+ const require_is_null = require('./is-null.cjs');
3
+
4
+ //#region ../type-checks/src/is-empty.ts
5
+ /**
6
+ * Check if the provided value's type is `null` or `undefined`
7
+ *
8
+ * @param value - The value to type check
9
+ * @returns An indicator specifying if the value provided is of type `null` or `undefined`
10
+ */
11
+ const isEmpty = (value) => {
12
+ try {
13
+ return require_is_undefined.isUndefined(value) || require_is_null.isNull(value);
14
+ } catch {
15
+ return false;
16
+ }
17
+ };
18
+
19
+ //#endregion
20
+ exports.isEmpty = isEmpty;
@@ -1,2 +1,21 @@
1
- import{isUndefined as e}from"./is-undefined.mjs";import{isNull as t}from"./is-null.mjs";const n=n=>{try{return e(n)||t(n)}catch{return!1}};export{n as isEmpty};
1
+ import { isUndefined } from "./is-undefined.mjs";
2
+ import { isNull } from "./is-null.mjs";
3
+
4
+ //#region ../type-checks/src/is-empty.ts
5
+ /**
6
+ * Check if the provided value's type is `null` or `undefined`
7
+ *
8
+ * @param value - The value to type check
9
+ * @returns An indicator specifying if the value provided is of type `null` or `undefined`
10
+ */
11
+ const isEmpty = (value) => {
12
+ try {
13
+ return isUndefined(value) || isNull(value);
14
+ } catch {
15
+ return false;
16
+ }
17
+ };
18
+
19
+ //#endregion
20
+ export { isEmpty };
2
21
  //# sourceMappingURL=is-empty.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-empty.mjs","names":[],"sources":["../../../../type-checks/src/is-empty.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isDate } from \"./is-date\";\nimport { isFunction } from \"./is-function\";\nimport { isNull } from \"./is-null\";\nimport { isNumber } from \"./is-number\";\nimport { isSymbol } from \"./is-symbol\";\nimport { isUndefined } from \"./is-undefined\";\n\n/**\n * Check if the provided value's type is `null` or `undefined`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `null` or `undefined`\n */\nexport const isEmpty = (value: unknown) => {\n try {\n return isUndefined(value) || isNull(value);\n } catch {\n return false;\n }\n};\n\nexport const isEmptyAnything = (value: any) => {\n if (value === true || value === false) return true;\n if (value === null || value === undefined) return true;\n if (isNumber(value)) return value === 0;\n if (isDate(value)) return Number.isNaN(value.getTime());\n if (isFunction(value)) return false;\n if (isSymbol(value)) return false;\n const { length } = value;\n if (isNumber(length)) return length === 0;\n const { size } = value;\n if (isNumber(size)) return size === 0;\n const keys = Object.keys(value).length;\n\n return keys === 0;\n};\n"],"mappings":"wFA+BA,MAAa,EAAW,GAAmB,CACzC,GAAI,CACF,OAAO,EAAY,EAAM,EAAI,EAAO,EAAM,MACpC,CACN,MAAO"}
1
+ {"version":3,"file":"is-empty.mjs","names":[],"sources":["../../../../type-checks/src/is-empty.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isDate } from \"./is-date\";\nimport { isFunction } from \"./is-function\";\nimport { isNull } from \"./is-null\";\nimport { isNumber } from \"./is-number\";\nimport { isSymbol } from \"./is-symbol\";\nimport { isUndefined } from \"./is-undefined\";\n\n/**\n * Check if the provided value's type is `null` or `undefined`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `null` or `undefined`\n */\nexport const isEmpty = (value: unknown) => {\n try {\n return isUndefined(value) || isNull(value);\n } catch {\n return false;\n }\n};\n\nexport const isEmptyAnything = (value: any) => {\n if (value === true || value === false) return true;\n if (value === null || value === undefined) return true;\n if (isNumber(value)) return value === 0;\n if (isDate(value)) return Number.isNaN(value.getTime());\n if (isFunction(value)) return false;\n if (isSymbol(value)) return false;\n const { length } = value;\n if (isNumber(length)) return length === 0;\n const { size } = value;\n if (isNumber(size)) return size === 0;\n const keys = Object.keys(value).length;\n\n return keys === 0;\n};\n"],"mappings":";;;;;;;;;;AA+BA,MAAa,WAAW,UAAmB;AACzC,KAAI;AACF,SAAO,YAAY,MAAM,IAAI,OAAO,MAAM;SACpC;AACN,SAAO"}
@@ -1 +1,14 @@
1
- const e=require(`./is-string.cjs`),t=require(`./is-number.cjs`),n=n=>!e.isString(n)&&t.isNumber(n)&&n%1==0;exports.isInteger=n;
1
+ const require_is_string = require('./is-string.cjs');
2
+ const require_is_number = require('./is-number.cjs');
3
+
4
+ //#region ../type-checks/src/is-integer.ts
5
+ /**
6
+ * Check if the provided value's type is an integer
7
+ *
8
+ * @param value - The value to type check
9
+ * @returns An indicator specifying if the value provided is of type `number` and is an integer
10
+ */
11
+ const isInteger = (value) => !require_is_string.isString(value) && require_is_number.isNumber(value) && value % 1 === 0;
12
+
13
+ //#endregion
14
+ exports.isInteger = isInteger;
@@ -1,2 +1,15 @@
1
- import{isString as e}from"./is-string.mjs";import{isNumber as t}from"./is-number.mjs";const n=n=>!e(n)&&t(n)&&n%1==0;export{n as isInteger};
1
+ import { isString } from "./is-string.mjs";
2
+ import { isNumber } from "./is-number.mjs";
3
+
4
+ //#region ../type-checks/src/is-integer.ts
5
+ /**
6
+ * Check if the provided value's type is an integer
7
+ *
8
+ * @param value - The value to type check
9
+ * @returns An indicator specifying if the value provided is of type `number` and is an integer
10
+ */
11
+ const isInteger = (value) => !isString(value) && isNumber(value) && value % 1 === 0;
12
+
13
+ //#endregion
14
+ export { isInteger };
2
15
  //# sourceMappingURL=is-integer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-integer.mjs","names":[],"sources":["../../../../type-checks/src/is-integer.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isNumber } from \"./is-number\";\nimport { isString } from \"./is-string\";\n\n/**\n * Check if the provided value's type is an integer\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number` and is an integer\n */\nexport const isInteger = (value: unknown): boolean =>\n !isString(value) && isNumber(value) && value % 1 === 0;\n"],"mappings":"sFA2BA,MAAa,EAAa,GACxB,CAAC,EAAS,EAAM,EAAI,EAAS,EAAM,EAAI,EAAQ,GAAM"}
1
+ {"version":3,"file":"is-integer.mjs","names":[],"sources":["../../../../type-checks/src/is-integer.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isNumber } from \"./is-number\";\nimport { isString } from \"./is-string\";\n\n/**\n * Check if the provided value's type is an integer\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number` and is an integer\n */\nexport const isInteger = (value: unknown): boolean =>\n !isString(value) && isNumber(value) && value % 1 === 0;\n"],"mappings":";;;;;;;;;;AA2BA,MAAa,aAAa,UACxB,CAAC,SAAS,MAAM,IAAI,SAAS,MAAM,IAAI,QAAQ,MAAM"}
@@ -1 +1,12 @@
1
- const e=e=>{try{return e===null}catch{return!1}};exports.isNull=e;
1
+
2
+ //#region ../type-checks/src/is-null.ts
3
+ const isNull = (value) => {
4
+ try {
5
+ return value === null;
6
+ } catch {
7
+ return false;
8
+ }
9
+ };
10
+
11
+ //#endregion
12
+ exports.isNull = isNull;
@@ -1,2 +1,12 @@
1
- const e=e=>{try{return e===null}catch{return!1}};export{e as isNull};
1
+ //#region ../type-checks/src/is-null.ts
2
+ const isNull = (value) => {
3
+ try {
4
+ return value === null;
5
+ } catch {
6
+ return false;
7
+ }
8
+ };
9
+
10
+ //#endregion
11
+ export { isNull };
2
12
  //# sourceMappingURL=is-null.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-null.mjs","names":[],"sources":["../../../../type-checks/src/is-null.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isNull = (value: unknown): value is null => {\n try {\n return value === null;\n } catch {\n return false;\n }\n};\n"],"mappings":"AAkBA,MAAa,EAAU,GAAkC,CACvD,GAAI,CACF,OAAO,IAAU,UACX,CACN,MAAO"}
1
+ {"version":3,"file":"is-null.mjs","names":[],"sources":["../../../../type-checks/src/is-null.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isNull = (value: unknown): value is null => {\n try {\n return value === null;\n } catch {\n return false;\n }\n};\n"],"mappings":";AAkBA,MAAa,UAAU,UAAkC;AACvD,KAAI;AACF,SAAO,UAAU;SACX;AACN,SAAO"}
@@ -1 +1,18 @@
1
- const e=e=>{try{return e instanceof Number||typeof e==`number`||Number(e)===e}catch{return!1}};exports.isNumber=e;
1
+
2
+ //#region ../type-checks/src/is-number.ts
3
+ /**
4
+ * Check if the provided value's type is `number`
5
+ *
6
+ * @param value - The value to type check
7
+ * @returns An indicator specifying if the value provided is of type `number`
8
+ */
9
+ const isNumber = (value) => {
10
+ try {
11
+ return value instanceof Number || typeof value === "number" || Number(value) === value;
12
+ } catch {
13
+ return false;
14
+ }
15
+ };
16
+
17
+ //#endregion
18
+ exports.isNumber = isNumber;
@@ -1,2 +1,18 @@
1
- const e=e=>{try{return e instanceof Number||typeof e==`number`||Number(e)===e}catch{return!1}};export{e as isNumber};
1
+ //#region ../type-checks/src/is-number.ts
2
+ /**
3
+ * Check if the provided value's type is `number`
4
+ *
5
+ * @param value - The value to type check
6
+ * @returns An indicator specifying if the value provided is of type `number`
7
+ */
8
+ const isNumber = (value) => {
9
+ try {
10
+ return value instanceof Number || typeof value === "number" || Number(value) === value;
11
+ } catch {
12
+ return false;
13
+ }
14
+ };
15
+
16
+ //#endregion
17
+ export { isNumber };
2
18
  //# sourceMappingURL=is-number.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-number.mjs","names":[],"sources":["../../../../type-checks/src/is-number.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AnyNumber } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Check if the provided value's type is `number`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number`\n */\nexport const isNumber = (value: unknown): value is number => {\n try {\n return (\n value instanceof Number ||\n typeof value === \"number\" ||\n Number(value) === value\n );\n } catch {\n return false;\n }\n};\n\n/**\n * Check if the provided value's type is `AnyNumber`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `AnyNumber`\n */\nexport function isAnyNumber(value?: any): value is AnyNumber {\n return isNumber(value) || getObjectTag(value) === \"[object Number]\";\n}\n"],"mappings":"AA2BA,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OACE,aAAiB,QACjB,OAAO,GAAU,UACjB,OAAO,EAAM,GAAK,OAEd,CACN,MAAO"}
1
+ {"version":3,"file":"is-number.mjs","names":[],"sources":["../../../../type-checks/src/is-number.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AnyNumber } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Check if the provided value's type is `number`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number`\n */\nexport const isNumber = (value: unknown): value is number => {\n try {\n return (\n value instanceof Number ||\n typeof value === \"number\" ||\n Number(value) === value\n );\n } catch {\n return false;\n }\n};\n\n/**\n * Check if the provided value's type is `AnyNumber`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `AnyNumber`\n */\nexport function isAnyNumber(value?: any): value is AnyNumber {\n return isNumber(value) || getObjectTag(value) === \"[object Number]\";\n}\n"],"mappings":";;;;;;;AA2BA,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SACE,iBAAiB,UACjB,OAAO,UAAU,YACjB,OAAO,MAAM,KAAK;SAEd;AACN,SAAO"}
@@ -1 +1,19 @@
1
- const e=require(`./is-plain-object.cjs`),t=t=>{try{return typeof t==`object`||!!t&&t?.constructor===Object||e.isPlainObject(t)}catch{return!1}};exports.isObject=t;
1
+ const require_is_plain_object = require('./is-plain-object.cjs');
2
+
3
+ //#region ../type-checks/src/is-object.ts
4
+ /**
5
+ * Check if the provided value's type is `Object`
6
+ *
7
+ * @param value - The value to type check
8
+ * @returns An indicator specifying if the value provided is of type `Object`
9
+ */
10
+ const isObject = (value) => {
11
+ try {
12
+ return typeof value === "object" || Boolean(value) && value?.constructor === Object || require_is_plain_object.isPlainObject(value);
13
+ } catch {
14
+ return false;
15
+ }
16
+ };
17
+
18
+ //#endregion
19
+ exports.isObject = isObject;
@@ -1,2 +1,20 @@
1
- import{isPlainObject as e}from"./is-plain-object.mjs";const t=t=>{try{return typeof t==`object`||!!t&&t?.constructor===Object||e(t)}catch{return!1}};export{t as isObject};
1
+ import { isPlainObject } from "./is-plain-object.mjs";
2
+
3
+ //#region ../type-checks/src/is-object.ts
4
+ /**
5
+ * Check if the provided value's type is `Object`
6
+ *
7
+ * @param value - The value to type check
8
+ * @returns An indicator specifying if the value provided is of type `Object`
9
+ */
10
+ const isObject = (value) => {
11
+ try {
12
+ return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
13
+ } catch {
14
+ return false;
15
+ }
16
+ };
17
+
18
+ //#endregion
19
+ export { isObject };
2
20
  //# sourceMappingURL=is-object.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-object.mjs","names":[],"sources":["../../../../type-checks/src/is-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/* eslint-disable ts/no-unsafe-function-type */\n/* eslint-disable ts/no-unsafe-call */\n\nimport type { NativeClass } from \"@stryke/types/base\";\nimport { isPlainObject } from \"./is-plain-object\";\n\n// Prepare\nconst isClassRegex = /^class\\s|^function\\s+[A-Z]/;\nconst isConventionalClassRegex = /^function\\s+[A-Z]/;\nconst isNativeClassRegex = /^class\\s/;\n\n/** Is ES6+ class */\nexport function isNativeClass(value?: any): value is NativeClass {\n // NOTE TO DEVELOPER: If any of this changes, isClass must also be updated\n return (\n typeof value === \"function\" && isNativeClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is a conventional class\n *\n * @remarks\n * Is Conventional Class\n * Looks for function with capital first letter MyClass\n * First letter is the 9th character\n * If changed, isClass must also be updated\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is a conventional class\n */\nexport function isConventionalClass(value?: any): value is Function {\n return (\n typeof value === \"function\" &&\n isConventionalClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport function isClass(value?: any): value is Function | NativeClass; // only guarantee of truth type, not of validity\nexport function isClass(value?: any): boolean {\n return typeof value === \"function\" && isClassRegex.test(value.toString());\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport const isObject = (value: unknown): value is object => {\n try {\n return (\n typeof value === \"object\" ||\n (Boolean(value) && value?.constructor === Object) ||\n isPlainObject(value)\n );\n } catch {\n return false;\n }\n};\n"],"mappings":"sDAyEA,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OACE,OAAO,GAAU,UAChB,EAAQ,GAAU,GAAO,cAAgB,QAC1C,EAAc,EAAM,MAEhB,CACN,MAAO"}
1
+ {"version":3,"file":"is-object.mjs","names":[],"sources":["../../../../type-checks/src/is-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/* eslint-disable ts/no-unsafe-function-type */\n/* eslint-disable ts/no-unsafe-call */\n\nimport type { NativeClass } from \"@stryke/types/base\";\nimport { isPlainObject } from \"./is-plain-object\";\n\n// Prepare\nconst isClassRegex = /^class\\s|^function\\s+[A-Z]/;\nconst isConventionalClassRegex = /^function\\s+[A-Z]/;\nconst isNativeClassRegex = /^class\\s/;\n\n/** Is ES6+ class */\nexport function isNativeClass(value?: any): value is NativeClass {\n // NOTE TO DEVELOPER: If any of this changes, isClass must also be updated\n return (\n typeof value === \"function\" && isNativeClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is a conventional class\n *\n * @remarks\n * Is Conventional Class\n * Looks for function with capital first letter MyClass\n * First letter is the 9th character\n * If changed, isClass must also be updated\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is a conventional class\n */\nexport function isConventionalClass(value?: any): value is Function {\n return (\n typeof value === \"function\" &&\n isConventionalClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport function isClass(value?: any): value is Function | NativeClass; // only guarantee of truth type, not of validity\nexport function isClass(value?: any): boolean {\n return typeof value === \"function\" && isClassRegex.test(value.toString());\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport const isObject = (value: unknown): value is object => {\n try {\n return (\n typeof value === \"object\" ||\n (Boolean(value) && value?.constructor === Object) ||\n isPlainObject(value)\n );\n } catch {\n return false;\n }\n};\n"],"mappings":";;;;;;;;;AAyEA,MAAa,YAAY,UAAoC;AAC3D,KAAI;AACF,SACE,OAAO,UAAU,YAChB,QAAQ,MAAM,IAAI,OAAO,gBAAgB,UAC1C,cAAc,MAAM;SAEhB;AACN,SAAO"}