@kmkf-fe-packages/kmkf-utils 0.7.14-alpha.3 → 0.7.14-alpha.5

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.
@@ -1,7 +1,14 @@
1
1
  import { isNull } from '@kmkf-fe-packages/kmkf-utils';
2
2
  import isEqual from 'lodash/isEqual';
3
+ import intersection from 'lodash/intersection';
3
4
  var getExpression = function getExpression(condition, l, r) {
4
5
  if (condition === 'EQ') {
6
+ if (Array.isArray(l) && Array.isArray(r)) {
7
+ // 如果长度不想等,直接不想等
8
+ if (l.length !== r.length) return false;
9
+ // 长度相等,并且交集之后长度相等,一定是相等的
10
+ return intersection(l, r).length === l.length;
11
+ }
5
12
  return isEqual(l, r);
6
13
  }
7
14
  if (condition === 'GT') {
@@ -36,7 +43,8 @@ var getExpression = function getExpression(condition, l, r) {
36
43
  }
37
44
  // 包含任一
38
45
  if (condition === 'INCLUDE') {
39
- return r === null || r === void 0 ? void 0 : r.includes(l);
46
+ var _intersection, _intersection2;
47
+ return Array.isArray(l) ? ((_intersection = intersection(r, l)) === null || _intersection === void 0 ? void 0 : _intersection.length) > 0 : ((_intersection2 = intersection(r, [l])) === null || _intersection2 === void 0 ? void 0 : _intersection2.length) > 0;
40
48
  }
41
49
  return false;
42
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "0.7.14-alpha.3",
3
+ "version": "0.7.14-alpha.5",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -42,5 +42,5 @@
42
42
  "gitHooks": {
43
43
  "pre-commit": "lint-staged"
44
44
  },
45
- "gitHead": "994e5658b36259cfb2ec6c32123c64f2b9466faa"
45
+ "gitHead": "5ffd891e1e64e8c641355563439da6eed910a512"
46
46
  }