index.cjs 776 B

1234567891011121314151617181920212223242526272829
  1. "use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
  2. var _meta = require('@turf/meta');
  3. function bbox(geojson, options = {}) {
  4. if (geojson.bbox != null && true !== options.recompute) {
  5. return geojson.bbox;
  6. }
  7. const result = [Infinity, Infinity, -Infinity, -Infinity];
  8. _meta.coordEach.call(void 0, geojson, (coord) => {
  9. if (result[0] > coord[0]) {
  10. result[0] = coord[0];
  11. }
  12. if (result[1] > coord[1]) {
  13. result[1] = coord[1];
  14. }
  15. if (result[2] < coord[0]) {
  16. result[2] = coord[0];
  17. }
  18. if (result[3] < coord[1]) {
  19. result[3] = coord[1];
  20. }
  21. });
  22. return result;
  23. }
  24. var turf_bbox_default = bbox;
  25. exports.bbox = bbox; exports.default = turf_bbox_default;
  26. //# sourceMappingURL=index.cjs.map