sort.js 508 B

1234567891011121314151617
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.Sort = exports.defined = void 0;
  4. function defined(d) {
  5. return d !== undefined && d !== null && !Number.isNaN(d);
  6. }
  7. exports.defined = defined;
  8. /**
  9. * Sort data similar with Array.prototypo.sort.
  10. */
  11. const Sort = (options) => {
  12. const { callback } = options;
  13. return (data) => (Array.isArray(data) ? [...data].sort(callback) : data);
  14. };
  15. exports.Sort = Sort;
  16. exports.Sort.props = {};
  17. //# sourceMappingURL=sort.js.map