Blame view

天文台pc/tianwentai-ui/node_modules/recharts/lib/util/payload/getUniqPayload.js 866 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  "use strict";
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.getUniqPayload = getUniqPayload;
  var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
  var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  /**
   * This is configuration option that decides how to filter for unique values only:
   *
   * - `false` means "no filter"
   * - `true` means "use recharts default filter"
   * - function means "use return of this function as the default key"
   */
  
  function getUniqPayload(payload, option, defaultUniqBy) {
    if (option === true) {
      return (0, _uniqBy["default"])(payload, defaultUniqBy);
    }
    if ((0, _isFunction["default"])(option)) {
      return (0, _uniqBy["default"])(payload, option);
    }
    return payload;
  }