@wzyjs/utils 0.2.14 → 0.2.26

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.
Files changed (37) hide show
  1. package/dist/cjs/common/array.js +68 -0
  2. package/dist/cjs/common/index.d.ts +1 -0
  3. package/dist/cjs/common/index.js +3 -1
  4. package/dist/cjs/common/string.js +28 -0
  5. package/dist/esm/common/array.js +65 -0
  6. package/dist/esm/common/index.d.ts +1 -0
  7. package/dist/esm/common/index.js +1 -0
  8. package/dist/esm/common/string.js +31 -0
  9. package/package.json +3 -3
  10. package/dist/cjs/browser/element.d.ts +0 -9
  11. package/dist/cjs/browser/index.d.ts +0 -19
  12. package/dist/cjs/browser/initHttpClient.d.ts +0 -4
  13. package/dist/cjs/browser/other.d.ts +0 -1
  14. package/dist/cjs/browser/style.d.ts +0 -10
  15. package/dist/cjs/common/classs.d.ts +0 -5
  16. package/dist/cjs/common/number.d.ts +0 -4
  17. package/dist/cjs/common/object.d.ts +0 -10
  18. package/dist/cjs/common/other.d.ts +0 -25
  19. package/dist/cjs/common/string.d.ts +0 -17
  20. package/dist/cjs/node/file/index.d.ts +0 -1
  21. package/dist/cjs/node/index.d.ts +0 -4
  22. package/dist/cjs/node/jsonFile/index.d.ts +0 -7
  23. package/dist/cjs/node/mail/index.d.ts +0 -1
  24. package/dist/esm/browser/element.d.ts +0 -9
  25. package/dist/esm/browser/index.d.ts +0 -19
  26. package/dist/esm/browser/initHttpClient.d.ts +0 -4
  27. package/dist/esm/browser/other.d.ts +0 -1
  28. package/dist/esm/browser/style.d.ts +0 -10
  29. package/dist/esm/common/classs.d.ts +0 -5
  30. package/dist/esm/common/number.d.ts +0 -4
  31. package/dist/esm/common/object.d.ts +0 -10
  32. package/dist/esm/common/other.d.ts +0 -25
  33. package/dist/esm/common/string.d.ts +0 -17
  34. package/dist/esm/node/file/index.d.ts +0 -1
  35. package/dist/esm/node/index.d.ts +0 -4
  36. package/dist/esm/node/jsonFile/index.d.ts +0 -7
  37. package/dist/esm/node/mail/index.d.ts +0 -1
@@ -0,0 +1,68 @@
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
+
19
+ // src/common/array.ts
20
+ var array_exports = {};
21
+ __export(array_exports, {
22
+ removeSimilarDuplicates: () => removeSimilarDuplicates,
23
+ shuffleArray: () => shuffleArray
24
+ });
25
+ module.exports = __toCommonJS(array_exports);
26
+ var import_string = require("./string");
27
+ var shuffleArray = (array) => {
28
+ const shuffledArray = [...array];
29
+ for (let i = shuffledArray.length - 1; i > 0; i--) {
30
+ const j = Math.floor(Math.random() * (i + 1));
31
+ [shuffledArray[i], shuffledArray[j]] = [shuffledArray[j], shuffledArray[i]];
32
+ }
33
+ return shuffledArray;
34
+ };
35
+ var removeSimilarDuplicates = (arr, threshold, isLog) => {
36
+ const uniqueArray = [];
37
+ const similarPairs = [];
38
+ for (const str of arr) {
39
+ const isSimilar = uniqueArray.some((uniqueStr) => {
40
+ const distance = (0, import_string.levenshteinDistance)(str, uniqueStr);
41
+ if (distance <= threshold) {
42
+ similarPairs.push([str, uniqueStr]);
43
+ return true;
44
+ }
45
+ return false;
46
+ });
47
+ if (!isSimilar) {
48
+ uniqueArray.push(str);
49
+ }
50
+ }
51
+ if (isLog) {
52
+ if (similarPairs.length > 0) {
53
+ similarPairs.forEach((pair) => {
54
+ console.log(pair[0]);
55
+ console.log(pair[1]);
56
+ console.log();
57
+ });
58
+ } else {
59
+ console.log("没有找到类似的字符串");
60
+ }
61
+ }
62
+ return uniqueArray;
63
+ };
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ removeSimilarDuplicates,
67
+ shuffleArray
68
+ });
@@ -8,5 +8,6 @@ export * from './object';
8
8
  export * from './other';
