@turf/circle 7.2.0 → 7.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,17 +4,17 @@
4
4
 
5
5
  ## circle
6
6
 
7
- Takes a [Point][1] and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.
7
+ Takes a [Point][1] and calculates the circle polygon given a radius in [Units][2]; and steps for precision.
8
8
 
9
9
  ### Parameters
10
10
 
11
- * `center` **([Feature][2]<[Point][1]> | [Array][3]<[number][4]>)** center point
12
- * `radius` **[number][4]** radius of the circle
13
- * `options` **[Object][5]** Optional parameters (optional, default `{}`)
11
+ * `center` **([Feature][3]<[Point][1]> | [Array][4]<[number][5]>)** center point
12
+ * `radius` **[number][5]** radius of the circle
13
+ * `options` **[Object][6]** Optional parameters (optional, default `{}`)
14
14
 
15
- * `options.steps` **[number][4]** number of steps (optional, default `64`)
16
- * `options.units` **[string][6]** miles, kilometers, degrees, or radians (optional, default `'kilometers'`)
17
- * `options.properties` **[Object][5]** properties (optional, default `{}`)
15
+ * `options.steps` **[number][5]** number of steps (optional, default `64`)
16
+ * `options.units` **Units** Supports all valid Turf [Units][2] (optional, default `'kilometers'`)
17
+ * `options.properties` **[Object][6]** properties (optional, default `{}`)
18
18
 
19
19
  ### Examples
20
20
 
@@ -28,19 +28,19 @@ var circle = turf.circle(center, radius, options);
28
28
  var addToMap = [turf.point(center), circle]
