diff --git a/packages/turf-bezier/README.md b/packages/turf-bezier/README.md index 2a71fc8533..83964f3e30 100644 --- a/packages/turf-bezier/README.md +++ b/packages/turf-bezier/README.md @@ -17,23 +17,14 @@ The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc **Examples** ```javascript -var line = { - "type": "Feature", - "properties": { - "stroke": "#f00" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [-76.091308, 18.427501], - [-76.695556, 18.729501], - [-76.552734, 19.40443], - [-74.61914, 19.134789], - [-73.652343, 20.07657], - [-73.157958, 20.210656] - ] - } -}; +var line = turf.lineString([ + [-76.091308, 18.427501], + [-76.695556, 18.729501], + [-76.552734, 19.40443], + [-74.61914, 19.134789], + [-73.652343, 20.07657], + [-73.157958, 20.210656] +]); var curved = turf.bezier(line); diff --git a/packages/turf-bezier/index.js b/packages/turf-bezier/index.js index 6a561f542f..ac605117e2 100644 --- a/packages/turf-bezier/index.js +++ b/packages/turf-bezier/index.js @@ -14,23 +14,14 @@ var Spline = require('./spline.js'); * @param {number} [sharpness=0.85] a measure of how curvy the path should be between splines * @returns {Feature} curved line * @example - * var line = { - * "type": "Feature", - * "properties": { - * "stroke": "#f00" - * }, - * "geometry": { - * "type": "LineString", - * "coordinates": [ - * [-76.091308, 18.427501], - * [-76.695556, 18.729501], - * [-76.552734, 19.40443], - * [-74.61914, 19.134789], - * [-73.652343, 20.07657], - * [-73.157958, 20.210656] - * ] - * } - * }; + * var line = turf.lineString([ + * [-76.091308, 18.427501], + * [-76.695556, 18.729501], + * [-76.552734, 19.40443], + * [-74.61914, 19.134789], + * [-73.652343, 20.07657], + * [-73.157958, 20.210656] + * ]); * * var curved = turf.bezier(line); * diff --git a/packages/turf-boolean-clockwise/README.md b/packages/turf-boolean-clockwise/README.md index f53e2e4abf..b0aafe9aec 100755 --- a/packages/turf-boolean-clockwise/README.md +++ b/packages/turf-boolean-clockwise/README.md @@ -11,8 +11,8 @@ Takes a ring and return true or false whether or not the ring is clockwise or co **Examples** ```javascript -var clockwiseRing = [[0,0],[1,1],[1,0],[0,0]] -var counterClockwiseRing = [[0,0],[1,0],[1,1],[0,0]] +var clockwiseRing = turf.lineString([[0,0],[1,1],[1,0],[0,0]]); +var counterClockwiseRing = turf.lineString([[0,0],[1,0],[1,1],[0,0]]); turf.booleanClockwise(clockwiseRing) //=true diff --git a/packages/turf-boolean-clockwise/index.js b/packages/turf-boolean-clockwise/index.js index 089d10757c..def2b79d63 100755 --- a/packages/turf-boolean-clockwise/index.js +++ b/packages/turf-boolean-clockwise/index.js @@ -8,8 +8,8 @@ var getCoords = invariant.getCoords; * @param {Geometry|Feature|Array>} line to be evaluated * @returns {Boolean} true/false * @example - * var clockwiseRing = [[0,0],[1,1],[1,0],[0,0]] - * var counterClockwiseRing = [[0,0],[1,0],[1,1],[0,0]] + * var clockwiseRing = turf.lineString([[0,0],[1,1],[1,0],[0,0]]); + * var counterClockwiseRing = turf.lineString([[0,0],[1,0],[1,1],[0,0]]); * * turf.booleanClockwise(clockwiseRing) * //=true diff --git a/packages/turf-boolean-contains/README.md b/packages/turf-boolean-contains/README.md index e9a3468a2d..f568bf6297 100644 --- a/packages/turf-boolean-contains/README.md +++ b/packages/turf-boolean-contains/README.md @@ -15,22 +15,9 @@ Boolean-contains returns the exact opposite result of the `@turf/boolean-within` **Examples** ```javascript -const point = { - "type": "Feature", - "properties": {}, - "geometry": { - "type": "Point", - "coordinates": [1, 2] - } -} -const line = { - "type": "Feature", - "properties": {}, - "geometry": { - "type": "LineString", - "coordinates": [[1, 1], [1, 2], [1, 3], [1, 4]] - } -} +const line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]); +const point = turf.point([1, 2]); + turf.booleanContains(line, point); //=true ``` diff --git a/packages/turf-boolean-contains/index.js b/packages/turf-boolean-contains/index.js index 3994ee98e6..87ab81b30a 100644 --- a/packages/turf-boolean-contains/index.js +++ b/packages/turf-boolean-contains/index.js @@ -16,22 +16,9 @@ var getGeomType = invariant.getGeomType; * @param {Geometry|Feature} feature2 GeoJSON Feature or Geometry * @returns {Boolean} true/false * @example - * const point = { - * "type": "Feature", - * "properties": {}, - * "geometry": { - * "type": "Point", - * "coordinates": [1, 2] - * } - * } - * const line = { - * "type": "Feature", - * "properties": {}, - * "geometry": { - * "type": "LineString", - * "coordinates": [[1, 1], [1, 2], [1, 3], [1, 4]] - * } - * } + * const line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]); + * const point = turf.point([1, 2]); + * * turf.booleanContains(line, point); * //=true */ diff --git a/packages/turf-boolean-crosses/README.md b/packages/turf-boolean-crosses/README.md index ba751f6064..3ea999fbc8 100644 --- a/packages/turf-boolean-crosses/README.md +++ b/packages/turf-boolean-crosses/README.md @@ -16,10 +16,14 @@ Boolean-Crosses returns t (TRUE) for only multipoint/polygon, multipoint/linestr **Examples** ```javascript -var cross = turf.booleanCrosses(feature1, feature2); +var line1 = turf.lineString([[-2, 2], [4, 2]]); +var line2 = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]); + +var cross = turf.booleanCrosses(line1, line2); +//=true ``` -Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false +Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false