sampling.js 426 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.sampling = void 0;
  4. function sampling(data, size) {
  5. if (data.length <= size)
  6. return data;
  7. var step = Math.floor(data.length / size);
  8. var result = [];
  9. for (var i = 0; i < data.length; i += step) {
  10. result.push(data[i]);
  11. }
  12. return result;
  13. }
  14. exports.sampling = sampling;
  15. //# sourceMappingURL=sampling.js.map