index.cjs 853 B

12345678910111213141516171819202122232425
  1. "use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
  2. var _meta = require('@turf/meta');
  3. var _helpers = require('@turf/helpers');
  4. var _clone = require('@turf/clone');
  5. function flip(geojson, options) {
  6. var _a;
  7. options = options || {};
  8. if (!_helpers.isObject.call(void 0, options)) throw new Error("options is invalid");
  9. const mutate = (_a = options.mutate) != null ? _a : false;
  10. if (!geojson) throw new Error("geojson is required");
  11. if (mutate === false || mutate === void 0) geojson = _clone.clone.call(void 0, geojson);
  12. _meta.coordEach.call(void 0, geojson, function(coord) {
  13. var x = coord[0];
  14. var y = coord[1];
  15. coord[0] = y;
  16. coord[1] = x;
  17. });
  18. return geojson;
  19. }
  20. var turf_flip_default = flip;
  21. exports.default = turf_flip_default; exports.flip = flip;
  22. //# sourceMappingURL=index.cjs.map