@kmkf-fe-packages/kmkf-utils 1.19.0 → 1.19.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/README.md CHANGED
@@ -1 +1 @@
1
- 1112234
1
+ 11122345
@@ -0,0 +1,2 @@
1
+ declare const extractPrimitiveValues: (obj: unknown) => any[];
2
+ export default extractPrimitiveValues;
@@ -0,0 +1,32 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var extractPrimitiveValues = function extractPrimitiveValues(obj) {
3
+ // 定义一个数组来存储基本类型的值
4
+ var primitiveValues = [];
5
+
6
+ // 定义一个递归函数来遍历对象
7
+ function traverse(value) {
8
+ // 检查值是否是对象,但不是null,并且不是Date,RegExp,Function等特殊对象
9
+ if (value && _typeof(value) === 'object' && !(value instanceof Date) && !(value instanceof RegExp) && !(value instanceof Function)) {
10
+ // 如果是数组或对象,递归遍历其元素或属性
11
+ if (Array.isArray(value)) {
12
+ value.forEach(function (item) {
13
+ return traverse(item);
14
+ });
15
+ } else {
16
+ Object.values(value).forEach(function (prop) {
17
+ return traverse(prop);
18
+ });
19
+ }
20
+ } else {
21
+ // 如果是基本类型,添加到数组中
22
+ primitiveValues.push(value);
23
+ }
24
+ }
25
+
26
+ // 调用递归函数开始遍历
27
+ traverse(obj);
28
+
29
+ // 返回收集到的基本类型值的数组
30
+ return primitiveValues;
31
+ };
32
+ export default extractPrimitiveValues;
@@ -1,4 +1,5 @@
1
- import { isNull } from '@kmkf-fe-packages/kmkf-utils';
1
+ import isNull from "./isNull";
2
+ import extractPrimitiveValues from "./extractPrimitiveValues";
2
3
  import isEqual from 'lodash/isEqual';
3
4
  import intersection from 'lodash/intersection';
4
5
  var getExpression = function getExpression(condition, l, r) {
@@ -51,6 +52,15 @@ var getExpression = function getExpression(condition, l, r) {
51
52
  var _intersection3, _intersection4;
52
53
  return Array.isArray(l) ? ((_intersection3 = intersection(r, l)) === null || _intersection3 === void 0 ? void 0 : _intersection3.length) > 0 : ((_intersection4 = intersection(r, [l])) === null || _intersection4 === void 0 ? void 0 : _intersection4.length) > 0;
53
54
  }
55
+ if (condition === 'NINCLUDE') {
56
+ var _intersection5, _intersection6;
57
+ var _include = Array.isArray(l) ? ((_intersection5 = intersection(r, l)) === null || _intersection5 === void 0 ? void 0 : _intersection5.length) > 0 : ((_intersection6 = intersection(r, [l])) === null || _intersection6 === void 0 ? void 0 : _intersection6.length) > 0;
58
+ return !_include;
59
+ }
60
+ if (condition === 'ARRAY_OBJECT_INCLUDE') {
61
+ var _intersection7;
62
+ return ((_intersection7 = intersection(extractPrimitiveValues(l), r)) === null || _intersection7 === void 0 ? void 0 : _intersection7.length) > 0;
63
+ }
54
64
  return false;
55
65
  };
56
66
  export default getExpression;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "1.19.0",
3
+ "version": "1.19.2",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -41,7 +41,7 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "6f361642c2628122e1b599da51620cc6b1621c4d",
44
+ "gitHead": "2e2f27ba765c9dfa3ee60dbbc3fa4cf37c9ef689",
45
45
  "gitHooks": {
46
46
  "pre-commit": "lint-staged"
47
47
  }