@oeos-components/utils 0.0.10 → 0.0.11

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/dist/index.cjs CHANGED
@@ -2,23 +2,10 @@
2
2
 
3
3
  const reactivity = require('@vue/reactivity');
4
4
  const consola = require('consola');
5
+ const lodashEs = require('lodash-es');
5
6
  const elementPlus = require('element-plus');
6
7
 
7
8
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
8
- function cloneDeep(source) {
9
- if (!source && typeof source !== "object") {
10
- throw new Error("error arguments", "cloneDeep");
11
- }
12
- const targetObj = source.constructor === Array ? [] : {};
13
- Object.keys(source).forEach((keys) => {
14
- if (source[keys] && typeof source[keys] === "object") {
15
- targetObj[keys] = cloneDeep(source[keys]);
16
- } else {
17
- targetObj[keys] = source[keys];
18
- }
19
- });
20
- return targetObj;
21
- }
22
9
  const isString = (val) => typeof val === "string";
23
10
  const isStringNumber = (val) => {
24
11
  if (!isString(val)) {
@@ -228,9 +215,9 @@ function clone(data, times = 1) {
228
215
  data = reactivity.unref(data);
229
216
  }
230
217
  if (getType(data) !== "array") {
231
- return cloneDeep(data);
218
+ return lodashEs.cloneDeep(data);
232
219
  }
233
- const clonedData = cloneDeep(data);
220
+ const clonedData = lodashEs.cloneDeep(data);
234
221
  const result = [];
235
222
  for (let i = 0; i < times; i++) {
236
223
  result.push(...clonedData);
@@ -810,7 +797,6 @@ exports.$toast = $toast;
810
797
  exports.asyncWrapper = asyncWrapper;
811
798
  exports.clearStorage = clearStorage;
812
799
  exports.clone = clone;
813
- exports.cloneDeep = cloneDeep;
814
800
  exports.confirm = confirm;
815
801
  exports.copy = copy;
816
802
  exports.debounce = debounce;
package/dist/index.d.cts CHANGED
@@ -2,7 +2,6 @@ import * as element_plus from 'element-plus';
2
2
  import { MessageOptions } from 'element-plus';
3
3
  import { Ref } from '@vue/reactivity';
4
4
 
5
- declare function cloneDeep(source: any): {};
6
5
  /**
7
6
  * 现有方法如下
8
7
  * $toast(message, type: string | object = 'success', otherParams: object = {})
@@ -118,7 +117,7 @@ declare function merge(obj1: object, obj2: object): object;
118
117
  * clone(123) => 123
119
118
  * clone([1,2, {name: 'andy'}], 2) => [1, 2, {name: 'andy'}, 1, 2, {name: 'andy'}]
120
119
  */
121
- declare function clone(data: any, times?: number): {};
120
+ declare function clone(data: any, times?: number): any;
122
121
  /**
123
122
  * 格式化时间为年月日时分秒的格式, 格式可以自定义。
124
123
  * ① 时间戳10位和13位都可以转换成格式化的日期
@@ -363,4 +362,4 @@ declare function formatNewLines(str: any): any;
363
362
  * */
364
363
  declare function getVariable(propertyName: any): string;
365
364
 
366
- export { $toast, asyncWrapper, clearStorage, clone, cloneDeep, confirm, copy, debounce, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatNewLines, formatThousands, formatTime, getStorage, getType, getVariable, isEmpty, isNumber, isString, isStringNumber, log, merge, notEmpty, processWidth, random, setStorage, sleep, throttle, toFixed, toLine, tryCatch, uuid, validForm, validate };
365
+ export { $toast, asyncWrapper, clearStorage, clone, confirm, copy, debounce, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatNewLines, formatThousands, formatTime, getStorage, getType, getVariable, isEmpty, isNumber, isString, isStringNumber, log, merge, notEmpty, processWidth, random, setStorage, sleep, throttle, toFixed, toLine, tryCatch, uuid, validForm, validate };
package/dist/index.d.mts CHANGED
@@ -2,7 +2,6 @@ import * as element_plus from 'element-plus';
2
2
  import { MessageOptions } from 'element-plus';
3
3
  import { Ref } from '@vue/reactivity';
4
4
 
5
- declare function cloneDeep(source: any): {};
6
5
  /**
7
6
  * 现有方法如下
8
7
  * $toast(message, type: string | object = 'success', otherParams: object = {})
@@ -118,7 +117,7 @@ declare function merge(obj1: object, obj2: object): object;
118
117
  * clone(123) => 123
119
118
  * clone([1,2, {name: 'andy'}], 2) => [1, 2, {name: 'andy'}, 1, 2, {name: 'andy'}]
120
119
  */
121
- declare function clone(data: any, times?: number): {};
120
+ declare function clone(data: any, times?: number): any;
122
121
  /**
123
122
  * 格式化时间为年月日时分秒的格式, 格式可以自定义。
124
123
  * ① 时间戳10位和13位都可以转换成格式化的日期
@@ -363,4 +362,4 @@ declare function formatNewLines(str: any): any;
363
362
  * */
364
363
  declare function getVariable(propertyName: any): string;
365
364
 
366
- export { $toast, asyncWrapper, clearStorage, clone, cloneDeep, confirm, copy, debounce, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatNewLines, formatThousands, formatTime, getStorage, getType, getVariable, isEmpty, isNumber, isString, isStringNumber, log, merge, notEmpty, processWidth, random, setStorage, sleep, throttle, toFixed, toLine, tryCatch, uuid, validForm, validate };
365
+ export { $toast, asyncWrapper, clearStorage, clone, confirm, copy, debounce, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatNewLines, formatThousands, formatTime, getStorage, getType, getVariable, isEmpty, isNumber, isString, isStringNumber, log, merge, notEmpty, processWidth, random, setStorage, sleep, throttle, toFixed, toLine, tryCatch, uuid, validForm, validate };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,6 @@ import * as element_plus from 'element-plus';
2
2
  import { MessageOptions } from 'element-plus';
3
3
  import { Ref } from '@vue/reactivity';
4
4
 
5
- declare function cloneDeep(source: any): {};
6
5
  /**
7
6
  * 现有方法如下
8
7
  * $toast(message, type: string | object = 'success', otherParams: object = {})
@@ -118,7 +117,7 @@ declare function merge(obj1: object, obj2: object): object;
118
117
  * clone(123) => 123
119
118
  * clone([1,2, {name: 'andy'}], 2) => [1, 2, {name: 'andy'}, 1, 2, {name: 'andy'}]
120
119
  */
121
- declare function clone(data: any, times?: number): {};
120
+ declare function clone(data: any, times?: number): any;
122
121
  /**
123
122
  * 格式化时间为年月日时分秒的格式, 格式可以自定义。
124
123
  * ① 时间戳10位和13位都可以转换成格式化的日期
@@ -363,4 +362,4 @@ declare function formatNewLines(str: any): any;
363
362
  * */
364
363
  declare function getVariable(propertyName: any): string;
365
364
 
366
- export { $toast, asyncWrapper, clearStorage, clone, cloneDeep, confirm, copy, debounce, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatNewLines, formatThousands, formatTime, getStorage, getType, getVariable, isEmpty, isNumber, isString, isStringNumber, log, merge, notEmpty, processWidth, random, setStorage, sleep, throttle, toFixed, toLine, tryCatch, uuid, validForm, validate };
365
+ export { $toast, asyncWrapper, clearStorage, clone, confirm, copy, debounce, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatNewLines, formatThousands, formatTime, getStorage, getType, getVariable, isEmpty, isNumber, isString, isStringNumber, log, merge, notEmpty, processWidth, random, setStorage, sleep, throttle, toFixed, toLine, tryCatch, uuid, validForm, validate };
package/dist/index.mjs CHANGED
@@ -1,21 +1,8 @@
1
1
  import { unref, isRef, toRaw } from '@vue/reactivity';
2
2
  import { consola } from 'consola';
3
+ import { cloneDeep } from 'lodash-es';
3
4
  import { ElMessage, ElMessageBox } from 'element-plus';
4
5
 
5
- function cloneDeep(source) {
6
- if (!source && typeof source !== "object") {
7
- throw new Error("error arguments", "cloneDeep");
8
- }
9
- const targetObj = source.constructor === Array ? [] : {};
10
- Object.keys(source).forEach((keys) => {
11
- if (source[keys] && typeof source[keys] === "object") {
12
- targetObj[keys] = cloneDeep(source[keys]);
13
- } else {
14
- targetObj[keys] = source[keys];
15
- }
16
- });
17
- return targetObj;
18
- }
19
6
  const isString = (val) => typeof val === "string";
20
7
  const isStringNumber = (val) => {
21
8
  if (!isString(val)) {
@@ -803,4 +790,4 @@ function getVariable(propertyName) {
803
790
  return res;
804
791
  }
805
792
 
806
- export { $toast, asyncWrapper, clearStorage, clone, cloneDeep, confirm, copy, debounce, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatNewLines, formatThousands, formatTime, getStorage, getType, getVariable, isEmpty, isNumber, isString, isStringNumber, log, merge, notEmpty, processWidth, random, setStorage, sleep, throttle, toFixed, toLine, tryCatch, uuid, validForm, validate };
793
+ export { $toast, asyncWrapper, clearStorage, clone, confirm, copy, debounce, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatNewLines, formatThousands, formatTime, getStorage, getType, getVariable, isEmpty, isNumber, isString, isStringNumber, log, merge, notEmpty, processWidth, random, setStorage, sleep, throttle, toFixed, toLine, tryCatch, uuid, validForm, validate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oeos-components/utils",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "utils of oeos-components",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",