29
29
  ```
30
30
 
31
- Returns **[Feature][2]<[Polygon][7]>** circle polygon
31
+ Returns **[Feature][3]<[Polygon][7]>** circle polygon
32
32
 
33
33
  [1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
34
34
 
35
- [2]: https://tools.ietf.org/html/rfc7946#section-3.2
35
+ [2]: https://turfjs.org/docs/api/types/Units
36
36
 
37
- [3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
37
+ [3]: https://tools.ietf.org/html/rfc7946#section-3.2
38
38
 
39
- [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
39
+ [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
40
40
 
41
- [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
41
+ [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
42
42
 
43
- [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
43
+ [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
44
44
 
45
45
  [7]: https://tools.ietf.org/html/rfc7946#section-3.1.6
46
46
 
@@ -13,9 +13,9 @@ function circle(center, radius, options = {}) {
13
13
  coordinates.push(coordinates[0]);
14
14
  return _helpers.polygon.call(void 0, [coordinates], properties);
15
15
  }
16
- var turf_circle_default = circle;
16
+ var index_default = circle;
17
17
 
18
18
 
19
19
 
20
- exports.circle = circle; exports.default = turf_circle_default;
20
+ exports.circle = circle; exports.default = index_default;
21
21
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-circle/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,gDAA4B;AAC5B,wCAA+B;AAsB/B,SAAS,MAAA,CACP,MAAA,EACA,MAAA,EACA,QAAA,EAII,CAAC,CAAA,EACgB;AAErB,EAAA,MAAM,MAAA,EAAQ,OAAA,CAAQ,MAAA,GAAS,EAAA;AAC/B,EAAA,MAAM,WAAA,EAAkB,OAAA,CAAQ,WAAA,EAC5B,OAAA,CAAQ,WAAA,EACR,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,EAAA,GAAK,MAAA,CAAO,KAAA,IAAS,UAAA,GAAa,MAAA,CAAO,WAAA,EAC5D,MAAA,CAAO,WAAA,EACP,CAAC,CAAA;AAGP,EAAA,MAAM,YAAA,EAAc,CAAC,CAAA;AACrB,EAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,KAAA,EAAO,CAAA,EAAA,EAAK;AAC9B,IAAA,WAAA,CAAY,IAAA;AAAA,MACV,sCAAA,MAAY,EAAQ,MAAA,EAAS,EAAA,EAAI,CAAA,IAAA,EAAQ,KAAA,EAAO,OAAO,CAAA,CAAE,QAAA,CACtD;AAAA,IACL,CAAA;AAAA,EACF;AACA,EAAA,WAAA,CAAY,IAAA,CAAK,WAAA,CAAY,CAAC,CAAC,CAAA;AAE/B,EAAA,OAAO,8BAAA,CAAS,WAAW,CAAA,EAAG,UAAU,CAAA;AAC1C;AAGA,IAAO,oBAAA,EAAQ,MAAA;ADvCf;AACE;AACA;AACF,+DAAC","file":"/home/runner/work/turf/turf/packages/turf-circle/dist/cjs/index.cjs","sourcesContent":[null,"import { GeoJsonProperties, Feature, Point, Polygon } from \"geojson\";\nimport { destination } from \"@turf/destination\";\nimport { polygon, Units } from \"@turf/helpers\";\n\n/**\n * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.\n *\n * @function\n * @param {Feature<Point>|number[]} center center point\n * @param {number} radius radius of the circle\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.steps=64] number of steps\n * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians\n * @param {Object} [options.properties={}] properties\n * @returns {Feature<Polygon>} circle polygon\n * @example\n * var center = [-75.343, 39.984];\n * var radius = 5;\n * var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}};\n * var circle = turf.circle(center, radius, options);\n *\n * //addToMap\n * var addToMap = [turf.point(center), circle]\n */\nfunction circle<P extends GeoJsonProperties = GeoJsonProperties>(\n center: number[] | Point | Feature<Point, P>,\n radius: number,\n options: {\n steps?: number;\n units?: Units;\n properties?: P;\n } = {}\n): Feature<Polygon, P> {\n // default params\n const steps = options.steps || 64;\n const properties: any = options.properties\n ? options.properties\n : !Array.isArray(center) && center.type === \"Feature\" && center.properties\n ? center.properties\n : {};\n\n // main\n const coordinates = [];\n for (let i = 0; i < steps; i++) {\n coordinates.push(\n destination(center, radius, (i * -360) / steps, options).geometry\n .coordinates\n );\n }\n coordinates.push(coordinates[0]);\n\n return polygon([coordinates], properties);\n}\n\nexport { circle };\nexport default circle;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-circle/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,gDAA4B;AAC5B,wCAA+B;AAsB/B,SAAS,MAAA,CACP,MAAA,EACA,MAAA,EACA,QAAA,EAII,CAAC,CAAA,EACgB;AAErB,EAAA,MAAM,MAAA,EAAQ,OAAA,CAAQ,MAAA,GAAS,EAAA;AAC/B,EAAA,MAAM,WAAA,EAAkB,OAAA,CAAQ,WAAA,EAC5B,OAAA,CAAQ,WAAA,EACR,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,EAAA,GAAK,MAAA,CAAO,KAAA,IAAS,UAAA,GAAa,MAAA,CAAO,WAAA,EAC5D,MAAA,CAAO,WAAA,EACP,CAAC,CAAA;AAGP,EAAA,MAAM,YAAA,EAAc,CAAC,CAAA;AACrB,EAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,KAAA,EAAO,CAAA,EAAA,EAAK;AAC9B,IAAA,WAAA,CAAY,IAAA;AAAA,MACV,sCAAA,MAAY,EAAQ,MAAA,EAAS,EAAA,EAAI,CAAA,IAAA,EAAQ,KAAA,EAAO,OAAO,CAAA,CAAE,QAAA,CACtD;AAAA,IACL,CAAA;AAAA,EACF;AACA,EAAA,WAAA,CAAY,IAAA,CAAK,WAAA,CAAY,CAAC,CAAC,CAAA;AAE/B,EAAA,OAAO,8BAAA,CAAS,WAAW,CAAA,EAAG,UAAU,CAAA;AAC1C;AAGA,IAAO,cAAA,EAAQ,MAAA;ADvCf;AACE;AACA;AACF,yDAAC","file":"/home/runner/work/turf/turf/packages/turf-circle/dist/cjs/index.cjs","sourcesContent":[null,"import { GeoJsonProperties, Feature, Point, Polygon } from \"geojson\";\nimport { destination } from \"@turf/destination\";\nimport { polygon, Units } from \"@turf/helpers\";\n\n/**\n * Takes a {@link Point} and calculates the circle polygon given a radius in {@link https://turfjs.org/docs/api/types/Units Units}; and steps for precision.\n *\n * @function\n * @param {Feature<Point>|number[]} center center point\n * @param {number} radius radius of the circle\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.steps=64] number of steps\n * @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}\n * @param {Object} [options.properties={}] properties\n * @returns {Feature<Polygon>} circle polygon\n * @example\n * var center = [-75.343, 39.984];\n * var radius = 5;\n * var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}};\n * var circle = turf.circle(center, radius, options);\n *\n * //addToMap\n * var addToMap = [turf.point(center), circle]\n */\nfunction circle<P extends GeoJsonProperties = GeoJsonProperties>(\n center: number[] | Point | Feature<Point, P>,\n radius: number,\n options: {\n steps?: number;\n units?: Units;\n properties?: P;\n } = {}\n): Feature<Polygon, P> {\n // default params\n const steps = options.steps || 64;\n const properties: any = options.properties\n ? options.properties\n : !Array.isArray(center) && center.type === \"Feature\" && center.properties\n ? center.properties\n : {};\n\n // main\n const coordinates = [];\n for (let i = 0; i < steps; i++) {\n coordinates.push(\n destination(center, radius, (i * -360) / steps, options).geometry\n .coordinates\n );\n }\n coordinates.push(coordinates[0]);\n\n return polygon([coordinates], properties);\n}\n\nexport { circle };\nexport default circle;\n"]}
@@ -2,14 +2,14 @@ import { GeoJsonProperties, Point, Feature, Polygon } from 'geojson';
2
2
  import { Units } from '@turf/helpers';
3
3
 
4
4
  /**
5
- * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.
5
+ * Takes a {@link Point} and calculates the circle polygon given a radius in {@link https://turfjs.org/docs/api/types/Units Units}; and steps for precision.
6
6
  *
7
7
  * @function
8
8
  * @param {Feature<Point>|number[]} center center point
9
9
  * @param {number} radius radius of the circle
10
10
  * @param {Object} [options={}] Optional parameters
11
11
  * @param {number} [options.steps=64] number of steps
12
- * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians
12
+ * @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}
13
13
  * @param {Object} [options.properties={}] properties
14
14
  * @returns {Feature<Polygon>} circle polygon
15
15
  * @example
@@ -2,14 +2,14 @@ import { GeoJsonProperties, Point, Feature, Polygon } from 'geojson';
2
2
  import { Units } from '@turf/helpers';
3
3
 
4
4
  /**
5
- * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.
5
+ * Takes a {@link Point} and calculates the circle polygon given a radius in {@link https://turfjs.org/docs/api/types/Units Units}; and steps for precision.
6
6
  *
7
7
  * @function
8
8
  * @param {Feature<Point>|number[]} center center point
9
9
  * @param {number} radius radius of the circle
10
10
  * @param {Object} [options={}] Optional parameters
11
11
  * @param {number} [options.steps=64] number of steps
12
- * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians
12
+ * @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}
13
13
  * @param {Object} [options.properties={}] properties
14
14
  * @returns {Feature<Polygon>} circle polygon
15
15
  * @example
package/dist/esm/index.js CHANGED
@@ -13,9 +13,9 @@ function circle(center, radius, options = {}) {
13
13
  coordinates.push(coordinates[0]);
14
14
  return polygon([coordinates], properties);
15
15
  }
16
- var turf_circle_default = circle;
16
+ var index_default = circle;
17
17
  export {
18
18
  circle,
19
- turf_circle_default as default
19
+ index_default as default
20
20
  };
21
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { GeoJsonProperties, Feature, Point, Polygon } from \"geojson\";\nimport { destination } from \"@turf/destination\";\nimport { polygon, Units } from \"@turf/helpers\";\n\n/**\n * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.\n *\n * @function\n * @param {Feature<Point>|number[]} center center point\n * @param {number} radius radius of the circle\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.steps=64] number of steps\n * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians\n * @param {Object} [options.properties={}] properties\n * @returns {Feature<Polygon>} circle polygon\n * @example\n * var center = [-75.343, 39.984];\n * var radius = 5;\n * var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}};\n * var circle = turf.circle(center, radius, options);\n *\n * //addToMap\n * var addToMap = [turf.point(center), circle]\n */\nfunction circle<P extends GeoJsonProperties = GeoJsonProperties>(\n center: number[] | Point | Feature<Point, P>,\n radius: number,\n options: {\n steps?: number;\n units?: Units;\n properties?: P;\n } = {}\n): Feature<Polygon, P> {\n // default params\n const steps = options.steps || 64;\n const properties: any = options.properties\n ? options.properties\n : !Array.isArray(center) && center.type === \"Feature\" && center.properties\n ? center.properties\n : {};\n\n // main\n const coordinates = [];\n for (let i = 0; i < steps; i++) {\n coordinates.push(\n destination(center, radius, (i * -360) / steps, options).geometry\n .coordinates\n );\n }\n coordinates.push(coordinates[0]);\n\n return polygon([coordinates], properties);\n}\n\nexport { circle };\nexport default circle;\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,eAAsB;AAsB/B,SAAS,OACP,QACA,QACA,UAII,CAAC,GACgB;AAErB,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,aAAkB,QAAQ,aAC5B,QAAQ,aACR,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS,aAAa,OAAO,aAC5D,OAAO,aACP,CAAC;AAGP,QAAM,cAAc,CAAC;AACrB,WAAS,IAAI,GAAG,IAAI,OAAO,KAAK;AAC9B,gBAAY;AAAA,MACV,YAAY,QAAQ,QAAS,IAAI,OAAQ,OAAO,OAAO,EAAE,SACtD;AAAA,IACL;AAAA,EACF;AACA,cAAY,KAAK,YAAY,CAAC,CAAC;AAE/B,SAAO,QAAQ,CAAC,WAAW,GAAG,UAAU;AAC1C;AAGA,IAAO,sBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { GeoJsonProperties, Feature, Point, Polygon } from \"geojson\";\nimport { destination } from \"@turf/destination\";\nimport { polygon, Units } from \"@turf/helpers\";\n\n/**\n * Takes a {@link Point} and calculates the circle polygon given a radius in {@link https://turfjs.org/docs/api/types/Units Units}; and steps for precision.\n *\n * @function\n * @param {Feature<Point>|number[]} center center point\n * @param {number} radius radius of the circle\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.steps=64] number of steps\n * @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}\n * @param {Object} [options.properties={}] properties\n * @returns {Feature<Polygon>} circle polygon\n * @example\n * var center = [-75.343, 39.984];\n * var radius = 5;\n * var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}};\n * var circle = turf.circle(center, radius, options);\n *\n * //addToMap\n * var addToMap = [turf.point(center), circle]\n */\nfunction circle<P extends GeoJsonProperties = GeoJsonProperties>(\n center: number[] | Point | Feature<Point, P>,\n radius: number,\n options: {\n steps?: number;\n units?: Units;\n properties?: P;\n } = {}\n): Feature<Polygon, P> {\n // default params\n const steps = options.steps || 64;\n const properties: any = options.properties\n ? options.properties\n : !Array.isArray(center) && center.type === \"Feature\" && center.properties\n ? center.properties\n : {};\n\n // main\n const coordinates = [];\n for (let i = 0; i < steps; i++) {\n coordinates.push(\n destination(center, radius, (i * -360) / steps, options).geometry\n .coordinates\n );\n }\n coordinates.push(coordinates[0]);\n\n return polygon([coordinates], properties);\n}\n\nexport { circle };\nexport default circle;\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,eAAsB;AAsB/B,SAAS,OACP,QACA,QACA,UAII,CAAC,GACgB;AAErB,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,aAAkB,QAAQ,aAC5B,QAAQ,aACR,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS,aAAa,OAAO,aAC5D,OAAO,aACP,CAAC;AAGP,QAAM,cAAc,CAAC;AACrB,WAAS,IAAI,GAAG,IAAI,OAAO,KAAK;AAC9B,gBAAY;AAAA,MACV,YAAY,QAAQ,QAAS,IAAI,OAAQ,OAAO,OAAO,EAAE,SACtD;AAAA,IACL;AAAA,EACF;AACA,cAAY,KAAK,YAAY,CAAC,CAAC;AAE/B,SAAO,QAAQ,CAAC,WAAW,GAAG,UAAU;AAC1C;AAGA,IAAO,gBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turf/circle",
3
- "version": "7.2.0",
4
- "description": "turf circle module",
3
+ "version": "7.3.1",
4
+ "description": "Takes a point and calculates the circle polygon given a radius.",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
7
7
  "bugs": {
@@ -49,29 +49,28 @@
49
49
  "bench": "tsx bench.ts",
50
50
  "build": "tsup --config ../../tsup.config.ts",
51
51
  "docs": "tsx ../../scripts/generate-readmes.ts",
52
- "test": "npm-run-all --npm-path npm test:*",
52
+ "test": "pnpm run /test:.*/",
53
53
  "test:tape": "tsx test.ts",
54
54
  "test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@placemarkio/check-geojson": "^0.1.12",
58
- "@turf/truncate": "^7.2.0",
58
+ "@turf/truncate": "7.3.1",
59
59
  "@types/benchmark": "^2.1.5",
60
- "@types/tape": "^4.13.4",
60
+ "@types/tape": "^5.8.1",
61
61
  "benchmark": "^2.1.4",
62
62
  "load-json-file": "^7.0.1",
63
- "npm-run-all": "^4.1.5",
64
63
  "tape": "^5.9.0",
65
- "tsup": "^8.3.5",
66
- "tsx": "^4.19.2",
67
- "typescript": "^5.5.4",
68
- "write-json-file": "^5.0.0"
64
+ "tsup": "^8.4.0",
65
+ "tsx": "^4.19.4",
66
+ "typescript": "^5.8.3",
67
+ "write-json-file": "^6.0.0"
69
68
  },
70
69
  "dependencies": {
71
- "@turf/destination": "^7.2.0",
72
- "@turf/helpers": "^7.2.0",
70
+ "@turf/destination": "7.3.1",
71
+ "@turf/helpers": "7.3.1",
73
72
  "@types/geojson": "^7946.0.10",
74
73
  "tslib": "^2.8.1"
75
74
  },
76
- "gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
75
+ "gitHead": "b7f1b4eafb760431e03955499d8eac9489438219"
77
76
  }