@akanjs/common 0.0.40 → 0.0.41

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/index.d.ts CHANGED
@@ -1,19 +1 @@
1
- export { FetchPolicy, SnakeCase, SnakeCaseObj, SnakeMsg } from './src/types.js';
2
- export { splitVersion } from './src/splitVersion.js';
3
- export { deepObjectify } from './src/deepObjectify.js';
4
- export { pathGet } from './src/pathGet.js';
5
- export { isQueryEqual } from './src/isQueryEqual.js';
6
- export { isValidDate } from './src/isValidDate.js';
7
- export { objectify } from './src/objectify.js';
8
- export { randomPick } from './src/randomPick.js';
9
- export { randomPicks } from './src/randomPicks.js';
10
- export { pathSet } from './src/pathSet.js';
11
- export { isDayjs } from 'dayjs';
12
- export { mergeVersion } from './src/mergeVersion.js';
13
- export { default as pluralize } from 'pluralize';
14
- export { applyMixins } from './src/applyMixins.js';
15
- export { capitalize } from './src/capitalize.js';
16
- export { Logger } from './src/Logger.js';
17
- export { lowerlize } from './src/lowerlize.js';
18
- export { sleep } from './src/sleep.js';
19
- import '@urql/core';
1
+ export * from "./src";
package/index.js CHANGED
@@ -1,21 +1,344 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var index_exports = {};
16
- module.exports = __toCommonJS(index_exports);
17
- __reExport(index_exports, require("./src"), module.exports);
18
- // Annotate the CommonJS export names for ESM import in node:
19
- 0 && (module.exports = {
20
- ...require("./src")
21
- });
1
+ (() => {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined")
12
+ return require.apply(this, arguments);
13
+ throw Error('Dynamic require of "' + x + '" is not supported');
14
+ });
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+
32
+ // pkgs/@akanjs/common/src/splitVersion.ts
33
+ var splitVersion = (version) => {
34
+ const [major, minor, patch] = version.split(".");
35
+ return { major, minor, patch };
36
+ };
37
+
38
+ // pkgs/@akanjs/common/src/isDayjs.ts
39
+ var import_dayjs = __require("dayjs");
40
+
41
+ // pkgs/@akanjs/common/src/deepObjectify.ts
42
+ var deepObjectify = (obj, option = {}) => {
43
+ if ((0, import_dayjs.isDayjs)(obj) || obj?.constructor === Date) {
44
+ if (!option.serializable && !option.convertDate)
45
+ return obj;
46
+ if (option.convertDate === "string")
47
+ return obj.toISOString();
48
+ else if (option.convertDate === "number")
49
+ return (0, import_dayjs.isDayjs)(obj) ? obj.toDate().getTime() : obj.getTime();
50
+ else
51
+ return (0, import_dayjs.isDayjs)(obj) ? obj.toDate() : obj;
52
+ } else if (Array.isArray(obj)) {
53
+ return obj.map((o) => deepObjectify(o, option));
54
+ } else if (obj && typeof obj === "object") {
55
+ const val = {};
56
+ Object.keys(obj).forEach((key) => {
57
+ const fieldValue = obj[key];
58
+ if (fieldValue?.__ModelType__ && !option.serializable)
59
+ val[key] = fieldValue;
60
+ else if (typeof obj[key] !== "function")
61
+ val[key] = deepObjectify(fieldValue, option);
62
+ });
63
+ return val;
64
+ } else {
65
+ return obj;
66
+ }
67
+ };
68
+
69
+ // pkgs/@akanjs/common/src/pathGet.ts
70
+ var pathGet = (path, obj, separator = ".") => {
71
+ const properties = Array.isArray(path) ? path : path.split(separator);
72
+ return properties.reduce((prev, curr) => prev[curr], obj);
73
+ };
74
+
75
+ // pkgs/@akanjs/common/src/isQueryEqual.ts
76
+ var import_dayjs2 = __toESM(__require("dayjs"));
77
+ var isQueryEqual = (value1, value2) => {
78
+ if (value1 === value2)
79
+ return true;
80
+ if (Array.isArray(value1) && Array.isArray(value2)) {
81
+ if (value1.length !== value2.length)
82
+ return false;
83
+ for (let i = 0; i < value1.length; i++)
84
+ if (!isQueryEqual(value1[i], value2[i]))
85
+ return false;
86
+ return true;
87
+ }
88
+ if ([value1, value2].some((val) => val instanceof Date || (0, import_dayjs.isDayjs)(val)))
89
+ return (0, import_dayjs2.default)(value1).isSame((0, import_dayjs2.default)(value2));
90
+ if (typeof value1 === "object" && typeof value2 === "object") {
91
+ if (value1 === null || value2 === null)
92
+ return value1 === value2;
93
+ if (Object.keys(value1).length !== Object.keys(value2).length)
94
+ return false;
95
+ for (const key of Object.keys(value1))
96
+ if (!isQueryEqual(value1[key], value2[key]))
97
+ return false;
98
+ return true;
99
+ }
100
+ return false;
101
+ };
102
+
103
+ // pkgs/@akanjs/common/src/isValidDate.ts
104
+ var import_dayjs3 = __toESM(__require("dayjs"));
105
+ var import_customParseFormat = __toESM(__require("dayjs/plugin/customParseFormat"));
106
+ import_dayjs3.default.extend(import_customParseFormat.default);
107
+ var isValidDate = (d) => {
108
+ const format = "YYYY-MM-DD";
109
+ if (typeof d === "string") {
110
+ return (0, import_dayjs3.default)(d, format).isValid();
111
+ } else if ((0, import_dayjs.isDayjs)(d))
112
+ return d.isValid();
113
+ else
114
+ return d instanceof Date && !isNaN(d.getTime());
115
+ };
116
+
117
+ // pkgs/@akanjs/common/src/objectify.ts
118
+ var objectify = (obj, keys = Object.keys(obj)) => {
119
+ const val = {};
120
+ keys.forEach((key) => {
121
+ if (typeof obj[key] !== "function")
122
+ val[key] = obj[key];
123
+ });
124
+ return val;
125
+ };
126
+
127
+ // pkgs/@akanjs/common/src/randomPick.ts
128
+ var randomPick = (arr) => arr[Math.floor(Math.random() * arr.length)];
129
+
130
+ // pkgs/@akanjs/common/src/randomPicks.ts
131
+ var randomPicks = (arr, count = 1, allowDuplicate = false) => {
132
+ if (!allowDuplicate && arr.length <= count)
133
+ return arr;
134
+ const idxs = [];
135
+ let pickIdx;
136
+ for (let i = 0; i < count; i++) {
137
+ do {
138
+ pickIdx = Math.floor(Math.random() * arr.length);
139
+ } while (!allowDuplicate && idxs.includes(pickIdx));
140
+ idxs.push(pickIdx);
141
+ }
142
+ return idxs.map((idx) => arr[idx]);
143
+ };
144
+
145
+ // pkgs/@akanjs/common/src/pathSet.ts
146
+ var pathSet = (obj, path, value) => {
147
+ if (Object(obj) !== obj)
148
+ return obj;
149
+ if (!Array.isArray(path))
150
+ path = path.toString().match(/[^.[\]]+/g) || [];
151
+ path.slice(0, -1).reduce(
152
+ (a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {},
153
+ obj
154
+ )[path[path.length - 1]] = value;
155
+ return obj;
156
+ };
157
+
158
+ // pkgs/@akanjs/common/src/mergeVersion.ts
159
+ var mergeVersion = (major, minor, patch) => `${major}.${minor}.${patch}`;
160
+
161
+ // pkgs/@akanjs/common/src/pluralize.ts
162
+ var import_pluralize = __toESM(__require("pluralize"));
163
+
164
+ // pkgs/@akanjs/common/src/applyMixins.ts
165
+ var getAllPropertyDescriptors = (objRef) => {
166
+ const descriptors = {};
167
+ let current = objRef.prototype;
168
+ while (current) {
169
+ Object.getOwnPropertyNames(current).forEach((name) => {
170
+ descriptors[name] ??= Object.getOwnPropertyDescriptor(current, name);
171
+ });
172
+ current = Object.getPrototypeOf(current);
173
+ }
174
+ return descriptors;
175
+ };
176
+ var applyMixins = (derivedCtor, constructors, avoidKeys) => {
177
+ constructors.forEach((baseCtor) => {
178
+ Object.entries(getAllPropertyDescriptors(baseCtor)).forEach(([name, descriptor]) => {
179
+ if (name === "constructor" || avoidKeys?.has(name))
180
+ return;
181
+ Object.defineProperty(derivedCtor.prototype, name, { ...descriptor, configurable: true });
182
+ });
183
+ });
184
+ };
185
+
186
+ // pkgs/@akanjs/common/src/capitalize.ts
187
+ var capitalize = (str) => {
188
+ return str.charAt(0).toUpperCase() + str.slice(1);
189
+ };
190
+
191
+ // pkgs/@akanjs/common/src/Logger.ts
192
+ var import_dayjs4 = __toESM(__require("dayjs"));
193
+ var logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
194
+ var clc = {
195
+ bold: (text) => `\x1B[1m${text}\x1B[0m`,
196
+ green: (text) => `\x1B[32m${text}\x1B[39m`,
197
+ yellow: (text) => `\x1B[33m${text}\x1B[39m`,
198
+ red: (text) => `\x1B[31m${text}\x1B[39m`,
199
+ magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
200
+ cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
201
+ };
202
+ var colorizeMap = {
203
+ trace: clc.bold,
204
+ verbose: clc.cyanBright,
205
+ debug: clc.magentaBright,
206
+ log: clc.green,
207
+ info: clc.green,
208
+ warn: clc.yellow,
209
+ error: clc.red
210
+ };
211
+ var Logger = class _Logger {
212
+ static #ignoreCtxSet = /* @__PURE__ */ new Set([
213
+ "InstanceLoader",
214
+ "RoutesResolver",
215
+ "RouterExplorer",
216
+ "NestFactory",
217
+ "WebSocketsController",
218
+ "GraphQLModule",
219
+ "NestApplication"
220
+ ]);
221
+ static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
222
+ static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
223
+ static #startAt = (0, import_dayjs4.default)();
224
+ static setLevel(level) {
225
+ this.level = level;
226
+ this.#levelIdx = logLevels.findIndex((l) => l === level);
227
+ }
228
+ name;
229
+ constructor(name) {
230
+ this.name = name;
231
+ }
232
+ trace(msg, context = "") {
233
+ if (_Logger.#levelIdx <= 0)
234
+ _Logger.#printMessages(this.name ?? "App", msg, context, "trace");
235
+ }
236
+ verbose(msg, context = "") {
237
+ if (_Logger.#levelIdx <= 1)
238
+ _Logger.#printMessages(this.name ?? "App", msg, context, "verbose");
239
+ }
240
+ debug(msg, context = "") {
241
+ if (_Logger.#levelIdx <= 2)
242
+ _Logger.#printMessages(this.name ?? "App", msg, context, "debug");
243
+ }
244
+ log(msg, context = "") {
245
+ if (_Logger.#levelIdx <= 3)
246
+ _Logger.#printMessages(this.name ?? "App", msg, context, "log");
247
+ }
248
+ info(msg, context = "") {
249
+ if (_Logger.#levelIdx <= 4)
250
+ _Logger.#printMessages(this.name ?? "App", msg, context, "info");
251
+ }
252
+ warn(msg, context = "") {
253
+ if (_Logger.#levelIdx <= 5)
254
+ _Logger.#printMessages(this.name ?? "App", msg, context, "warn");
255
+ }
256
+ error(msg, context = "") {
257
+ if (_Logger.#levelIdx <= 6)
258
+ _Logger.#printMessages(this.name ?? "App", msg, context, "error");
259
+ }
260
+ raw(msg, method) {
261
+ _Logger.rawLog(msg, method);
262
+ }
263
+ rawLog(msg, method) {
264
+ _Logger.rawLog(msg, method);
265
+ }
266
+ static trace(msg, context = "") {
267
+ if (_Logger.#levelIdx <= 0)
268
+ _Logger.#printMessages("App", msg, context, "trace");
269
+ }
270
+ static verbose(msg, context = "") {
271
+ if (_Logger.#levelIdx <= 1)
272
+ _Logger.#printMessages("App", msg, context, "verbose");
273
+ }
274
+ static debug(msg, context = "") {
275
+ if (_Logger.#levelIdx <= 2)
276
+ _Logger.#printMessages("App", msg, context, "debug");
277
+ }
278
+ static log(msg, context = "") {
279
+ if (_Logger.#levelIdx <= 3)
280
+ _Logger.#printMessages("App", msg, context, "log");
281
+ }
282
+ static info(msg, context = "") {
283
+ if (_Logger.#levelIdx <= 4)
284
+ _Logger.#printMessages("App", msg, context, "info");
285
+ }
286
+ static warn(msg, context = "") {
287
+ if (_Logger.#levelIdx <= 5)
288
+ _Logger.#printMessages("App", msg, context, "warn");
289
+ }
290
+ static error(msg, context = "") {
291
+ if (_Logger.#levelIdx <= 6)
292
+ _Logger.#printMessages("App", msg, context, "error");
293
+ }
294
+ static #colorize(msg, logLevel) {
295
+ return colorizeMap[logLevel](msg);
296
+ }
297
+ static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
298
+ if (this.#ignoreCtxSet.has(context))
299
+ return;
300
+ const now = (0, import_dayjs4.default)();
301
+ const processMsg = this.#colorize(
302
+ `[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
303
+ logLevel
304
+ );
305
+ const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
306
+ const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
307
+ const contextMsg = context ? clc.yellow(`[${context}] `) : "";
308
+ const contentMsg = this.#colorize(content, logLevel);
309
+ const timeDiffMsg = clc.yellow(`+${now.diff(_Logger.#startAt, "ms")}ms`);
310
+ if (typeof window === "undefined")
311
+ process[writeStreamType].write(
312
+ `${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
313
+ `
314
+ );
315
+ else
316
+ console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
317
+ `);
318
+ }
319
+ static rawLog(msg, method) {
320
+ this.raw(`${msg}
321
+ `, method);
322
+ }
323
+ static raw(msg, method) {
324
+ if (typeof window === "undefined" && method !== "console" && global.process)
325
+ global.process.stdout.write(msg);
326
+ else
327
+ console.log(msg);
328
+ }
329
+ };
330
+
331
+ // pkgs/@akanjs/common/src/lowerlize.ts
332
+ var lowerlize = (str) => {
333
+ return str.charAt(0).toLowerCase() + str.slice(1);
334
+ };
335
+
336
+ // pkgs/@akanjs/common/src/sleep.ts
337
+ var sleep = async (ms) => {
338
+ return new Promise((resolve) => {
339
+ setTimeout(() => {
340
+ resolve(true);
341
+ }, ms);
342
+ });
343
+ };
344
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/common",
3
- "version": "0.0.40",
3
+ "version": "0.0.41",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,5 +14,8 @@
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
17
- "dependencies": {}
17
+ "dependencies": {
18
+ "dayjs": "^1.11.13",
19
+ "pluralize": "^8.0.0"
20
+ }
18
21
  }
package/src/Logger.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare const logLevels: readonly ["trace", "verbose", "debug", "log", "info", "warn", "error"];
2
2
  type LogLevel = (typeof logLevels)[number];
3
- declare class Logger {
3
+ export declare class Logger {
4
4
  #private;
5
5
  static level: LogLevel;
6
6
  static setLevel(level: LogLevel): void;
@@ -25,5 +25,4 @@ declare class Logger {
25
25
  static rawLog(msg: string, method?: "console" | "process"): void;
26
26
  static raw(msg: string, method?: "console" | "process"): void;
27
27
  }
28
-
29
- export { Logger };
28
+ export {};
@@ -1,4 +1,3 @@
1
1
  type Type<T = any> = new (...args: any[]) => T;
2
- declare const applyMixins: (derivedCtor: Type, constructors: (Type | undefined)[], avoidKeys?: Set<string>) => void;
3
-
4
- export { applyMixins };
2
+ export declare const applyMixins: (derivedCtor: Type, constructors: (Type | undefined)[], avoidKeys?: Set<string>) => void;
3
+ export {};
@@ -1,3 +1 @@
1
- declare const capitalize: (str: string) => string;
2
-
3
- export { capitalize };
1
+ export declare const capitalize: (str: string) => string;
@@ -1,6 +1,4 @@
1
- declare const deepObjectify: <T = any>(obj: T | null | undefined, option?: {
1
+ export declare const deepObjectify: <T = any>(obj: T | null | undefined, option?: {
2
2
  serializable?: boolean;
3
3
  convertDate?: "string" | "number";
4
4
  }) => T;
5
-
6
- export { deepObjectify };
package/src/index.d.ts CHANGED
@@ -1,19 +1,18 @@
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';
1
+ export type * from "./types";
2
+ export { splitVersion } from "./splitVersion";
3
+ export { deepObjectify } from "./deepObjectify";
4
+ export { pathGet } from "./pathGet";
5
+ export { isQueryEqual } from "./isQueryEqual";
6
+ export { isValidDate } from "./isValidDate";
7
+ export { objectify } from "./objectify";
8
+ export { randomPick } from "./randomPick";
9
+ export { randomPicks } from "./randomPicks";
10
+ export { pathSet } from "./pathSet";
11
+ export { isDayjs } from "./isDayjs";
12
+ export { mergeVersion } from "./mergeVersion";
13
+ export { pluralize } from "./pluralize";
14
+ export { applyMixins } from "./applyMixins";
15
+ export { capitalize } from "./capitalize";
16
+ export { Logger } from "./Logger";
17
+ export { lowerlize } from "./lowerlize";
18
+ export { sleep } from "./sleep";
package/src/isDayjs.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { isDayjs } from 'dayjs';
2
- import 'pluralize';
1
+ import { isDayjs } from "dayjs";
2
+ export { isDayjs };
@@ -1,3 +1 @@
1
- declare const isQueryEqual: (value1: object | null, value2: object | null) => boolean;
2
-
3
- export { isQueryEqual };
1
+ export declare const isQueryEqual: (value1: object | null, value2: object | null) => boolean;
@@ -1,5 +1,2 @@
1
- import { Dayjs } from 'dayjs';
2
-
3
- declare const isValidDate: (d: string | Date | Dayjs) => boolean;
4
-
5
- export { isValidDate };
1
+ import { Dayjs } from "dayjs";
2
+ export declare const isValidDate: (d: string | Date | Dayjs) => boolean;
@@ -1,3 +1 @@
1
- declare const lowerlize: (str: string) => string;
2
-
3
- export { lowerlize };
1
+ export declare const lowerlize: (str: string) => string;
@@ -7,6 +7,4 @@
7
7
  * @param patch 코드푸시 (Framework 자체 버전)
8
8
  * @returns `major.minor.patch` 형식으로 조합된 버전
9
9
  */
10
- declare const mergeVersion: (major: number, minor: number, patch: number) => string;
11
-
12
- export { mergeVersion };
10
+ export declare const mergeVersion: (major: number, minor: number, patch: number) => string;
@@ -1,3 +1 @@
1
- declare const objectify: (obj: any, keys?: string[]) => any;
2
-
3
- export { objectify };
1
+ export declare const objectify: (obj: any, keys?: string[]) => any;
package/src/pathGet.d.ts CHANGED
@@ -1,3 +1 @@
1
- declare const pathGet: (path: string | (string | number)[], obj: any, separator?: string) => unknown;
2
-
3
- export { pathGet };
1
+ export declare const pathGet: (path: string | (string | number)[], obj: any, separator?: string) => unknown;
package/src/pathSet.d.ts CHANGED
@@ -1,3 +1 @@
1
- declare const pathSet: (obj: any, path: any, value: any) => any;
2
-
3
- export { pathSet };
1
+ export declare const pathSet: (obj: any, path: any, value: any) => any;
@@ -1 +1,2 @@
1
- export { default as pluralize } from 'pluralize';
1
+ import pluralize from "pluralize";
2
+ export { pluralize };
@@ -1,3 +1 @@
1
- declare const randomPick: <T = any>(arr: T[] | readonly T[]) => T;
2
-
3
- export { randomPick };
1
+ export declare const randomPick: <T = any>(arr: T[] | readonly T[]) => T;
@@ -1,3 +1 @@
1
- declare const randomPicks: <T>(arr: T[] | readonly T[], count?: number, allowDuplicate?: boolean) => T[];
2
-
3
- export { randomPicks };
1
+ export declare const randomPicks: <T>(arr: T[] | readonly T[], count?: number, allowDuplicate?: boolean) => T[];
package/src/sleep.d.ts CHANGED
@@ -1,3 +1 @@
1
- declare const sleep: (ms: number) => Promise<unknown>;
2
-
3
- export { sleep };
1
+ export declare const sleep: (ms: number) => Promise<unknown>;
@@ -4,10 +4,8 @@
4
4
  * https://semver.org/
5
5
  * @params version `major.minor.patch` 형식으로 조합된 버전
6
6
  */
7
- declare const splitVersion: (version: string) => {
7
+ export declare const splitVersion: (version: string) => {
8
8
  major: string;
9
9
  minor: string;
10
10
  patch: string;
11
11
  };
12
-
13
- export { splitVersion };
package/src/types.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { RequestPolicy } from '@urql/core';
2
-
3
- interface FetchPolicy<Returns = any> {
1
+ import type { RequestPolicy } from "@urql/core";
2
+ export interface FetchPolicy<Returns = any> {
4
3
  cache?: boolean | number | RequestPolicy;
5
4
  crystalize?: boolean;
6
5
  url?: string;
@@ -9,10 +8,8 @@ interface FetchPolicy<Returns = any> {
9
8
  partial?: string[];
10
9
  transport?: "udp" | "websocket" | "graphql" | "restapi";
11
10
  }
12
- type SnakeCase<S extends string> = S extends `${infer T}_${infer U}` ? `${Lowercase<T>}_${SnakeCase<U>}` : S;
13
- type SnakeCaseObj<T> = {
11
+ export type SnakeCase<S extends string> = S extends `${infer T}_${infer U}` ? `${Lowercase<T>}_${SnakeCase<U>}` : S;
12
+ export type SnakeCaseObj<T> = {
14
13
  [K in keyof T as SnakeCase<K & string>]: T[K] extends object ? SnakeCaseObj<T[K]> : T[K];
15
14
  };
16
- type SnakeMsg<Msg> = SnakeCaseObj<Msg>;
17
-
18
- export type { FetchPolicy, SnakeCase, SnakeCaseObj, SnakeMsg };
15
+ export type SnakeMsg<Msg> = SnakeCaseObj<Msg>;