@koine/utils 2.0.0-beta.20 → 2.0.0-beta.21
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/cjs/invariant.js +1 -1
- package/cjs/readCookie.js +2 -2
- package/cjs/render.js +1 -1
- package/cjs/roundTo.js +1 -1
- package/cjs/serializeCookie.js +3 -3
- package/cjs/setCookie.js +1 -1
- package/invariant.js +1 -1
- package/package.json +1 -2
- package/readCookie.js +2 -2
- package/render.js +1 -1
- package/roundTo.js +1 -1
- package/serializeCookie.js +3 -3
- package/setCookie.js +1 -1
package/cjs/invariant.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.invariant = void 0;
|
|
4
4
|
function invariant(condition, message, lib, prefix) {
|
|
5
|
-
if (process.env["NODE_ENV"]
|
|
5
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
6
6
|
if (condition) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
package/cjs/readCookie.js
CHANGED
|
@@ -9,7 +9,7 @@ function converterRead(value) {
|
|
|
9
9
|
}
|
|
10
10
|
function readCookie(name) {
|
|
11
11
|
if (typeof document === "undefined") {
|
|
12
|
-
if (process.env["NODE_ENV"]
|
|
12
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
13
13
|
console.warn("[@koine/utils:readCookie] document is undefined");
|
|
14
14
|
}
|
|
15
15
|
return name ? "" : {};
|
|
@@ -27,7 +27,7 @@ function readCookie(name) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
|
-
if (process.env["NODE_ENV"]
|
|
30
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
31
31
|
console.warn("[@koine/utils:readCookie] failed to decode", value);
|
|
32
32
|
}
|
|
33
33
|
}
|
package/cjs/render.js
CHANGED
|
@@ -112,7 +112,7 @@ var render = function (tmpl, def) {
|
|
|
112
112
|
return new Function(varname, str);
|
|
113
113
|
}
|
|
114
114
|
catch (e) {
|
|
115
|
-
if (process.env["NODE_ENV"]
|
|
115
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
116
116
|
console.log("Could not create a template function: " + str);
|
|
117
117
|
throw e;
|
|
118
118
|
}
|
package/cjs/roundTo.js
CHANGED
|
@@ -7,7 +7,7 @@ function roundTo(num, decimals) {
|
|
|
7
7
|
var multiplicator = Math.pow(10, decimals);
|
|
8
8
|
return Math.round(num * multiplicator) / multiplicator + "";
|
|
9
9
|
}
|
|
10
|
-
if (process.env["NODE_ENV"]
|
|
10
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
11
11
|
console.warn("[@koine/utils] math:roundTo -> given not a finite number as first arg");
|
|
12
12
|
}
|
|
13
13
|
return "";
|
package/cjs/serializeCookie.js
CHANGED
|
@@ -8,7 +8,7 @@ function serializeCookie(name, val, attributes) {
|
|
|
8
8
|
var _a = attributes.encode, encode = _a === void 0 ? encodeURIComponent : _a, domain = attributes.domain, path = attributes.path, httpOnly = attributes.httpOnly, secure = attributes.secure, sameSite = attributes.sameSite;
|
|
9
9
|
var maxAge = attributes.maxAge, expires = attributes.expires;
|
|
10
10
|
var value = encode(val);
|
|
11
|
-
if (process.env["NODE_ENV"]
|
|
11
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
12
12
|
if (!fieldContentRegExp.test(name)) {
|
|
13
13
|
throw new TypeError("argument name is invalid");
|
|
14
14
|
}
|
|
@@ -28,7 +28,7 @@ function serializeCookie(name, val, attributes) {
|
|
|
28
28
|
str += "; Max-Age=" + Math.floor(maxAge);
|
|
29
29
|
}
|
|
30
30
|
if (domain) {
|
|
31
|
-
if (process.env["NODE_ENV"]
|
|
31
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
32
32
|
if (!fieldContentRegExp.test(domain)) {
|
|
33
33
|
throw new TypeError("option domain is invalid");
|
|
34
34
|
}
|
|
@@ -36,7 +36,7 @@ function serializeCookie(name, val, attributes) {
|
|
|
36
36
|
str += "; Domain=" + domain;
|
|
37
37
|
}
|
|
38
38
|
if (path) {
|
|
39
|
-
if (process.env["NODE_ENV"]
|
|
39
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
40
40
|
if (!fieldContentRegExp.test(path)) {
|
|
41
41
|
throw new TypeError("option path is invalid");
|
|
42
42
|
}
|
package/cjs/setCookie.js
CHANGED
|
@@ -13,7 +13,7 @@ function setCookie(name, value, attributes) {
|
|
|
13
13
|
var expires = attributes.expires, restAttrs = tslib_1.__rest(attributes, ["expires"]);
|
|
14
14
|
var cleanedAttrs = tslib_1.__assign(tslib_1.__assign({ expires: "" }, cookie_1.defaultAttributesClient), restAttrs);
|
|
15
15
|
if ((0, isUndefined_1.default)(document)) {
|
|
16
|
-
if (process.env["NODE_ENV"]
|
|
16
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
17
17
|
console.warn("[@koine/utils:setCookie] document is undefined");
|
|
18
18
|
}
|
|
19
19
|
return undefined;
|
package/invariant.js
CHANGED
package/package.json
CHANGED
package/readCookie.js
CHANGED
|
@@ -6,7 +6,7 @@ function converterRead(value) {
|
|
|
6
6
|
}
|
|
7
7
|
export function readCookie(name) {
|
|
8
8
|
if (typeof document === "undefined") {
|
|
9
|
-
if (process.env["NODE_ENV"]
|
|
9
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
10
10
|
console.warn("[@koine/utils:readCookie] document is undefined");
|
|
11
11
|
}
|
|
12
12
|
return name ? "" : {};
|
|
@@ -24,7 +24,7 @@ export function readCookie(name) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
catch (e) {
|
|
27
|
-
if (process.env["NODE_ENV"]
|
|
27
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
28
28
|
console.warn("[@koine/utils:readCookie] failed to decode", value);
|
|
29
29
|
}
|
|
30
30
|
}
|
package/render.js
CHANGED
|
@@ -109,7 +109,7 @@ export var render = function (tmpl, def) {
|
|
|
109
109
|
return new Function(varname, str);
|
|
110
110
|
}
|
|
111
111
|
catch (e) {
|
|
112
|
-
if (process.env["NODE_ENV"]
|
|
112
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
113
113
|
console.log("Could not create a template function: " + str);
|
|
114
114
|
throw e;
|
|
115
115
|
}
|
package/roundTo.js
CHANGED
|
@@ -4,7 +4,7 @@ export function roundTo(num, decimals) {
|
|
|
4
4
|
var multiplicator = Math.pow(10, decimals);
|
|
5
5
|
return Math.round(num * multiplicator) / multiplicator + "";
|
|
6
6
|
}
|
|
7
|
-
if (process.env["NODE_ENV"]
|
|
7
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
8
8
|
console.warn("[@koine/utils] math:roundTo -> given not a finite number as first arg");
|
|
9
9
|
}
|
|
10
10
|
return "";
|
package/serializeCookie.js
CHANGED
|
@@ -5,7 +5,7 @@ export function serializeCookie(name, val, attributes) {
|
|
|
5
5
|
var _a = attributes.encode, encode = _a === void 0 ? encodeURIComponent : _a, domain = attributes.domain, path = attributes.path, httpOnly = attributes.httpOnly, secure = attributes.secure, sameSite = attributes.sameSite;
|
|
6
6
|
var maxAge = attributes.maxAge, expires = attributes.expires;
|
|
7
7
|
var value = encode(val);
|
|
8
|
-
if (process.env["NODE_ENV"]
|
|
8
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
9
9
|
if (!fieldContentRegExp.test(name)) {
|
|
10
10
|
throw new TypeError("argument name is invalid");
|
|
11
11
|
}
|
|
@@ -25,7 +25,7 @@ export function serializeCookie(name, val, attributes) {
|
|
|
25
25
|
str += "; Max-Age=" + Math.floor(maxAge);
|
|
26
26
|
}
|
|
27
27
|
if (domain) {
|
|
28
|
-
if (process.env["NODE_ENV"]
|
|
28
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
29
29
|
if (!fieldContentRegExp.test(domain)) {
|
|
30
30
|
throw new TypeError("option domain is invalid");
|
|
31
31
|
}
|
|
@@ -33,7 +33,7 @@ export function serializeCookie(name, val, attributes) {
|
|
|
33
33
|
str += "; Domain=" + domain;
|
|
34
34
|
}
|
|
35
35
|
if (path) {
|
|
36
|
-
if (process.env["NODE_ENV"]
|
|
36
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
37
37
|
if (!fieldContentRegExp.test(path)) {
|
|
38
38
|
throw new TypeError("option path is invalid");
|
|
39
39
|
}
|
package/setCookie.js
CHANGED
|
@@ -10,7 +10,7 @@ export function setCookie(name, value, attributes) {
|
|
|
10
10
|
var expires = attributes.expires, restAttrs = __rest(attributes, ["expires"]);
|
|
11
11
|
var cleanedAttrs = __assign(__assign({ expires: "" }, defaultAttributesClient), restAttrs);
|
|
12
12
|
if (isUndefined(document)) {
|
|
13
|
-
if (process.env["NODE_ENV"]
|
|
13
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
14
14
|
console.warn("[@koine/utils:setCookie] document is undefined");
|
|
15
15
|
}
|
|
16
16
|
return undefined;
|