index.d.cts 843 B

12345678910111213141516171819202122232425262728
  1. import { GeoJsonProperties } from 'geojson';
  2. import { AllGeoJSON } from '@turf/helpers';
  3. /**
  4. * Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'.
  5. * ~3-5x faster than the common JSON.parse + JSON.stringify combo method.
  6. *
  7. * @function
  8. * @param {GeoJSON} geojson GeoJSON Object
  9. * @returns {GeoJSON} cloned GeoJSON Object
  10. * @example
  11. * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]], {color: 'red'});
  12. *
  13. * var lineCloned = turf.clone(line);
  14. */
  15. declare function clone<T extends AllGeoJSON>(geojson: T): T;
  16. /**
  17. * Clone Properties
  18. *
  19. * @private
  20. * @param {Object} properties GeoJSON Properties
  21. * @returns {Object} cloned Properties
  22. */
  23. declare function cloneProperties(properties: GeoJsonProperties): {
  24. [key: string]: any;
  25. };
  26. export { clone, cloneProperties, clone as default };