@akanjs/common 0.0.53 → 0.0.54
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/Logger.js +6 -35
- package/applyMixins.js +3 -22
- package/capitalize.js +3 -22
- package/deepObjectify.js +7 -26
- package/isDayjs.js +3 -22
- package/isQueryEqual.js +7 -36
- package/isValidDate.js +9 -38
- package/lowerlize.js +3 -22
- package/mergeVersion.js +3 -22
- package/objectify.js +3 -22
- package/package.json +3 -6
- package/pathGet.js +3 -22
- package/pathSet.js +3 -22
- package/pluralize.js +3 -32
- package/randomPick.js +3 -22
- package/randomPicks.js +3 -22
- package/sleep.js +3 -22
- package/splitVersion.js +3 -22
- package/types.js +0 -15
package/Logger.js
CHANGED
|
@@ -1,36 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
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
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var Logger_exports = {};
|
|
29
|
-
__export(Logger_exports, {
|
|
30
|
-
Logger: () => Logger
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(Logger_exports);
|
|
33
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
1
|
+
import dayjs from "dayjs";
|
|
34
2
|
const logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
|
|
35
3
|
const clc = {
|
|
36
4
|
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
@@ -61,7 +29,7 @@ class Logger {
|
|
|
61
29
|
]);
|
|
62
30
|
static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
|
|
63
31
|
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
64
|
-
static #startAt = (
|
|
32
|
+
static #startAt = dayjs();
|
|
65
33
|
static setLevel(level) {
|
|
66
34
|
this.level = level;
|
|
67
35
|
this.#levelIdx = logLevels.findIndex((l) => l === level);
|
|
@@ -138,7 +106,7 @@ class Logger {
|
|
|
138
106
|
static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
|
|
139
107
|
if (this.#ignoreCtxSet.has(context))
|
|
140
108
|
return;
|
|
141
|
-
const now = (
|
|
109
|
+
const now = dayjs();
|
|
142
110
|
const processMsg = this.#colorize(
|
|
143
111
|
`[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
|
|
144
112
|
logLevel
|
|
@@ -168,3 +136,6 @@ class Logger {
|
|
|
168
136
|
console.log(msg);
|
|
169
137
|
}
|
|
170
138
|
}
|
|
139
|
+
export {
|
|
140
|
+
Logger
|
|
141
|
+
};
|
package/applyMixins.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var applyMixins_exports = {};
|
|
19
|
-
__export(applyMixins_exports, {
|
|
20
|
-
applyMixins: () => applyMixins
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(applyMixins_exports);
|
|
23
1
|
const getAllPropertyDescriptors = (objRef) => {
|
|
24
2
|
const descriptors = {};
|
|
25
3
|
let current = objRef.prototype;
|
|
@@ -40,3 +18,6 @@ const applyMixins = (derivedCtor, constructors, avoidKeys) => {
|
|
|
40
18
|
});
|
|
41
19
|
});
|
|
42
20
|
};
|
|
21
|
+
export {
|
|
22
|
+
applyMixins
|
|
23
|
+
};
|
package/capitalize.js
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var capitalize_exports = {};
|
|
19
|
-
__export(capitalize_exports, {
|
|
20
|
-
capitalize: () => capitalize
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(capitalize_exports);
|
|
23
1
|
const capitalize = (str) => {
|
|
24
2
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
25
3
|
};
|
|
4
|
+
export {
|
|
5
|
+
capitalize
|
|
6
|
+
};
|
package/deepObjectify.js
CHANGED
|
@@ -1,36 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var deepObjectify_exports = {};
|
|
19
|
-
__export(deepObjectify_exports, {
|
|
20
|
-
deepObjectify: () => deepObjectify
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(deepObjectify_exports);
|
|
23
|
-
var import_isDayjs = require("./isDayjs");
|
|
1
|
+
import { isDayjs } from "./isDayjs";
|
|
24
2
|
const deepObjectify = (obj, option = {}) => {
|
|
25
|
-
if (
|
|
3
|
+
if (isDayjs(obj) || obj?.constructor === Date) {
|
|
26
4
|
if (!option.serializable && !option.convertDate)
|
|
27
5
|
return obj;
|
|
28
6
|
if (option.convertDate === "string")
|
|
29
7
|
return obj.toISOString();
|
|
30
8
|
else if (option.convertDate === "number")
|
|
31
|
-
return
|
|
9
|
+
return isDayjs(obj) ? obj.toDate().getTime() : obj.getTime();
|
|
32
10
|
else
|
|
33
|
-
return
|
|
11
|
+
return isDayjs(obj) ? obj.toDate() : obj;
|
|
34
12
|
} else if (Array.isArray(obj)) {
|
|
35
13
|
return obj.map((o) => deepObjectify(o, option));
|
|
36
14
|
} else if (obj && typeof obj === "object") {
|
|
@@ -47,3 +25,6 @@ const deepObjectify = (obj, option = {}) => {
|
|
|
47
25
|
return obj;
|
|
48
26
|
}
|
|
49
27
|
};
|
|
28
|
+
export {
|
|
29
|
+
deepObjectify
|
|
30
|
+
};
|
package/isDayjs.js
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1
|
+
import { isDayjs } from "dayjs";
|
|
2
|
+
export {
|
|
3
|
+
isDayjs
|
|
8
4
|
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var isDayjs_exports = {};
|
|
19
|
-
__export(isDayjs_exports, {
|
|
20
|
-
isDayjs: () => import_dayjs.isDayjs
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(isDayjs_exports);
|
|
23
|
-
var import_dayjs = require("dayjs");
|
package/isQueryEqual.js
CHANGED
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
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
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var isQueryEqual_exports = {};
|
|
29
|
-
__export(isQueryEqual_exports, {
|
|
30
|
-
isQueryEqual: () => isQueryEqual
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(isQueryEqual_exports);
|
|
33
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
34
|
-
var import_isDayjs = require("./isDayjs");
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import { isDayjs } from "./isDayjs";
|
|
35
3
|
const isQueryEqual = (value1, value2) => {
|
|
36
4
|
if (value1 === value2)
|
|
37
5
|
return true;
|
|
@@ -43,8 +11,8 @@ const isQueryEqual = (value1, value2) => {
|
|
|
43
11
|
return false;
|
|
44
12
|
return true;
|
|
45
13
|
}
|
|
46
|
-
if ([value1, value2].some((val) => val instanceof Date ||
|
|
47
|
-
return (
|
|
14
|
+
if ([value1, value2].some((val) => val instanceof Date || isDayjs(val)))
|
|
15
|
+
return dayjs(value1).isSame(dayjs(value2));
|
|
48
16
|
if (typeof value1 === "object" && typeof value2 === "object") {
|
|
49
17
|
if (value1 === null || value2 === null)
|
|
50
18
|
return value1 === value2;
|
|
@@ -57,3 +25,6 @@ const isQueryEqual = (value1, value2) => {
|
|
|
57
25
|
}
|
|
58
26
|
return false;
|
|
59
27
|
};
|
|
28
|
+
export {
|
|
29
|
+
isQueryEqual
|
|
30
|
+
};
|
package/isValidDate.js
CHANGED
|
@@ -1,45 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
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
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var isValidDate_exports = {};
|
|
29
|
-
__export(isValidDate_exports, {
|
|
30
|
-
isValidDate: () => isValidDate
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(isValidDate_exports);
|
|
33
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
34
|
-
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
35
|
-
var import_isDayjs = require("./isDayjs");
|
|
36
|
-
import_dayjs.default.extend(import_customParseFormat.default);
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
3
|
+
import { isDayjs } from "./isDayjs";
|
|
4
|
+
dayjs.extend(customParseFormat);
|
|
37
5
|
const isValidDate = (d) => {
|
|
38
6
|
const format = "YYYY-MM-DD";
|
|
39
7
|
if (typeof d === "string") {
|
|
40
|
-
return (
|
|
41
|
-
} else if (
|
|
8
|
+
return dayjs(d, format).isValid();
|
|
9
|
+
} else if (isDayjs(d))
|
|
42
10
|
return d.isValid();
|
|
43
11
|
else
|
|
44
12
|
return d instanceof Date && !isNaN(d.getTime());
|
|
45
13
|
};
|
|
14
|
+
export {
|
|
15
|
+
isValidDate
|
|
16
|
+
};
|
package/lowerlize.js
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var lowerlize_exports = {};
|
|
19
|
-
__export(lowerlize_exports, {
|
|
20
|
-
lowerlize: () => lowerlize
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(lowerlize_exports);
|
|
23
1
|
const lowerlize = (str) => {
|
|
24
2
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
25
3
|
};
|
|
4
|
+
export {
|
|
5
|
+
lowerlize
|
|
6
|
+
};
|
package/mergeVersion.js
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var mergeVersion_exports = {};
|
|
19
|
-
__export(mergeVersion_exports, {
|
|
20
|
-
mergeVersion: () => mergeVersion
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(mergeVersion_exports);
|
|
23
1
|
const mergeVersion = (major, minor, patch) => `${major}.${minor}.${patch}`;
|
|
2
|
+
export {
|
|
3
|
+
mergeVersion
|
|
4
|
+
};
|
package/objectify.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var objectify_exports = {};
|
|
19
|
-
__export(objectify_exports, {
|
|
20
|
-
objectify: () => objectify
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(objectify_exports);
|
|
23
1
|
const objectify = (obj, keys = Object.keys(obj)) => {
|
|
24
2
|
const val = {};
|
|
25
3
|
keys.forEach((key) => {
|
|
@@ -28,3 +6,6 @@ const objectify = (obj, keys = Object.keys(obj)) => {
|
|
|
28
6
|
});
|
|
29
7
|
return val;
|
|
30
8
|
};
|
|
9
|
+
export {
|
|
10
|
+
objectify
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/common",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "0.0.54",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -14,8 +14,5 @@
|
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=22"
|
|
16
16
|
},
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"dayjs": "^1.11.13",
|
|
19
|
-
"pluralize": "^8.0.0"
|
|
20
|
-
}
|
|
17
|
+
"dependencies": {}
|
|
21
18
|
}
|
package/pathGet.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var pathGet_exports = {};
|
|
19
|
-
__export(pathGet_exports, {
|
|
20
|
-
pathGet: () => pathGet
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(pathGet_exports);
|
|
23
1
|
const pathGet = (path, obj, separator = ".") => {
|
|
24
2
|
const properties = Array.isArray(path) ? path : path.split(separator);
|
|
25
3
|
return properties.reduce((prev, curr) => prev[curr], obj);
|
|
26
4
|
};
|
|
5
|
+
export {
|
|
6
|
+
pathGet
|
|
7
|
+
};
|
package/pathSet.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var pathSet_exports = {};
|
|
19
|
-
__export(pathSet_exports, {
|
|
20
|
-
pathSet: () => pathSet
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(pathSet_exports);
|
|
23
1
|
const pathSet = (obj, path, value) => {
|
|
24
2
|
if (Object(obj) !== obj)
|
|
25
3
|
return obj;
|
|
@@ -31,3 +9,6 @@ const pathSet = (obj, path, value) => {
|
|
|
31
9
|
)[path[path.length - 1]] = value;
|
|
32
10
|
return obj;
|
|
33
11
|
};
|
|
12
|
+
export {
|
|
13
|
+
pathSet
|
|
14
|
+
};
|
package/pluralize.js
CHANGED
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1
|
+
import pluralize from "pluralize";
|
|
2
|
+
export {
|
|
3
|
+
pluralize
|
|
10
4
|
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
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
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var pluralize_exports = {};
|
|
29
|
-
__export(pluralize_exports, {
|
|
30
|
-
pluralize: () => import_pluralize.default
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(pluralize_exports);
|
|
33
|
-
var import_pluralize = __toESM(require("pluralize"));
|
package/randomPick.js
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var randomPick_exports = {};
|
|
19
|
-
__export(randomPick_exports, {
|
|
20
|
-
randomPick: () => randomPick
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(randomPick_exports);
|
|
23
1
|
const randomPick = (arr) => arr[Math.floor(Math.random() * arr.length)];
|
|
2
|
+
export {
|
|
3
|
+
randomPick
|
|
4
|
+
};
|
package/randomPicks.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var randomPicks_exports = {};
|
|
19
|
-
__export(randomPicks_exports, {
|
|
20
|
-
randomPicks: () => randomPicks
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(randomPicks_exports);
|
|
23
1
|
const randomPicks = (arr, count = 1, allowDuplicate = false) => {
|
|
24
2
|
if (!allowDuplicate && arr.length <= count)
|
|
25
3
|
return arr;
|
|
@@ -33,3 +11,6 @@ const randomPicks = (arr, count = 1, allowDuplicate = false) => {
|
|
|
33
11
|
}
|
|
34
12
|
return idxs.map((idx) => arr[idx]);
|
|
35
13
|
};
|
|
14
|
+
export {
|
|
15
|
+
randomPicks
|
|
16
|
+
};
|
package/sleep.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var sleep_exports = {};
|
|
19
|
-
__export(sleep_exports, {
|
|
20
|
-
sleep: () => sleep
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(sleep_exports);
|
|
23
1
|
const sleep = async (ms) => {
|
|
24
2
|
return new Promise((resolve) => {
|
|
25
3
|
setTimeout(() => {
|
|
@@ -27,3 +5,6 @@ const sleep = async (ms) => {
|
|
|
27
5
|
}, ms);
|
|
28
6
|
});
|
|
29
7
|
};
|
|
8
|
+
export {
|
|
9
|
+
sleep
|
|
10
|
+
};
|
package/splitVersion.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var splitVersion_exports = {};
|
|
19
|
-
__export(splitVersion_exports, {
|
|
20
|
-
splitVersion: () => splitVersion
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(splitVersion_exports);
|
|
23
1
|
const splitVersion = (version) => {
|
|
24
2
|
const [major, minor, patch] = version.split(".");
|
|
25
3
|
return { major, minor, patch };
|
|
26
4
|
};
|
|
5
|
+
export {
|
|
6
|
+
splitVersion
|
|
7
|
+
};
|
package/types.js
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var types_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(types_exports);
|