@koine/utils 1.0.75 → 1.0.78
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/capitalize.d.ts +1 -1
- package/capitalize.js +4 -4
- package/getParamAsInt.d.ts +1 -1
- package/getParamAsInt.js +5 -4
- package/getUrlHashParams.d.ts +2 -2
- package/getUrlHashParams.js +2 -2
- package/getUrlHashPathname.d.ts +1 -1
- package/getUrlHashPathname.js +1 -1
- package/getZonedDate.d.ts +16 -0
- package/getZonedDate.js +37 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/node/buildUrlQueryString.js +4 -3
- package/node/capitalize.js +4 -4
- package/node/changeUrlPath.js +3 -2
- package/node/getEmptyArray.js +2 -1
- package/node/getParamAmong.js +2 -1
- package/node/getParamAsInt.js +7 -5
- package/node/getParamAsString.js +2 -1
- package/node/getUrlHashParams.js +2 -2
- package/node/getUrlHashPathname.js +1 -1
- package/node/getUrlPathnameParts.js +2 -1
- package/node/getUrlQueryParams.js +2 -1
- package/node/getZonedDate.js +42 -0
- package/node/index.js +1 -0
- package/node/isAnyObject.js +2 -1
- package/node/isArray.js +2 -1
- package/node/isBlob.js +2 -1
- package/node/isBoolean.js +2 -1
- package/node/isDate.js +2 -1
- package/node/isEmptyArray.js +2 -1
- package/node/isEmptyObject.js +2 -1
- package/node/isError.js +2 -1
- package/node/isExternalUrl.js +2 -1
- package/node/isFile.js +2 -1
- package/node/isFloat.js +2 -1
- package/node/isFormData.js +2 -1
- package/node/isFullArray.js +2 -1
- package/node/isFullObject.js +2 -1
- package/node/isFullString.js +2 -1
- package/node/isInt.js +2 -1
- package/node/isMap.js +2 -1
- package/node/isNaNValue.js +2 -1
- package/node/isNegativeNumber.js +2 -1
- package/node/isNull.js +2 -1
- package/node/isNullOrUndefined.js +4 -3
- package/node/isNumber.js +2 -1
- package/node/isObject.js +2 -1
- package/node/isObjectLike.js +2 -1
- package/node/isPlainObject.js +2 -1
- package/node/isPositiveNumber.js +2 -1
- package/node/isPrimitive.js +7 -6
- package/node/isPromise.js +2 -1
- package/node/isRegExp.js +2 -1
- package/node/isServer.js +2 -1
- package/node/isSet.js +2 -1
- package/node/isString.js +2 -1
- package/node/isSymbol.js +2 -1
- package/node/isType.js +2 -1
- package/node/isUndefined.js +2 -1
- package/node/isWeakMap.js +2 -1
- package/node/isWeakSet.js +2 -1
- package/node/matchSorter.js +1 -1
- package/node/mergeUrlQueryParams.js +2 -1
- package/node/navigateToHashParams.js +3 -2
- package/node/navigateToMergedHashParams.js +4 -3
- package/node/navigateToMergedParams.js +4 -3
- package/node/navigateToParams.js +3 -2
- package/node/navigateWithoutUrlParam.js +3 -2
- package/node/normaliseUrl.js +2 -1
- package/node/normaliseUrlPathname.js +2 -1
- package/node/pageview.js +2 -1
- package/node/readCookie.js +2 -2
- package/node/redirectTo.js +3 -2
- package/node/removeUrlQueryParams.js +3 -2
- package/node/setCookie.js +4 -3
- package/node/transformToUrlPathname.js +2 -1
- package/node/updateLinkParams.js +2 -1
- package/node/updateUrlQueryParams.js +4 -3
- package/package.json +4 -3
- package/readCookie.js +2 -2
- package/setCookie.js +3 -2
package/capitalize.d.ts
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @category text
|
|
5
5
|
* @see https://stackoverflow.com/a/11409944/1938970
|
|
6
6
|
*/
|
|
7
|
-
export declare function capitalize<T extends string>(
|
|
7
|
+
export declare function capitalize<T extends string>(string: null | T): Capitalize<T>;
|
|
8
8
|
export default capitalize;
|
package/capitalize.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @category text
|
|
5
5
|
* @see https://stackoverflow.com/a/11409944/1938970
|
|
6
6
|
*/
|
|
7
|
-
export function capitalize(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export function capitalize(string) {
|
|
8
|
+
var ensuredString = string || "";
|
|
9
|
+
return (ensuredString.charAt(0).toUpperCase() +
|
|
10
|
+
ensuredString.slice(1));
|
|
11
11
|
}
|
|
12
12
|
export default capitalize;
|
package/getParamAsInt.d.ts
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* @param {string} [raw] - The _raw_ query parameter
|
|
9
9
|
* @param {number} [fallback] - Fallback number, we return `null` if not provided
|
|
10
10
|
*/
|
|
11
|
-
export declare function getParamAsInt(raw?: string | string[], fallback?:
|
|
11
|
+
export declare function getParamAsInt<TFallback extends number | null | undefined>(raw?: string | string[], fallback?: TFallback): number | TFallback;
|
|
12
12
|
export default getParamAsInt;
|
package/getParamAsInt.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import getParamAsString from "./getParamAsString";
|
|
2
|
-
import isUndefined from "./isUndefined";
|
|
3
2
|
/**
|
|
4
3
|
* Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
|
|
5
4
|
* [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
|
|
@@ -11,9 +10,11 @@ import isUndefined from "./isUndefined";
|
|
|
11
10
|
* @param {number} [fallback] - Fallback number, we return `null` if not provided
|
|
12
11
|
*/
|
|
13
12
|
export function getParamAsInt(raw, fallback) {
|
|
13
|
+
if (fallback === void 0) { fallback = null; }
|
|
14
14
|
var string = getParamAsString(raw);
|
|
15
|
-
if (string)
|
|
16
|
-
parseInt(string, 10);
|
|
17
|
-
|
|
15
|
+
if (string) {
|
|
16
|
+
return parseInt(string, 10);
|
|
17
|
+
}
|
|
18
|
+
return fallback;
|
|
18
19
|
}
|
|
19
20
|
export default getParamAsInt;
|
package/getUrlHashParams.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type AnyQueryParams } from "./location";
|
|
2
2
|
/**
|
|
3
3
|
* It returns the "query params" as an object extracting it from the given `hash`
|
|
4
|
-
*string or, if not provided, failling back reading the `location.hash`
|
|
5
|
-
|
|
4
|
+
* string or, if not provided, failling back reading the `location.hash`
|
|
5
|
+
*
|
|
6
6
|
* @category location
|
|
7
7
|
*/
|
|
8
8
|
export declare function getUrlHashParams<T extends NonNullable<AnyQueryParams>>(hash?: string): T;
|
package/getUrlHashParams.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* It returns the "query params" as an object extracting it from the given `hash`
|
|
3
|
-
*string or, if not provided, failling back reading the `location.hash`
|
|
4
|
-
|
|
3
|
+
* string or, if not provided, failling back reading the `location.hash`
|
|
4
|
+
*
|
|
5
5
|
* @category location
|
|
6
6
|
*/
|
|
7
7
|
export function getUrlHashParams(hash) {
|
package/getUrlHashPathname.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* It returns the "pathname" cleaned up from the `#` and the initial slashes
|
|
3
|
-
*
|
|
3
|
+
* extracting it from the given `hash` string or, if not provided, failling
|
|
4
4
|
* back reading the `location.hash`
|
|
5
5
|
*
|
|
6
6
|
* @category location
|
package/getUrlHashPathname.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* It returns the "pathname" cleaned up from the `#` and the initial slashes
|
|
3
|
-
*
|
|
3
|
+
* extracting it from the given `hash` string or, if not provided, failling
|
|
4
4
|
* back reading the `location.hash`
|
|
5
5
|
*
|
|
6
6
|
* @category location
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* It returns a `Date` object from a date `string` adjusted on the user timeZone,
|
|
3
|
+
* if a timeZone is not provided we try getting it from the `Intl` browwser native
|
|
4
|
+
* API. It gracefully falls back returning a _non-timezone-based_ `Date`.
|
|
5
|
+
*
|
|
6
|
+
* @category date
|
|
7
|
+
*
|
|
8
|
+
* @resources
|
|
9
|
+
* - to get the timeZone client side see [this article](https://attacomsian.com/blog/javascript-current-timezone)
|
|
10
|
+
* - for converting the date based on the time zone [date-fns docs](https://date-fns.org/v2.27.0/docs/Time-Zones) and [date-fns-tz docs](https://github.com/marnusw/date-fns-tz)
|
|
11
|
+
*
|
|
12
|
+
* @param dateString A parseable date as string, `Z` is automatically suffixed if not present to correctly get time zone based time from a UTC date.
|
|
13
|
+
* @param timeZone Optionally pass a timeZone (e.g. from user preference or from the server), it falls back trying to read it from the `Intl` browwser native API.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getZonedDate(dateString?: string, timeZone?: string): Date;
|
|
16
|
+
export default getZonedDate;
|
package/getZonedDate.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import utcToZonedTime from "date-fns-tz/utcToZonedTime";
|
|
2
|
+
import isBrowser from "./isBrowser";
|
|
3
|
+
/**
|
|
4
|
+
* It returns a `Date` object from a date `string` adjusted on the user timeZone,
|
|
5
|
+
* if a timeZone is not provided we try getting it from the `Intl` browwser native
|
|
6
|
+
* API. It gracefully falls back returning a _non-timezone-based_ `Date`.
|
|
7
|
+
*
|
|
8
|
+
* @category date
|
|
9
|
+
*
|
|
10
|
+
* @resources
|
|
11
|
+
* - to get the timeZone client side see [this article](https://attacomsian.com/blog/javascript-current-timezone)
|
|
12
|
+
* - for converting the date based on the time zone [date-fns docs](https://date-fns.org/v2.27.0/docs/Time-Zones) and [date-fns-tz docs](https://github.com/marnusw/date-fns-tz)
|
|
13
|
+
*
|
|
14
|
+
* @param dateString A parseable date as string, `Z` is automatically suffixed if not present to correctly get time zone based time from a UTC date.
|
|
15
|
+
* @param timeZone Optionally pass a timeZone (e.g. from user preference or from the server), it falls back trying to read it from the `Intl` browwser native API.
|
|
16
|
+
*/
|
|
17
|
+
export function getZonedDate(dateString, timeZone) {
|
|
18
|
+
if (dateString === void 0) { dateString = ""; }
|
|
19
|
+
if (!dateString.endsWith("Z"))
|
|
20
|
+
dateString += "Z";
|
|
21
|
+
if (!timeZone && isBrowser) {
|
|
22
|
+
try {
|
|
23
|
+
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
if (process.env["NODE_ENV"] !== "production") {
|
|
27
|
+
console.warn("[@koine/utils:getZonedDate] failed reading timeZone, error", e);
|
|
28
|
+
}
|
|
29
|
+
// no need to do anything here, it just means `Intl` failed, probably
|
|
30
|
+
// because the browser does not support it
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return timeZone
|
|
34
|
+
? utcToZonedTime(new Date(dateString), timeZone)
|
|
35
|
+
: new Date(dateString);
|
|
36
|
+
}
|
|
37
|
+
export default getZonedDate;
|
package/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export * from "./getUrlHashParams";
|
|
|
28
28
|
export * from "./getUrlHashPathname";
|
|
29
29
|
export * from "./getUrlPathnameParts";
|
|
30
30
|
export * from "./getUrlQueryParams";
|
|
31
|
+
export * from "./getZonedDate";
|
|
31
32
|
export * from "./imgEmptyPixel";
|
|
32
33
|
export * from "./isAnyObject";
|
|
33
34
|
export * from "./isArray";
|
package/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export * from "./getUrlHashParams";
|
|
|
29
29
|
export * from "./getUrlHashPathname";
|
|
30
30
|
export * from "./getUrlPathnameParts";
|
|
31
31
|
export * from "./getUrlQueryParams";
|
|
32
|
+
export * from "./getZonedDate";
|
|
32
33
|
export * from "./imgEmptyPixel";
|
|
33
34
|
export * from "./isAnyObject";
|
|
34
35
|
export * from "./isArray";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildUrlQueryString = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNull_1 = tslib_1.__importDefault(require("./isNull"));
|
|
6
|
+
var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
|
|
7
|
+
var isArray_1 = tslib_1.__importDefault(require("./isArray"));
|
|
7
8
|
/**
|
|
8
9
|
* Get clean query string for URL
|
|
9
10
|
*
|
package/node/capitalize.js
CHANGED
|
@@ -7,10 +7,10 @@ exports.capitalize = void 0;
|
|
|
7
7
|
* @category text
|
|
8
8
|
* @see https://stackoverflow.com/a/11409944/1938970
|
|
9
9
|
*/
|
|
10
|
-
function capitalize(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
function capitalize(string) {
|
|
11
|
+
var ensuredString = string || "";
|
|
12
|
+
return (ensuredString.charAt(0).toUpperCase() +
|
|
13
|
+
ensuredString.slice(1));
|
|
14
14
|
}
|
|
15
15
|
exports.capitalize = capitalize;
|
|
16
16
|
exports.default = capitalize;
|
package/node/changeUrlPath.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.changeUrlPath = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
6
|
+
var normaliseUrlPathname_1 = tslib_1.__importDefault(require("./normaliseUrlPathname"));
|
|
6
7
|
/**
|
|
7
8
|
* Change URL path, ensures initial and ending slashes and normalise eventual
|
|
8
9
|
* consecutive slashes, it uses `history`.
|
package/node/getEmptyArray.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEmptyArray = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
5
6
|
/**
|
|
6
7
|
*
|
|
7
8
|
* Returns an array of undefined values of the desired length, useful to build
|
package/node/getParamAmong.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getParamAmong = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
|
|
5
6
|
/**
|
|
6
7
|
* Get query parameter as `string` treating the `ParsedUrlQuery` result of
|
|
7
8
|
* [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
|
package/node/getParamAsInt.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getParamAsInt = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getParamAsString_1 = tslib_1.__importDefault(require("./getParamAsString"));
|
|
6
6
|
/**
|
|
7
7
|
* Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
|
|
8
8
|
* [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
|
|
@@ -14,10 +14,12 @@ var isUndefined_1 = require("./isUndefined");
|
|
|
14
14
|
* @param {number} [fallback] - Fallback number, we return `null` if not provided
|
|
15
15
|
*/
|
|
16
16
|
function getParamAsInt(raw, fallback) {
|
|
17
|
+
if (fallback === void 0) { fallback = null; }
|
|
17
18
|
var string = (0, getParamAsString_1.default)(raw);
|
|
18
|
-
if (string)
|
|
19
|
-
parseInt(string, 10);
|
|
20
|
-
|
|
19
|
+
if (string) {
|
|
20
|
+
return parseInt(string, 10);
|
|
21
|
+
}
|
|
22
|
+
return fallback;
|
|
21
23
|
}
|
|
22
24
|
exports.getParamAsInt = getParamAsInt;
|
|
23
25
|
exports.default = getParamAsInt;
|
package/node/getParamAsString.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getParamAsString = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isArray_1 = tslib_1.__importDefault(require("./isArray"));
|
|
5
6
|
/**
|
|
6
7
|
* Get query parameter as `string` treating the `ParsedUrlQuery` result of
|
|
7
8
|
* [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
|
package/node/getUrlHashParams.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getUrlHashParams = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* It returns the "query params" as an object extracting it from the given `hash`
|
|
6
|
-
*string or, if not provided, failling back reading the `location.hash`
|
|
7
|
-
|
|
6
|
+
* string or, if not provided, failling back reading the `location.hash`
|
|
7
|
+
*
|
|
8
8
|
* @category location
|
|
9
9
|
*/
|
|
10
10
|
function getUrlHashParams(hash) {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getUrlHashPathname = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* It returns the "pathname" cleaned up from the `#` and the initial slashes
|
|
6
|
-
*
|
|
6
|
+
* extracting it from the given `hash` string or, if not provided, failling
|
|
7
7
|
* back reading the `location.hash`
|
|
8
8
|
*
|
|
9
9
|
* @category location
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUrlPathnameParts = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
5
6
|
/**
|
|
6
7
|
* Get pathname parts
|
|
7
8
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUrlQueryParams = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
5
6
|
/**
|
|
6
7
|
* Get parsed query parameters as object dictionary (from URL or given query string)
|
|
7
8
|
*
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getZonedDate = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var utcToZonedTime_1 = tslib_1.__importDefault(require("date-fns-tz/utcToZonedTime"));
|
|
6
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
7
|
+
/**
|
|
8
|
+
* It returns a `Date` object from a date `string` adjusted on the user timeZone,
|
|
9
|
+
* if a timeZone is not provided we try getting it from the `Intl` browwser native
|
|
10
|
+
* API. It gracefully falls back returning a _non-timezone-based_ `Date`.
|
|
11
|
+
*
|
|
12
|
+
* @category date
|
|
13
|
+
*
|
|
14
|
+
* @resources
|
|
15
|
+
* - to get the timeZone client side see [this article](https://attacomsian.com/blog/javascript-current-timezone)
|
|
16
|
+
* - for converting the date based on the time zone [date-fns docs](https://date-fns.org/v2.27.0/docs/Time-Zones) and [date-fns-tz docs](https://github.com/marnusw/date-fns-tz)
|
|
17
|
+
*
|
|
18
|
+
* @param dateString A parseable date as string, `Z` is automatically suffixed if not present to correctly get time zone based time from a UTC date.
|
|
19
|
+
* @param timeZone Optionally pass a timeZone (e.g. from user preference or from the server), it falls back trying to read it from the `Intl` browwser native API.
|
|
20
|
+
*/
|
|
21
|
+
function getZonedDate(dateString, timeZone) {
|
|
22
|
+
if (dateString === void 0) { dateString = ""; }
|
|
23
|
+
if (!dateString.endsWith("Z"))
|
|
24
|
+
dateString += "Z";
|
|
25
|
+
if (!timeZone && isBrowser_1.default) {
|
|
26
|
+
try {
|
|
27
|
+
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
if (process.env["NODE_ENV"] !== "production") {
|
|
31
|
+
console.warn("[@koine/utils:getZonedDate] failed reading timeZone, error", e);
|
|
32
|
+
}
|
|
33
|
+
// no need to do anything here, it just means `Intl` failed, probably
|
|
34
|
+
// because the browser does not support it
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return timeZone
|
|
38
|
+
? (0, utcToZonedTime_1.default)(new Date(dateString), timeZone)
|
|
39
|
+
: new Date(dateString);
|
|
40
|
+
}
|
|
41
|
+
exports.getZonedDate = getZonedDate;
|
|
42
|
+
exports.default = getZonedDate;
|
package/node/index.js
CHANGED
|
@@ -32,6 +32,7 @@ tslib_1.__exportStar(require("./getUrlHashParams"), exports);
|
|
|
32
32
|
tslib_1.__exportStar(require("./getUrlHashPathname"), exports);
|
|
33
33
|
tslib_1.__exportStar(require("./getUrlPathnameParts"), exports);
|
|
34
34
|
tslib_1.__exportStar(require("./getUrlQueryParams"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./getZonedDate"), exports);
|
|
35
36
|
tslib_1.__exportStar(require("./imgEmptyPixel"), exports);
|
|
36
37
|
tslib_1.__exportStar(require("./isAnyObject"), exports);
|
|
37
38
|
tslib_1.__exportStar(require("./isArray"), exports);
|
package/node/isAnyObject.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isAnyObject = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)
|
|
7
8
|
*
|
package/node/isArray.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isArray = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is an array
|
|
7
8
|
*
|
package/node/isBlob.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isBlob = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a Blob
|
|
7
8
|
*
|
package/node/isBoolean.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isBoolean = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a boolean
|
|
7
8
|
*
|
package/node/isDate.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isDate = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a Date, and that the date is valid
|
|
7
8
|
*
|
package/node/isEmptyArray.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isEmptyArray = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isArray_1 = tslib_1.__importDefault(require("./isArray"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a an empty array
|
|
7
8
|
*
|
package/node/isEmptyObject.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isEmptyObject = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isPlainObject_1 = tslib_1.__importDefault(require("./isPlainObject"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
|
|
7
8
|
*
|
package/node/isError.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isError = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is an Error
|
|
7
8
|
*
|
package/node/isExternalUrl.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isExternalUrl = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
5
6
|
/**
|
|
6
7
|
* Is external url compared to the given current URL (if not provided it falls
|
|
7
8
|
* back to `location.href`)
|
package/node/isFile.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isFile = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a File
|
|
7
8
|
*
|
package/node/isFloat.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isFloat = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a float number
|
|
7
8
|
*
|
package/node/isFormData.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isFormData = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a FormData
|
|
7
8
|
*
|
package/node/isFullArray.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isFullArray = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isArray_1 = tslib_1.__importDefault(require("./isArray"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a an array with at least 1 item
|
|
7
8
|
*
|
package/node/isFullObject.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isFullObject = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isPlainObject_1 = tslib_1.__importDefault(require("./isPlainObject"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
|
|
7
8
|
*
|
package/node/isFullString.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isFullString = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isString_1 = tslib_1.__importDefault(require("./isString"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a string, BUT returns false for ''
|
|
7
8
|
*
|
package/node/isInt.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isInt = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is an integer number
|
|
7
8
|
*
|
package/node/isMap.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isMap = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a Map
|
|
7
8
|
*
|
package/node/isNaNValue.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNaNValue = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is literally the value `NaN` (it's `NaN` and also a `number`)
|
|
7
8
|
*
|
package/node/isNegativeNumber.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNegativeNumber = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a negative number (but not 0)
|
|
7
8
|
*
|
package/node/isNull.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNull = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is null
|
|
7
8
|
*
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNullOrUndefined = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNull_1 = tslib_1.__importDefault(require("./isNull"));
|
|
6
|
+
var isOneOf_1 = tslib_1.__importDefault(require("./isOneOf"));
|
|
7
|
+
var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
|
|
7
8
|
/**
|
|
8
9
|
* Returns true whether the payload is null or undefined
|
|
9
10
|
*
|
package/node/isNumber.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNumber = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a number (but not NaN)
|
|
7
8
|
*
|
package/node/isObject.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isObject = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isPlainObject_1 = tslib_1.__importDefault(require("./isPlainObject"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
|
|
7
8
|
*
|
package/node/isObjectLike.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isObjectLike = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isAnyObject_1 = tslib_1.__importDefault(require("./isAnyObject"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is an object like a type passed in < >
|
|
7
8
|
*
|
package/node/isPlainObject.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPlainObject = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
|
|
7
8
|
*
|
package/node/isPositiveNumber.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPositiveNumber = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a positive number (but not 0)
|
|
7
8
|
*
|
package/node/isPrimitive.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPrimitive = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isString_1 = tslib_1.__importDefault(require("./isString"));
|
|
6
|
+
var isNull_1 = tslib_1.__importDefault(require("./isNull"));
|
|
7
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
8
|
+
var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
|
|
9
|
+
var isBoolean_1 = tslib_1.__importDefault(require("./isBoolean"));
|
|
10
|
+
var isSymbol_1 = tslib_1.__importDefault(require("./isSymbol"));
|
|
10
11
|
/**
|
|
11
12
|
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol)
|
|
12
13
|
*
|
package/node/isPromise.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPromise = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a Promise
|
|
7
8
|
*
|
package/node/isRegExp.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isRegExp = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a regular expression (RegExp)
|
|
7
8
|
*
|
package/node/isServer.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isServer = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
5
6
|
/**
|
|
6
7
|
* @category ssr
|
|
7
8
|
* @category is
|
package/node/isSet.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isSet = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a Set
|
|
7
8
|
*
|
package/node/isString.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isString = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a string
|
|
7
8
|
*
|
package/node/isSymbol.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isSymbol = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a Symbol
|
|
7
8
|
*
|
package/node/isType.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isType = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Does a generic check to check that the given payload is of a given type.
|
|
7
8
|
* In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
|
package/node/isUndefined.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isUndefined = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is undefined
|
|
7
8
|
*
|
package/node/isWeakMap.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isWeakMap = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a WeakMap
|
|
7
8
|
*
|
package/node/isWeakSet.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isWeakSet = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getType_1 = tslib_1.__importDefault(require("./getType"));
|
|
5
6
|
/**
|
|
6
7
|
* Returns whether the payload is a WeakSet
|
|
7
8
|
*
|
package/node/matchSorter.js
CHANGED
|
@@ -18,7 +18,7 @@ var tslib_1 = require("tslib");
|
|
|
18
18
|
* @copyright (c) 2020 Kent C. Dodds
|
|
19
19
|
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
|
20
20
|
*/
|
|
21
|
-
var removeAccents_1 = require("./removeAccents");
|
|
21
|
+
var removeAccents_1 = tslib_1.__importDefault(require("./removeAccents"));
|
|
22
22
|
var RANKING_CASE_SENSITIVE_EQUAL = 7;
|
|
23
23
|
var RANKING_EQUAL = 6;
|
|
24
24
|
var RANKING_STARTS_WITH = 5;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeUrlQueryParams = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isNull_1 = tslib_1.__importDefault(require("./isNull"));
|
|
5
6
|
/**
|
|
6
7
|
* Merge query parameters objects, it *mutates* the first given object argument
|
|
7
8
|
*
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.navigateToHashParams = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var buildUrlQueryString_1 = tslib_1.__importDefault(require("./buildUrlQueryString"));
|
|
6
|
+
var getUrlHashPathname_1 = tslib_1.__importDefault(require("./getUrlHashPathname"));
|
|
6
7
|
/**
|
|
7
8
|
* It updates the `location.hash` with the given query params, it uses `location.hash`
|
|
8
9
|
* if a second argument `hash` is not provded
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.navigateToMergedHashParams = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getUrlHashParams_1 = tslib_1.__importDefault(require("./getUrlHashParams"));
|
|
6
|
+
var mergeUrlQueryParams_1 = tslib_1.__importDefault(require("./mergeUrlQueryParams"));
|
|
7
|
+
var navigateToHashParams_1 = tslib_1.__importDefault(require("./navigateToHashParams"));
|
|
7
8
|
/**
|
|
8
9
|
* It updates the "query params" within the `location.hash`, it uses `location`
|
|
9
10
|
*
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.navigateToMergedParams = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getUrlQueryParams_1 = tslib_1.__importDefault(require("./getUrlQueryParams"));
|
|
6
|
+
var mergeUrlQueryParams_1 = tslib_1.__importDefault(require("./mergeUrlQueryParams"));
|
|
7
|
+
var navigateToParams_1 = tslib_1.__importDefault(require("./navigateToParams"));
|
|
7
8
|
/**
|
|
8
9
|
* Merge current URL query parameters with the given ones, it uses `history`.
|
|
9
10
|
*
|
package/node/navigateToParams.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.navigateToParams = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var buildUrlQueryString_1 = tslib_1.__importDefault(require("./buildUrlQueryString"));
|
|
6
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
6
7
|
/**
|
|
7
8
|
* Change current URL query parameters, it uses `history`.
|
|
8
9
|
*
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.navigateWithoutUrlParam = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var getUrlQueryParams_1 = tslib_1.__importDefault(require("./getUrlQueryParams"));
|
|
6
|
+
var navigateToParams_1 = tslib_1.__importDefault(require("./navigateToParams"));
|
|
6
7
|
/**
|
|
7
8
|
* Remove URL query parameter, it uses `history`
|
|
8
9
|
*
|
package/node/normaliseUrl.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normaliseUrl = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var removeTrailingSlash_1 = tslib_1.__importDefault(require("./removeTrailingSlash"));
|
|
5
6
|
/**
|
|
6
7
|
* Normalise URL, it works both for absolute and relative URLs
|
|
7
8
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normaliseUrlPathname = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var removeTrailingSlash_1 = tslib_1.__importDefault(require("./removeTrailingSlash"));
|
|
5
6
|
/**
|
|
6
7
|
* Normalise URL pathname (relative URL)
|
|
7
8
|
*
|
package/node/pageview.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pageview = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
|
|
5
6
|
/**
|
|
6
7
|
* @category analytics-google
|
|
7
8
|
*/
|
package/node/readCookie.js
CHANGED
|
@@ -10,7 +10,7 @@ function converterRead(value) {
|
|
|
10
10
|
function readCookie(name) {
|
|
11
11
|
if (typeof document === "undefined") {
|
|
12
12
|
if (process.env["NODE_ENV"] !== "production") {
|
|
13
|
-
console.warn("[@koine/utils]
|
|
13
|
+
console.warn("[@koine/utils:readCookie] document is undefined");
|
|
14
14
|
}
|
|
15
15
|
return name ? "" : {};
|
|
16
16
|
}
|
|
@@ -28,7 +28,7 @@ function readCookie(name) {
|
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
30
|
if (process.env["NODE_ENV"] !== "production") {
|
|
31
|
-
console.warn("[@koine/utils]
|
|
31
|
+
console.warn("[@koine/utils:readCookie] failed to decode", value);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
package/node/redirectTo.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.redirectTo = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var buildUrlQueryString_1 = tslib_1.__importDefault(require("./buildUrlQueryString"));
|
|
6
|
+
var isBrowser_1 = tslib_1.__importDefault(require("./isBrowser"));
|
|
6
7
|
/**
|
|
7
8
|
* Redirect to url with params {optionally}, removes eventual trailing question
|
|
8
9
|
* marks from the given URL, it uses `location`
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removeUrlQueryParams = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var buildUrlQueryString_1 = tslib_1.__importDefault(require("./buildUrlQueryString"));
|
|
6
|
+
var getUrlQueryParams_1 = tslib_1.__importDefault(require("./getUrlQueryParams"));
|
|
6
7
|
/**
|
|
7
8
|
* Remove the given keys from the given URL query parameters
|
|
8
9
|
*
|
package/node/setCookie.js
CHANGED
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setCookie = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var cookie_1 = require("./cookie");
|
|
6
|
-
var isNumber_1 = require("./isNumber");
|
|
6
|
+
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
7
|
+
var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
|
|
7
8
|
function converterWrite(value) {
|
|
8
9
|
return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
|
|
9
10
|
}
|
|
@@ -19,9 +20,9 @@ function setCookie(name, value, attributes) {
|
|
|
19
20
|
// eslint-disable-next-line prefer-const
|
|
20
21
|
var expires = attributes.expires, restAttrs = tslib_1.__rest(attributes, ["expires"]);
|
|
21
22
|
var cleanedAttrs = tslib_1.__assign(tslib_1.__assign({ expires: "" }, cookie_1.defaultAttributesClient), restAttrs);
|
|
22
|
-
if (
|
|
23
|
+
if ((0, isUndefined_1.default)(document)) {
|
|
23
24
|
if (process.env["NODE_ENV"] !== "production") {
|
|
24
|
-
console.warn("[@koine/utils]
|
|
25
|
+
console.warn("[@koine/utils:setCookie] document is undefined");
|
|
25
26
|
}
|
|
26
27
|
return undefined;
|
|
27
28
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformToUrlPathname = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var isString_1 = tslib_1.__importDefault(require("./isString"));
|
|
5
6
|
/**
|
|
6
7
|
* Transform string in a URL pathname (relative URL)
|
|
7
8
|
*
|
package/node/updateLinkParams.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateLinkParams = void 0;
|
|
4
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var updateUrlQueryParams_1 = tslib_1.__importDefault(require("./updateUrlQueryParams"));
|
|
5
6
|
/**
|
|
6
7
|
* Update link `<a href="">` merging the given new query parameters.
|
|
7
8
|
* it returns the newly created `href` URL value
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateUrlQueryParams = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var buildUrlQueryString_1 = tslib_1.__importDefault(require("./buildUrlQueryString"));
|
|
6
|
+
var getUrlQueryParams_1 = tslib_1.__importDefault(require("./getUrlQueryParams"));
|
|
7
|
+
var mergeUrlQueryParams_1 = tslib_1.__importDefault(require("./mergeUrlQueryParams"));
|
|
7
8
|
/**
|
|
8
9
|
* Update a URL string query parameters merging the given new query parameters
|
|
9
10
|
*
|
package/package.json
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"typings": "./index.d.ts",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"date-fns-tz": "^1.3.7",
|
|
8
8
|
"tslib": "^2.4.0"
|
|
9
9
|
},
|
|
10
|
-
"
|
|
10
|
+
"peerDependencies": {},
|
|
11
|
+
"version": "1.0.78",
|
|
11
12
|
"module": "./index.js",
|
|
12
13
|
"types": "./index.d.ts"
|
|
13
14
|
}
|
package/readCookie.js
CHANGED
|
@@ -7,7 +7,7 @@ function converterRead(value) {
|
|
|
7
7
|
export function readCookie(name) {
|
|
8
8
|
if (typeof document === "undefined") {
|
|
9
9
|
if (process.env["NODE_ENV"] !== "production") {
|
|
10
|
-
console.warn("[@koine/utils]
|
|
10
|
+
console.warn("[@koine/utils:readCookie] document is undefined");
|
|
11
11
|
}
|
|
12
12
|
return name ? "" : {};
|
|
13
13
|
}
|
|
@@ -25,7 +25,7 @@ export function readCookie(name) {
|
|
|
25
25
|
}
|
|
26
26
|
catch (e) {
|
|
27
27
|
if (process.env["NODE_ENV"] !== "production") {
|
|
28
|
-
console.warn("[@koine/utils]
|
|
28
|
+
console.warn("[@koine/utils:readCookie] failed to decode", value);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
package/setCookie.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import { defaultAttributesClient } from "./cookie";
|
|
3
3
|
import isNumber from "./isNumber";
|
|
4
|
+
import isUndefined from "./isUndefined";
|
|
4
5
|
function converterWrite(value) {
|
|
5
6
|
return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
|
|
6
7
|
}
|
|
@@ -16,9 +17,9 @@ export function setCookie(name, value, attributes) {
|
|
|
16
17
|
// eslint-disable-next-line prefer-const
|
|
17
18
|
var expires = attributes.expires, restAttrs = __rest(attributes, ["expires"]);
|
|
18
19
|
var cleanedAttrs = __assign(__assign({ expires: "" }, defaultAttributesClient), restAttrs);
|
|
19
|
-
if (
|
|
20
|
+
if (isUndefined(document)) {
|
|
20
21
|
if (process.env["NODE_ENV"] !== "production") {
|
|
21
|
-
console.warn("[@koine/utils]
|
|
22
|
+
console.warn("[@koine/utils:setCookie] document is undefined");
|
|
22
23
|
}
|
|
23
24
|
return undefined;
|
|
24
25
|
}
|