Turfjs / turf

A modular geospatial engine written in JavaScript and TypeScript
https://turfjs.org/
MIT License
9.21k stars 934 forks source link

Documenting ES6 imports for modules in examples #2091

Open sirmspencer opened 3 years ago

sirmspencer commented 3 years ago

The example here uses the full turf package version of length. https://www.npmjs.com/package/@turf/length Here is one possible correct example

import turfLength from "@turf/length";

const lineString = {
  type: "Feature",
  geometry: {
    type: "LineString",
    coordinates: [[115, -32], [131, -22], [143, -25], [150, -34]]
  }
};
const length = turfLength(line, {units: 'miles'});
rowanwins commented 3 years ago

Hi @sirmspencer

All our examples using the turf. syntax rather than an individual module.

Working out how to publish docs which cater for both usage patterns requires a bit of thought...

Cheers Rowan