{"name":"@turf/invariant","version":"7.3.0","keywords":["turf","invariant","expectations"],"author":"Turf Authors","license":"MIT","_id":"@turf/invariant@7.3.0","maintainers":[{"name":"rowanwins","email":"rowanwins@yahoo.com.au"},{"name":"tmcw","email":"tom@macwright.com"},{"name":"morganherlocker","email":"morgan.herlocker@gmail.com"},{"name":"tcql","email":"tim.channell@gmail.com"},{"name":"mdfedderly","email":"mdfedderly@mdfedderly.com"},{"name":"twelch","email":"tim.j.welch@gmail.com"},{"name":"jamesmilneruk","email":"jamesmilner22@hotmail.com"},{"name":"morgan.herlocker","email":"morganherlocker@gmail.com"},{"name":"smallsaucepan","email":"james@smallsaucepan.com"}],"contributors":["Tom MacWright <@tmcw>","Denis Carriere <@DenisCarriere>"],"homepage":"https://github.com/Turfjs/turf","bugs":{"url":"https://github.com/Turfjs/turf/issues"},"dist":{"shasum":"4947d432e1b8a65472fcf8a1040f10a49f8fd10b","tarball":"http://registry-npm.ywwl.com/@turf/invariant/download/@turf/invariant-7.3.0.tgz","fileCount":9,"integrity":"sha512-AmDFmdhpbLZv0zlI4EF4bVFE0iYmKcOBI2m8DTcFFUQDRusgjc+NLCnX1RIENfYyeI2FKHg84E9vSt6XytUDvw==","signatures":[{"sig":"MEUCIHRldAUKmD+8sGobWKKSu77zvIAFn4zTxEvKQgz/w26vAiEAu2GXTQgevtjgBTranSNaXV0S4gLyaLTAUiNRBUUcUwQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45714,"size":8032,"noattachment":false,"key":"/@turf/invariant/-/@turf/invariant-7.3.0.tgz"},"main":"dist/cjs/index.cjs","type":"module","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}},"./package.json":"./package.json"},"funding":"https://opencollective.com/turf","gitHead":"9f58a103e8f9a587ab640307ed03ba5233913ddd","scripts":{"docs":"tsx ../../scripts/generate-readmes.ts","test":"npm-run-all --npm-path npm test:*","bench":"tsx bench.ts","build":"tsup --config ../../tsup.config.ts","test:tape":"tsx test.ts","test:types":"tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"},"_npmUser":{"name":"mdfedderly","email":"mdfedderly@mdfedderly.com"},"repository":{"url":"git://github.com/Turfjs/turf.git","type":"git"},"_npmVersion":"lerna/8.2.2/node@v20.19.5+x64 (linux)","description":"Lightweight utility for input validation and data extraction in Turf.js. Ensures GeoJSON inputs are in the correct format and extracts specific components like coordinates or geometries.","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"tslib":"^2.8.1","@turf/helpers":"7.3.0","@types/geojson":"^7946.0.10"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.4","tape":"^5.9.0","tsup":"^8.4.0","benchmark":"^2.1.4","typescript":"^5.8.3","@types/tape":"^5.8.1","npm-run-all":"^4.1.5","@types/benchmark":"^2.1.5"},"_npmOperationalInternal":{"tmp":"tmp/invariant_7.3.0_1763371504186_0.21795588235919805","host":"s3://npm-registry-packages-npm-production"},"readme":"# @turf/invariant\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n## getCoord\n\nUnwrap a coordinate from a Point Feature, Geometry or a single coordinate.\n\n### Parameters\n\n*   `coord` **([Array][1]<[number][2]> | [Geometry][3]<[Point][4]> | [Feature][5]<[Point][4]>)** GeoJSON Point or an Array of numbers\n\n### Examples\n\n```javascript\nvar pt = turf.point([10, 10]);\n\nvar coord = turf.getCoord(pt);\n//= [10, 10]\n```\n\nReturns **[Array][1]<[number][2]>** coordinates\n\n## getCoords\n\nUnwrap coordinates from a Feature, Geometry Object or an Array\n\n### Parameters\n\n*   `coords` **([Array][1]\\<any> | [Geometry][3] | [Feature][5])** Feature, Geometry Object or an Array\n\n### Examples\n\n```javascript\nvar poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]);\n\nvar coords = turf.getCoords(poly);\n//= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]\n```\n\nReturns **[Array][1]\\<any>** coordinates\n\n## containsNumber\n\nChecks if coordinates contains a number\n\n### Parameters\n\n*   `coordinates` **[Array][1]\\<any>** GeoJSON Coordinates\n\nReturns **[boolean][6]** true if Array contains a number\n\n## geojsonType\n\nEnforce expectations about types of GeoJSON objects for Turf.\n\n### Parameters\n\n*   `value` **[GeoJSON][7]** any GeoJSON object\n*   `type` **[string][8]** expected GeoJSON type\n*   `name` **[string][8]** name of calling function\n\n<!---->\n\n*   Throws **[Error][9]** if value is not the expected type.\n\nReturns **void**&#x20;\n\n## featureOf\n\nEnforce expectations about types of [Feature][5] inputs for Turf.\nInternally this uses [geojsonType][10] to judge geometry types.\n\n### Parameters\n\n*   `feature` **[Feature][5]** a feature with an expected geometry type\n*   `type` **[string][8]** expected GeoJSON type\n*   `name` **[string][8]** name of calling function\n\n<!---->\n\n*   Throws **[Error][9]** error if value is not the expected type.\n\nReturns **void**&#x20;\n\n## collectionOf\n\nEnforce expectations about types of [FeatureCollection][11] inputs for Turf.\nInternally this uses [geojsonType][10] to judge geometry types.\n\n### Parameters\n\n*   `featureCollection` **[FeatureCollection][11]** a FeatureCollection for which features will be judged\n*   `type` **[string][8]** expected GeoJSON type\n*   `name` **[string][8]** name of calling function\n\n<!---->\n\n*   Throws **[Error][9]** if value is not the expected type.\n\n## getGeom\n\nGet Geometry from Feature or Geometry Object\n\n### Parameters\n\n*   `geojson` **([Feature][5] | [Geometry][3])** GeoJSON Feature or Geometry Object\n\n### Examples\n\n```javascript\nvar point = {\n  \"type\": \"Feature\",\n  \"properties\": {},\n  \"geometry\": {\n    \"type\": \"Point\",\n    \"coordinates\": [110, 40]\n  }\n}\nvar geom = turf.getGeom(point)\n//={\"type\": \"Point\", \"coordinates\": [110, 40]}\n```\n\n*   Throws **[Error][9]** if geojson is not a Feature or Geometry Object\n\nReturns **([Geometry][3] | null)** GeoJSON Geometry Object\n\n## getType\n\nGet GeoJSON object's type, Geometry type is prioritize.\n\n### Parameters\n\n*   `geojson` **[GeoJSON][7]** GeoJSON object\n*   `_name` **[string][8]?**&#x20;\n*   `name` **[string][8]** name of the variable to display in error message (unused) (optional, default `\"geojson\"`)\n\n### Examples\n\n```javascript\nvar point = {\n  \"type\": \"Feature\",\n  \"properties\": {},\n  \"geometry\": {\n    \"type\": \"Point\",\n    \"coordinates\": [110, 40]\n  }\n}\nvar geom = turf.getType(point)\n//=\"Point\"\n```\n\nReturns **[string][8]** GeoJSON type\n\n[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array\n\n[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\n\n[3]: https://tools.ietf.org/html/rfc7946#section-3.1\n\n[4]: https://tools.ietf.org/html/rfc7946#section-3.1.2\n\n[5]: https://tools.ietf.org/html/rfc7946#section-3.2\n\n[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean\n\n[7]: https://tools.ietf.org/html/rfc7946#section-3\n\n[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String\n\n[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error\n\n[10]: #geojsontype\n\n[11]: https://tools.ietf.org/html/rfc7946#section-3.3\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/invariant\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":1763371504370,"_cnpm_publish_time":1763371504370,"dist-tags":{"canary":"3.5.2-alpha.d2c36ee7","latest":"7.4.0","prerelease":"7.1.0-alpha.70"}}