@lightsoft/js-sdk 1.2.1 → 1.2.2

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.d.ts CHANGED
@@ -219,6 +219,11 @@ declare function findTreeDataNode(data: ISectoralTable[], targetDeptCode: string
219
219
  * @param results 查找结果集
220
220
  */
221
221
  declare function findTreeDataNodeName(dept: ISectoralTable, queryString: string, results: ISectoralTable[]): void;
222
+ /**
223
+ *
224
+ * 数组对象根据某个值去重
225
+ */
226
+ declare function uniqueByProperty<T>(arr: T[], prop: keyof T): T[];
222
227
 
223
228
  declare class Mask {
224
229
  private task;
@@ -307,5 +312,5 @@ declare const email: RegExp;
307
312
  */
308
313
  declare const url: RegExp;
309
314
 
310
- export { HAS_FEILD, InputLegalityValidate, InputLengthValidate, LENGTH_LIMIT, LOGIN_TYPE, Mask, RecordType, Request, RequestChain, Tour, addURLParams, countUp, createWebSocket, dataHandler, debounce, deepMerge, deleteURLParams, download, email, findTreeDataNode, findTreeDataNodeName, getState, getURLParams, hasRepeatArray, idCard, ip, isMobileDevice, isNull, objectArrayToString, phone, throttle, url, useClose, useCountDown, useDownload, useOnMessage, useSendMessage, zhLetterNumber };
315
+ export { HAS_FEILD, InputLegalityValidate, InputLengthValidate, LENGTH_LIMIT, LOGIN_TYPE, Mask, RecordType, Request, RequestChain, Tour, addURLParams, countUp, createWebSocket, dataHandler, debounce, deepMerge, deleteURLParams, download, email, findTreeDataNode, findTreeDataNodeName, getState, getURLParams, hasRepeatArray, idCard, ip, isMobileDevice, isNull, objectArrayToString, phone, throttle, uniqueByProperty, url, useClose, useCountDown, useDownload, useOnMessage, useSendMessage, zhLetterNumber };
311
316
  export type { ISectoralTable, Tag, typeIsNull };
package/dist/index.js CHANGED
@@ -2640,6 +2640,21 @@ function findTreeDataNodeName(dept, queryString, results) {
2640
2640
  }
2641
2641
  }
2642
2642
  }
2643
+ /**
2644
+ *
2645
+ * 数组对象根据某个值去重
2646
+ */
2647
+ function uniqueByProperty(arr, prop) {
2648
+ return arr.reduce(function (acc, current) {
2649
+ var x = acc.find(function (item) { return item[prop] === current[prop]; });
2650
+ if (!x) {
2651
+ return acc.concat([current]);
2652
+ }
2653
+ else {
2654
+ return acc;
2655
+ }
2656
+ }, []);
2657
+ }
2643
2658
 
2644
2659
  var Mask = /** @class */ (function () {
2645
2660
  function Mask(selectors, opacity) {
@@ -2915,4 +2930,4 @@ var email = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$
2915
2930
  */
2916
2931
  var url = /^https?:\/\/[^\s/$.?#].[^\s]*$/;
2917
2932
 
2918
- export { HAS_FEILD, InputLegalityValidate, InputLengthValidate, LENGTH_LIMIT, LOGIN_TYPE, Mask, RecordType, Request, RequestChain, Tour, addURLParams, countUp, dataHandler, debounce, deepMerge, deleteURLParams, download, email, findTreeDataNode, findTreeDataNodeName, getURLParams, hasRepeatArray, idCard, ip, isMobileDevice, isNull, objectArrayToString, phone, throttle, url, useCountDown, useDownload, zhLetterNumber };
2933
+ export { HAS_FEILD, InputLegalityValidate, InputLengthValidate, LENGTH_LIMIT, LOGIN_TYPE, Mask, RecordType, Request, RequestChain, Tour, addURLParams, countUp, dataHandler, debounce, deepMerge, deleteURLParams, download, email, findTreeDataNode, findTreeDataNodeName, getURLParams, hasRepeatArray, idCard, ip, isMobileDevice, isNull, objectArrayToString, phone, throttle, uniqueByProperty, url, useCountDown, useDownload, zhLetterNumber };
package/dist/index.umd.js CHANGED
@@ -738,6 +738,21 @@
738
738
  }
739
739
  }
740
740
  }
741
+ /**
742
+ *
743
+ * 数组对象根据某个值去重
744
+ */
745
+ function uniqueByProperty(arr, prop) {
746
+ return arr.reduce(function (acc, current) {
747
+ var x = acc.find(function (item) { return item[prop] === current[prop]; });
748
+ if (!x) {
749
+ return acc.concat([current]);
750
+ }
751
+ else {
752
+ return acc;
753
+ }
754
+ }, []);
755
+ }
741
756
 
742
757
  var Mask = /** @class */ (function () {
743
758
  function Mask(selectors, opacity) {
@@ -1136,6 +1151,7 @@
1136
1151
  exports.objectArrayToString = objectArrayToString;
1137
1152
  exports.phone = phone;
1138
1153
  exports.throttle = throttle;
1154
+ exports.uniqueByProperty = uniqueByProperty;
1139
1155
  exports.url = url;
1140
1156
  exports.useClose = useClose;
1141
1157
  exports.useCountDown = useCountDown;
@@ -99,4 +99,9 @@ export declare function findTreeDataNode(data: ISectoralTable[], targetDeptCode:
99
99
  * @param results 查找结果集
100
100
  */
101
101
  export declare function findTreeDataNodeName(dept: ISectoralTable, queryString: string, results: ISectoralTable[]): void;
102
+ /**
103
+ *
104
+ * 数组对象根据某个值去重
105
+ */
106
+ export declare function uniqueByProperty<T>(arr: T[], prop: keyof T): T[];
102
107
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightsoft/js-sdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.js",