@akanjs/common 0.0.31 → 0.0.32
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/package.json +2 -3
- package/src/isQueryEqual.js +12 -2
- package/src/isValidDate.d.ts +1 -1
- package/src/isValidDate.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@urql/core": "^5.1.0",
|
|
15
15
|
"dayjs": "^1.11.13",
|
|
16
|
-
"pluralize": "^8.0.0"
|
|
17
|
-
"tunnel-ssh": "^5.2.0"
|
|
16
|
+
"pluralize": "^8.0.0"
|
|
18
17
|
},
|
|
19
18
|
"main": "./index.js"
|
|
20
19
|
}
|
package/src/isQueryEqual.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,13 +16,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
var isQueryEqual_exports = {};
|
|
19
29
|
__export(isQueryEqual_exports, {
|
|
20
30
|
isQueryEqual: () => isQueryEqual
|
|
21
31
|
});
|
|
22
32
|
module.exports = __toCommonJS(isQueryEqual_exports);
|
|
23
|
-
var
|
|
33
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
24
34
|
var import_isDayjs = require("./isDayjs");
|
|
25
35
|
const isQueryEqual = (value1, value2) => {
|
|
26
36
|
if (value1 === value2)
|
|
@@ -34,7 +44,7 @@ const isQueryEqual = (value1, value2) => {
|
|
|
34
44
|
return true;
|
|
35
45
|
}
|
|
36
46
|
if ([value1, value2].some((val) => val instanceof Date || (0, import_isDayjs.isDayjs)(val)))
|
|
37
|
-
return (0,
|
|
47
|
+
return (0, import_dayjs.default)(value1).isSame((0, import_dayjs.default)(value2));
|
|
38
48
|
if (typeof value1 === "object" && typeof value2 === "object") {
|
|
39
49
|
if (value1 === null || value2 === null)
|
|
40
50
|
return value1 === value2;
|
package/src/isValidDate.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Dayjs } from "
|
|
1
|
+
import { Dayjs } from "dayjs";
|
|
2
2
|
export declare const isValidDate: (d: string | Date | Dayjs) => boolean;
|
package/src/isValidDate.js
CHANGED
|
@@ -30,14 +30,14 @@ __export(isValidDate_exports, {
|
|
|
30
30
|
isValidDate: () => isValidDate
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(isValidDate_exports);
|
|
33
|
-
var
|
|
33
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
34
34
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
35
35
|
var import_isDayjs = require("./isDayjs");
|
|
36
|
-
|
|
36
|
+
import_dayjs.default.extend(import_customParseFormat.default);
|
|
37
37
|
const isValidDate = (d) => {
|
|
38
38
|
const format = "YYYY-MM-DD";
|
|
39
39
|
if (typeof d === "string") {
|
|
40
|
-
return (0,
|
|
40
|
+
return (0, import_dayjs.default)(d, format).isValid();
|
|
41
41
|
} else if ((0, import_isDayjs.isDayjs)(d))
|
|
42
42
|
return d.isValid();
|
|
43
43
|
else
|