9
9
  export * from './number';
10
10
  export * from './classs';
11
+ export * from './array';
11
12
  export { default as _ } from 'lodash';
12
13
  export { default as axios } from 'axios';
@@ -66,6 +66,7 @@ __reExport(common_exports, require("./object"), module.exports);
66
66
  __reExport(common_exports, require("./other"), module.exports);
67
67
  __reExport(common_exports, require("./number"), module.exports);
68
68
  __reExport(common_exports, require("./classs"), module.exports);
69
+ __reExport(common_exports, require("./array"), module.exports);
69
70
  var import_lodash2 = __toESM(require("lodash"));
70
71
  var import_axios = __toESM(require("axios"));
71
72
  // Annotate the CommonJS export names for ESM import in node:
@@ -100,5 +101,6 @@ var import_axios = __toESM(require("axios"));
100
101
  ...require("./object"),
101
102
  ...require("./other"),
102
103
  ...require("./number"),
103
- ...require("./classs")
104
+ ...require("./classs"),
105
+ ...require("./array")
104
106
  });
@@ -33,6 +33,7 @@ __export(string_exports, {
33
33
  getType: () => getType,
34
34
  isJson: () => isJson,
35
35
  jsonParse: () => jsonParse,
36
+ levenshteinDistance: () => levenshteinDistance,
36
37
  replaceAll: () => replaceAll,
37
38
  replaceByRules: () => replaceByRules,
38
39
  toString: () => toString
@@ -140,6 +141,32 @@ var getCookie = (name) => {
140
141
  var generateAlphabetArray = (n) => {
141
142
  return Array.from({ length: n }, (_, i) => String.fromCharCode(97 + i));
142
143
  };
144
+ var levenshteinDistance = (a, b) => {
145
+ const matrix = [];
146
+ for (let i = 0; i <= b.length; i++) {
147
+ matrix[i] = [i];
148
+ }
149
+ for (let j = 0; j <= a.length; j++) {
150
+ matrix[0][j] = j;
151
+ }
152
+ for (let i = 1; i <= b.length; i++) {
153
+ for (let j = 1; j <= a.length; j++) {
154
+ if (b[i - 1] === a[j - 1]) {
155
+ matrix[i][j] = matrix[i - 1][j - 1];
156
+ } else {
157
+ matrix[i][j] = Math.min(
158
+ matrix[i - 1][j - 1] + 1,
159
+ // 替换
160
+ matrix[i][j - 1] + 1,
161
+ // 插入
162
+ matrix[i - 1][j] + 1
163
+ // 删除
164
+ );
165
+ }
166
+ }
167
+ }
168
+ return matrix[b.length][a.length];
169
+ };
143
170
  // Annotate the CommonJS export names for ESM import in node:
144
171
  0 && (module.exports = {
145
172
  amount,
@@ -156,6 +183,7 @@ var generateAlphabetArray = (n) => {
156
183
  getType,
157
184
  isJson,
158
185
  jsonParse,
186
+ levenshteinDistance,
159
187
  replaceAll,
160
188
  replaceByRules,
161
189
  toString
@@ -0,0 +1,65 @@
1
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
+ import { levenshteinDistance } from "./string";
9
+
10
+ // 数组随机变换位置
11
+ export var shuffleArray = function shuffleArray(array) {
12
+ var shuffledArray = _toConsumableArray(array); // 创建数组的副本以避免修改原数组
13
+ for (var i = shuffledArray.length - 1; i > 0; i--) {
14
+ var j = Math.floor(Math.random() * (i + 1));
15
+ var _ref = [shuffledArray[j], shuffledArray[i]];
16
+ shuffledArray[i] = _ref[0];
17
+ shuffledArray[j] = _ref[1];
18
+ }
19
+ return shuffledArray;
20
+ };
21
+
22
+ // 去重函数,接受一个字符串数组,返回一个相似程度高的去重后的数组
23
+ export var removeSimilarDuplicates = function removeSimilarDuplicates(arr, threshold, isLog) {
24
+ var uniqueArray = [];
25
+ var similarPairs = []; // 用于存储相似的字符串对
26
+ var _iterator = _createForOfIteratorHelper(arr),
27
+ _step;
28
+ try {
29
+ var _loop = function _loop() {
30
+ var str = _step.value;
31
+ var isSimilar = uniqueArray.some(function (uniqueStr) {
32
+ var distance = levenshteinDistance(str, uniqueStr);
33
+ if (distance <= threshold) {
34
+ similarPairs.push([str, uniqueStr]); // 记录相似字符串对
35
+ return true;
36
+ }
37
+ return false;
38
+ });
39
+ if (!isSimilar) {
40
+ uniqueArray.push(str);
41
+ }
42
+ };
43
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
44
+ _loop();
45
+ }
46
+
47
+ // 打印相似的字符串
48
+ } catch (err) {
49
+ _iterator.e(err);
50
+ } finally {
51
+ _iterator.f();
52
+ }
53
+ if (isLog) {
54
+ if (similarPairs.length > 0) {
55
+ similarPairs.forEach(function (pair) {
56
+ console.log(pair[0]);
57
+ console.log(pair[1]);
58
+ console.log();
59
+ });
60
+ } else {
61
+ console.log('没有找到类似的字符串');
62
+ }
63
+ }
64
+ return uniqueArray;
65
+ };
@@ -8,5 +8,6 @@ export * from './object';
8
8
  export * from './other';
9
9
  export * from './number';
10
10
  export * from './classs';
11
+ export * from './array';
11
12
  export { default as _ } from 'lodash';
12
13
  export { default as axios } from 'axios';
@@ -9,5 +9,6 @@ export * from "./object";
9
9
  export * from "./other";
10
10
  export * from "./number";
11
11
  export * from "./classs";
12
+ export * from "./array";
12
13
  export { default as _ } from 'lodash';
13
14
  export { default as axios } from 'axios';
@@ -146,4 +146,35 @@ export var generateAlphabetArray = function generateAlphabetArray(n) {
146
146
  }, function (_, i) {
147
147
  return String.fromCharCode(97 + i);
148
148
  });
149
+ };
150
+
151
+ // 计算文本相似度 (Levenshtein 距离算法)
152
+ export var levenshteinDistance = function levenshteinDistance(a, b) {
153
+ var matrix = [];
154
+
155
+ // 初始化矩阵
156
+ for (var i = 0; i <= b.length; i++) {
157
+ matrix[i] = [i];
158
+ }
159
+ for (var j = 0; j <= a.length; j++) {
160
+ matrix[0][j] = j;
161
+ }
162
+
163
+ // 填充矩阵
164
+ for (var _i2 = 1; _i2 <= b.length; _i2++) {
165
+ for (var _j = 1; _j <= a.length; _j++) {
166
+ if (b[_i2 - 1] === a[_j - 1]) {
167
+ matrix[_i2][_j] = matrix[_i2 - 1][_j - 1];
168
+ } else {
169
+ matrix[_i2][_j] = Math.min(matrix[_i2 - 1][_j - 1] + 1,
170
+ // 替换
171
+ matrix[_i2][_j - 1] + 1,
172
+ // 插入
173
+ matrix[_i2 - 1][_j] + 1 // 删除
174
+ );
175
+ }
176
+ }
177
+ }
178
+
179
+ return matrix[b.length][a.length];
149
180
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wzyjs/utils",
3
- "version": "0.2.14",
3
+ "version": "0.2.26",
4
4
  "description": "description",
5
5
  "author": "wzy",
6
6
  "scripts": {
@@ -36,7 +36,7 @@
36
36
  "classnames": "^2.3.2",
37
37
  "consola": "^2.15.3",
38
38
  "copy-to-clipboard": "^3.3.3",
39
- "dayjs": "^1.11.6",
39
+ "dayjs": "^1.11.12",
40
40
  "fs-extra": "^11.2.0",
41
41
  "localforage": "^1.10.0",
42
42
  "lodash": "^4.17.21",
@@ -64,5 +64,5 @@
64
64
  "type": "git",
65
65
  "url": "https://gitee.com/wang-zhenyu/app.git"
66
66
  },
67
- "gitHead": "4debf634852c7e5375d4dc5616e4e607005761c2"
67
+ "gitHead": "495360e8f5a4e726be716ca842c769fa3ca3a6b2"
68
68
  }
@@ -1,9 +0,0 @@
1
- export declare const scrollIntoView: (el: Element, option?: ScrollIntoViewOptions) => void;
2
- export declare const getElement: (el: string | Element) => {
3
- element: null;
4
- originalStyle: {};
5
- } | {
6
- element: Element;
7
- originalStyle: CSSStyleDeclaration;
8
- };
9
- export declare const isElementInViewport: (el: string | Element) => boolean | undefined;
@@ -1,19 +0,0 @@
1
- import md5 from 'md5';
2
- import classnames from 'classnames';
3
- import copy from 'copy-to-clipboard';
4
- import anime from 'animejs';
5
- export { copy, classnames, md5, anime };
6
- export declare const localforage: {
7
- config: {
8
- (options: LocalForageOptions): boolean;
9
- (options: string): any;
10
- (): LocalForageOptions;
11
- };
12
- setItem: <T>(key: string, value: T, callback?: ((err: any, value: T) => void) | undefined) => Promise<T>;
13
- getItem: <T_1>(key: string, callback?: ((err: any, value: T_1 | null) => void) | undefined) => Promise<T_1 | null>;
14
- removeItem: (key: string, callback?: ((err: any) => void) | undefined) => Promise<void>;
15
- };
16
- export * from './style';
17
- export * from './element';
18
- export * from './other';
19
- export * from './initHttpClient';
@@ -1,4 +0,0 @@
1
- export declare const initHttpClient: (setupHttpClient: any, option: {
2
- timeout: number;
3
- onError: any;
4
- }) => void;
@@ -1 +0,0 @@
1
- export declare const readClipboard: () => Promise<string>;
@@ -1,10 +0,0 @@
1
- export declare const hexToRgba: (hexColor: string, a?: number) => {
2
- nums: {
3
- red: number;
4
- green: number;
5
- blue: number;
6
- };
7
- text: string;
8
- };
9
- export declare const flashBackground: (el: string | Element, color: string, a?: number) => void;
10
- export declare const flashBorder: (el: string | Element, color: string, a?: number) => void;
@@ -1,5 +0,0 @@
1
- export declare class CustomError extends Error {
2
- code?: number;
3
- data?: any;
4
- constructor(message: string, code?: number, data?: any);
5
- }
@@ -1,4 +0,0 @@
1
- export declare const getRandomNum: (min: number, max: number) => number;
2
- export declare const limitDecimals: (v: string, num: number | undefined, isForce: boolean) => string;
3
- export declare const getFileSize: (size: number) => string;
4
- export declare const isValidNumber: (value: any) => boolean;
@@ -1,10 +0,0 @@
1
- export declare const findItem: <I>(list: I[], attr: keyof I, value?: I[keyof I] | undefined) => I | undefined;
2
- export declare const filterParams: (params: {
3
- [key: string]: any;
4
- }) => any;
5
- export declare const watch: {
6
- observe(obj: {
7
- [key: string]: any;
8
- }, key: string, watchFun: (value: any, val: any) => undefined): void;
9
- setWatcher(data?: {}, watch?: any): void;
10
- };
@@ -1,25 +0,0 @@
1
- import { FilterParams, Order, Pagination, SortParams, Where } from '@wzyjs/types';
2
- export declare const handleParams: <I>(params: Pagination & I, sort: SortParams, filter: FilterParams, additional?: Where) => {
3
- where?: Where | undefined;
4
- order?: Order | undefined;
5
- pagination?: Pagination | undefined;
6
- };
7
- export declare const handleRes2List: <D>(reqPromise: any) => Promise<{
8
- label: string;
9
- value: string;
10
- }[]>;
11
- export declare const executePromise: (promise: Promise<any>) => Promise<{
12
- result: any;
13
- time: number;
14
- }>;
15
- export declare const locationFn: {
16
- url2Params: (url?: string) => {
17
- [key: string]: string;
18
- };
19
- params2Url: (params: {
20
- [key: string]: any;
21
- }) => string;
22
- setUrlParams: (key: string, value: any, keepName: string) => void;
23
- urlGetPath: (url?: string) => string;
24
- };
25
- export declare const delay: (time?: number) => Promise<unknown>;
@@ -1,17 +0,0 @@
1
- export declare const getChineseByStr: (str: string) => string;
2
- export declare const getStrLength: (value: string) => number;
3
- export declare const replaceAll: (str: string, searchValue: string, replaceValue: string) => string;
4
- export declare const replaceByRules: (str: string, rules: [string, string][]) => string;
5
- export declare const getType: (value: any) => string;
6
- export declare const amount: (str: string) => string;
7
- export declare const jsonParse: (value: string | object) => object;
8
- export declare const isJson: (str: string) => boolean;
9
- export declare const toString: (value: any) => string;
10
- export declare const getRandomColor: () => string;
11
- export declare const getRandomString: (length?: number) => string;
12
- export declare const getChinese: (str: string) => string;
13
- export declare const getSliceStr: (str: string, before: string, after: string) => string;
14
- export declare const getProxyUrl: (url: string) => string;
15
- export declare const getLength: (value: string) => number;
16
- export declare const getCookie: (name: string) => string | null;
17
- export declare const generateAlphabetArray: (n: number) => string[];
@@ -1 +0,0 @@
1
- export declare const replaceContentInFile: (filePath: string, targetContent: string, replacement: string) => Promise<void>;
@@ -1,4 +0,0 @@
1
- export * from './jsonFile';
2
- export * from './mail';
3
- export * from './file';
4
- export { default as DataStore, DataStoreOptions } from 'nedb';
@@ -1,7 +0,0 @@
1
- export declare class JsonFile {
2
- filePath: string;
3
- constructor(filePath: string);
4
- private ensureFileExists;
5
- get(key: string): Promise<any>;
6
- set(key: string, value: any): Promise<void>;
7
- }
@@ -1 +0,0 @@
1
- export declare const sendMail: (toEmail: string, title: string, content?: string) => Promise<string>;
@@ -1,9 +0,0 @@
1
- export declare const scrollIntoView: (el: Element, option?: ScrollIntoViewOptions) => void;
2
- export declare const getElement: (el: string | Element) => {
3
- element: null;
4
- originalStyle: {};
5
- } | {
6
- element: Element;
7
- originalStyle: CSSStyleDeclaration;
8
- };
9
- export declare const isElementInViewport: (el: string | Element) => boolean | undefined;
@@ -1,19 +0,0 @@
1
- import md5 from 'md5';
2
- import classnames from 'classnames';
3
- import copy from 'copy-to-clipboard';
4
- import anime from 'animejs';
5
- export { copy, classnames, md5, anime };
6
- export declare const localforage: {
7
- config: {
8
- (options: LocalForageOptions): boolean;
9
- (options: string): any;
10
- (): LocalForageOptions;
11
- };
12
- setItem: <T>(key: string, value: T, callback?: ((err: any, value: T) => void) | undefined) => Promise<T>;
13
- getItem: <T_1>(key: string, callback?: ((err: any, value: T_1 | null) => void) | undefined) => Promise<T_1 | null>;
14
- removeItem: (key: string, callback?: ((err: any) => void) | undefined) => Promise<void>;
15
- };
16
- export * from './style';
17
- export * from './element';
18
- export * from './other';
19
- export * from './initHttpClient';
@@ -1,4 +0,0 @@
1
- export declare const initHttpClient: (setupHttpClient: any, option: {
2
- timeout: number;
3
- onError: any;
4
- }) => void;
@@ -1 +0,0 @@
1
- export declare const readClipboard: () => Promise<string>;
@@ -1,10 +0,0 @@
1
- export declare const hexToRgba: (hexColor: string, a?: number) => {
2
- nums: {
3
- red: number;
4
- green: number;
5
- blue: number;
6
- };
7
- text: string;
8
- };
9
- export declare const flashBackground: (el: string | Element, color: string, a?: number) => void;
10
- export declare const flashBorder: (el: string | Element, color: string, a?: number) => void;
@@ -1,5 +0,0 @@
1
- export declare class CustomError extends Error {
2
- code?: number;
3
- data?: any;
4
- constructor(message: string, code?: number, data?: any);
5
- }
@@ -1,4 +0,0 @@
1
- export declare const getRandomNum: (min: number, max: number) => number;
2
- export declare const limitDecimals: (v: string, num: number | undefined, isForce: boolean) => string;
3
- export declare const getFileSize: (size: number) => string;
4
- export declare const isValidNumber: (value: any) => boolean;
@@ -1,10 +0,0 @@
1
- export declare const findItem: <I>(list: I[], attr: keyof I, value?: I[keyof I] | undefined) => I | undefined;
2
- export declare const filterParams: (params: {
3
- [key: string]: any;
4
- }) => any;
5
- export declare const watch: {
6
- observe(obj: {
7
- [key: string]: any;
8
- }, key: string, watchFun: (value: any, val: any) => undefined): void;
9
- setWatcher(data?: {}, watch?: any): void;
10
- };
@@ -1,25 +0,0 @@
1
- import { FilterParams, Order, Pagination, SortParams, Where } from '@wzyjs/types';
2
- export declare const handleParams: <I>(params: Pagination & I, sort: SortParams, filter: FilterParams, additional?: Where) => {
3
- where?: Where | undefined;
4
- order?: Order | undefined;
5
- pagination?: Pagination | undefined;
6
- };
7
- export declare const handleRes2List: <D>(reqPromise: any) => Promise<{
8
- label: string;
9
- value: string;
10
- }[]>;
11
- export declare const executePromise: (promise: Promise<any>) => Promise<{
12
- result: any;
13
- time: number;
14
- }>;
15
- export declare const locationFn: {
16
- url2Params: (url?: string) => {
17
- [key: string]: string;
18
- };
19
- params2Url: (params: {
20
- [key: string]: any;
21
- }) => string;
22
- setUrlParams: (key: string, value: any, keepName: string) => void;
23
- urlGetPath: (url?: string) => string;
24
- };
25
- export declare const delay: (time?: number) => Promise<unknown>;
@@ -1,17 +0,0 @@
1
- export declare const getChineseByStr: (str: string) => string;
2
- export declare const getStrLength: (value: string) => number;
3
- export declare const replaceAll: (str: string, searchValue: string, replaceValue: string) => string;
4
- export declare const replaceByRules: (str: string, rules: [string, string][]) => string;
5
- export declare const getType: (value: any) => string;
6
- export declare const amount: (str: string) => string;
7
- export declare const jsonParse: (value: string | object) => object;
8
- export declare const isJson: (str: string) => boolean;
9
- export declare const toString: (value: any) => string;
10
- export declare const getRandomColor: () => string;
11
- export declare const getRandomString: (length?: number) => string;
12
- export declare const getChinese: (str: string) => string;
13
- export declare const getSliceStr: (str: string, before: string, after: string) => string;
14
- export declare const getProxyUrl: (url: string) => string;
15
- export declare const getLength: (value: string) => number;
16
- export declare const getCookie: (name: string) => string | null;
17
- export declare const generateAlphabetArray: (n: number) => string[];
@@ -1 +0,0 @@
1
- export declare const replaceContentInFile: (filePath: string, targetContent: string, replacement: string) => Promise<void>;
@@ -1,4 +0,0 @@
1
- export * from './jsonFile';
2
- export * from './mail';
3
- export * from './file';
4
- export { default as DataStore, DataStoreOptions } from 'nedb';
@@ -1,7 +0,0 @@
1
- export declare class JsonFile {
2
- filePath: string;
3
- constructor(filePath: string);
4
- private ensureFileExists;
5
- get(key: string): Promise<any>;
6
- set(key: string, value: any): Promise<void>;
7
- }
@@ -1 +0,0 @@
1
- export declare const sendMail: (toEmail: string, title: string, content?: string) => Promise<string>;