@fangzhongya/utils 0.0.1

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 (63) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +3 -0
  3. package/dist/basic/array/index.cjs +12 -0
  4. package/dist/basic/array/index.d.ts +2 -0
  5. package/dist/basic/array/index.js +12 -0
  6. package/dist/basic/array/isArray.cjs +7 -0
  7. package/dist/basic/array/isArray.d.ts +7 -0
  8. package/dist/basic/array/isArray.js +7 -0
  9. package/dist/basic/array/toggleArray.cjs +7 -0
  10. package/dist/basic/array/toggleArray.d.ts +11 -0
  11. package/dist/basic/array/toggleArray.js +7 -0
  12. package/dist/basic/index.cjs +21 -0
  13. package/dist/basic/index.d.ts +8 -0
  14. package/dist/basic/index.js +21 -0
  15. package/dist/basic/object/index.cjs +13 -0
  16. package/dist/basic/object/index.d.ts +2 -0
  17. package/dist/basic/object/index.js +13 -0
  18. package/dist/basic/object/isObject.cjs +8 -0
  19. package/dist/basic/object/isObject.d.ts +7 -0
  20. package/dist/basic/object/isObject.js +8 -0
  21. package/dist/basic/object/mergeObject.cjs +7 -0
  22. package/dist/basic/object/mergeObject.d.ts +11 -0
  23. package/dist/basic/object/mergeObject.js +7 -0
  24. package/dist/basic/string/index.cjs +12 -0
  25. package/dist/basic/string/index.d.ts +1 -0
  26. package/dist/basic/string/index.js +12 -0
  27. package/dist/basic/string/index2.cjs +11 -0
  28. package/dist/basic/string/index2.d.ts +20 -0
  29. package/dist/basic/string/index2.js +11 -0
  30. package/dist/chunk-26S4B3P7.cjs +42 -0
  31. package/dist/chunk-33TTIBDF.cjs +20 -0
  32. package/dist/chunk-4PBAZ73I.cjs +20 -0
  33. package/dist/chunk-5AZGAKWR.cjs +9 -0
  34. package/dist/chunk-5PX3AFSC.js +8 -0
  35. package/dist/chunk-BEQYORII.cjs +33 -0
  36. package/dist/chunk-DEENZC5X.js +33 -0
  37. package/dist/chunk-G5N77RKJ.js +20 -0
  38. package/dist/chunk-GR5LYHLF.js +20 -0
  39. package/dist/chunk-HRECTLZO.js +20 -0
  40. package/dist/chunk-ISHLY7WM.cjs +8 -0
  41. package/dist/chunk-KM7XK6D6.cjs +20 -0
  42. package/dist/chunk-KQVPI7TL.cjs +24 -0
  43. package/dist/chunk-KRIX2OSK.cjs +21 -0
  44. package/dist/chunk-LWHAS5EP.js +42 -0
  45. package/dist/chunk-N6OX2U6W.cjs +20 -0
  46. package/dist/chunk-UICA3PK6.js +9 -0
  47. package/dist/chunk-UKH47H42.js +24 -0
  48. package/dist/chunk-WO6JQRTD.js +16 -0
  49. package/dist/chunk-XRGLFTH2.cjs +16 -0
  50. package/dist/chunk-YYNHNLVW.js +20 -0
  51. package/dist/chunk-Z3GMPMGF.js +21 -0
  52. package/dist/index-24872dab.d.ts +13 -0
  53. package/dist/index-2e5b01e0.d.ts +13 -0
  54. package/dist/index-52ce4c1c.d.ts +13 -0
  55. package/dist/index-5691335a.d.ts +14 -0
  56. package/dist/index-ee246de3.d.ts +13 -0
  57. package/dist/index.cjs +19 -0
  58. package/dist/index.d.ts +10 -0
  59. package/dist/index.js +19 -0
  60. package/dist/iss/index.cjs +12 -0
  61. package/dist/iss/index.d.ts +2 -0
  62. package/dist/iss/index.js +12 -0
  63. package/package.json +75 -0
