{"name":"@turf/helpers","version":"4.7.3","keywords":["geo","point","turf","geojson"],"author":{"name":"Turf Authors"},"license":"MIT","_id":"@turf/helpers@4.7.3","maintainers":[{"name":"deniscarriere","email":"carriere.denis@gmail.com"},{"name":"tcql","email":"tim.channell@gmail.com"},{"name":"morganherlocker","email":"morgan.herlocker@gmail.com"},{"name":"tmcw","email":"tom+npm@macwright.org"}],"contributors":[{"name":"Tom MacWright","email":"@tmcw"},{"name":"Stefano Borghi","email":"@stebogit"},{"name":"Denis Carriere","email":"@DenisCarriere"},{"name":"William Nordmann","email":"@wnordmann"}],"homepage":"https://github.com/Turfjs/turf","bugs":{"url":"https://github.com/Turfjs/turf/issues"},"dist":{"shasum":"bc312ac43cab3c532a483151c4c382c5649429e9","tarball":"http://registry-npm.ywwl.com/@turf/helpers/download/@turf/helpers-4.7.3.tgz","integrity":"sha512-hk5ANVazb80zK6tjJYAG76oCRTWMQo6SAFu5E1dVnlb2kT3FHLoPcOB9P11duwDafMwywz24KZ+FUorB5e728w==","signatures":[{"sig":"MEYCIQCb3a83E6cQYBZar0Nh7I7UJF51mUd1egOPuC7xET6mSAIhAKaIwaoBETpBNTiAImnoUIVrJlEMVcKWs8ppkZQPU8i6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":7908,"noattachment":false,"key":"/@turf/helpers/-/@turf/helpers-4.7.3.tgz"},"main":"index.js","_from":".","files":["index.js","index.d.ts"],"types":"index.d.ts","_shasum":"bc312ac43cab3c532a483151c4c382c5649429e9","scripts":{"test":"node test.js","bench":"node bench.js"},"_npmUser":{"name":"deniscarriere","email":"carriere.denis@gmail.com"},"repository":{"url":"git://github.com/Turfjs/turf.git","type":"git"},"_npmVersion":"3.10.10","description":"turf helpers module","directories":{},"_nodeVersion":"6.11.2","devDependencies":{"tape":"4.8.0","benchmark":"2.1.4"},"_npmOperationalInternal":{"tmp":"tmp/helpers-4.7.3.tgz_1505222466153_0.853886067867279","host":"s3://npm-registry-packages"},"readme":"# @turf/helpers\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n## helpers\n\n### earthRadius\n\nEarth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.\n\nType: [number][1]\n\n### factors\n\nUnit of measurement factors using a spherical (non-ellipsoid) earth radius.\n\nKeys are the name of the unit, values are the number of that unit in a single radian\n\nType: [Object][2]\n\n### areaFactors\n\nArea of measurement factors based on 1 square meter.\n\nType: [Object][2]\n\n## feature\n\nWraps a GeoJSON [Geometry][3] in a GeoJSON [Feature][4].\n\n### Parameters\n\n*   `geometry` **[Geometry][5]** input geometry\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the Feature\n\n### Examples\n\n```javascript\nvar geometry = {\n  \"type\": \"Point\",\n  \"coordinates\": [110, 50]\n};\n\nvar feature = turf.feature(geometry);\n\n//=feature\n```\n\nReturns **[Feature][8]** a GeoJSON Feature\n\n## geometry\n\nCreates a GeoJSON [Geometry][3] from a Geometry string type & coordinates.\nFor GeometryCollection type use `helpers.geometryCollection`\n\n### Parameters\n\n*   `type` **[string][7]** Geometry Type\n*   `coordinates` **[Array][6]\\<any>** Coordinates\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n### Examples\n\n```javascript\nvar type = \"Point\";\nvar coordinates = [110, 50];\nvar geometry = turf.geometry(type, coordinates);\n// => geometry\n```\n\nReturns **[Geometry][5]** a GeoJSON Geometry\n\n## point\n\nCreates a [Point][9] [Feature][4] from a Position.\n\n### Parameters\n\n*   `coordinates` **[Array][6]<[number][1]>** longitude, latitude position (each in decimal degrees)\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the Feature\n\n### Examples\n\n```javascript\nvar point = turf.point([-75.343, 39.984]);\n\n//=point\n```\n\nReturns **[Feature][8]<[Point][10]>** a Point feature\n\n## points\n\nCreates a [Point][9] [FeatureCollection][11] from an Array of Point coordinates.\n\n### Parameters\n\n*   `coordinates` **[Array][6]<[Array][6]<[number][1]>>** an array of Points\n*   `properties` **[Object][2]** Translate these properties to each Feature (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north]\n        associated with the FeatureCollection\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the FeatureCollection\n\n### Examples\n\n```javascript\nvar points = turf.points([\n  [-75, 39],\n  [-80, 45],\n  [-78, 50]\n]);\n\n//=points\n```\n\nReturns **[FeatureCollection][12]<[Point][10]>** Point Feature\n\n## polygon\n\nCreates a [Polygon][13] [Feature][4] from an Array of LinearRings.\n\n### Parameters\n\n*   `coordinates` **[Array][6]<[Array][6]<[Array][6]<[number][1]>>>** an array of LinearRings\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the Feature\n\n### Examples\n\n```javascript\nvar polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' });\n\n//=polygon\n```\n\nReturns **[Feature][8]<[Polygon][14]>** Polygon Feature\n\n## polygons\n\nCreates a [Polygon][13] [FeatureCollection][11] from an Array of Polygon coordinates.\n\n### Parameters\n\n*   `coordinates` **[Array][6]<[Array][6]<[Array][6]<[Array][6]<[number][1]>>>>** an array of Polygon coordinates\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the FeatureCollection\n\n### Examples\n\n```javascript\nvar polygons = turf.polygons([\n  [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],\n  [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]],\n]);\n\n//=polygons\n```\n\nReturns **[FeatureCollection][12]<[Polygon][14]>** Polygon FeatureCollection\n\n## lineString\n\nCreates a [LineString][15] [Feature][4] from an Array of Positions.\n\n### Parameters\n\n*   `coordinates` **[Array][6]<[Array][6]<[number][1]>>** an array of Positions\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the Feature\n\n### Examples\n\n```javascript\nvar linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});\nvar linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});\n\n//=linestring1\n//=linestring2\n```\n\nReturns **[Feature][8]<[LineString][16]>** LineString Feature\n\n## lineStrings\n\nCreates a [LineString][15] [FeatureCollection][11] from an Array of LineString coordinates.\n\n### Parameters\n\n*   `coordinates` **[Array][6]<[Array][6]<[Array][6]<[number][1]>>>** an array of LinearRings\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north]\n        associated with the FeatureCollection\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the FeatureCollection\n\n### Examples\n\n```javascript\nvar linestrings = turf.lineStrings([\n  [[-24, 63], [-23, 60], [-25, 65], [-20, 69]],\n  [[-14, 43], [-13, 40], [-15, 45], [-10, 49]]\n]);\n\n//=linestrings\n```\n\nReturns **[FeatureCollection][12]<[LineString][16]>** LineString FeatureCollection\n\n## featureCollection\n\nTakes one or more [Features][4] and creates a [FeatureCollection][11].\n\n### Parameters\n\n*   `features` **[Array][6]<[Feature][8]>** input features\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the Feature\n\n### Examples\n\n```javascript\nvar locationA = turf.point([-75.343, 39.984], {name: 'Location A'});\nvar locationB = turf.point([-75.833, 39.284], {name: 'Location B'});\nvar locationC = turf.point([-75.534, 39.123], {name: 'Location C'});\n\nvar collection = turf.featureCollection([\n  locationA,\n  locationB,\n  locationC\n]);\n\n//=collection\n```\n\nReturns **[FeatureCollection][12]** FeatureCollection of Features\n\n## multiLineString\n\nCreates a [Feature\\<MultiLineString>][17] based on a\ncoordinate array. Properties can be added optionally.\n\n### Parameters\n\n*   `coordinates` **[Array][6]<[Array][6]<[Array][6]<[number][1]>>>** an array of LineStrings\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the Feature\n\n### Examples\n\n```javascript\nvar multiLine = turf.multiLineString([[[0,0],[10,10]]]);\n\n//=multiLine\n```\n\n*   Throws **[Error][18]** if no coordinates are passed\n\nReturns **[Feature][8]<[MultiLineString][19]>** a MultiLineString feature\n\n## multiPoint\n\nCreates a [Feature\\<MultiPoint>][20] based on a\ncoordinate array. Properties can be added optionally.\n\n### Parameters\n\n*   `coordinates` **[Array][6]<[Array][6]<[number][1]>>** an array of Positions\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the Feature\n\n### Examples\n\n```javascript\nvar multiPt = turf.multiPoint([[0,0],[10,10]]);\n\n//=multiPt\n```\n\n*   Throws **[Error][18]** if no coordinates are passed\n\nReturns **[Feature][8]<[MultiPoint][21]>** a MultiPoint feature\n\n## multiPolygon\n\nCreates a [Feature\\<MultiPolygon>][22] based on a\ncoordinate array. Properties can be added optionally.\n\n### Parameters\n\n*   `coordinates` **[Array][6]<[Array][6]<[Array][6]<[Array][6]<[number][1]>>>>** an array of Polygons\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the Feature\n\n### Examples\n\n```javascript\nvar multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);\n\n//=multiPoly\n```\n\n*   Throws **[Error][18]** if no coordinates are passed\n\nReturns **[Feature][8]<[MultiPolygon][23]>** a multipolygon feature\n\n## geometryCollection\n\nCreates a [Feature\\<GeometryCollection>][24] based on a\ncoordinate array. Properties can be added optionally.\n\n### Parameters\n\n*   `geometries` **[Array][6]<[Geometry][5]>** an array of GeoJSON Geometries\n*   `properties` **[Object][2]** an Object of key-value pairs to add as properties (optional, default `{}`)\n*   `options` **[Object][2]** Optional Parameters (optional, default `{}`)\n\n    *   `options.bbox` **[Array][6]<[number][1]>?** Bounding Box Array \\[west, south, east, north] associated with the Feature\n    *   `options.id` **([string][7] | [number][1])?** Identifier associated with the Feature\n\n### Examples\n\n```javascript\nvar pt = turf.geometry(\"Point\", [100, 0]);\nvar line = turf.geometry(\"LineString\", [[101, 0], [102, 1]]);\nvar collection = turf.geometryCollection([pt, line]);\n\n// => collection\n```\n\nReturns **[Feature][8]<[GeometryCollection][25]>** a GeoJSON GeometryCollection Feature\n\n## round\n\nRound number to precision\n\n### Parameters\n\n*   `num` **[number][1]** Number\n*   `precision` **[number][1]** Precision (optional, default `0`)\n\n### Examples\n\n```javascript\nturf.round(120.4321)\n//=120\n\nturf.round(120.4321, 2)\n//=120.43\n```\n\nReturns **[number][1]** rounded number\n\n## radiansToLength\n\nConvert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.\nValid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n\n### Parameters\n\n*   `radians` **[number][1]** in radians across the sphere\n*   `units` **[string][7]** can be degrees, radians, miles, inches, yards, metres,\n    meters, kilometres, kilometers. (optional, default `\"kilometers\"`)\n\nReturns **[number][1]** distance\n\n## lengthToRadians\n\nConvert a distance measurement (assuming a spherical Earth) from a real-world unit into radians\nValid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n\n### Parameters\n\n*   `distance` **[number][1]** in real units\n*   `units` **[string][7]** can be degrees, radians, miles, inches, yards, metres,\n    meters, kilometres, kilometers. (optional, default `\"kilometers\"`)\n\nReturns **[number][1]** radians\n\n## lengthToDegrees\n\nConvert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees\nValid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet\n\n### Parameters\n\n*   `distance` **[number][1]** in real units\n*   `units` **[string][7]** can be degrees, radians, miles, inches, yards, metres,\n    meters, kilometres, kilometers. (optional, default `\"kilometers\"`)\n\nReturns **[number][1]** degrees\n\n## bearingToAzimuth\n\nConverts any bearing angle from the north line direction (positive clockwise)\nand returns an angle between 0-360 degrees (positive clockwise), 0 being the north line\n\n### Parameters\n\n*   `bearing` **[number][1]** angle, between -180 and +180 degrees\n\nReturns **[number][1]** angle between 0 and 360 degrees\n\n## radiansToDegrees\n\nConverts an angle in radians to degrees\n\n### Parameters\n\n*   `radians` **[number][1]** angle in radians\n\nReturns **[number][1]** degrees between 0 and 360 degrees\n\n## degreesToRadians\n\nConverts an angle in degrees to radians\n\n### Parameters\n\n*   `degrees` **[number][1]** angle between 0 and 360 degrees\n\nReturns **[number][1]** angle in radians\n\n## convertLength\n\nConverts a length to the requested unit.\nValid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n\n### Parameters\n\n*   `length` **[number][1]** to be converted\n*   `originalUnit` **Units** of the length (optional, default `\"kilometers\"`)\n*   `finalUnit` **Units** returned unit (optional, default `\"kilometers\"`)\n\nReturns **[number][1]** the converted length\n\n## convertArea\n\nConverts a area to the requested unit.\nValid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches, hectares\n\n### Parameters\n\n*   `area` **[number][1]** to be converted\n*   `originalUnit` **Units** of the distance (optional, default `\"meters\"`)\n*   `finalUnit` **Units** returned unit (optional, default `\"kilometers\"`)\n\nReturns **[number][1]** the converted area\n\n## isNumber\n\nisNumber\n\n### Parameters\n\n*   `num` **any** Number to validate\n\n### Examples\n\n```javascript\nturf.isNumber(123)\n//=true\nturf.isNumber('foo')\n//=false\n```\n\nReturns **[boolean][26]** true/false\n\n## isObject\n\nisObject\n\n### Parameters\n\n*   `input` **any** variable to validate\n\n### Examples\n\n```javascript\nturf.isObject({elevation: 10})\n//=true\nturf.isObject('foo')\n//=false\n```\n\nReturns **[boolean][26]** true/false, including false for Arrays and Functions\n\n[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\n\n[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object\n\n[3]: https://tools.ietf.org/html/rfc7946#section-3.1\n\n[4]: https://tools.ietf.org/html/rfc7946#section-3.2\n\n[5]: https://tools.ietf.org/html/rfc7946#section-3.1\n\n[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array\n\n[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String\n\n[8]: https://tools.ietf.org/html/rfc7946#section-3.2\n\n[9]: https://tools.ietf.org/html/rfc7946#section-3.1.2\n\n[10]: https://tools.ietf.org/html/rfc7946#section-3.1.2\n\n[11]: https://tools.ietf.org/html/rfc7946#section-3.3\n\n[12]: https://tools.ietf.org/html/rfc7946#section-3.3\n\n[13]: https://tools.ietf.org/html/rfc7946#section-3.1.6\n\n[14]: https://tools.ietf.org/html/rfc7946#section-3.1.6\n\n[15]: https://tools.ietf.org/html/rfc7946#section-3.1.4\n\n[16]: https://tools.ietf.org/html/rfc7946#section-3.1.4\n\n[17]: Feature<MultiLineString>\n\n[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error\n\n[19]: https://tools.ietf.org/html/rfc7946#section-3.1.5\n\n[20]: Feature<MultiPoint>\n\n[21]: https://tools.ietf.org/html/rfc7946#section-3.1.3\n\n[22]: Feature<MultiPolygon>\n\n[23]: https://tools.ietf.org/html/rfc7946#section-3.1.7\n\n[24]: Feature<GeometryCollection>\n\n[25]: https://tools.ietf.org/html/rfc7946#section-3.1.8\n\n[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean\n\n<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run \"yarn docs\" from the root of the turf project. -->\n\n---\n\nThis module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.\n\n### Installation\n\nInstall this single module individually:\n\n```sh\n$ npm install @turf/helpers\n```\n\nOr install the all-encompassing @turf/turf module that includes all modules as functions:\n\n```sh\n$ npm install @turf/turf\n```\n","publish_time":1505222466229,"_cnpm_publish_time":1505222466229,"dist-tags":{"canary":"3.5.2-alpha.d2c36ee7","latest":"7.4.0","prerelease":"7.1.0-alpha.70"}}