@akanjs/common 0.0.38 → 0.0.40

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.
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var capitalize_exports = {};
20
+ __export(capitalize_exports, {
21
+ capitalize: () => capitalize
22
+ });
23
+ module.exports = __toCommonJS(capitalize_exports);
24
+ const capitalize = /* @__PURE__ */ __name((str) => {
25
+ return str.charAt(0).toUpperCase() + str.slice(1);
26
+ }, "capitalize");
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ capitalize
30
+ });
@@ -0,0 +1,6 @@
1
+ declare const deepObjectify: <T = any>(obj: T | null | undefined, option?: {
2
+ serializable?: boolean;
3
+ convertDate?: "string" | "number";
4
+ }) => T;
5
+
6
+ export { deepObjectify };
@@ -0,0 +1,48 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var deepObjectify_exports = {};
20
+ __export(deepObjectify_exports, {
21
+ deepObjectify: () => deepObjectify
22
+ });
23
+ module.exports = __toCommonJS(deepObjectify_exports);
24
+ var import_isDayjs = require("./isDayjs");
25
+ const deepObjectify = /* @__PURE__ */ __name((obj, option = {}) => {
26
+ if ((0, import_isDayjs.isDayjs)(obj) || obj?.constructor === Date) {
27
+ if (!option.serializable && !option.convertDate) return obj;
28
+ if (option.convertDate === "string") return obj.toISOString();
29
+ else if (option.convertDate === "number") return (0, import_isDayjs.isDayjs)(obj) ? obj.toDate().getTime() : obj.getTime();
30
+ else return (0, import_isDayjs.isDayjs)(obj) ? obj.toDate() : obj;
31
+ } else if (Array.isArray(obj)) {
32
+ return obj.map((o) => deepObjectify(o, option));
33
+ } else if (obj && typeof obj === "object") {
34
+ const val = {};
35
+ Object.keys(obj).forEach((key) => {
36
+ const fieldValue = obj[key];
37
+ if (fieldValue?.__ModelType__ && !option.serializable) val[key] = fieldValue;
38
+ else if (typeof obj[key] !== "function") val[key] = deepObjectify(fieldValue, option);
39
+ });
40
+ return val;
41
+ } else {
42
+ return obj;
43
+ }
44
+ }, "deepObjectify");
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ deepObjectify
48
+ });
package/src/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ export { FetchPolicy, SnakeCase, SnakeCaseObj, SnakeMsg } from './types.js';
2
+ export { splitVersion } from './splitVersion.js';
3
+ export { deepObjectify } from './deepObjectify.js';
4
+ export { pathGet } from './pathGet.js';
5
+ export { isQueryEqual } from './isQueryEqual.js';
6
+ export { isValidDate } from './isValidDate.js';
7
+ export { objectify } from './objectify.js';
8
+ export { randomPick } from './randomPick.js';
9
+ export { randomPicks } from './randomPicks.js';
10
+ export { pathSet } from './pathSet.js';
11
+ export { isDayjs } from 'dayjs';
12
+ export { mergeVersion } from './mergeVersion.js';
13
+ export { default as pluralize } from 'pluralize';
14
+ export { applyMixins } from './applyMixins.js';
15
+ export { capitalize } from './capitalize.js';
16
+ export { Logger } from './Logger.js';
17
+ export { lowerlize } from './lowerlize.js';
18
+ export { sleep } from './sleep.js';
19
+ import '@urql/core';
package/src/index.js ADDED
@@ -0,0 +1,75 @@
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 src_exports = {};
19
+ __export(src_exports, {
20
+ Logger: () => import_Logger.Logger,
21
+ applyMixins: () => import_applyMixins.applyMixins,
22
+ capitalize: () => import_capitalize.capitalize,
23
+ deepObjectify: () => import_deepObjectify.deepObjectify,
24
+ isDayjs: () => import_isDayjs.isDayjs,
25
+ isQueryEqual: () => import_isQueryEqual.isQueryEqual,
26
+ isValidDate: () => import_isValidDate.isValidDate,
27
+ lowerlize: () => import_lowerlize.lowerlize,
28
+ mergeVersion: () => import_mergeVersion.mergeVersion,
29
+ objectify: () => import_objectify.objectify,
30
+ pathGet: () => import_pathGet.pathGet,
31
+ pathSet: () => import_pathSet.pathSet,
32
+ pluralize: () => import_pluralize.pluralize,
33
+ randomPick: () => import_randomPick.randomPick,
34
+ randomPicks: () => import_randomPicks.randomPicks,
35
+ sleep: () => import_sleep.sleep,
36
+ splitVersion: () => import_splitVersion.splitVersion
37
+ });
38
+ module.exports = __toCommonJS(src_exports);
39
+ var import_splitVersion = require("./splitVersion");
40
+ var import_deepObjectify = require("./deepObjectify");
41
+ var import_pathGet = require("./pathGet");
42
+ var import_isQueryEqual = require("./isQueryEqual");
43
+ var import_isValidDate = require("./isValidDate");
44
+ var import_objectify = require("./objectify");
45
+ var import_randomPick = require("./randomPick");
46
+ var import_randomPicks = require("./randomPicks");
47
+ var import_pathSet = require("./pathSet");
48
+ var import_isDayjs = require("./isDayjs");
49
+ var import_mergeVersion = require("./mergeVersion");
50
+ var import_pluralize = require("./pluralize");
51
+ var import_applyMixins = require("./applyMixins");
52
+ var import_capitalize = require("./capitalize");
53
+ var import_Logger = require("./Logger");
54
+ var import_lowerlize = require("./lowerlize");
55
+ var import_sleep = require("./sleep");
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ Logger,
59
+ applyMixins,
60
+ capitalize,
61
+ deepObjectify,
62
+ isDayjs,
63
+ isQueryEqual,
64
+ isValidDate,
65
+ lowerlize,
66
+ mergeVersion,
67
+ objectify,
68
+ pathGet,
69
+ pathSet,
70
+ pluralize,
71
+ randomPick,
72
+ randomPicks,
73
+ sleep,
74
+ splitVersion
75
+ });
@@ -0,0 +1,2 @@
1
+ export { isDayjs } from 'dayjs';
2
+ import 'pluralize';
package/src/isDayjs.js ADDED
@@ -0,0 +1,27 @@
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 isDayjs_exports = {};
19
+ __export(isDayjs_exports, {
20
+ isDayjs: () => import_dayjs.isDayjs
21
+ });
22
+ module.exports = __toCommonJS(isDayjs_exports);
23
+ var import_dayjs = require("dayjs");
24
+ // Annotate the CommonJS export names for ESM import in node:
25
+ 0 && (module.exports = {
26
+ isDayjs
27
+ });
@@ -0,0 +1,3 @@
1
+ declare const isQueryEqual: (value1: object | null, value2: object | null) => boolean;
2
+
3
+ export { isQueryEqual };
@@ -0,0 +1,58 @@
1
+ var __create = Object.create;
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var isQueryEqual_exports = {};
30
+ __export(isQueryEqual_exports, {
31
+ isQueryEqual: () => isQueryEqual
32
+ });
33
+ module.exports = __toCommonJS(isQueryEqual_exports);
34
+ var import_dayjs = __toESM(require("dayjs"));
35
+ var import_isDayjs = require("./isDayjs");
36
+ const isQueryEqual = /* @__PURE__ */ __name((value1, value2) => {
37
+ if (value1 === value2) return true;
38
+ if (Array.isArray(value1) && Array.isArray(value2)) {
39
+ if (value1.length !== value2.length) return false;
40
+ for (let i = 0; i < value1.length; i++) if (!isQueryEqual(value1[i], value2[i])) return false;
41
+ return true;
42
+ }
43
+ if ([
44
+ value1,
45
+ value2
46
+ ].some((val) => val instanceof Date || (0, import_isDayjs.isDayjs)(val))) return (0, import_dayjs.default)(value1).isSame((0, import_dayjs.default)(value2));
47
+ if (typeof value1 === "object" && typeof value2 === "object") {
48
+ if (value1 === null || value2 === null) return value1 === value2;
49
+ if (Object.keys(value1).length !== Object.keys(value2).length) return false;
50
+ for (const key of Object.keys(value1)) if (!isQueryEqual(value1[key], value2[key])) return false;
51
+ return true;
52
+ }
53
+ return false;
54
+ }, "isQueryEqual");
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ isQueryEqual
58
+ });
@@ -0,0 +1,5 @@
1
+ import { Dayjs } from 'dayjs';
2
+
3
+ declare const isValidDate: (d: string | Date | Dayjs) => boolean;
4
+
5
+ export { isValidDate };
@@ -0,0 +1,48 @@
1
+ var __create = Object.create;
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var isValidDate_exports = {};
30
+ __export(isValidDate_exports, {
31
+ isValidDate: () => isValidDate
32
+ });
33
+ module.exports = __toCommonJS(isValidDate_exports);
34
+ var import_dayjs = __toESM(require("dayjs"));
35
+ var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
36
+ var import_isDayjs = require("./isDayjs");
37
+ import_dayjs.default.extend(import_customParseFormat.default);
38
+ const isValidDate = /* @__PURE__ */ __name((d) => {
39
+ const format = "YYYY-MM-DD";
40
+ if (typeof d === "string") {
41
+ return (0, import_dayjs.default)(d, format).isValid();
42
+ } else if ((0, import_isDayjs.isDayjs)(d)) return d.isValid();
43
+ else return d instanceof Date && !isNaN(d.getTime());
44
+ }, "isValidDate");
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ isValidDate
48
+ });
@@ -0,0 +1,3 @@
1
+ declare const lowerlize: (str: string) => string;
2
+
3
+ export { lowerlize };
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var lowerlize_exports = {};
20
+ __export(lowerlize_exports, {
21
+ lowerlize: () => lowerlize
22
+ });
23
+ module.exports = __toCommonJS(lowerlize_exports);
24
+ const lowerlize = /* @__PURE__ */ __name((str) => {
25
+ return str.charAt(0).toLowerCase() + str.slice(1);
26
+ }, "lowerlize");
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ lowerlize
30
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ *
3
+ * semantic version 규격에 맞게 조합하는 함수
4
+ * https://semver.org/
5
+ * @param major 릴리즈(플랫폼(google,apple,etc...)에 올라가 있는) 버전
6
+ * @param minor 릴리즈(플랫폼(google,apple,etc...)에 올라가 있는) 버전
7
+ * @param patch 코드푸시 (Framework 자체 버전)
8
+ * @returns `major.minor.patch` 형식으로 조합된 버전
9
+ */
10
+ declare const mergeVersion: (major: number, minor: number, patch: number) => string;
11
+
12
+ export { mergeVersion };
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var mergeVersion_exports = {};
20
+ __export(mergeVersion_exports, {
21
+ mergeVersion: () => mergeVersion
22
+ });
23
+ module.exports = __toCommonJS(mergeVersion_exports);
24
+ const mergeVersion = /* @__PURE__ */ __name((major, minor, patch) => `${major}.${minor}.${patch}`, "mergeVersion");
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ mergeVersion
28
+ });
@@ -0,0 +1,3 @@
1
+ declare const objectify: (obj: any, keys?: string[]) => any;
2
+
3
+ export { objectify };
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var objectify_exports = {};
20
+ __export(objectify_exports, {
21
+ objectify: () => objectify
22
+ });
23
+ module.exports = __toCommonJS(objectify_exports);
24
+ const objectify = /* @__PURE__ */ __name((obj, keys = Object.keys(obj)) => {
25
+ const val = {};
26
+ keys.forEach((key) => {
27
+ if (typeof obj[key] !== "function") val[key] = obj[key];
28
+ });
29
+ return val;
30
+ }, "objectify");
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ objectify
34
+ });
@@ -0,0 +1,3 @@
1
+ declare const pathGet: (path: string | (string | number)[], obj: any, separator?: string) => unknown;
2
+
3
+ export { pathGet };
package/src/pathGet.js ADDED
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var pathGet_exports = {};
20
+ __export(pathGet_exports, {
21
+ pathGet: () => pathGet
22
+ });
23
+ module.exports = __toCommonJS(pathGet_exports);
24
+ const pathGet = /* @__PURE__ */ __name((path, obj, separator = ".") => {
25
+ const properties = Array.isArray(path) ? path : path.split(separator);
26
+ return properties.reduce((prev, curr) => prev[curr], obj);
27
+ }, "pathGet");
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ pathGet
31
+ });
@@ -0,0 +1,3 @@
1
+ declare const pathSet: (obj: any, path: any, value: any) => any;
2
+
3
+ export { pathSet };
package/src/pathSet.js ADDED
@@ -0,0 +1,33 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var pathSet_exports = {};
20
+ __export(pathSet_exports, {
21
+ pathSet: () => pathSet
22
+ });
23
+ module.exports = __toCommonJS(pathSet_exports);
24
+ const pathSet = /* @__PURE__ */ __name((obj, path, value) => {
25
+ if (Object(obj) !== obj) return obj;
26
+ if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [];
27
+ path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
28
+ return obj;
29
+ }, "pathSet");
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ pathSet
33
+ });
@@ -0,0 +1 @@
1
+ export { default as pluralize } from 'pluralize';
@@ -0,0 +1,37 @@
1
+ var __create = Object.create;
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 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"));
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ pluralize
37
+ });
@@ -0,0 +1,3 @@
1
+ declare const randomPick: <T = any>(arr: T[] | readonly T[]) => T;
2
+
3
+ export { randomPick };
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var randomPick_exports = {};
20
+ __export(randomPick_exports, {
21
+ randomPick: () => randomPick
22
+ });
23
+ module.exports = __toCommonJS(randomPick_exports);
24
+ const randomPick = /* @__PURE__ */ __name((arr) => arr[Math.floor(Math.random() * arr.length)], "randomPick");
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ randomPick
28
+ });
@@ -0,0 +1,3 @@
1
+ declare const randomPicks: <T>(arr: T[] | readonly T[], count?: number, allowDuplicate?: boolean) => T[];
2
+
3
+ export { randomPicks };
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var randomPicks_exports = {};
20
+ __export(randomPicks_exports, {
21
+ randomPicks: () => randomPicks
22
+ });
23
+ module.exports = __toCommonJS(randomPicks_exports);
24
+ const randomPicks = /* @__PURE__ */ __name((arr, count = 1, allowDuplicate = false) => {
25
+ if (!allowDuplicate && arr.length <= count) return arr;
26
+ const idxs = [];
27
+ let pickIdx;
28
+ for (let i = 0; i < count; i++) {
29
+ do {
30
+ pickIdx = Math.floor(Math.random() * arr.length);
31
+ } while (!allowDuplicate && idxs.includes(pickIdx));
32
+ idxs.push(pickIdx);
33
+ }
34
+ return idxs.map((idx) => arr[idx]);
35
+ }, "randomPicks");
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ randomPicks
39
+ });
package/src/sleep.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare const sleep: (ms: number) => Promise<unknown>;
2
+
3
+ export { sleep };