package/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022-2024 fangzhongya
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated
7
+ documentation files (the "Software"), to deal in the
8
+ Software without restriction, including without limitation
9
+ the rights to use, copy, modify, merge, publish, distribute,
10
+ sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so,
12
+ subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall
15
+ be included in all copies or substantial portions of the
16
+ Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
22
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # utils
2
+
3
+ 个人工具库
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-33TTIBDF.cjs');
2
+
3
+
4
+ var _chunkKRIX2OSKcjs = require('../../chunk-KRIX2OSK.cjs');
5
+
6
+
7
+ var _chunkISHLY7WMcjs = require('../../chunk-ISHLY7WM.cjs');
8
+ require('../../chunk-5AZGAKWR.cjs');
9
+
10
+
11
+
12
+ exports.isArray = _chunkISHLY7WMcjs.isArray; exports.toggleArray = _chunkKRIX2OSKcjs.toggleArray;
@@ -0,0 +1,2 @@
1
+ export { isArray } from './isArray.js';
2
+ export { toggleArray } from './toggleArray.js';
@@ -0,0 +1,12 @@
1
+ import "../../chunk-GR5LYHLF.js";
2
+ import {
3
+ toggleArray
4
+ } from "../../chunk-Z3GMPMGF.js";
5
+ import {
6
+ isArray
7
+ } from "../../chunk-5PX3AFSC.js";
8
+ import "../../chunk-UICA3PK6.js";
9
+ export {
10
+ isArray,
11
+ toggleArray
12
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkISHLY7WMcjs = require('../../chunk-ISHLY7WM.cjs');
4
+ require('../../chunk-5AZGAKWR.cjs');
5
+
6
+
7
+ exports.isArray = _chunkISHLY7WMcjs.isArray;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 是否是数组
3
+ * @param {*} objs
4
+ */
5
+ declare function isArray(obj: any): boolean;
6
+
7
+ export { isArray };
@@ -0,0 +1,7 @@
1
+ import {
2
+ isArray
3
+ } from "../../chunk-5PX3AFSC.js";
4
+ import "../../chunk-UICA3PK6.js";
5
+ export {
6
+ isArray
7
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkKRIX2OSKcjs = require('../../chunk-KRIX2OSK.cjs');
4
+ require('../../chunk-5AZGAKWR.cjs');
5
+
6
+
7
+ exports.toggleArray = _chunkKRIX2OSKcjs.toggleArray;
@@ -0,0 +1,11 @@
1
+ interface Objunkn {
2
+ [key: string]: any;
3
+ }
4
+ /**
5
+ * 数组值,如果存在就删除,如果没有就添加
6
+ * @param {*} objs
7
+ * @param {*} id
8
+ */
9
+ declare function toggleArray(objs: Array<Objunkn>, arr: Objunkn, id: string): Array<Objunkn>;
10
+
11
+ export { toggleArray };
@@ -0,0 +1,7 @@
1
+ import {
2
+ toggleArray
3
+ } from "../../chunk-Z3GMPMGF.js";
4
+ import "../../chunk-UICA3PK6.js";
5
+ export {
6
+ toggleArray
7
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-KQVPI7TL.cjs');
2
+
3
+
4
+ var _chunk4PBAZ73Icjs = require('../chunk-4PBAZ73I.cjs');
5
+ require('../chunk-BEQYORII.cjs');
6
+
7
+
8
+ var _chunk33TTIBDFcjs = require('../chunk-33TTIBDF.cjs');
9
+ require('../chunk-KRIX2OSK.cjs');
10
+
11
+
12
+ var _chunkKM7XK6D6cjs = require('../chunk-KM7XK6D6.cjs');
13
+ require('../chunk-26S4B3P7.cjs');
14
+ require('../chunk-XRGLFTH2.cjs');
15
+ require('../chunk-ISHLY7WM.cjs');
16
+ require('../chunk-5AZGAKWR.cjs');
17
+
18
+
19
+
20
+
21
+ exports.array = _chunk33TTIBDFcjs.array_exports; exports.object = _chunkKM7XK6D6cjs.object_exports; exports.string = _chunk4PBAZ73Icjs.string_exports;
@@ -0,0 +1,8 @@
1
+ export { i as array } from '../index-ee246de3.js';
2
+ export { i as object } from '../index-52ce4c1c.js';
3
+ export { i as string } from '../index-5691335a.js';
4
+ import './array/isArray.js';
5
+ import './array/toggleArray.js';
6
+ import './object/isObject.js';
7
+ import './object/mergeObject.js';
8
+ import './string/index2.js';
@@ -0,0 +1,21 @@
1
+ import "../chunk-UKH47H42.js";
2
+ import {
3
+ string_exports
4
+ } from "../chunk-YYNHNLVW.js";
5
+ import "../chunk-DEENZC5X.js";
6
+ import {
7
+ array_exports
8
+ } from "../chunk-GR5LYHLF.js";
9
+ import "../chunk-Z3GMPMGF.js";
10
+ import {
11
+ object_exports
12
+ } from "../chunk-G5N77RKJ.js";
13
+ import "../chunk-LWHAS5EP.js";
14
+ import "../chunk-WO6JQRTD.js";
15
+ import "../chunk-5PX3AFSC.js";
16
+ import "../chunk-UICA3PK6.js";
17
+ export {
18
+ array_exports as array,
19
+ object_exports as object,
20
+ string_exports as string
21
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-KM7XK6D6.cjs');
2
+
3
+
4
+ var _chunk26S4B3P7cjs = require('../../chunk-26S4B3P7.cjs');
5
+
6
+
7
+ var _chunkXRGLFTH2cjs = require('../../chunk-XRGLFTH2.cjs');
8
+ require('../../chunk-ISHLY7WM.cjs');
9
+ require('../../chunk-5AZGAKWR.cjs');
10
+
11
+
12
+
13
+ exports.isObject = _chunkXRGLFTH2cjs.isObject; exports.mergeObject = _chunk26S4B3P7cjs.mergeObject;
@@ -0,0 +1,2 @@
1
+ export { isObject } from './isObject.js';
2
+ export { mergeObject } from './mergeObject.js';
@@ -0,0 +1,13 @@
1
+ import "../../chunk-G5N77RKJ.js";
2
+ import {
3
+ mergeObject
4
+ } from "../../chunk-LWHAS5EP.js";
5
+ import {
6
+ isObject
7
+ } from "../../chunk-WO6JQRTD.js";
8
+ import "../../chunk-5PX3AFSC.js";
9
+ import "../../chunk-UICA3PK6.js";
10
+ export {
11
+ isObject,
12
+ mergeObject
13
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkXRGLFTH2cjs = require('../../chunk-XRGLFTH2.cjs');
4
+ require('../../chunk-ISHLY7WM.cjs');
5
+ require('../../chunk-5AZGAKWR.cjs');
6
+
7
+
8
+ exports.isObject = _chunkXRGLFTH2cjs.isObject;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 是否是对象
3
+ * @param {*} objs
4
+ */
5
+ declare function isObject(obj: any): boolean;
6
+
7
+ export { isObject };
@@ -0,0 +1,8 @@
1
+ import {
2
+ isObject
3
+ } from "../../chunk-WO6JQRTD.js";
4
+ import "../../chunk-5PX3AFSC.js";
5
+ import "../../chunk-UICA3PK6.js";
6
+ export {
7
+ isObject
8
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk26S4B3P7cjs = require('../../chunk-26S4B3P7.cjs');
4
+ require('../../chunk-5AZGAKWR.cjs');
5
+
6
+
7
+ exports.mergeObject = _chunk26S4B3P7cjs.mergeObject;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 合并两个对象的值
3
+ * @param a 合并到的对象
4
+ * @param b 合并对象
5
+ * @param j 合并级别
6
+ * @param i 是否合并数组
7
+ * @returns 合并的对象
8
+ */
9
+ declare function mergeObject<T>(a: T, b: T, j?: number, i?: boolean): T;
10
+
11
+ export { mergeObject };
@@ -0,0 +1,7 @@
1
+ import {
2
+ mergeObject
3
+ } from "../../chunk-LWHAS5EP.js";
4
+ import "../../chunk-UICA3PK6.js";
5
+ export {
6
+ mergeObject
7
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-4PBAZ73I.cjs');
2
+
3
+
4
+
5
+
6
+ var _chunkBEQYORIIcjs = require('../../chunk-BEQYORII.cjs');
7
+ require('../../chunk-5AZGAKWR.cjs');
8
+
9
+
10
+
11
+
12
+ exports.firstLower = _chunkBEQYORIIcjs.firstLower; exports.firstUpper = _chunkBEQYORIIcjs.firstUpper; exports.getNmaeBar = _chunkBEQYORIIcjs.getNmaeBar;
@@ -0,0 +1 @@
1
+ export { firstLower, firstUpper, getNmaeBar } from './index2.js';
@@ -0,0 +1,12 @@
1
+ import "../../chunk-YYNHNLVW.js";
2
+ import {
3
+ firstLower,
4
+ firstUpper,
5
+ getNmaeBar
6
+ } from "../../chunk-DEENZC5X.js";
7
+ import "../../chunk-UICA3PK6.js";
8
+ export {
9
+ firstLower,
10
+ firstUpper,
11
+ getNmaeBar
12
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkBEQYORIIcjs = require('../../chunk-BEQYORII.cjs');
6
+ require('../../chunk-5AZGAKWR.cjs');
7
+
8
+
9
+
10
+
11
+ exports.firstLower = _chunkBEQYORIIcjs.firstLower; exports.firstUpper = _chunkBEQYORIIcjs.firstUpper; exports.getNmaeBar = _chunkBEQYORIIcjs.getNmaeBar;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 首字母大写
3
+ * @param {string} vs
4
+ * @returns string
5
+ */
6
+ declare function firstUpper(vs: string): string;
7
+ /**
8
+ * 首字母小写
9
+ * @param {string} vs
10
+ * @returns string
11
+ */
12
+ declare function firstLower(vs: string): string;
13
+ /**
14
+ * 获取-方式组件名称 el-input
15
+ * @param {*} name
16
+ * @returns
17
+ */
18
+ declare function getNmaeBar(name: string): string;
19
+
20
+ export { firstLower, firstUpper, getNmaeBar };
@@ -0,0 +1,11 @@
1
+ import {
2
+ firstLower,
3
+ firstUpper,
4
+ getNmaeBar
5
+ } from "../../chunk-DEENZC5X.js";
6
+ import "../../chunk-UICA3PK6.js";
7
+ export {
8
+ firstLower,
9
+ firstUpper,
10
+ getNmaeBar
11
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/basic/object/mergeObject.ts
2
+ function mergeObject(a, b, j = 1, i) {
3
+ for (const key in b) {
4
+ const v = a[key];
5
+ const t = b[key];
6
+ if (v) {
7
+ if (v instanceof Array) {
8
+ if (i) {
9
+ if (t instanceof Array) {
10
+ v.push(...t);
11
+ } else {
12
+ v.push(t);
13
+ }
14
+ } else {
15
+ a[key] = t;
16
+ }
17
+ } else if (typeof v == "object") {
18
+ const cv = Object.prototype.toString.call(v);
19
+ const ct = Object.prototype.toString.call(t);
20
+ if (cv == ct) {
21
+ const n = j - 1;
22
+ if (n > 0) {
23
+ a[key] = mergeObject(v, t, n, i);
24
+ } else {
25
+ a[key] = t;
26
+ }
27
+ } else {
28
+ a[key] = t;
29
+ }
30
+ } else {
31
+ a[key] = t;
32
+ }
33
+ } else {
34
+ a[key] = t;
35
+ }
36
+ }
37
+ return a;
38
+ }
39
+
40
+
41
+
42
+ exports.mergeObject = mergeObject;
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkKRIX2OSKcjs = require('./chunk-KRIX2OSK.cjs');
4
+
5
+
6
+ var _chunkISHLY7WMcjs = require('./chunk-ISHLY7WM.cjs');
7
+
8
+
9
+ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
10
+
11
+ // packages/basic/array/index.ts
12
+ var array_exports = {};
13
+ _chunk5AZGAKWRcjs.__export.call(void 0, array_exports, {
14
+ isArray: () => _chunkISHLY7WMcjs.isArray,
15
+ toggleArray: () => _chunkKRIX2OSKcjs.toggleArray
16
+ });
17
+
18
+
19
+
20
+ exports.array_exports = array_exports;
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkBEQYORIIcjs = require('./chunk-BEQYORII.cjs');
6
+
7
+
8
+ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
9
+
10
+ // packages/basic/string/index.ts
11
+ var string_exports = {};
12
+ _chunk5AZGAKWRcjs.__export.call(void 0, string_exports, {
13
+ firstLower: () => _chunkBEQYORIIcjs.firstLower,
14
+ firstUpper: () => _chunkBEQYORIIcjs.firstUpper,
15
+ getNmaeBar: () => _chunkBEQYORIIcjs.getNmaeBar
16
+ });
17
+
18
+
19
+
20
+ exports.string_exports = string_exports;
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+
8
+
9
+ exports.__export = __export;
@@ -0,0 +1,8 @@
1
+ // packages/basic/array/isArray.ts
2
+ function isArray(obj) {
3
+ return Object.prototype.toString.call(obj) == "[object Array]";
4
+ }
5
+
6
+ export {
7
+ isArray
8
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/basic/string/index2.ts
2
+ function firstUpper(vs) {
3
+ return vs.slice(0, 1).toUpperCase() + vs.slice(1);
4
+ }
5
+ function firstLower(vs) {
6
+ return vs.slice(0, 1).toLowerCase() + vs.slice(1);
7
+ }
8
+ function getNmaeBar(name) {
9
+ const reg = /(([A-Z])([^A-Z]*))/g;
10
+ let result;
11
+ const arr = [];
12
+ let i = 0;
13
+ while ((result = reg.exec(name)) !== null) {
14
+ if (i == 0 && result.index != 0) {
15
+ arr.push(name.substring(0, result.index));
16
+ }
17
+ i++;
18
+ arr.push(result[1].toLowerCase());
19
+ }
20
+ if (arr.length == 0) {
21
+ return name;
22
+ } else {
23
+ let a = arr.join("-");
24
+ a = a.replace(/[-]{2,}/g, "-");
25
+ return a;
26
+ }
27
+ }
28
+
29
+
30
+
31
+
32
+
33
+ exports.firstUpper = firstUpper; exports.firstLower = firstLower; exports.getNmaeBar = getNmaeBar;
@@ -0,0 +1,33 @@
1
+ // packages/basic/string/index2.ts
2
+ function firstUpper(vs) {
3
+ return vs.slice(0, 1).toUpperCase() + vs.slice(1);
4
+ }
5
+ function firstLower(vs) {
6
+ return vs.slice(0, 1).toLowerCase() + vs.slice(1);
7
+ }
8
+ function getNmaeBar(name) {
9
+ const reg = /(([A-Z])([^A-Z]*))/g;
10
+ let result;
11
+ const arr = [];
12
+ let i = 0;
13
+ while ((result = reg.exec(name)) !== null) {
14
+ if (i == 0 && result.index != 0) {
15
+ arr.push(name.substring(0, result.index));
16
+ }
17
+ i++;
18
+ arr.push(result[1].toLowerCase());
19
+ }
20
+ if (arr.length == 0) {
21
+ return name;
22
+ } else {
23
+ let a = arr.join("-");
24
+ a = a.replace(/[-]{2,}/g, "-");
25
+ return a;
26
+ }
27
+ }
28
+
29
+ export {
30
+ firstUpper,
31
+ firstLower,
32
+ getNmaeBar
33
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ mergeObject
3
+ } from "./chunk-LWHAS5EP.js";
4
+ import {
5
+ isObject
6
+ } from "./chunk-WO6JQRTD.js";
7
+ import {
8
+ __export
9
+ } from "./chunk-UICA3PK6.js";
10
+
11
+ // packages/basic/object/index.ts
12
+ var object_exports = {};
13
+ __export(object_exports, {
14
+ isObject: () => isObject,
15
+ mergeObject: () => mergeObject
16
+ });
17
+
18
+ export {
19
+ object_exports
20
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ toggleArray
3
+ } from "./chunk-Z3GMPMGF.js";
4
+ import {
5
+ isArray
6
+ } from "./chunk-5PX3AFSC.js";
7
+ import {
8
+ __export
9
+ } from "./chunk-UICA3PK6.js";
10
+
11
+ // packages/basic/array/index.ts
12
+ var array_exports = {};
13
+ __export(array_exports, {
14
+ isArray: () => isArray,
15
+ toggleArray: () => toggleArray
16
+ });
17
+
18
+ export {
19
+ array_exports
20
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ isObject
3
+ } from "./chunk-WO6JQRTD.js";
4
+ import {
5
+ isArray
6
+ } from "./chunk-5PX3AFSC.js";
7
+ import {
8
+ __export
9
+ } from "./chunk-UICA3PK6.js";
10
+
11
+ // packages/iss/index.ts
12
+ var iss_exports = {};
13
+ __export(iss_exports, {
14
+ isArray: () => isArray,
15
+ isObject: () => isObject
16
+ });
17
+
18
+ export {
19
+ iss_exports
20
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/basic/array/isArray.ts
2
+ function isArray(obj) {
3
+ return Object.prototype.toString.call(obj) == "[object Array]";
4
+ }
5
+
6
+
7
+
8
+ exports.isArray = isArray;
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk26S4B3P7cjs = require('./chunk-26S4B3P7.cjs');
4
+
5
+
6
+ var _chunkXRGLFTH2cjs = require('./chunk-XRGLFTH2.cjs');
7
+
8
+
9
+ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
10
+
11
+ // packages/basic/object/index.ts
12
+ var object_exports = {};
13
+ _chunk5AZGAKWRcjs.__export.call(void 0, object_exports, {
14
+ isObject: () => _chunkXRGLFTH2cjs.isObject,
15
+ mergeObject: () => _chunk26S4B3P7cjs.mergeObject
16
+ });
17
+
18
+
19
+
20
+ exports.object_exports = object_exports;
@@ -0,0 +1,24 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk4PBAZ73Icjs = require('./chunk-4PBAZ73I.cjs');
4
+
5
+
6
+ var _chunk33TTIBDFcjs = require('./chunk-33TTIBDF.cjs');
7
+
8
+
9
+ var _chunkKM7XK6D6cjs = require('./chunk-KM7XK6D6.cjs');
10
+
11
+
12
+ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
13
+
14
+ // packages/basic/index.ts
15
+ var basic_exports = {};
16
+ _chunk5AZGAKWRcjs.__export.call(void 0, basic_exports, {
17
+ array: () => _chunk33TTIBDFcjs.array_exports,
18
+ object: () => _chunkKM7XK6D6cjs.object_exports,
19
+ string: () => _chunk4PBAZ73Icjs.string_exports
20
+ });
21
+
22
+
23
+
24
+ exports.basic_exports = basic_exports;
@@ -0,0 +1,21 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/basic/array/toggleArray.ts
2
+ function toggleArray(objs, arr, id) {
3
+ let varr = [];
4
+ let is = true;
5
+ for (let index = 0; index < objs.length; index++) {
6
+ const element = objs[index];
7
+ if (element[id] === arr[id]) {
8
+ is = false;
9
+ } else {
10
+ varr.push(element);
11
+ }
12
+ }
13
+ if (is) {
14
+ varr.push(arr);
15
+ }
16
+ return varr;
17
+ }
18
+
19
+
20
+
21
+ exports.toggleArray = toggleArray;
@@ -0,0 +1,42 @@
1
+ // packages/basic/object/mergeObject.ts
2
+ function mergeObject(a, b, j = 1, i) {
3
+ for (const key in b) {
4
+ const v = a[key];
5
+ const t = b[key];
6
+ if (v) {
7
+ if (v instanceof Array) {
8
+ if (i) {
9
+ if (t instanceof Array) {
10
+ v.push(...t);
11
+ } else {
12
+ v.push(t);
13
+ }
14
+ } else {
15
+ a[key] = t;
16
+ }
17
+ } else if (typeof v == "object") {
18
+ const cv = Object.prototype.toString.call(v);
19
+ const ct = Object.prototype.toString.call(t);
20
+ if (cv == ct) {
21
+ const n = j - 1;
22
+ if (n > 0) {
23
+ a[key] = mergeObject(v, t, n, i);
24
+ } else {
25
+ a[key] = t;
26
+ }
27
+ } else {
28
+ a[key] = t;
29
+ }
30
+ } else {
31
+ a[key] = t;
32
+ }
33
+ } else {
34
+ a[key] = t;
35
+ }
36
+ }
37
+ return a;
38
+ }
39
+
40
+ export {
41
+ mergeObject
42
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkXRGLFTH2cjs = require('./chunk-XRGLFTH2.cjs');
4
+
5
+
6
+ var _chunkISHLY7WMcjs = require('./chunk-ISHLY7WM.cjs');
7
+
8
+
9
+ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
10
+
11
+ // packages/iss/index.ts
12
+ var iss_exports = {};
13
+ _chunk5AZGAKWRcjs.__export.call(void 0, iss_exports, {
14
+ isArray: () => _chunkISHLY7WMcjs.isArray,
15
+ isObject: () => _chunkXRGLFTH2cjs.isObject
16
+ });
17
+
18
+
19
+
20
+ exports.iss_exports = iss_exports;
@@ -0,0 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
@@ -0,0 +1,24 @@
1
+ import {
2
+ string_exports
3
+ } from "./chunk-YYNHNLVW.js";
4
+ import {
5
+ array_exports
6
+ } from "./chunk-GR5LYHLF.js";
7
+ import {
8
+ object_exports
9
+ } from "./chunk-G5N77RKJ.js";
10
+ import {
11
+ __export
12
+ } from "./chunk-UICA3PK6.js";
13
+
14
+ // packages/basic/index.ts
15
+ var basic_exports = {};
16
+ __export(basic_exports, {
17
+ array: () => array_exports,
18
+ object: () => object_exports,
19
+ string: () => string_exports
20
+ });
21
+
22
+ export {
23
+ basic_exports
24
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ isArray
3
+ } from "./chunk-5PX3AFSC.js";
4
+
5
+ // packages/basic/object/isObject.ts
6
+ function isObject(obj) {
7
+ if (typeof obj == "object") {
8
+ return !isArray(obj);
9
+ } else {
10
+ return false;
11
+ }
12
+ }
13
+
14
+ export {
15
+ isObject
16
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkISHLY7WMcjs = require('./chunk-ISHLY7WM.cjs');
4
+
5
+ // packages/basic/object/isObject.ts
6
+ function isObject(obj) {
7
+ if (typeof obj == "object") {
8
+ return !_chunkISHLY7WMcjs.isArray.call(void 0, obj);
9
+ } else {
10
+ return false;
11
+ }
12
+ }
13
+
14
+
15
+
16
+ exports.isObject = isObject;
@@ -0,0 +1,20 @@
1
+ import {
2
+ firstLower,
3
+ firstUpper,
4
+ getNmaeBar
5
+ } from "./chunk-DEENZC5X.js";
6
+ import {
7
+ __export
8
+ } from "./chunk-UICA3PK6.js";
9
+
10
+ // packages/basic/string/index.ts
11
+ var string_exports = {};
12
+ __export(string_exports, {
13
+ firstLower: () => firstLower,
14
+ firstUpper: () => firstUpper,
15
+ getNmaeBar: () => getNmaeBar
16
+ });
17
+
18
+ export {
19
+ string_exports
20
+ };
@@ -0,0 +1,21 @@
1
+ // packages/basic/array/toggleArray.ts
2
+ function toggleArray(objs, arr, id) {
3
+ let varr = [];
4
+ let is = true;
5
+ for (let index = 0; index < objs.length; index++) {
6
+ const element = objs[index];
7
+ if (element[id] === arr[id]) {
8
+ is = false;
9
+ } else {
10
+ varr.push(element);
11
+ }
12
+ }
13
+ if (is) {
14
+ varr.push(arr);
15
+ }
16
+ return varr;
17
+ }
18
+
19
+ export {
20
+ toggleArray
21
+ };
@@ -0,0 +1,13 @@
1
+ import { isArray } from './basic/array/isArray.js';
2
+ import { isObject } from './basic/object/isObject.js';
3
+
4
+ declare const index_isArray: typeof isArray;
5
+ declare const index_isObject: typeof isObject;
6
+ declare namespace index {
7
+ export {
8
+ index_isArray as isArray,
9
+ index_isObject as isObject,
10
+ };
11
+ }
12
+
13
+ export { index as i };
@@ -0,0 +1,13 @@
1
+ import { i as index$1 } from './index-ee246de3.js';
2
+ import { i as index$2 } from './index-52ce4c1c.js';
3
+ import { i as index$3 } from './index-5691335a.js';
4
+
5
+ declare namespace index {
6
+ export {
7
+ index$1 as array,
8
+ index$2 as object,
9
+ index$3 as string,
10
+ };
11
+ }
12
+
13
+ export { index as i };
@@ -0,0 +1,13 @@
1
+ import { isObject } from './basic/object/isObject.js';
2
+ import { mergeObject } from './basic/object/mergeObject.js';
3
+
4
+ declare const index_isObject: typeof isObject;
5
+ declare const index_mergeObject: typeof mergeObject;
6
+ declare namespace index {
7
+ export {
8
+ index_isObject as isObject,
9
+ index_mergeObject as mergeObject,
10
+ };
11
+ }
12
+
13
+ export { index as i };
@@ -0,0 +1,14 @@
1
+ import { firstLower, firstUpper, getNmaeBar } from './basic/string/index2.js';
2
+
3
+ declare const index_firstLower: typeof firstLower;
4
+ declare const index_firstUpper: typeof firstUpper;
5
+ declare const index_getNmaeBar: typeof getNmaeBar;
6
+ declare namespace index {
7
+ export {
8
+ index_firstLower as firstLower,
9
+ index_firstUpper as firstUpper,
10
+ index_getNmaeBar as getNmaeBar,
11
+ };
12
+ }
13
+
14
+ export { index as i };
@@ -0,0 +1,13 @@
1
+ import { isArray } from './basic/array/isArray.js';
2
+ import { toggleArray } from './basic/array/toggleArray.js';
3
+
4
+ declare const index_isArray: typeof isArray;
5
+ declare const index_toggleArray: typeof toggleArray;
6
+ declare namespace index {
7
+ export {
8
+ index_isArray as isArray,
9
+ index_toggleArray as toggleArray,
10
+ };
11
+ }
12
+
13
+ export { index as i };
package/dist/index.cjs ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkKQVPI7TLcjs = require('./chunk-KQVPI7TL.cjs');
4
+ require('./chunk-4PBAZ73I.cjs');
5
+ require('./chunk-BEQYORII.cjs');
6
+
7
+
8
+ var _chunkN6OX2U6Wcjs = require('./chunk-N6OX2U6W.cjs');
9
+ require('./chunk-33TTIBDF.cjs');
10
+ require('./chunk-KRIX2OSK.cjs');
11
+ require('./chunk-KM7XK6D6.cjs');
12
+ require('./chunk-26S4B3P7.cjs');
13
+ require('./chunk-XRGLFTH2.cjs');
14
+ require('./chunk-ISHLY7WM.cjs');
15
+ require('./chunk-5AZGAKWR.cjs');
16
+
17
+
18
+
19
+ exports.basic = _chunkKQVPI7TLcjs.basic_exports; exports.iss = _chunkN6OX2U6Wcjs.iss_exports;
@@ -0,0 +1,10 @@
1
+ export { i as basic } from './index-2e5b01e0.js';
2
+ export { i as iss } from './index-24872dab.js';
3
+ import './index-ee246de3.js';
4
+ import './basic/array/isArray.js';
5
+ import './basic/array/toggleArray.js';
6
+ import './index-52ce4c1c.js';
7
+ import './basic/object/isObject.js';
8
+ import './basic/object/mergeObject.js';
9
+ import './index-5691335a.js';
10
+ import './basic/string/index2.js';
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ import {
2
+ basic_exports
3
+ } from "./chunk-UKH47H42.js";
4
+ import "./chunk-YYNHNLVW.js";
5
+ import "./chunk-DEENZC5X.js";
6
+ import {
7
+ iss_exports
8
+ } from "./chunk-HRECTLZO.js";
9
+ import "./chunk-GR5LYHLF.js";
10
+ import "./chunk-Z3GMPMGF.js";
11
+ import "./chunk-G5N77RKJ.js";
12
+ import "./chunk-LWHAS5EP.js";
13
+ import "./chunk-WO6JQRTD.js";
14
+ import "./chunk-5PX3AFSC.js";
15
+ import "./chunk-UICA3PK6.js";
16
+ export {
17
+ basic_exports as basic,
18
+ iss_exports as iss
19
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-N6OX2U6W.cjs');
2
+
3
+
4
+ var _chunkXRGLFTH2cjs = require('../chunk-XRGLFTH2.cjs');
5
+
6
+
7
+ var _chunkISHLY7WMcjs = require('../chunk-ISHLY7WM.cjs');
8
+ require('../chunk-5AZGAKWR.cjs');
9
+
10
+
11
+
12
+ exports.isArray = _chunkISHLY7WMcjs.isArray; exports.isObject = _chunkXRGLFTH2cjs.isObject;
@@ -0,0 +1,2 @@
1
+ export { isArray } from '../basic/array/isArray.js';
2
+ export { isObject } from '../basic/object/isObject.js';
@@ -0,0 +1,12 @@
1
+ import "../chunk-HRECTLZO.js";
2
+ import {
3
+ isObject
4
+ } from "../chunk-WO6JQRTD.js";
5
+ import {
6
+ isArray
7
+ } from "../chunk-5PX3AFSC.js";
8
+ import "../chunk-UICA3PK6.js";
9
+ export {
10
+ isArray,
11
+ isObject
12
+ };
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@fangzhongya/utils",
3
+ "private": false,
4
+ "version": "0.0.1",
5
+ "type": "module",
6
+ "description ": "个人工具库",
7
+ "author": "fangzhongya ",
8
+ "license": "MIT",
9
+ "keywords": [
10
+ "个人工具库"
11
+ ],
12
+ "main": "./dist/index.cjs.js",
13
+ "module": "./dist/index.js",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs.js",
18
+ "types": "./dist/index.d.ts"
19
+ },
20
+ "./*": "./*",
21
+ "./basic": {
22
+ "require": "./dist/basic/index.cjs.js",
23
+ "import": "./dist/basic/index.js",
24
+ "types": "./dist/basic/index.d.ts"
25
+ },
26
+ "./basic/array": {
27
+ "require": "./dist/basic/array/index.cjs.js",
28
+ "import": "./dist/basic/array/index.js",
29
+ "types": "./dist/basic/array/index.d.ts"
30
+ },
31
+ "./basic/string": {
32
+ "require": "./dist/basic/string/index.cjs.js",
33
+ "import": "./dist/basic/string/index.js",
34
+ "types": "./dist/basic/string/index.d.ts"
35
+ },
36
+ "./basic/object": {
37
+ "require": "./dist/basic/object/index.cjs.js",
38
+ "import": "./dist/basic/object/index.js",
39
+ "types": "./dist/basic/object/index.d.ts"
40
+ }
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "types",
45
+ "*.d.ts"
46
+ ],
47
+ "types": "./dist/index.d.ts",
48
+ "typesVersions": {
49
+ "*": {
50
+ "*": [
51
+ "./dist/*",
52
+ "./*"
53
+ ]
54
+ }
55
+ },
56
+ "repository": {
57
+ "type": "git",
58
+ "url": " https://github.com/fangzhongya/utils.git"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public",
62
+ "registry": "https://registry.npmjs.org/"
63
+ },
64
+ "scripts": {
65
+ "dev": "ts-node node.index.ts",
66
+ "build": "tsup",
67
+ "test": "vitest test"
68
+ },
69
+ "devDependencies": {
70
+ "@types/node": "^18.11.18",
71
+ "tsup": "^6.5.0",
72
+ "typescript": "^4.9.5",
73
+ "vitest": "^0.28.3"
74
+ }
75
+ }