@uxf/core 11.68.2 → 11.72.3
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/cookie/index.d.ts +4 -1
- package/cookie/index.js +10 -0
- package/package.json +1 -1
- package/utils/throw-error.d.ts +1 -1
- package/utils/throw-error.test.js +2 -2
package/cookie/index.d.ts
CHANGED
package/cookie/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Cookie = void 0;
|
|
4
4
|
const is_not_empty_1 = require("../utils/is-not-empty");
|
|
5
|
+
const is_not_nil_1 = require("../utils/is-not-nil");
|
|
5
6
|
class Cookie {
|
|
6
7
|
constructor(ctx = null) {
|
|
7
8
|
this.ctx = ctx;
|
|
@@ -16,6 +17,15 @@ class Cookie {
|
|
|
16
17
|
const date = new Date();
|
|
17
18
|
date.setTime(date.getTime() + ttl * 1000);
|
|
18
19
|
const cookieParts = [`${name}=${encodeURIComponent(value)}`, `expires=${date.toUTCString()}`];
|
|
20
|
+
if ((0, is_not_nil_1.isNotNil)(options.domain) && (0, is_not_empty_1.isNotEmpty)(options.domain)) {
|
|
21
|
+
cookieParts.push(`domain=${options.domain}`);
|
|
22
|
+
}
|
|
23
|
+
if ((0, is_not_nil_1.isNotNil)(options.domain)) {
|
|
24
|
+
cookieParts.push(`samesite=${options.sameSite}`);
|
|
25
|
+
}
|
|
26
|
+
if (options.partitioned) {
|
|
27
|
+
cookieParts.push("partitioned");
|
|
28
|
+
}
|
|
19
29
|
if (options.httpOnly) {
|
|
20
30
|
cookieParts.push("httponly");
|
|
21
31
|
}
|
package/package.json
CHANGED
package/utils/throw-error.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function throwError(message
|
|
1
|
+
export declare function throwError(message: string): never;
|
|
@@ -8,7 +8,7 @@ describe("throwError", () => {
|
|
|
8
8
|
expect(() => (0, throw_error_1.throwError)(message)).toThrow(message);
|
|
9
9
|
});
|
|
10
10
|
it("should throw an error without a message", () => {
|
|
11
|
-
expect(() => (0, throw_error_1.throwError)()).toThrow(Error);
|
|
12
|
-
expect(() => (0, throw_error_1.throwError)()).toThrow();
|
|
11
|
+
expect(() => (0, throw_error_1.throwError)("Error message")).toThrow(Error);
|
|
12
|
+
expect(() => (0, throw_error_1.throwError)("Error message")).toThrow();
|
|
13
13
|
});
|
|
14
14
|
});
|