@stryke/cookie 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +1 -1
- package/dist/parse.cjs +1 -1
- package/dist/parse.d.cts +23 -2
- package/dist/parse.d.cts.map +1 -0
- package/dist/parse.d.mts +23 -2
- package/dist/parse.d.mts.map +1 -0
- package/dist/parse.mjs +2 -1
- package/dist/parse.mjs.map +1 -0
- package/dist/split.cjs +1 -1
- package/dist/split.d.cts +5 -2
- package/dist/split.d.cts.map +1 -0
- package/dist/split.d.mts +5 -2
- package/dist/split.d.mts.map +1 -0
- package/dist/split.mjs +2 -1
- package/dist/split.mjs.map +1 -0
- package/dist/stringify.cjs +1 -1
- package/dist/stringify.d.cts +16 -2
- package/dist/stringify.d.cts.map +1 -0
- package/dist/stringify.d.mts +16 -2
- package/dist/stringify.d.mts.map +1 -0
- package/dist/stringify.mjs +2 -1
- package/dist/stringify.mjs.map +1 -0
- package/dist/type-checks/src/get-object-tag.cjs +1 -0
- package/dist/type-checks/src/get-object-tag.mjs +2 -0
- package/dist/type-checks/src/get-object-tag.mjs.map +1 -0
- package/dist/type-checks/src/index.cjs +1 -0
- package/dist/type-checks/src/index.mjs +1 -0
- package/dist/type-checks/src/is-buffer.cjs +1 -0
- package/dist/type-checks/src/is-buffer.mjs +2 -0
- package/dist/type-checks/src/is-buffer.mjs.map +1 -0
- package/dist/type-checks/src/is-collection.cjs +1 -0
- package/dist/type-checks/src/is-collection.mjs +1 -0
- package/dist/type-checks/src/is-date.cjs +1 -0
- package/dist/type-checks/src/is-date.mjs +2 -0
- package/dist/type-checks/src/is-date.mjs.map +1 -0
- package/dist/type-checks/src/is-empty.cjs +1 -0
- package/dist/type-checks/src/is-empty.mjs +2 -0
- package/dist/type-checks/src/is-empty.mjs.map +1 -0
- package/dist/type-checks/src/is-function.cjs +1 -0
- package/dist/type-checks/src/is-function.mjs +2 -0
- package/dist/type-checks/src/is-function.mjs.map +1 -0
- package/dist/type-checks/src/is-null.cjs +1 -0
- package/dist/type-checks/src/is-null.mjs +2 -0
- package/dist/type-checks/src/is-null.mjs.map +1 -0
- package/dist/type-checks/src/is-plain-object.cjs +1 -0
- package/dist/type-checks/src/is-plain-object.mjs +2 -0
- package/dist/type-checks/src/is-plain-object.mjs.map +1 -0
- package/dist/type-checks/src/is-set.cjs +1 -0
- package/dist/type-checks/src/is-set.mjs +2 -0
- package/dist/type-checks/src/is-set.mjs.map +1 -0
- package/dist/{is-string-Cdq5ranA.mjs → type-checks/src/is-string.cjs} +1 -2
- package/dist/type-checks/src/is-string.mjs +2 -0
- package/dist/type-checks/src/is-string.mjs.map +1 -0
- package/dist/type-checks/src/is-undefined.cjs +1 -0
- package/dist/type-checks/src/is-undefined.mjs +2 -0
- package/dist/type-checks/src/is-undefined.mjs.map +1 -0
- package/dist/type-checks/src/type-detect.cjs +1 -0
- package/dist/type-checks/src/type-detect.mjs +2 -0
- package/dist/type-checks/src/type-detect.mjs.map +1 -0
- package/dist/types.d.cts +188 -2
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +188 -2
- package/dist/types.d.mts.map +1 -0
- package/package.json +5 -5
- package/dist/is-string-Cdq5ranA.mjs.map +0 -1
- package/dist/is-string-qyWqKQj-.cjs +0 -1
- package/dist/parse-CB7V9-FM.mjs +0 -2
- package/dist/parse-CB7V9-FM.mjs.map +0 -1
- package/dist/parse-CC7RDu95.d.cts +0 -23
- package/dist/parse-CC7RDu95.d.cts.map +0 -1
- package/dist/parse-DClQAhyZ.d.mts +0 -23
- package/dist/parse-DClQAhyZ.d.mts.map +0 -1
- package/dist/parse-Lu_9IylD.cjs +0 -1
- package/dist/split-BMQx0Ga2.d.mts +0 -5
- package/dist/split-BMQx0Ga2.d.mts.map +0 -1
- package/dist/split-DGuM3LaG.cjs +0 -1
- package/dist/split-DyNIhQJp.mjs +0 -2
- package/dist/split-DyNIhQJp.mjs.map +0 -1
- package/dist/split-Y8qgB1su.d.cts +0 -5
- package/dist/split-Y8qgB1su.d.cts.map +0 -1
- package/dist/src-Bw3xE0BI.mjs +0 -2
- package/dist/src-Bw3xE0BI.mjs.map +0 -1
- package/dist/src-C0Osv7A0.cjs +0 -1
- package/dist/stringify-BkjTv8_W.mjs +0 -2
- package/dist/stringify-BkjTv8_W.mjs.map +0 -1
- package/dist/stringify-DGdYwk9z.d.mts +0 -16
- package/dist/stringify-DGdYwk9z.d.mts.map +0 -1
- package/dist/stringify-f5GFtoll.cjs +0 -1
- package/dist/stringify-iqRz2xah.d.cts +0 -16
- package/dist/stringify-iqRz2xah.d.cts.map +0 -1
- package/dist/types-DfXe0PRY.d.mts +0 -188
- package/dist/types-DfXe0PRY.d.mts.map +0 -1
- package/dist/types-DmPnClfS.d.cts +0 -188
- package/dist/types-DmPnClfS.d.cts.map +0 -1
package/dist/types.d.cts
CHANGED
|
@@ -1,2 +1,188 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Cookie serialization options
|
|
4
|
+
*/
|
|
5
|
+
interface CookieSerializeOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3 | Domain Set-Cookie attribute}. By default, no
|
|
8
|
+
* domain is set, and most clients will consider the cookie to apply to only
|
|
9
|
+
* the current domain.
|
|
10
|
+
*/
|
|
11
|
+
domain?: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Specifies a function that will be used to encode a cookie's value. Since
|
|
14
|
+
* value of a cookie has a limited character set (and must be a simple
|
|
15
|
+
* string), this function can be used to encode a value into a string suited
|
|
16
|
+
* for a cookie's value.
|
|
17
|
+
*
|
|
18
|
+
* The default function is the global `encodeURIComponent`, which will
|
|
19
|
+
* encode a JavaScript string into UTF-8 byte sequences and then URL-encode
|
|
20
|
+
* any that fall outside of the cookie range.
|
|
21
|
+
*/
|
|
22
|
+
encode?: (value: string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1 | `Expires` `Set-Cookie` attribute}. By default,
|
|
25
|
+
* no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete
|
|
26
|
+
* it on a condition like exiting a web browser application.
|
|
27
|
+
*
|
|
28
|
+
* Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3 | cookie storage model specification}
|
|
29
|
+
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
|
|
30
|
+
* possible not all clients by obey this, so if both are set, they should
|
|
31
|
+
* point to the same date and time.
|
|
32
|
+
*/
|
|
33
|
+
expires?: Date | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6 | `HttpOnly` `Set-Cookie` attribute}.
|
|
36
|
+
* When truthy, the `HttpOnly` attribute is set, otherwise it is not. By
|
|
37
|
+
* default, the `HttpOnly` attribute is not set.
|
|
38
|
+
*
|
|
39
|
+
* Note* be careful when setting this to true, as compliant clients will
|
|
40
|
+
* not allow client-side JavaScript to see the cookie in `document.cookie`.
|
|
41
|
+
*/
|
|
42
|
+
httpOnly?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the number (in seconds) to be the value for the `Max-Age`
|
|
45
|
+
* `Set-Cookie` attribute. The given number will be converted to an integer
|
|
46
|
+
* by rounding down. By default, no maximum age is set.
|
|
47
|
+
*
|
|
48
|
+
* Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3 | cookie storage model specification}
|
|
49
|
+
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
|
|
50
|
+
* possible not all clients by obey this, so if both are set, they should
|
|
51
|
+
* point to the same date and time.
|
|
52
|
+
*/
|
|
53
|
+
maxAge?: number | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}.
|
|
56
|
+
* By default, the path is considered the "default path".
|
|
57
|
+
*/
|
|
58
|
+
path?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1].
|
|
61
|
+
*
|
|
62
|
+
* - `'low'` will set the `Priority` attribute to `Low`.
|
|
63
|
+
* - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
|
|
64
|
+
* - `'high'` will set the `Priority` attribute to `High`.
|
|
65
|
+
*
|
|
66
|
+
* More information about the different priority levels can be found in
|
|
67
|
+
* [the specification][rfc-west-cookie-priority-00-4.1].
|
|
68
|
+
*
|
|
69
|
+
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
|
|
70
|
+
* This also means many clients may ignore this attribute until they understand it.
|
|
71
|
+
*/
|
|
72
|
+
priority?: "low" | "medium" | "high" | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}.
|
|
75
|
+
*
|
|
76
|
+
* - `true` will set the `SameSite` attribute to `Strict` for strict same
|
|
77
|
+
* site enforcement.
|
|
78
|
+
* - `false` will not set the `SameSite` attribute.
|
|
79
|
+
* - `'lax'` will set the `SameSite` attribute to Lax for lax same site
|
|
80
|
+
* enforcement.
|
|
81
|
+
* - `'strict'` will set the `SameSite` attribute to Strict for strict same
|
|
82
|
+
* site enforcement.
|
|
83
|
+
* - `'none'` will set the SameSite attribute to None for an explicit
|
|
84
|
+
* cross-site cookie.
|
|
85
|
+
*
|
|
86
|
+
* More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}.
|
|
87
|
+
*
|
|
88
|
+
* note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.
|
|
89
|
+
*/
|
|
90
|
+
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5 | `Secure` `Set-Cookie` attribute}. When truthy, the
|
|
93
|
+
* `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
|
|
94
|
+
*
|
|
95
|
+
* Note* be careful when setting this to `true`, as compliant clients will
|
|
96
|
+
* not send the cookie back to the server in the future if the browser does
|
|
97
|
+
* not have an HTTPS connection.
|
|
98
|
+
*/
|
|
99
|
+
secure?: boolean | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1)
|
|
102
|
+
* attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
|
|
103
|
+
* `Partitioned` attribute is not set.
|
|
104
|
+
*
|
|
105
|
+
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
|
|
106
|
+
* This also means many clients may ignore this attribute until they understand it.
|
|
107
|
+
*
|
|
108
|
+
* More information can be found in the [proposal](https://github.com/privacycg/CHIPS).
|
|
109
|
+
*/
|
|
110
|
+
partitioned?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Additional parsing options
|
|
114
|
+
*/
|
|
115
|
+
interface CookieParseOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Specifies a function that will be used to decode a cookie's value. Since
|
|
118
|
+
* the value of a cookie has a limited character set (and must be a simple
|
|
119
|
+
* string), this function can be used to decode a previously-encoded cookie
|
|
120
|
+
* value into a JavaScript string or other object.
|
|
121
|
+
*
|
|
122
|
+
* The default function is the global `decodeURIComponent`, which will decode
|
|
123
|
+
* any URL-encoded sequences into their byte representations.
|
|
124
|
+
*
|
|
125
|
+
* Note* if an error is thrown from this function, the original, non-decoded
|
|
126
|
+
* cookie value will be returned as the cookie's value.
|
|
127
|
+
*/
|
|
128
|
+
decode?: (value: string) => string;
|
|
129
|
+
/**
|
|
130
|
+
* Custom function to filter parsing specific keys.
|
|
131
|
+
*/
|
|
132
|
+
filter?: (key: string) => boolean;
|
|
133
|
+
}
|
|
134
|
+
interface SetCookieParseOptions {
|
|
135
|
+
/**
|
|
136
|
+
* Custom decode function to use on cookie values.
|
|
137
|
+
*
|
|
138
|
+
* By default, `decodeURIComponent` is used.
|
|
139
|
+
*
|
|
140
|
+
* **Note:** If decoding fails, the original (undecoded) value will be used
|
|
141
|
+
*/
|
|
142
|
+
decode?: false | ((value: string) => string);
|
|
143
|
+
}
|
|
144
|
+
interface SetCookie {
|
|
145
|
+
/**
|
|
146
|
+
* Cookie name
|
|
147
|
+
*/
|
|
148
|
+
name: string;
|
|
149
|
+
/**
|
|
150
|
+
* Cookie value
|
|
151
|
+
*/
|
|
152
|
+
value: string;
|
|
153
|
+
/**
|
|
154
|
+
* Cookie path
|
|
155
|
+
*/
|
|
156
|
+
path?: string | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* Absolute expiration date for the cookie
|
|
159
|
+
*/
|
|
160
|
+
expires?: Date | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Relative max age of the cookie in seconds from when the client receives it (integer or undefined)
|
|
163
|
+
*
|
|
164
|
+
* Note: when using with express's res.cookie() method, multiply maxAge by 1000 to convert to milliseconds
|
|
165
|
+
*/
|
|
166
|
+
maxAge?: number | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Domain for the cookie,
|
|
169
|
+
* May begin with "." to indicate the named domain or any subdomain of it
|
|
170
|
+
*/
|
|
171
|
+
domain?: string | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Indicates that this cookie should only be sent over HTTPs
|
|
174
|
+
*/
|
|
175
|
+
secure?: boolean | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Indicates that this cookie should not be accessible to client-side JavaScript
|
|
178
|
+
*/
|
|
179
|
+
httpOnly?: boolean | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Indicates a cookie ought not to be sent along with cross-site requests
|
|
182
|
+
*/
|
|
183
|
+
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
184
|
+
[key: string]: unknown;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
export { CookieParseOptions, CookieSerializeOptions, SetCookie, SetCookieParseOptions };
|
|
188
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAiHA;AAoBiB,UArIA,sBAAA,CAqIqB;EAWrB;;;;;;;;;;;;;;;;;;;;;;;;;;;YAlHL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmFK,kBAAA;;;;;;;;;;;;;;;;;;;UAoBA,qBAAA;;;;;;;;;;UAWA,SAAA;;;;;;;;;;;;;;;;YAmBL"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,188 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Cookie serialization options
|
|
4
|
+
*/
|
|
5
|
+
interface CookieSerializeOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3 | Domain Set-Cookie attribute}. By default, no
|
|
8
|
+
* domain is set, and most clients will consider the cookie to apply to only
|
|
9
|
+
* the current domain.
|
|
10
|
+
*/
|
|
11
|
+
domain?: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Specifies a function that will be used to encode a cookie's value. Since
|
|
14
|
+
* value of a cookie has a limited character set (and must be a simple
|
|
15
|
+
* string), this function can be used to encode a value into a string suited
|
|
16
|
+
* for a cookie's value.
|
|
17
|
+
*
|
|
18
|
+
* The default function is the global `encodeURIComponent`, which will
|
|
19
|
+
* encode a JavaScript string into UTF-8 byte sequences and then URL-encode
|
|
20
|
+
* any that fall outside of the cookie range.
|
|
21
|
+
*/
|
|
22
|
+
encode?: (value: string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1 | `Expires` `Set-Cookie` attribute}. By default,
|
|
25
|
+
* no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete
|
|
26
|
+
* it on a condition like exiting a web browser application.
|
|
27
|
+
*
|
|
28
|
+
* Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3 | cookie storage model specification}
|
|
29
|
+
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
|
|
30
|
+
* possible not all clients by obey this, so if both are set, they should
|
|
31
|
+
* point to the same date and time.
|
|
32
|
+
*/
|
|
33
|
+
expires?: Date | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6 | `HttpOnly` `Set-Cookie` attribute}.
|
|
36
|
+
* When truthy, the `HttpOnly` attribute is set, otherwise it is not. By
|
|
37
|
+
* default, the `HttpOnly` attribute is not set.
|
|
38
|
+
*
|
|
39
|
+
* Note* be careful when setting this to true, as compliant clients will
|
|
40
|
+
* not allow client-side JavaScript to see the cookie in `document.cookie`.
|
|
41
|
+
*/
|
|
42
|
+
httpOnly?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the number (in seconds) to be the value for the `Max-Age`
|
|
45
|
+
* `Set-Cookie` attribute. The given number will be converted to an integer
|
|
46
|
+
* by rounding down. By default, no maximum age is set.
|
|
47
|
+
*
|
|
48
|
+
* Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3 | cookie storage model specification}
|
|
49
|
+
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
|
|
50
|
+
* possible not all clients by obey this, so if both are set, they should
|
|
51
|
+
* point to the same date and time.
|
|
52
|
+
*/
|
|
53
|
+
maxAge?: number | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}.
|
|
56
|
+
* By default, the path is considered the "default path".
|
|
57
|
+
*/
|
|
58
|
+
path?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1].
|
|
61
|
+
*
|
|
62
|
+
* - `'low'` will set the `Priority` attribute to `Low`.
|
|
63
|
+
* - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
|
|
64
|
+
* - `'high'` will set the `Priority` attribute to `High`.
|
|
65
|
+
*
|
|
66
|
+
* More information about the different priority levels can be found in
|
|
67
|
+
* [the specification][rfc-west-cookie-priority-00-4.1].
|
|
68
|
+
*
|
|
69
|
+
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
|
|
70
|
+
* This also means many clients may ignore this attribute until they understand it.
|
|
71
|
+
*/
|
|
72
|
+
priority?: "low" | "medium" | "high" | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}.
|
|
75
|
+
*
|
|
76
|
+
* - `true` will set the `SameSite` attribute to `Strict` for strict same
|
|
77
|
+
* site enforcement.
|
|
78
|
+
* - `false` will not set the `SameSite` attribute.
|
|
79
|
+
* - `'lax'` will set the `SameSite` attribute to Lax for lax same site
|
|
80
|
+
* enforcement.
|
|
81
|
+
* - `'strict'` will set the `SameSite` attribute to Strict for strict same
|
|
82
|
+
* site enforcement.
|
|
83
|
+
* - `'none'` will set the SameSite attribute to None for an explicit
|
|
84
|
+
* cross-site cookie.
|
|
85
|
+
*
|
|
86
|
+
* More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}.
|
|
87
|
+
*
|
|
88
|
+
* note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.
|
|
89
|
+
*/
|
|
90
|
+
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5 | `Secure` `Set-Cookie` attribute}. When truthy, the
|
|
93
|
+
* `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
|
|
94
|
+
*
|
|
95
|
+
* Note* be careful when setting this to `true`, as compliant clients will
|
|
96
|
+
* not send the cookie back to the server in the future if the browser does
|
|
97
|
+
* not have an HTTPS connection.
|
|
98
|
+
*/
|
|
99
|
+
secure?: boolean | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1)
|
|
102
|
+
* attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
|
|
103
|
+
* `Partitioned` attribute is not set.
|
|
104
|
+
*
|
|
105
|
+
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
|
|
106
|
+
* This also means many clients may ignore this attribute until they understand it.
|
|
107
|
+
*
|
|
108
|
+
* More information can be found in the [proposal](https://github.com/privacycg/CHIPS).
|
|
109
|
+
*/
|
|
110
|
+
partitioned?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Additional parsing options
|
|
114
|
+
*/
|
|
115
|
+
interface CookieParseOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Specifies a function that will be used to decode a cookie's value. Since
|
|
118
|
+
* the value of a cookie has a limited character set (and must be a simple
|
|
119
|
+
* string), this function can be used to decode a previously-encoded cookie
|
|
120
|
+
* value into a JavaScript string or other object.
|
|
121
|
+
*
|
|
122
|
+
* The default function is the global `decodeURIComponent`, which will decode
|
|
123
|
+
* any URL-encoded sequences into their byte representations.
|
|
124
|
+
*
|
|
125
|
+
* Note* if an error is thrown from this function, the original, non-decoded
|
|
126
|
+
* cookie value will be returned as the cookie's value.
|
|
127
|
+
*/
|
|
128
|
+
decode?: (value: string) => string;
|
|
129
|
+
/**
|
|
130
|
+
* Custom function to filter parsing specific keys.
|
|
131
|
+
*/
|
|
132
|
+
filter?: (key: string) => boolean;
|
|
133
|
+
}
|
|
134
|
+
interface SetCookieParseOptions {
|
|
135
|
+
/**
|
|
136
|
+
* Custom decode function to use on cookie values.
|
|
137
|
+
*
|
|
138
|
+
* By default, `decodeURIComponent` is used.
|
|
139
|
+
*
|
|
140
|
+
* **Note:** If decoding fails, the original (undecoded) value will be used
|
|
141
|
+
*/
|
|
142
|
+
decode?: false | ((value: string) => string);
|
|
143
|
+
}
|
|
144
|
+
interface SetCookie {
|
|
145
|
+
/**
|
|
146
|
+
* Cookie name
|
|
147
|
+
*/
|
|
148
|
+
name: string;
|
|
149
|
+
/**
|
|
150
|
+
* Cookie value
|
|
151
|
+
*/
|
|
152
|
+
value: string;
|
|
153
|
+
/**
|
|
154
|
+
* Cookie path
|
|
155
|
+
*/
|
|
156
|
+
path?: string | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* Absolute expiration date for the cookie
|
|
159
|
+
*/
|
|
160
|
+
expires?: Date | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Relative max age of the cookie in seconds from when the client receives it (integer or undefined)
|
|
163
|
+
*
|
|
164
|
+
* Note: when using with express's res.cookie() method, multiply maxAge by 1000 to convert to milliseconds
|
|
165
|
+
*/
|
|
166
|
+
maxAge?: number | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Domain for the cookie,
|
|
169
|
+
* May begin with "." to indicate the named domain or any subdomain of it
|
|
170
|
+
*/
|
|
171
|
+
domain?: string | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Indicates that this cookie should only be sent over HTTPs
|
|
174
|
+
*/
|
|
175
|
+
secure?: boolean | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Indicates that this cookie should not be accessible to client-side JavaScript
|
|
178
|
+
*/
|
|
179
|
+
httpOnly?: boolean | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Indicates a cookie ought not to be sent along with cross-site requests
|
|
182
|
+
*/
|
|
183
|
+
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
|
|
184
|
+
[key: string]: unknown;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
export { CookieParseOptions, CookieSerializeOptions, SetCookie, SetCookieParseOptions };
|
|
188
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAiHA;AAoBiB,UArIA,sBAAA,CAqIqB;EAWrB;;;;;;;;;;;;;;;;;;;;;;;;;;;YAlHL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmFK,kBAAA;;;;;;;;;;;;;;;;;;;UAoBA,qBAAA;;;;;;;;;;UAWA,SAAA;;;;;;;;;;;;;;;;YAmBL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/cookie",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing HTTP Cookie utilities used by Storm Software.",
|
|
6
6
|
"repository": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
},
|
|
25
25
|
"types": "./dist/index.d.cts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@stryke/convert": "^0.6.
|
|
28
|
-
"@stryke/type-checks": "^0.5.
|
|
27
|
+
"@stryke/convert": "^0.6.25",
|
|
28
|
+
"@stryke/type-checks": "^0.5.10"
|
|
29
29
|
},
|
|
30
|
-
"devDependencies": { "tsdown": "^0.17.
|
|
30
|
+
"devDependencies": { "tsdown": "^0.17.2" },
|
|
31
31
|
"publishConfig": { "access": "public" },
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "8f2e484743eb3ce54929e99096ca2ea188b4730e"
|
|
33
33
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-string-Cdq5ranA.mjs","names":[],"sources":["../../type-checks/src/is-string.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 isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n"],"mappings":"AAkBA,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OAAO,OAAO,GAAU,cAClB,CACN,MAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=e=>{try{return typeof e==`string`}catch{return!1}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
package/dist/parse-CB7V9-FM.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./is-string-Cdq5ranA.mjs";function t(t,n){if(!e(t))throw Error(`argument str must be a string`);let r={},i=n??{},a=i.decode??(e=>e.includes(`%`)?decodeURIComponent(e):e),o=0;for(;o<t.length;){let e=t.indexOf(`=`,o);if(e===-1)break;let n=t.indexOf(`;`,o);if(n===-1)n=t.length;else if(n<e){o=t.lastIndexOf(`;`,e-1)+1;continue}let s=t.slice(o,e).trim();if(i?.filter&&!i?.filter(s)){o=n+1;continue}if(r[s]===void 0){let i=t.slice(e+1,n).trim();i.codePointAt(0)===34&&(i=i.slice(1,-1));try{r[s]=a(i)}catch{r[s]=i}}o=n+1}return r}function n(t,n){let r=(t||``).split(`;`).filter(t=>e(t)&&!!t.trim()),i=r.shift()||``,a=``,o=``,s=i.split(`=`);s.length>1?(a=s.shift(),o=s.join(`=`)):o=i;try{o=n?.decode===!1?o:(n?.decode??decodeURIComponent)(o)}catch{}let c={name:a,value:o};for(let e of r){let t=e.split(`=`),n=(t.shift()||``).trimStart().toLowerCase(),r=t.join(`=`);switch(n){case`expires`:c.expires=new Date(r);break;case`max-age`:c.maxAge=Number.parseInt(r,10);break;case`secure`:c.secure=!0;break;case`httponly`:c.httpOnly=!0;break;case`samesite`:c.sameSite=r;break;default:c[n]=r}}return c}export{n,t};
|
|
2
|
-
//# sourceMappingURL=parse-CB7V9-FM.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-CB7V9-FM.mjs","names":["cookie: SetCookie"],"sources":["../src/parse.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 { isString } from \"@stryke/type-checks\";\nimport type {\n CookieParseOptions,\n SetCookie,\n SetCookieParseOptions\n} from \"./types\";\n\n/**\n * Parse an HTTP Cookie header string and returning an object of all cookie name-value pairs.\n *\n * @param cookie - the string representing a `Cookie` header value\n * @param options - object containing parsing options\n * @returns an object with the parsed cookies\n */\nexport function parseCookie(\n cookie: string,\n options?: CookieParseOptions\n): Record<string, string> {\n if (!isString(cookie)) {\n throw new Error(\"argument str must be a string\");\n }\n\n const obj = {};\n const opt = options ?? {};\n const dec =\n opt.decode ??\n ((str: string) => (str.includes(\"%\") ? decodeURIComponent(str) : str));\n\n let index = 0;\n while (index < cookie.length) {\n const eqIdx = cookie.indexOf(\"=\", index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = cookie.indexOf(\";\", index);\n\n if (endIdx === -1) {\n endIdx = cookie.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = cookie.lastIndexOf(\";\", eqIdx - 1) + 1;\n\n continue;\n }\n\n const key = cookie.slice(index, eqIdx).trim();\n if (opt?.filter && !opt?.filter(key)) {\n index = endIdx + 1;\n\n continue;\n }\n\n // only assign once\n if (undefined === obj[key as keyof typeof obj]) {\n let val = cookie.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.codePointAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n (obj as any)[key] = dec(val);\n } catch {\n (obj as any)[key] = val;\n }\n }\n\n index = endIdx + 1;\n }\n\n return obj;\n}\n\n/**\n * Parse a [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) header string into an object.\n *\n * @param setCookieValue - the string representing a `Set-Cookie` header value\n * @param options - object containing parsing options\n * @returns an object with the parsed cookie\n */\nexport function parseSetCookie(\n setCookieValue: string,\n options?: SetCookieParseOptions\n): SetCookie {\n const parts = (setCookieValue || \"\")\n .split(\";\")\n .filter(str => isString(str) && Boolean(str.trim()));\n\n const nameValuePairStr = parts.shift() || \"\";\n\n let name = \"\";\n let value = \"\";\n const nameValueArr = nameValuePairStr.split(\"=\");\n if (nameValueArr.length > 1) {\n name = nameValueArr.shift()!;\n // Everything after the first =, joined by a \"=\" if there was more than one part\n value = nameValueArr.join(\"=\");\n } else {\n value = nameValuePairStr;\n }\n\n try {\n value =\n options?.decode === false\n ? value\n : (options?.decode ?? decodeURIComponent)(value);\n } catch {\n // Do nothing\n }\n\n const cookie: SetCookie = {\n name,\n value\n };\n\n for (const part of parts) {\n const sides = part.split(\"=\");\n const partKey = (sides.shift() || \"\").trimStart().toLowerCase();\n const partValue = sides.join(\"=\");\n switch (partKey) {\n case \"expires\": {\n cookie.expires = new Date(partValue);\n break;\n }\n case \"max-age\": {\n cookie.maxAge = Number.parseInt(partValue, 10);\n break;\n }\n case \"secure\": {\n cookie.secure = true;\n break;\n }\n case \"httponly\": {\n cookie.httpOnly = true;\n break;\n }\n case \"samesite\": {\n cookie.sameSite = partValue as SetCookie[\"sameSite\"];\n break;\n }\n default: {\n cookie[partKey] = partValue;\n }\n }\n }\n\n return cookie;\n}\n"],"mappings":"6CAgCA,SAAgB,EACd,EACA,EACwB,CACxB,GAAI,CAAC,EAAS,EAAO,CACnB,MAAU,MAAM,gCAAgC,CAGlD,IAAM,EAAM,EAAE,CACR,EAAM,GAAW,EAAE,CACnB,EACJ,EAAI,SACF,GAAiB,EAAI,SAAS,IAAI,CAAG,mBAAmB,EAAI,CAAG,GAE/D,EAAQ,EACZ,KAAO,EAAQ,EAAO,QAAQ,CAC5B,IAAM,EAAQ,EAAO,QAAQ,IAAK,EAAM,CAGxC,GAAI,IAAU,GACZ,MAGF,IAAI,EAAS,EAAO,QAAQ,IAAK,EAAM,CAEvC,GAAI,IAAW,GACb,EAAS,EAAO,eACP,EAAS,EAAO,CAEzB,EAAQ,EAAO,YAAY,IAAK,EAAQ,EAAE,CAAG,EAE7C,SAGF,IAAM,EAAM,EAAO,MAAM,EAAO,EAAM,CAAC,MAAM,CAC7C,GAAI,GAAK,QAAU,CAAC,GAAK,OAAO,EAAI,CAAE,CACpC,EAAQ,EAAS,EAEjB,SAIF,GAAkB,EAAI,KAAlB,IAAA,GAA4C,CAC9C,IAAI,EAAM,EAAO,MAAM,EAAQ,EAAG,EAAO,CAAC,MAAM,CAG5C,EAAI,YAAY,EAAE,GAAK,KACzB,EAAM,EAAI,MAAM,EAAG,GAAG,EAGxB,GAAI,CACD,EAAY,GAAO,EAAI,EAAI,MACtB,CACL,EAAY,GAAO,GAIxB,EAAQ,EAAS,EAGnB,OAAO,EAUT,SAAgB,EACd,EACA,EACW,CACX,IAAM,GAAS,GAAkB,IAC9B,MAAM,IAAI,CACV,OAAO,GAAO,EAAS,EAAI,EAAI,EAAQ,EAAI,MAAM,CAAE,CAEhD,EAAmB,EAAM,OAAO,EAAI,GAEtC,EAAO,GACP,EAAQ,GACN,EAAe,EAAiB,MAAM,IAAI,CAC5C,EAAa,OAAS,GACxB,EAAO,EAAa,OAAO,CAE3B,EAAQ,EAAa,KAAK,IAAI,EAE9B,EAAQ,EAGV,GAAI,CACF,EACE,GAAS,SAAW,GAChB,GACC,GAAS,QAAU,oBAAoB,EAAM,MAC9C,EAIR,IAAMA,EAAoB,CACxB,OACA,QACD,CAED,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAQ,EAAK,MAAM,IAAI,CACvB,GAAW,EAAM,OAAO,EAAI,IAAI,WAAW,CAAC,aAAa,CACzD,EAAY,EAAM,KAAK,IAAI,CACjC,OAAQ,EAAR,CACE,IAAK,UACH,EAAO,QAAU,IAAI,KAAK,EAAU,CACpC,MAEF,IAAK,UACH,EAAO,OAAS,OAAO,SAAS,EAAW,GAAG,CAC9C,MAEF,IAAK,SACH,EAAO,OAAS,GAChB,MAEF,IAAK,WACH,EAAO,SAAW,GAClB,MAEF,IAAK,WACH,EAAO,SAAW,EAClB,MAEF,QACE,EAAO,GAAW,GAKxB,OAAO"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { i as SetCookieParseOptions, r as SetCookie, t as CookieParseOptions } from "./types-DmPnClfS.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/parse.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Parse an HTTP Cookie header string and returning an object of all cookie name-value pairs.
|
|
7
|
-
*
|
|
8
|
-
* @param cookie - the string representing a `Cookie` header value
|
|
9
|
-
* @param options - object containing parsing options
|
|
10
|
-
* @returns an object with the parsed cookies
|
|
11
|
-
*/
|
|
12
|
-
declare function parseCookie(cookie: string, options?: CookieParseOptions): Record<string, string>;
|
|
13
|
-
/**
|
|
14
|
-
* Parse a [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) header string into an object.
|
|
15
|
-
*
|
|
16
|
-
* @param setCookieValue - the string representing a `Set-Cookie` header value
|
|
17
|
-
* @param options - object containing parsing options
|
|
18
|
-
* @returns an object with the parsed cookie
|
|
19
|
-
*/
|
|
20
|
-
declare function parseSetCookie(setCookieValue: string, options?: SetCookieParseOptions): SetCookie;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { parseSetCookie as n, parseCookie as t };
|
|
23
|
-
//# sourceMappingURL=parse-CC7RDu95.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-CC7RDu95.d.cts","names":[],"sources":["../src/parse.ts"],"sourcesContent":[],"mappings":";;;;;;AAgCA;AAsEA;;;;iBAtEgB,WAAA,2BAEJ,qBACT;;;;;;;;iBAmEa,cAAA,mCAEJ,wBACT"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { i as SetCookieParseOptions, r as SetCookie, t as CookieParseOptions } from "./types-DfXe0PRY.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/parse.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Parse an HTTP Cookie header string and returning an object of all cookie name-value pairs.
|
|
7
|
-
*
|
|
8
|
-
* @param cookie - the string representing a `Cookie` header value
|
|
9
|
-
* @param options - object containing parsing options
|
|
10
|
-
* @returns an object with the parsed cookies
|
|
11
|
-
*/
|
|
12
|
-
declare function parseCookie(cookie: string, options?: CookieParseOptions): Record<string, string>;
|
|
13
|
-
/**
|
|
14
|
-
* Parse a [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) header string into an object.
|
|
15
|
-
*
|
|
16
|
-
* @param setCookieValue - the string representing a `Set-Cookie` header value
|
|
17
|
-
* @param options - object containing parsing options
|
|
18
|
-
* @returns an object with the parsed cookie
|
|
19
|
-
*/
|
|
20
|
-
declare function parseSetCookie(setCookieValue: string, options?: SetCookieParseOptions): SetCookie;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { parseSetCookie as n, parseCookie as t };
|
|
23
|
-
//# sourceMappingURL=parse-DClQAhyZ.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-DClQAhyZ.d.mts","names":[],"sources":["../src/parse.ts"],"sourcesContent":[],"mappings":";;;;;;AAgCA;AAsEA;;;;iBAtEgB,WAAA,2BAEJ,qBACT;;;;;;;;iBAmEa,cAAA,mCAEJ,wBACT"}
|
package/dist/parse-Lu_9IylD.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./is-string-qyWqKQj-.cjs`);function t(t,n){if(!e.t(t))throw Error(`argument str must be a string`);let r={},i=n??{},a=i.decode??(e=>e.includes(`%`)?decodeURIComponent(e):e),o=0;for(;o<t.length;){let e=t.indexOf(`=`,o);if(e===-1)break;let n=t.indexOf(`;`,o);if(n===-1)n=t.length;else if(n<e){o=t.lastIndexOf(`;`,e-1)+1;continue}let s=t.slice(o,e).trim();if(i?.filter&&!i?.filter(s)){o=n+1;continue}if(r[s]===void 0){let i=t.slice(e+1,n).trim();i.codePointAt(0)===34&&(i=i.slice(1,-1));try{r[s]=a(i)}catch{r[s]=i}}o=n+1}return r}function n(t,n){let r=(t||``).split(`;`).filter(t=>e.t(t)&&!!t.trim()),i=r.shift()||``,a=``,o=``,s=i.split(`=`);s.length>1?(a=s.shift(),o=s.join(`=`)):o=i;try{o=n?.decode===!1?o:(n?.decode??decodeURIComponent)(o)}catch{}let c={name:a,value:o};for(let e of r){let t=e.split(`=`),n=(t.shift()||``).trimStart().toLowerCase(),r=t.join(`=`);switch(n){case`expires`:c.expires=new Date(r);break;case`max-age`:c.maxAge=Number.parseInt(r,10);break;case`secure`:c.secure=!0;break;case`httponly`:c.httpOnly=!0;break;case`samesite`:c.sameSite=r;break;default:c[n]=r}}return c}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"split-BMQx0Ga2.d.mts","names":[],"sources":["../src/split.ts"],"sourcesContent":[],"mappings":";iBAsCgB,oBAAA"}
|
package/dist/split-DGuM3LaG.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./is-string-qyWqKQj-.cjs`);function t(n){if(Array.isArray(n))return n.flatMap(e=>t(e));if(!e.t(n))return[];let r=[],i=0,a,o,s,c,l,u=()=>{for(;i<n.length&&/\s/.test(n.charAt(i));)i+=1;return i<n.length},d=()=>(o=n.charAt(i),o!==`=`&&o!==`;`&&o!==`,`);for(;i<n.length;){for(a=i,l=!1;u();)if(o=n.charAt(i),o===`,`){for(s=i,i+=1,u(),c=i;i<n.length&&d();)i+=1;i<n.length&&n.charAt(i)===`=`?(l=!0,i=c,r.push(n.slice(a,s)),a=i):i=s+1}else i+=1;(!l||i>=n.length)&&r.push(n.slice(a))}return r}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
package/dist/split-DyNIhQJp.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./is-string-Cdq5ranA.mjs";function t(n){if(Array.isArray(n))return n.flatMap(e=>t(e));if(!e(n))return[];let r=[],i=0,a,o,s,c,l,u=()=>{for(;i<n.length&&/\s/.test(n.charAt(i));)i+=1;return i<n.length},d=()=>(o=n.charAt(i),o!==`=`&&o!==`;`&&o!==`,`);for(;i<n.length;){for(a=i,l=!1;u();)if(o=n.charAt(i),o===`,`){for(s=i,i+=1,u(),c=i;i<n.length&&d();)i+=1;i<n.length&&n.charAt(i)===`=`?(l=!0,i=c,r.push(n.slice(a,s)),a=i):i=s+1}else i+=1;(!l||i>=n.length)&&r.push(n.slice(a))}return r}export{t};
|
|
2
|
-
//# sourceMappingURL=split-DyNIhQJp.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"split-DyNIhQJp.mjs","names":["cookiesStrings: string[]","pos: number","start: number","ch: string","lastComma: number","nextStart: number","cookiesSeparatorFound: boolean"],"sources":["../src/split.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 { isString } from \"@stryke/type-checks/is-string\";\n\n/* -------------------------------------------------------------------\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 function splitSetCookieString(strCookie: string | string[]): string[] {\n if (Array.isArray(strCookie)) {\n return strCookie.flatMap(c => splitSetCookieString(c));\n }\n\n if (!isString(strCookie)) {\n return [];\n }\n\n const cookiesStrings: string[] = [];\n let pos: number = 0;\n let start: number;\n let ch: string;\n let lastComma: number;\n let nextStart: number;\n let cookiesSeparatorFound: boolean;\n\n const skipWhitespace = () => {\n while (pos < strCookie.length && /\\s/.test(strCookie.charAt(pos))) {\n pos += 1;\n }\n return pos < strCookie.length;\n };\n\n const notSpecialChar = () => {\n ch = strCookie.charAt(pos);\n return ch !== \"=\" && ch !== \";\" && ch !== \",\";\n };\n\n while (pos < strCookie.length) {\n start = pos;\n cookiesSeparatorFound = false;\n\n while (skipWhitespace()) {\n ch = strCookie.charAt(pos);\n if (ch === \",\") {\n // ',' is a cookie separator if we have later first '=', not ';' or ','\n lastComma = pos;\n pos += 1;\n\n skipWhitespace();\n nextStart = pos;\n\n while (pos < strCookie.length && notSpecialChar()) {\n pos += 1;\n }\n\n // currently special character\n if (pos < strCookie.length && strCookie.charAt(pos) === \"=\") {\n // we found cookies separator\n cookiesSeparatorFound = true;\n // pos is inside the next cookie, so back up and return it.\n pos = nextStart;\n cookiesStrings.push(strCookie.slice(start, lastComma));\n start = pos;\n } else {\n // in param ',' or param separator ';',\n // we continue from that comma\n pos = lastComma + 1;\n }\n } else {\n pos += 1;\n }\n }\n\n if (!cookiesSeparatorFound || pos >= strCookie.length) {\n cookiesStrings.push(strCookie.slice(start));\n }\n }\n\n return cookiesStrings;\n}\n"],"mappings":"6CAsCA,SAAgB,EAAqB,EAAwC,CAC3E,GAAI,MAAM,QAAQ,EAAU,CAC1B,OAAO,EAAU,QAAQ,GAAK,EAAqB,EAAE,CAAC,CAGxD,GAAI,CAAC,EAAS,EAAU,CACtB,MAAO,EAAE,CAGX,IAAMA,EAA2B,EAAE,CAC/BC,EAAc,EACdC,EACAC,EACAC,EACAC,EACAC,EAEE,MAAuB,CAC3B,KAAO,EAAM,EAAU,QAAU,KAAK,KAAK,EAAU,OAAO,EAAI,CAAC,EAC/D,GAAO,EAET,OAAO,EAAM,EAAU,QAGnB,OACJ,EAAK,EAAU,OAAO,EAAI,CACnB,IAAO,KAAO,IAAO,KAAO,IAAO,KAG5C,KAAO,EAAM,EAAU,QAAQ,CAI7B,IAHA,EAAQ,EACR,EAAwB,GAEjB,GAAgB,EAErB,GADA,EAAK,EAAU,OAAO,EAAI,CACtB,IAAO,IAAK,CAQd,IANA,EAAY,EACZ,GAAO,EAEP,GAAgB,CAChB,EAAY,EAEL,EAAM,EAAU,QAAU,GAAgB,EAC/C,GAAO,EAIL,EAAM,EAAU,QAAU,EAAU,OAAO,EAAI,GAAK,KAEtD,EAAwB,GAExB,EAAM,EACN,EAAe,KAAK,EAAU,MAAM,EAAO,EAAU,CAAC,CACtD,EAAQ,GAIR,EAAM,EAAY,OAGpB,GAAO,GAIP,CAAC,GAAyB,GAAO,EAAU,SAC7C,EAAe,KAAK,EAAU,MAAM,EAAM,CAAC,CAI/C,OAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"split-Y8qgB1su.d.cts","names":[],"sources":["../src/split.ts"],"sourcesContent":[],"mappings":";iBAsCgB,oBAAA"}
|
package/dist/src-Bw3xE0BI.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e),t=e=>typeof e==`object`&&!!e,n=n=>t(n)&&e(n)==`[object Date]`;function r(t){return e(t)===`[object Function]`}function i(t){return e(t)===`[object AsyncFunction]`}const a=e=>{try{return e instanceof Function||typeof e==`function`||!!(e?.constructor&&e?.call&&e?.apply)||r(e)||i(e)}catch{return!1}},o=e=>{try{return e===null}catch{return!1}},s=e=>e===void 0,c=e=>{try{return s(e)||o(e)}catch{return!1}};typeof Buffer<`u`&&Buffer.isBuffer.bind(Buffer),(e=>(typeof globalThis==`object`||Object.defineProperty(e,`typeDetectGlobalObject`,{get(){return this},configurable:!0}),globalThis))(Object.prototype);const l=e=>{try{return!c(e)}catch{return!1}};export{a as n,n as r,l as t};
|
|
2
|
-
//# sourceMappingURL=src-Bw3xE0BI.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-Bw3xE0BI.mjs","names":["isBuffer: typeof Buffer.isBuffer","isBuffer"],"sources":["../../type-checks/src/get-object-tag.ts","../../type-checks/src/is-plain-object.ts","../../type-checks/src/is-date.ts","../../type-checks/src/is-function.ts","../../type-checks/src/is-null.ts","../../type-checks/src/is-undefined.ts","../../type-checks/src/is-empty.ts","../../type-checks/src/is-buffer.ts","../../type-checks/src/type-detect.ts","../../type-checks/src/is-set.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","/* -------------------------------------------------------------------\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 { PlainObject } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @example\n * ```typescript\n * isObjectLike({})\n * // => true\n *\n * isObjectLike([1, 2, 3])\n * // => true\n *\n * isObjectLike(Function)\n * // => false\n *\n * isObjectLike(null)\n * // => false\n * ```\n *\n * @param value - The value to check.\n * @returns Returns `true` if `value` is object-like, else `false`.\n */\nexport const isObjectLike = (obj: unknown) => {\n return typeof obj === \"object\" && obj !== null;\n};\n\n/**\n * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @example\n * ```typescript\n * function Foo() {\n * this.a = 1\n * }\n *\n * isPlainObject(new Foo)\n * // => false\n *\n * isPlainObject([1, 2, 3])\n * // => false\n *\n * isPlainObject({ 'x': 0, 'y': 0 })\n * // => true\n *\n * isPlainObject(Object.create(null))\n * // => true\n * ```\n *\n * @param obj - The value to check.\n * @returns Returns `true` if `obj` is a plain object, else `false`.\n */\nexport const isPlainObject = (obj: unknown): obj is PlainObject => {\n if (!isObjectLike(obj) || getObjectTag(obj) !== \"[object Object]\") {\n return false;\n }\n if (Object.getPrototypeOf(obj) === null) {\n return true;\n }\n let proto = obj;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(obj) === proto;\n};\n","/* -------------------------------------------------------------------\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 { getObjectTag } from \"./get-object-tag\";\nimport { isObjectLike } from \"./is-plain-object\";\n\n/**\n * Checks if `value` is classified as a `Date` object.\n *\n * @example\n * ```typescript\n * isDate(new Date)\n * // => true\n *\n * isDate('Mon April 23 2012')\n * // => false\n * ```\n *\n * @param value - The value to check.\n * @returns Returns `true` if `obj` is a date object, else `false`.\n */\nexport const isDate = (value: unknown): value is Date =>\n isObjectLike(value) && getObjectTag(value) == \"[object Date]\";\n","/* -------------------------------------------------------------------\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 { AnyFunction } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\nexport function isSyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object Function]\";\n}\n\nexport function isAsyncFunction(value?: any): value is AnyFunction {\n return getObjectTag(value) === \"[object AsyncFunction]\";\n}\n\n/**\n * Check if the provided value's type is `Function`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Function`\n */\nexport const isFunction = (value: unknown): value is AnyFunction => {\n try {\n return (\n value instanceof Function ||\n typeof value === \"function\" ||\n Boolean(\n value?.constructor && (value as any)?.call && (value as any)?.apply\n ) ||\n isSyncFunction(value) ||\n isAsyncFunction(value)\n );\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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 isUndefined = (value: unknown): value is undefined => {\n return value === undefined;\n};\n","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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 isBufferExists = typeof Buffer !== \"undefined\";\n\n/**\n * Check if the provided value's type is `Buffer`\n */\nexport const isBuffer: typeof Buffer.isBuffer = isBufferExists\n ? Buffer.isBuffer.bind(Buffer)\n : /**\n * Check if the provided value's type is `Buffer`\n\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Buffer`\n */\n function isBuffer(\n value: Parameters<typeof Buffer.isBuffer>[0]\n ): value is Buffer {\n return false;\n };\n","/* -------------------------------------------------------------------\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 { isBuffer } from \"./is-buffer\";\n\nconst globalObject = (Obj => {\n if (typeof globalThis === \"object\") {\n return globalThis;\n }\n Object.defineProperty(Obj, \"typeDetectGlobalObject\", {\n get() {\n return this;\n },\n configurable: true\n });\n\n // // biome-ignore lint/correctness/noUndeclaredVariables: <explanation>\n // const global = typeDetectGlobalObject;\n\n // // biome-ignore lint/performance/noDelete: <explanation>\n // delete Obj.typeDetectGlobalObject;\n return globalThis;\n})(Object.prototype);\n\nexport function typeDetect(obj: unknown): string {\n // NOTE: isBuffer must execute before type-detect,\n // because type-detect returns 'Uint8Array'.\n if (isBuffer(obj)) {\n return \"Buffer\";\n }\n\n const typeofObj = typeof obj;\n if (typeofObj !== \"object\") {\n return typeofObj;\n }\n\n if (obj === null) {\n return \"null\";\n }\n\n if (obj === globalObject) {\n return \"global\";\n }\n\n if (\n Array.isArray(obj) &&\n (Symbol.toStringTag === undefined || !(Symbol.toStringTag in obj))\n ) {\n return \"Array\";\n }\n\n // https://html.spec.whatwg.org/multipage/browsers.html#location\n if (typeof globalThis === \"object\" && globalThis !== null) {\n if (\n typeof (globalThis as any).location === \"object\" &&\n obj === (globalThis as any).location\n ) {\n return \"Location\";\n }\n\n // https://html.spec.whatwg.org/#document\n if (\n typeof (globalThis as any).document === \"object\" &&\n obj === (globalThis as any).document\n ) {\n return \"Document\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray\n if (typeof (globalThis as any).navigator === \"object\") {\n if (\n typeof (globalThis as any).navigator.mimeTypes === \"object\" &&\n obj === (globalThis as any).navigator.mimeTypes\n ) {\n return \"MimeTypeArray\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n typeof (globalThis as any).navigator.plugins === \"object\" &&\n obj === (globalThis as any).navigator.plugins\n ) {\n return \"PluginArray\";\n }\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n (typeof (globalThis as any).HTMLElement === \"function\" ||\n typeof (globalThis as any).HTMLElement === \"object\") &&\n obj instanceof (globalThis as any).HTMLElement\n ) {\n if ((obj as any).tagName === \"BLOCKQUOTE\") {\n return \"HTMLQuoteElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltabledatacellelement\n if ((obj as any).tagName === \"TD\") {\n return \"HTMLTableDataCellElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltableheadercellelement\n if ((obj as any).tagName === \"TH\") {\n return \"HTMLTableHeaderCellElement\";\n }\n }\n }\n\n const stringTag =\n Symbol.toStringTag !== undefined && (obj as any)[Symbol.toStringTag];\n if (typeof stringTag === \"string\") {\n return stringTag;\n }\n\n const objPrototype = Object.getPrototypeOf(obj);\n if (objPrototype === RegExp.prototype) {\n return \"RegExp\";\n }\n\n if (objPrototype === Date.prototype) {\n return \"Date\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag\n if (typeof Promise !== \"undefined\" && objPrototype === Promise.prototype) {\n return \"Promise\";\n }\n\n if (typeof Set !== \"undefined\" && objPrototype === Set.prototype) {\n return \"Set\";\n }\n\n if (typeof Map !== \"undefined\" && objPrototype === Map.prototype) {\n return \"Map\";\n }\n\n if (typeof WeakSet !== \"undefined\" && objPrototype === WeakSet.prototype) {\n return \"WeakSet\";\n }\n\n if (typeof WeakMap !== \"undefined\" && objPrototype === WeakMap.prototype) {\n return \"WeakMap\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag\n if (typeof DataView !== \"undefined\" && objPrototype === DataView.prototype) {\n return \"DataView\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag\n if (\n typeof Map !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Map().entries())\n ) {\n return \"Map Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag\n if (\n typeof Set !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Set().entries())\n ) {\n return \"Set Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag\n if (\n typeof Array.prototype[Symbol.iterator] === \"function\" &&\n objPrototype === Object.getPrototypeOf([][Symbol.iterator]())\n ) {\n return \"Array Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag\n if (\n Symbol.iterator !== undefined &&\n typeof String.prototype[Symbol.iterator] === \"function\" &&\n Object.getPrototypeOf(\"\"[Symbol.iterator]()) &&\n objPrototype === Object.getPrototypeOf(\"\"[Symbol.iterator]())\n ) {\n return \"String Iterator\";\n }\n\n if (objPrototype === null) {\n return \"Object\";\n }\n\n return Object.prototype.toString.call(obj).slice(8, -1);\n}\n","/* -------------------------------------------------------------------\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 { isEmpty } from \"./is-empty\";\n\n/**\n * The inverse of the `isEmpty` function\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`\n */\nexport const isSet = (value: unknown): value is NonNullable<unknown> => {\n try {\n return !isEmpty(value);\n } catch {\n return false;\n }\n};\n"],"mappings":"AAwBA,MAAa,EAAgB,GACvB,GAAS,KACJ,IAAU,IAAA,GAAY,qBAAuB,gBAE/C,OAAO,UAAU,SAAS,KAAK,EAAM,CCejC,EAAgB,GACpB,OAAO,GAAQ,YAAY,ECRvB,EAAU,GACrB,EAAa,EAAM,EAAI,EAAa,EAAM,EAAI,gBChBhD,SAAgB,EAAe,EAAmC,CAChE,OAAO,EAAa,EAAM,GAAK,oBAGjC,SAAgB,EAAgB,EAAmC,CACjE,OAAO,EAAa,EAAM,GAAK,yBASjC,MAAa,EAAc,GAAyC,CAClE,GAAI,CACF,OACE,aAAiB,UACjB,OAAO,GAAU,YACjB,GACE,GAAO,aAAgB,GAAe,MAAS,GAAe,QAEhE,EAAe,EAAM,EACrB,EAAgB,EAAM,MAElB,CACN,MAAO,KC7BE,EAAU,GAAkC,CACvD,GAAI,CACF,OAAO,IAAU,UACX,CACN,MAAO,KCJE,EAAe,GACnB,IAAU,IAAA,GCYN,EAAW,GAAmB,CACzC,GAAI,CACF,OAAO,EAAY,EAAM,EAAI,EAAO,EAAM,MACpC,CACN,MAAO,KCjBmB,OAAO,OAAW,KAM5C,OAAO,SAAS,KAAK,OAAO,ECJV,IAChB,OAAO,YAAe,UAG1B,OAAO,eAAe,EAAK,yBAA0B,CACnD,KAAM,CACJ,OAAO,MAET,aAAc,GACf,CAAC,CAPO,aAeR,OAAO,UAAU,CCXpB,MAAa,EAAS,GAAkD,CACtE,GAAI,CACF,MAAO,CAAC,EAAQ,EAAM,MAChB,CACN,MAAO"}
|
package/dist/src-C0Osv7A0.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e),t=e=>typeof e==`object`&&!!e,n=n=>t(n)&&e(n)==`[object Date]`;function r(t){return e(t)===`[object Function]`}function i(t){return e(t)===`[object AsyncFunction]`}const a=e=>{try{return e instanceof Function||typeof e==`function`||!!(e?.constructor&&e?.call&&e?.apply)||r(e)||i(e)}catch{return!1}},o=e=>{try{return e===null}catch{return!1}},s=e=>e===void 0,c=e=>{try{return s(e)||o(e)}catch{return!1}},l=typeof Buffer<`u`,u=l?Buffer.isBuffer.bind(Buffer):function(e){return!1},d=(e=>(typeof globalThis==`object`||Object.defineProperty(e,`typeDetectGlobalObject`,{get(){return this},configurable:!0}),globalThis))(Object.prototype),f=e=>{try{return!c(e)}catch{return!1}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./src-Bw3xE0BI.mjs";import{t as r}from"./is-string-Cdq5ranA.mjs";const i=/^[\t\u0020-\u007E\u0080-\u00FF]+$/;function a(a,o,s){let c=s??{},l=c.encode??encodeURIComponent;if(!e(l))throw Error(`option encode is invalid`);if(!i.test(a))throw Error(`argument name is invalid`);let u=l(o);if(u&&!i.test(u))throw Error(`argument val is invalid`);let d=`${a}=${u}`;if(!n(c.maxAge)){let e=Number(c.maxAge);if(Number.isNaN(e)||!Number.isFinite(e))throw TypeError(`option maxAge is invalid`);d+=`; Max-Age=${Math.floor(e)}`}if(c.domain){if(!i.test(c.domain))throw Error(`option domain is invalid`);d+=`; Domain=${c.domain}`}if(c.path){if(!i.test(c.path))throw Error(`option path is invalid`);d+=`; Path=${c.path}`}if(c.expires){if(!t(c.expires)||Number.isNaN(c.expires.valueOf()))throw Error(`option expires is invalid`);d+=`; Expires=${c.expires.toUTCString()}`}if(c.httpOnly&&(d+=`; HttpOnly`),c.secure&&(d+=`; Secure`),c.priority)switch(r(c.priority)?c.priority.toLowerCase():c.priority){case`low`:d+=`; Priority=Low`;break;case`medium`:d+=`; Priority=Medium`;break;case`high`:d+=`; Priority=High`;break;default:throw Error(`option priority is invalid`)}if(c.sameSite)switch(r(c.sameSite)?c.sameSite.toLowerCase():c.sameSite){case!0:d+=`; SameSite=Strict`;break;case`lax`:d+=`; SameSite=Lax`;break;case`strict`:d+=`; SameSite=Strict`;break;case`none`:d+=`; SameSite=None`;break;default:throw Error(`option sameSite is invalid`)}return c.partitioned&&(d+=`; Partitioned`),d}export{a as t};
|
|
2
|
-
//# sourceMappingURL=stringify-BkjTv8_W.mjs.map
|