From e0d5bbc9a6834e7ff2682da66d74fd7240b9de90 Mon Sep 17 00:00:00 2001 From: Nick Rabinowitz Date: Thu, 28 Jul 2022 17:53:59 -0700 Subject: [PATCH 1/2] Cleanup: Remove unnecessary files from package, update error docs --- .npmignore | 4 ++ README.md | 120 +++++++++++++++++++++++++++++++---- lib/errors.js | 9 +++ lib/h3core.js | 68 +++++++++++++------- out/libh3.js | 2 +- scripts/update-emscripten.sh | 2 +- 6 files changed, 169 insertions(+), 36 deletions(-) diff --git a/.npmignore b/.npmignore index 522af2c..6ec9b68 100644 --- a/.npmignore +++ b/.npmignore @@ -8,3 +8,7 @@ build/ test/ *.sublime-project *.sublime-workspace +cmake/ +doc-files/ +scripts/ +out/ \ No newline at end of file diff --git a/README.md b/README.md index 6949669..4103cc5 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,10 @@ Get the number of the base cell for a given H3 index Get the indices of all icosahedron faces intersected by a given H3 index **Returns**: Array.<number> - Indices (0-19) of all intersected faces +**Throws**: + +- H3Error Error if input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -262,6 +266,10 @@ Returns the resolution of an H3 index Get the hexagon containing a lat,lon point **Returns**: H3Index - H3 index +**Throws**: + +- H3Error Error if input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -278,6 +286,10 @@ Get the hexagon containing a lat,lon point Get the lat,lon center of a given hexagon **Returns**: Array.<number> - Point as a [lat, lng] pair +**Throws**: + +- H3Error Error if input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -294,6 +306,10 @@ points. For pentagons and hexagons on the edge of an icosahedron face, this function may return up to 10 vertices. **Returns**: Array.<Array.<number>> - Array of [lat, lng] pairs +**Throws**: + +- H3Error Error if input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -309,6 +325,10 @@ function may return up to 10 vertices. Get the parent of the given hexagon at a particular resolution **Returns**: H3Index - H3 index of parent, or null for invalid input +**Throws**: + +- H3Error Error if input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -324,6 +344,10 @@ Get the parent of the given hexagon at a particular resolution Get the children/descendents of the given hexagon at a particular resolution **Returns**: Array.<H3Index> - H3 indexes of children, or empty array for invalid input +**Throws**: + +- H3Error Error if resolution is invalid or output is too large for JS + | Param | Type | Description | | --- | --- | --- | @@ -339,6 +363,10 @@ Get the children/descendents of the given hexagon at a particular resolution Get the center child of the given hexagon at a particular resolution **Returns**: H3Index - H3 index of child, or null for invalid input +**Throws**: + +- H3Error Error if resolution is invalid + | Param | Type | Description | | --- | --- | --- | @@ -354,6 +382,10 @@ Get the center child of the given hexagon at a particular resolution Get all hexagons in a k-ring around a given center. The order of the hexagons is undefined. **Returns**: Array.<H3Index> - H3 indexes for all hexagons in ring +**Throws**: + +- H3Error Error if input is invalid or output is too large for JS + | Param | Type | Description | | --- | --- | --- | @@ -370,6 +402,10 @@ Get all hexagons in a k-ring around a given center, in an array of arrays ordered by distance from the origin. The order of the hexagons within each ring is undefined. **Returns**: Array.<Array.<H3Index>> - Array of arrays with H3 indexes for all hexagons each ring +**Throws**: + +- H3Error Error if input is invalid or output is too large for JS + | Param | Type | Description | | --- | --- | --- | @@ -389,6 +425,7 @@ Unlike kRing, this function will throw an error if there is a pentagon anywhere **Throws**: - Error If the algorithm could not calculate the ring +- H3Error Error if input is invalid | Param | Type | Description | @@ -409,6 +446,10 @@ The first loop is the perimeter of the polygon, and subsequent loops are expected to be holes. **Returns**: Array.<H3Index> - H3 indexes for all hexagons in polygon +**Throws**: + +- H3Error Error if input is invalid or output is too large for JS + | Param | Type | Description | | --- | --- | --- | @@ -433,6 +474,10 @@ is undefined if duplicates or multiple resolutions are present, and the algorithm may produce unexpected or invalid polygons. **Returns**: Array.<Array.<Array.<Array.<number>>>> - MultiPolygon-style output. +**Throws**: + +- H3Error Error if input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -451,7 +496,7 @@ multiple levels that represents the same area. **Returns**: Array.<H3Index> - Compacted H3 indexes **Throws**: -- Error If the input is invalid (e.g. duplicate hexagons) +- H3Error Error if the input is invalid (e.g. duplicate hexagons) | Param | Type | Description | @@ -469,7 +514,7 @@ Uncompact a compacted set of hexagons to hexagons of the same resolution **Returns**: Array.<H3Index> - The uncompacted H3 indexes **Throws**: -- Error If the input is invalid (e.g. invalid resolution) +- H3Error Error if the input is invalid (e.g. invalid resolution) | Param | Type | Description | @@ -486,6 +531,10 @@ Uncompact a compacted set of hexagons to hexagons of the same resolution Whether two H3 indexes are neighbors (share an edge) **Returns**: boolean - Whether the hexagons share an edge +**Throws**: + +- H3Error Error if the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -501,6 +550,10 @@ Whether two H3 indexes are neighbors (share an edge) Get an H3 index representing a unidirectional edge for a given origin and destination **Returns**: H3Index - H3 index of the edge, or null if no edge is shared +**Throws**: + +- H3Error Error if the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -516,6 +569,10 @@ Get an H3 index representing a unidirectional edge for a given origin and destin Get the origin hexagon from an H3 index representing a unidirectional edge **Returns**: H3Index - H3 index of the edge origin +**Throws**: + +- H3Error Error if the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -530,6 +587,10 @@ Get the origin hexagon from an H3 index representing a unidirectional edge Get the destination hexagon from an H3 index representing a unidirectional edge **Returns**: H3Index - H3 index of the edge destination +**Throws**: + +- H3Error Error if the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -558,6 +619,10 @@ Whether the input is a valid unidirectional edge Get the [origin, destination] pair represented by a unidirectional edge **Returns**: Array.<H3Index> - [origin, destination] pair as H3 indexes +**Throws**: + +- H3Error Error if the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -573,6 +638,10 @@ Get all of the unidirectional edges with the given H3 index as the origin (i.e. every neighbor) **Returns**: Array.<H3Index> - List of unidirectional edges +**Throws**: + +- H3Error Error if the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -588,6 +657,10 @@ Get the vertices of a given edge as an array of [lat, lng] points. Note that for cross the edge of an icosahedron face, this may return 3 coordinates. **Returns**: Array.<Array.<number>> - Array of geo coordinate pairs +**Throws**: + +- H3Error Error if the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -604,8 +677,11 @@ Get the grid distance between two hex indexes. This function may fail to find the distance between two indexes if they are very far apart or on opposite sides of a pentagon. -**Returns**: number - Distance between hexagons, or a negative - number if the distance could not be computed +**Returns**: number - Distance between hexagons +**Throws**: + +- H3Error Error if input is invalid or the distance could not be calculated + | Param | Type | Description | | --- | --- | --- | @@ -636,7 +712,7 @@ Notes: **Returns**: Array.<H3Index> - H3 indexes connecting origin and destination **Throws**: -- Error If the line cannot be calculated +- H3Error Error if input is invalid or the line cannot be calculated | Param | Type | Description | @@ -664,7 +740,7 @@ to be compatible across different versions of H3. **Returns**: CoordIJ - Coordinates as an `{i, j}` pair **Throws**: -- Error If the IJ coordinates cannot be calculated +- H3Error If the IJ coordinates cannot be calculated | Param | Type | Description | @@ -692,7 +768,7 @@ to be compatible across different versions of H3. **Returns**: H3Index - H3 index at the relative coordinates **Throws**: -- Error If the H3 index cannot be calculated +- H3Error If the H3 index cannot be calculated | Param | Type | Description | @@ -712,7 +788,7 @@ but is implemented in the library and provided here as a convenience. **Returns**: number - Great circle distance **Throws**: -- Error If the unit is invalid +- H3Error If the unit is invalid | Param | Type | Description | @@ -732,7 +808,7 @@ Exact area of a given cell **Returns**: number - Cell area **Throws**: -- Error If the unit is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -751,7 +827,7 @@ Exact length of a given unidirectional edge **Returns**: number - Cell area **Throws**: -- Error If the unit is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -770,7 +846,7 @@ Average hexagon area at a given resolution **Returns**: number - Average area **Throws**: -- Error If the unit is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -789,7 +865,7 @@ Average hexagon edge length at a given resolution **Returns**: number - Average edge length **Throws**: -- Error If the unit is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -806,6 +882,10 @@ Average hexagon edge length at a given resolution Find the index for a vertex of a cell. **Returns**: H3Index - Vertex index +**Throws**: + +- H3Error If the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -821,6 +901,10 @@ Find the index for a vertex of a cell. Find the indexes for all vertexes of a cell. **Returns**: Array.<H3Index> - All vertex indexes of this cell +**Throws**: + +- H3Error If the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -835,6 +919,10 @@ Find the indexes for all vertexes of a cell. Get the lat, lng of a given vertex **Returns**: Array.<number> - Latitude, longitude coordinates of the vertex +**Throws**: + +- H3Error If the input is invalid + | Param | Type | Description | | --- | --- | --- | @@ -865,6 +953,10 @@ resolution 8 the exact count cannot be represented in a JavaScript 32-bit number so consumers should use caution when applying further operations to the output. **Returns**: number - Count +**Throws**: + +- H3Error If the resolution is invalid + | Param | Type | Description | | --- | --- | --- | @@ -890,6 +982,10 @@ over H3 indexes at any resolution. Get the twelve pentagon indexes at a given resolution. **Returns**: Array.<H3Index> - All H3 pentagon indexes at res +**Throws**: + +- H3Error If the resolution is invalid + | Param | Type | Description | | --- | --- | --- | diff --git a/lib/errors.js b/lib/errors.js index b4357ac..c041b7f 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -60,6 +60,15 @@ const H3_ERROR_MSGS = { export const E_UNKNOWN_UNIT = 1000; export const E_ARRAY_LENGTH = 1001; +/** + * Custom JS Error with an attached error code. Error codes come from the + * core H3 library and can be found [in the H3 docs](https://h3geo.org/docs/next/library/errors#table-of-error-codes). + * @static + * @typedef {string} H3Error + * @extends {Error} + * @property {number} code + */ + /** * Error messages for errors thrown in the binding code. These don't strictly * need error codes, but it's simpler to treat all of the errors consistently diff --git a/lib/h3core.js b/lib/h3core.js index c4de3fc..27102f8 100644 --- a/lib/h3core.js +++ b/lib/h3core.js @@ -112,7 +112,7 @@ export const UNITS = { * Validate a resolution, throwing an error if invalid * @private * @param {unknown} res Value to validate - * @throws {Error} Error if invalid + * @throws {H3Error} Error if invalid */ function validateRes(res) { if (typeof res !== 'number' || res < 0 || res > 15 || Math.floor(res) !== res) { @@ -129,7 +129,7 @@ const MAX_JS_ARRAY_LENGTH = Math.pow(2, 32) - 1; * of data that won't even fit in an output array * @private * @param {number} length Length to validate - * @throws {Error} Error if invalid + * @throws {H3Error} Error if invalid */ function validateArrayLength(length) { if (length > MAX_JS_ARRAY_LENGTH) { @@ -595,7 +595,8 @@ export function getBaseCellNumber(h3Index) { * Get the indices of all icosahedron faces intersected by a given H3 index * @static * @param {H3IndexInput} h3Index H3 index to get faces for - * @return {number[]} Indices (0-19) of all intersected faces + * @return {number[]} Indices (0-19) of all intersected faces + * @throws {H3Error} Error if input is invalid */ export function getIcosahedronFaces(h3Index) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -637,6 +638,7 @@ export function getResolution(h3Index) { * @param {number} lng Longtitude of point * @param {number} res Resolution of hexagons to return * @return {H3Index} H3 index + * @throws {H3Error} Error if input is invalid */ export function latLngToCell(lat, lng, res) { const latLng = C._malloc(SZ_LATLNG); @@ -657,7 +659,8 @@ export function latLngToCell(lat, lng, res) { * Get the lat,lon center of a given hexagon * @static * @param {H3IndexInput} h3Index H3 index - * @return {number[]} Point as a [lat, lng] pair + * @return {number[]} Point as a [lat, lng] pair + * @throws {H3Error} Error if input is invalid */ export function cellToLatLng(h3Index) { const latLng = C._malloc(SZ_LATLNG); @@ -678,6 +681,7 @@ export function cellToLatLng(h3Index) { * @param {H3Index} h3Index H3 index * @param {boolean} [formatAsGeoJson] Whether to provide GeoJSON output: [lng, lat], closed loops * @return {number[][]} Array of [lat, lng] pairs + * @throws {H3Error} Error if input is invalid */ export function cellToBoundary(h3Index, formatAsGeoJson) { const cellBoundary = C._malloc(SZ_CELLBOUNDARY); @@ -699,6 +703,7 @@ export function cellToBoundary(h3Index, formatAsGeoJson) { * @param {H3IndexInput} h3Index H3 index to get parent for * @param {number} res Resolution of hexagon to return * @return {H3Index} H3 index of parent, or null for invalid input + * @throws {H3Error} Error if input is invalid */ export function cellToParent(h3Index, res) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -717,6 +722,7 @@ export function cellToParent(h3Index, res) { * @param {H3IndexInput} h3Index H3 index to get children for * @param {number} res Resolution of hexagons to return * @return {H3Index[]} H3 indexes of children, or empty array for invalid input + * @throws {H3Error} Error if resolution is invalid or output is too large for JS */ export function cellToChildren(h3Index, res) { // Bad input in this case can potentially result in high computation volume @@ -748,6 +754,7 @@ export function cellToChildren(h3Index, res) { * @param {H3IndexInput} h3Index H3 index to get center child for * @param {number} res Resolution of hexagon to return * @return {H3Index} H3 index of child, or null for invalid input + * @throws {H3Error} Error if resolution is invalid */ export function cellToCenterChild(h3Index, res) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -766,6 +773,7 @@ export function cellToCenterChild(h3Index, res) { * @param {H3IndexInput} h3Index H3 index of center hexagon * @param {number} ringSize Radius of k-ring * @return {H3Index[]} H3 indexes for all hexagons in ring + * @throws {H3Error} Error if input is invalid or output is too large for JS */ export function gridDisk(h3Index, ringSize) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -793,6 +801,7 @@ export function gridDisk(h3Index, ringSize) { * @param {H3IndexInput} h3Index H3 index of center hexagon * @param {number} ringSize Radius of k-ring * @return {H3Index[][]} Array of arrays with H3 indexes for all hexagons each ring + * @throws {H3Error} Error if input is invalid or output is too large for JS */ export function gridDiskDistances(h3Index, ringSize) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -837,6 +846,7 @@ export function gridDiskDistances(h3Index, ringSize) { * @param {number} ringSize Radius of ring * @return {H3Index[]} H3 indexes for all hexagons in ring * @throws {Error} If the algorithm could not calculate the ring + * @throws {H3Error} Error if input is invalid */ export function gridRingUnsafe(h3Index, ringSize) { const maxCount = ringSize === 0 ? 1 : 6 * ringSize; @@ -862,6 +872,7 @@ export function gridRingUnsafe(h3Index, ringSize) { * @param {boolean} [isGeoJson] Whether to expect GeoJson-style [lng, lat] * pairs instead of [lat, lng] * @return {H3Index[]} H3 indexes for all hexagons in polygon + * @throws {H3Error} Error if input is invalid or output is too large for JS */ export function polygonToCells(coordinates, res, isGeoJson) { validateRes(res); @@ -909,6 +920,7 @@ export function polygonToCells(coordinates, res, isGeoJson) { * @param {boolean} [formatAsGeoJson] Whether to provide GeoJSON output: * [lng, lat], closed loops * @return {number[][][][]} MultiPolygon-style output. + * @throws {H3Error} Error if input is invalid */ export function cellsToMultiPolygon(h3Indexes, formatAsGeoJson) { // Early exit on empty input @@ -938,7 +950,7 @@ export function cellsToMultiPolygon(h3Indexes, formatAsGeoJson) { * @static * @param {H3IndexInput[]} h3Set H3 indexes to compact * @return {H3Index[]} Compacted H3 indexes - * @throws {Error} If the input is invalid (e.g. duplicate hexagons) + * @throws {H3Error} Error if the input is invalid (e.g. duplicate hexagons) */ export function compactCells(h3Set) { if (!h3Set || !h3Set.length) { @@ -965,7 +977,7 @@ export function compactCells(h3Set) { * @param {H3IndexInput[]} compactedSet H3 indexes to uncompact * @param {number} res The resolution to uncompact to * @return {H3Index[]} The uncompacted H3 indexes - * @throws {Error} If the input is invalid (e.g. invalid resolution) + * @throws {H3Error} Error if the input is invalid (e.g. invalid resolution) */ export function uncompactCells(compactedSet, res) { validateRes(res); @@ -1017,6 +1029,7 @@ export function uncompactCells(compactedSet, res) { * @param {H3IndexInput} origin Origin hexagon index * @param {H3IndexInput} destination Destination hexagon index * @return {boolean} Whether the hexagons share an edge + * @throws {H3Error} Error if the input is invalid */ export function areNeighborCells(origin, destination) { const [oLower, oUpper] = h3IndexToSplitLong(origin); @@ -1036,6 +1049,7 @@ export function areNeighborCells(origin, destination) { * @param {H3IndexInput} origin Origin hexagon index * @param {H3IndexInput} destination Destination hexagon index * @return {H3Index} H3 index of the edge, or null if no edge is shared + * @throws {H3Error} Error if the input is invalid */ export function cellsToDirectedEdge(origin, destination) { const [oLower, oUpper] = h3IndexToSplitLong(origin); @@ -1054,6 +1068,7 @@ export function cellsToDirectedEdge(origin, destination) { * @static * @param {H3IndexInput} edgeIndex H3 index of the edge * @return {H3Index} H3 index of the edge origin + * @throws {H3Error} Error if the input is invalid */ export function getDirectedEdgeOrigin(edgeIndex) { const [lower, upper] = h3IndexToSplitLong(edgeIndex); @@ -1071,6 +1086,7 @@ export function getDirectedEdgeOrigin(edgeIndex) { * @static * @param {H3IndexInput} edgeIndex H3 index of the edge * @return {H3Index} H3 index of the edge destination + * @throws {H3Error} Error if the input is invalid */ export function getDirectedEdgeDestination(edgeIndex) { const [lower, upper] = h3IndexToSplitLong(edgeIndex); @@ -1099,6 +1115,7 @@ export function isValidDirectedEdge(edgeIndex) { * @static * @param {H3IndexInput} edgeIndex H3 index of the edge * @return {H3Index[]} [origin, destination] pair as H3 indexes + * @throws {H3Error} Error if the input is invalid */ export function directedEdgeToCells(edgeIndex) { const [lower, upper] = h3IndexToSplitLong(edgeIndex); @@ -1118,6 +1135,7 @@ export function directedEdgeToCells(edgeIndex) { * @static * @param {H3IndexInput} h3Index H3 index of the origin hexagon * @return {H3Index[]} List of unidirectional edges + * @throws {H3Error} Error if the input is invalid */ export function originToDirectedEdges(h3Index) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -1138,6 +1156,7 @@ export function originToDirectedEdges(h3Index) { * @param {H3IndexInput} edgeIndex H3 index of the edge * @param {boolean} [formatAsGeoJson] Whether to provide GeoJSON output: [lng, lat] * @return {number[][]} Array of geo coordinate pairs + * @throws {H3Error} Error if the input is invalid */ export function directedEdgeToBoundary(edgeIndex, formatAsGeoJson) { const cellBoundary = C._malloc(SZ_CELLBOUNDARY); @@ -1157,8 +1176,8 @@ export function directedEdgeToBoundary(edgeIndex, formatAsGeoJson) { * @static * @param {H3IndexInput} origin Origin hexagon index * @param {H3IndexInput} destination Destination hexagon index - * @return {number} Distance between hexagons, or a negative - * number if the distance could not be computed + * @return {number} Distance between hexagons + * @throws {H3Error} Error if input is invalid or the distance could not be calculated */ export function gridDistance(origin, destination) { const [oLower, oUpper] = h3IndexToSplitLong(origin); @@ -1192,7 +1211,7 @@ export function gridDistance(origin, destination) { * @param {H3IndexInput} origin Origin hexagon index * @param {H3IndexInput} destination Destination hexagon index * @return {H3Index[]} H3 indexes connecting origin and destination - * @throws {Error} If the line cannot be calculated + * @throws {H3Error} Error if input is invalid or the line cannot be calculated */ export function gridPathCells(origin, destination) { const [oLower, oUpper] = h3IndexToSplitLong(origin); @@ -1231,7 +1250,7 @@ const LOCAL_IJ_DEFAULT_MODE = 0; * @param {H3IndexInput} origin Origin H3 index * @param {H3IndexInput} destination H3 index for which to find relative coordinates * @return {CoordIJ} Coordinates as an `{i, j}` pair - * @throws {Error} If the IJ coordinates cannot be calculated + * @throws {H3Error} If the IJ coordinates cannot be calculated */ export function cellToLocalIj(origin, destination) { const ij = C._malloc(SZ_COORDIJ); @@ -1265,7 +1284,7 @@ export function cellToLocalIj(origin, destination) { * @param {H3IndexInput} origin Origin H3 index * @param {CoordIJ} coords Coordinates as an `{i, j}` pair * @return {H3Index} H3 index at the relative coordinates - * @throws {Error} If the H3 index cannot be calculated + * @throws {H3Error} If the H3 index cannot be calculated */ export function localIjToCell(origin, coords) { // Validate input coords @@ -1298,7 +1317,7 @@ export function localIjToCell(origin, coords) { * @param {number[]} latLng2 Destination coordinate as [lat, lng] * @param {string} unit Distance unit (either UNITS.m, UNITS.km, or UNITS.rads) * @return {number} Great circle distance - * @throws {Error} If the unit is invalid + * @throws {H3Error} If the unit is invalid */ export function greatCircleDistance(latLng1, latLng2, unit) { const coord1 = storeLatLng(latLng1[0], latLng1[1]); @@ -1331,7 +1350,7 @@ export function greatCircleDistance(latLng1, latLng2, unit) { * @param {H3Index} h3Index H3 index of the hexagon to measure * @param {string} unit Distance unit (either UNITS.m2, UNITS.km2, or UNITS.rads2) * @return {number} Cell area - * @throws {Error} If the unit is invalid + * @throws {H3Error} If the input is invalid */ export function cellArea(h3Index, unit) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -1362,7 +1381,7 @@ export function cellArea(h3Index, unit) { * @param {H3Index} edge H3 index of the edge to measure * @param {string} unit Distance unit (either UNITS.m, UNITS.km, or UNITS.rads) * @return {number} Cell area - * @throws {Error} If the unit is invalid + * @throws {H3Error} If the input is invalid */ export function exactEdgeLength(edge, unit) { const [lower, upper] = h3IndexToSplitLong(edge); @@ -1393,7 +1412,7 @@ export function exactEdgeLength(edge, unit) { * @param {number} res Hexagon resolution * @param {string} unit Area unit (either UNITS.m2, UNITS.km2, or UNITS.rads2) * @return {number} Average area - * @throws {Error} If the unit is invalid + * @throws {H3Error} If the input is invalid */ export function getHexagonAreaAvg(res, unit) { validateRes(res); @@ -1421,7 +1440,7 @@ export function getHexagonAreaAvg(res, unit) { * @param {number} res Hexagon resolution * @param {string} unit Distance unit (either UNITS.m, UNITS.km, or UNITS.rads) * @return {number} Average edge length - * @throws {Error} If the unit is invalid + * @throws {H3Error} If the input is invalid */ export function getHexagonEdgeLengthAvg(res, unit) { validateRes(res); @@ -1449,9 +1468,10 @@ export function getHexagonEdgeLengthAvg(res, unit) { /** * Find the index for a vertex of a cell. * @static - * @param {H3IndexInput} h3Index Cell to find the vertex for - * @param {number} vertexNum Number (index) of the vertex to calculate - * @return {H3Index} Vertex index + * @param {H3IndexInput} h3Index Cell to find the vertex for + * @param {number} vertexNum Number (index) of the vertex to calculate + * @return {H3Index} Vertex index + * @throws {H3Error} If the input is invalid */ export function cellToVertex(h3Index, vertexNum) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -1467,8 +1487,9 @@ export function cellToVertex(h3Index, vertexNum) { /** * Find the indexes for all vertexes of a cell. * @static - * @param {H3IndexInput} h3Index Cell to find all vertexes for - * @return {H3Index[]} All vertex indexes of this cell + * @param {H3IndexInput} h3Index Cell to find all vertexes for + * @return {H3Index[]} All vertex indexes of this cell + * @throws {H3Error} If the input is invalid */ export function cellToVertexes(h3Index) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -1487,6 +1508,7 @@ export function cellToVertexes(h3Index) { * @static * @param {H3IndexInput} h3Index A vertex index * @returns {number[]} Latitude, longitude coordinates of the vertex + * @throws {H3Error} If the input is invalid */ export function vertexToLatLng(h3Index) { const latlng = C._malloc(SZ_LATLNG); @@ -1520,6 +1542,7 @@ export function isValidVertex(h3Index) { * @static * @param {number} res Hexagon resolution * @return {number} Count + * @throws {H3Error} If the resolution is invalid */ export function getNumCells(res) { validateRes(res); @@ -1555,7 +1578,8 @@ export function getRes0Cells() { * Get the twelve pentagon indexes at a given resolution. * @static * @param {number} res Hexagon resolution - * @return {H3Index[]} All H3 pentagon indexes at res + * @return {H3Index[]} All H3 pentagon indexes at res + * @throws {H3Error} If the resolution is invalid */ export function getPentagons(res) { validateRes(res); diff --git a/out/libh3.js b/out/libh3.js index 0373f65..1ae04e0 100644 --- a/out/libh3.js +++ b/out/libh3.js @@ -14,7 +14,7 @@ return{___divdi3:kd,___muldi3:md,___remdi3:nd,___uremdi3:od,_areNeighborCells:Ya // EMSCRIPTEN_END_ASM -(asmGlobalArg,asmLibraryArg,buffer);var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var ___remdi3=Module["___remdi3"]=asm["___remdi3"];var ___uremdi3=Module["___uremdi3"]=asm["___uremdi3"];var _areNeighborCells=Module["_areNeighborCells"]=asm["_areNeighborCells"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _calloc=Module["_calloc"]=asm["_calloc"];var _cellAreaKm2=Module["_cellAreaKm2"]=asm["_cellAreaKm2"];var _cellAreaM2=Module["_cellAreaM2"]=asm["_cellAreaM2"];var _cellAreaRads2=Module["_cellAreaRads2"]=asm["_cellAreaRads2"];var _cellToBoundary=Module["_cellToBoundary"]=asm["_cellToBoundary"];var _cellToCenterChild=Module["_cellToCenterChild"]=asm["_cellToCenterChild"];var _cellToChildren=Module["_cellToChildren"]=asm["_cellToChildren"];var _cellToChildrenSize=Module["_cellToChildrenSize"]=asm["_cellToChildrenSize"];var _cellToLatLng=Module["_cellToLatLng"]=asm["_cellToLatLng"];var _cellToLocalIj=Module["_cellToLocalIj"]=asm["_cellToLocalIj"];var _cellToParent=Module["_cellToParent"]=asm["_cellToParent"];var _cellToVertex=Module["_cellToVertex"]=asm["_cellToVertex"];var _cellToVertexes=Module["_cellToVertexes"]=asm["_cellToVertexes"];var _cellsToDirectedEdge=Module["_cellsToDirectedEdge"]=asm["_cellsToDirectedEdge"];var _cellsToLinkedMultiPolygon=Module["_cellsToLinkedMultiPolygon"]=asm["_cellsToLinkedMultiPolygon"];var _compactCells=Module["_compactCells"]=asm["_compactCells"];var _destroyLinkedMultiPolygon=Module["_destroyLinkedMultiPolygon"]=asm["_destroyLinkedMultiPolygon"];var _directedEdgeToBoundary=Module["_directedEdgeToBoundary"]=asm["_directedEdgeToBoundary"];var _directedEdgeToCells=Module["_directedEdgeToCells"]=asm["_directedEdgeToCells"];var _emscripten_replace_memory=Module["_emscripten_replace_memory"]=asm["_emscripten_replace_memory"];var _exactEdgeLengthKm=Module["_exactEdgeLengthKm"]=asm["_exactEdgeLengthKm"];var _exactEdgeLengthM=Module["_exactEdgeLengthM"]=asm["_exactEdgeLengthM"];var _exactEdgeLengthRads=Module["_exactEdgeLengthRads"]=asm["_exactEdgeLengthRads"];var _free=Module["_free"]=asm["_free"];var _getBaseCellNumber=Module["_getBaseCellNumber"]=asm["_getBaseCellNumber"];var _getDirectedEdgeDestination=Module["_getDirectedEdgeDestination"]=asm["_getDirectedEdgeDestination"];var _getDirectedEdgeOrigin=Module["_getDirectedEdgeOrigin"]=asm["_getDirectedEdgeOrigin"];var _getHexagonAreaAvgKm2=Module["_getHexagonAreaAvgKm2"]=asm["_getHexagonAreaAvgKm2"];var _getHexagonAreaAvgM2=Module["_getHexagonAreaAvgM2"]=asm["_getHexagonAreaAvgM2"];var _getHexagonEdgeLengthAvgKm=Module["_getHexagonEdgeLengthAvgKm"]=asm["_getHexagonEdgeLengthAvgKm"];var _getHexagonEdgeLengthAvgM=Module["_getHexagonEdgeLengthAvgM"]=asm["_getHexagonEdgeLengthAvgM"];var _getIcosahedronFaces=Module["_getIcosahedronFaces"]=asm["_getIcosahedronFaces"];var _getNumCells=Module["_getNumCells"]=asm["_getNumCells"];var _getPentagons=Module["_getPentagons"]=asm["_getPentagons"];var _getRes0Cells=Module["_getRes0Cells"]=asm["_getRes0Cells"];var _getResolution=Module["_getResolution"]=asm["_getResolution"];var _greatCircleDistanceKm=Module["_greatCircleDistanceKm"]=asm["_greatCircleDistanceKm"];var _greatCircleDistanceM=Module["_greatCircleDistanceM"]=asm["_greatCircleDistanceM"];var _greatCircleDistanceRads=Module["_greatCircleDistanceRads"]=asm["_greatCircleDistanceRads"];var _gridDisk=Module["_gridDisk"]=asm["_gridDisk"];var _gridDiskDistances=Module["_gridDiskDistances"]=asm["_gridDiskDistances"];var _gridDistance=Module["_gridDistance"]=asm["_gridDistance"];var _gridPathCells=Module["_gridPathCells"]=asm["_gridPathCells"];var _gridPathCellsSize=Module["_gridPathCellsSize"]=asm["_gridPathCellsSize"];var _gridRingUnsafe=Module["_gridRingUnsafe"]=asm["_gridRingUnsafe"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _isPentagon=Module["_isPentagon"]=asm["_isPentagon"];var _isResClassIII=Module["_isResClassIII"]=asm["_isResClassIII"];var _isValidCell=Module["_isValidCell"]=asm["_isValidCell"];var _isValidDirectedEdge=Module["_isValidDirectedEdge"]=asm["_isValidDirectedEdge"];var _isValidVertex=Module["_isValidVertex"]=asm["_isValidVertex"];var _latLngToCell=Module["_latLngToCell"]=asm["_latLngToCell"];var _llvm_minnum_f64=Module["_llvm_minnum_f64"]=asm["_llvm_minnum_f64"];var _llvm_round_f64=Module["_llvm_round_f64"]=asm["_llvm_round_f64"];var _localIjToCell=Module["_localIjToCell"]=asm["_localIjToCell"];var _malloc=Module["_malloc"]=asm["_malloc"];var _maxFaceCount=Module["_maxFaceCount"]=asm["_maxFaceCount"];var _maxGridDiskSize=Module["_maxGridDiskSize"]=asm["_maxGridDiskSize"];var _maxPolygonToCellsSize=Module["_maxPolygonToCellsSize"]=asm["_maxPolygonToCellsSize"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _memset=Module["_memset"]=asm["_memset"];var _originToDirectedEdges=Module["_originToDirectedEdges"]=asm["_originToDirectedEdges"];var _pentagonCount=Module["_pentagonCount"]=asm["_pentagonCount"];var _polygonToCells=Module["_polygonToCells"]=asm["_polygonToCells"];var _readInt64AsDoubleFromPointer=Module["_readInt64AsDoubleFromPointer"]=asm["_readInt64AsDoubleFromPointer"];var _res0CellCount=Module["_res0CellCount"]=asm["_res0CellCount"];var _round=Module["_round"]=asm["_round"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var _sizeOfCellBoundary=Module["_sizeOfCellBoundary"]=asm["_sizeOfCellBoundary"];var _sizeOfCoordIJ=Module["_sizeOfCoordIJ"]=asm["_sizeOfCoordIJ"];var _sizeOfGeoLoop=Module["_sizeOfGeoLoop"]=asm["_sizeOfGeoLoop"];var _sizeOfGeoPolygon=Module["_sizeOfGeoPolygon"]=asm["_sizeOfGeoPolygon"];var _sizeOfH3Index=Module["_sizeOfH3Index"]=asm["_sizeOfH3Index"];var _sizeOfLatLng=Module["_sizeOfLatLng"]=asm["_sizeOfLatLng"];var _sizeOfLinkedGeoPolygon=Module["_sizeOfLinkedGeoPolygon"]=asm["_sizeOfLinkedGeoPolygon"];var _uncompactCells=Module["_uncompactCells"]=asm["_uncompactCells"];var _uncompactCellsSize=Module["_uncompactCellsSize"]=asm["_uncompactCellsSize"];var _vertexToLatLng=Module["_vertexToLatLng"]=asm["_vertexToLatLng"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var stackSave=Module["stackSave"]=asm["stackSave"];Module["asm"]=asm;Module["cwrap"]=cwrap;Module["setValue"]=setValue;Module["getValue"]=getValue;Module["getTempRet0"]=getTempRet0;if(memoryInitializer){if(!isDataURI(memoryInitializer)){memoryInitializer=locateFile(memoryInitializer)}if(ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=readBinary(memoryInitializer);HEAPU8.set(data,GLOBAL_BASE)}else{addRunDependency("memory initializer");var applyMemoryInitializer=function(data){if(data.byteLength)data=new Uint8Array(data);HEAPU8.set(data,GLOBAL_BASE);if(Module["memoryInitializerRequest"])delete Module["memoryInitializerRequest"].response;removeRunDependency("memory initializer")};var doBrowserLoad=function(){readAsync(memoryInitializer,applyMemoryInitializer,function(){throw"could not load memory initializer "+memoryInitializer})};var memoryInitializerBytes=tryParseAsDataURI(memoryInitializer);if(memoryInitializerBytes){applyMemoryInitializer(memoryInitializerBytes.buffer)}else if(Module["memoryInitializerRequest"]){var useRequest=function(){var request=Module["memoryInitializerRequest"];var response=request.response;if(request.status!==200&&request.status!==0){var data=tryParseAsDataURI(Module["memoryInitializerRequestURL"]);if(data){response=data.buffer}else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+request.status+", retrying "+memoryInitializer);doBrowserLoad();return}}applyMemoryInitializer(response)};if(Module["memoryInitializerRequest"].response){setTimeout(useRequest,0)}else{Module["memoryInitializerRequest"].addEventListener("load",useRequest)}}else{doBrowserLoad()}}}var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";out(what);err(what);ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}noExitRuntime=true;run(); +(asmGlobalArg,asmLibraryArg,buffer);var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var ___remdi3=Module["___remdi3"]=asm["___remdi3"];var ___uremdi3=Module["___uremdi3"]=asm["___uremdi3"];var _areNeighborCells=Module["_areNeighborCells"]=asm["_areNeighborCells"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _calloc=Module["_calloc"]=asm["_calloc"];var _cellAreaKm2=Module["_cellAreaKm2"]=asm["_cellAreaKm2"];var _cellAreaM2=Module["_cellAreaM2"]=asm["_cellAreaM2"];var _cellAreaRads2=Module["_cellAreaRads2"]=asm["_cellAreaRads2"];var _cellToBoundary=Module["_cellToBoundary"]=asm["_cellToBoundary"];var _cellToCenterChild=Module["_cellToCenterChild"]=asm["_cellToCenterChild"];var _cellToChildren=Module["_cellToChildren"]=asm["_cellToChildren"];var _cellToChildrenSize=Module["_cellToChildrenSize"]=asm["_cellToChildrenSize"];var _cellToLatLng=Module["_cellToLatLng"]=asm["_cellToLatLng"];var _cellToLocalIj=Module["_cellToLocalIj"]=asm["_cellToLocalIj"];var _cellToParent=Module["_cellToParent"]=asm["_cellToParent"];var _cellToVertex=Module["_cellToVertex"]=asm["_cellToVertex"];var _cellToVertexes=Module["_cellToVertexes"]=asm["_cellToVertexes"];var _cellsToDirectedEdge=Module["_cellsToDirectedEdge"]=asm["_cellsToDirectedEdge"];var _cellsToLinkedMultiPolygon=Module["_cellsToLinkedMultiPolygon"]=asm["_cellsToLinkedMultiPolygon"];var _compactCells=Module["_compactCells"]=asm["_compactCells"];var _destroyLinkedMultiPolygon=Module["_destroyLinkedMultiPolygon"]=asm["_destroyLinkedMultiPolygon"];var _directedEdgeToBoundary=Module["_directedEdgeToBoundary"]=asm["_directedEdgeToBoundary"];var _directedEdgeToCells=Module["_directedEdgeToCells"]=asm["_directedEdgeToCells"];var _emscripten_replace_memory=Module["_emscripten_replace_memory"]=asm["_emscripten_replace_memory"];var _exactEdgeLengthKm=Module["_exactEdgeLengthKm"]=asm["_exactEdgeLengthKm"];var _exactEdgeLengthM=Module["_exactEdgeLengthM"]=asm["_exactEdgeLengthM"];var _exactEdgeLengthRads=Module["_exactEdgeLengthRads"]=asm["_exactEdgeLengthRads"];var _free=Module["_free"]=asm["_free"];var _getBaseCellNumber=Module["_getBaseCellNumber"]=asm["_getBaseCellNumber"];var _getDirectedEdgeDestination=Module["_getDirectedEdgeDestination"]=asm["_getDirectedEdgeDestination"];var _getDirectedEdgeOrigin=Module["_getDirectedEdgeOrigin"]=asm["_getDirectedEdgeOrigin"];var _getHexagonAreaAvgKm2=Module["_getHexagonAreaAvgKm2"]=asm["_getHexagonAreaAvgKm2"];var _getHexagonAreaAvgM2=Module["_getHexagonAreaAvgM2"]=asm["_getHexagonAreaAvgM2"];var _getHexagonEdgeLengthAvgKm=Module["_getHexagonEdgeLengthAvgKm"]=asm["_getHexagonEdgeLengthAvgKm"];var _getHexagonEdgeLengthAvgM=Module["_getHexagonEdgeLengthAvgM"]=asm["_getHexagonEdgeLengthAvgM"];var _getIcosahedronFaces=Module["_getIcosahedronFaces"]=asm["_getIcosahedronFaces"];var _getNumCells=Module["_getNumCells"]=asm["_getNumCells"];var _getPentagons=Module["_getPentagons"]=asm["_getPentagons"];var _getRes0Cells=Module["_getRes0Cells"]=asm["_getRes0Cells"];var _getResolution=Module["_getResolution"]=asm["_getResolution"];var _greatCircleDistanceKm=Module["_greatCircleDistanceKm"]=asm["_greatCircleDistanceKm"];var _greatCircleDistanceM=Module["_greatCircleDistanceM"]=asm["_greatCircleDistanceM"];var _greatCircleDistanceRads=Module["_greatCircleDistanceRads"]=asm["_greatCircleDistanceRads"];var _gridDisk=Module["_gridDisk"]=asm["_gridDisk"];var _gridDiskDistances=Module["_gridDiskDistances"]=asm["_gridDiskDistances"];var _gridDistance=Module["_gridDistance"]=asm["_gridDistance"];var _gridPathCells=Module["_gridPathCells"]=asm["_gridPathCells"];var _gridPathCellsSize=Module["_gridPathCellsSize"]=asm["_gridPathCellsSize"];var _gridRingUnsafe=Module["_gridRingUnsafe"]=asm["_gridRingUnsafe"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _isPentagon=Module["_isPentagon"]=asm["_isPentagon"];var _isResClassIII=Module["_isResClassIII"]=asm["_isResClassIII"];var _isValidCell=Module["_isValidCell"]=asm["_isValidCell"];var _isValidDirectedEdge=Module["_isValidDirectedEdge"]=asm["_isValidDirectedEdge"];var _isValidVertex=Module["_isValidVertex"]=asm["_isValidVertex"];var _latLngToCell=Module["_latLngToCell"]=asm["_latLngToCell"];var _llvm_minnum_f64=Module["_llvm_minnum_f64"]=asm["_llvm_minnum_f64"];var _llvm_round_f64=Module["_llvm_round_f64"]=asm["_llvm_round_f64"];var _localIjToCell=Module["_localIjToCell"]=asm["_localIjToCell"];var _malloc=Module["_malloc"]=asm["_malloc"];var _maxFaceCount=Module["_maxFaceCount"]=asm["_maxFaceCount"];var _maxGridDiskSize=Module["_maxGridDiskSize"]=asm["_maxGridDiskSize"];var _maxPolygonToCellsSize=Module["_maxPolygonToCellsSize"]=asm["_maxPolygonToCellsSize"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _memset=Module["_memset"]=asm["_memset"];var _originToDirectedEdges=Module["_originToDirectedEdges"]=asm["_originToDirectedEdges"];var _pentagonCount=Module["_pentagonCount"]=asm["_pentagonCount"];var _polygonToCells=Module["_polygonToCells"]=asm["_polygonToCells"];var _readInt64AsDoubleFromPointer=Module["_readInt64AsDoubleFromPointer"]=asm["_readInt64AsDoubleFromPointer"];var _res0CellCount=Module["_res0CellCount"]=asm["_res0CellCount"];var _round=Module["_round"]=asm["_round"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var _sizeOfCellBoundary=Module["_sizeOfCellBoundary"]=asm["_sizeOfCellBoundary"];var _sizeOfCoordIJ=Module["_sizeOfCoordIJ"]=asm["_sizeOfCoordIJ"];var _sizeOfGeoLoop=Module["_sizeOfGeoLoop"]=asm["_sizeOfGeoLoop"];var _sizeOfGeoPolygon=Module["_sizeOfGeoPolygon"]=asm["_sizeOfGeoPolygon"];var _sizeOfH3Index=Module["_sizeOfH3Index"]=asm["_sizeOfH3Index"];var _sizeOfLatLng=Module["_sizeOfLatLng"]=asm["_sizeOfLatLng"];var _sizeOfLinkedGeoPolygon=Module["_sizeOfLinkedGeoPolygon"]=asm["_sizeOfLinkedGeoPolygon"];var _uncompactCells=Module["_uncompactCells"]=asm["_uncompactCells"];var _uncompactCellsSize=Module["_uncompactCellsSize"]=asm["_uncompactCellsSize"];var _vertexToLatLng=Module["_vertexToLatLng"]=asm["_vertexToLatLng"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var stackSave=Module["stackSave"]=asm["stackSave"];Module["asm"]=asm;Module["cwrap"]=cwrap;Module["setValue"]=setValue;Module["getValue"]=getValue;if(memoryInitializer){if(!isDataURI(memoryInitializer)){memoryInitializer=locateFile(memoryInitializer)}if(ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=readBinary(memoryInitializer);HEAPU8.set(data,GLOBAL_BASE)}else{addRunDependency("memory initializer");var applyMemoryInitializer=function(data){if(data.byteLength)data=new Uint8Array(data);HEAPU8.set(data,GLOBAL_BASE);if(Module["memoryInitializerRequest"])delete Module["memoryInitializerRequest"].response;removeRunDependency("memory initializer")};var doBrowserLoad=function(){readAsync(memoryInitializer,applyMemoryInitializer,function(){throw"could not load memory initializer "+memoryInitializer})};var memoryInitializerBytes=tryParseAsDataURI(memoryInitializer);if(memoryInitializerBytes){applyMemoryInitializer(memoryInitializerBytes.buffer)}else if(Module["memoryInitializerRequest"]){var useRequest=function(){var request=Module["memoryInitializerRequest"];var response=request.response;if(request.status!==200&&request.status!==0){var data=tryParseAsDataURI(Module["memoryInitializerRequestURL"]);if(data){response=data.buffer}else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+request.status+", retrying "+memoryInitializer);doBrowserLoad();return}}applyMemoryInitializer(response)};if(Module["memoryInitializerRequest"].response){setTimeout(useRequest,0)}else{Module["memoryInitializerRequest"].addEventListener("load",useRequest)}}else{doBrowserLoad()}}}var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";out(what);err(what);ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}noExitRuntime=true;run(); diff --git a/scripts/update-emscripten.sh b/scripts/update-emscripten.sh index 53d43cb..0f3c8e4 100755 --- a/scripts/update-emscripten.sh +++ b/scripts/update-emscripten.sh @@ -53,7 +53,7 @@ emcc -O3 -I ../include *.c -DH3_HAVE_VLA --memory-init-file 0 \ -s FILESYSTEM=0 -s NODEJS_CATCH_EXIT=0 -s NODEJS_CATCH_REJECTION=0 \ -s TOTAL_MEMORY=33554432 -s ALLOW_MEMORY_GROWTH=1 -s WARN_UNALIGNED=1 \ -s EXPORTED_FUNCTIONS=$bound_functions \ - -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap", "getValue", "setValue", "getTempRet0"]' \ + -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap", "getValue", "setValue"]' \ "$@" cp *.js ../../../../out popd From 29e4c6abe13ce8d18be60215ddca9c2519e742f4 Mon Sep 17 00:00:00 2001 From: Nick Rabinowitz Date: Thu, 28 Jul 2022 18:06:19 -0700 Subject: [PATCH 2/2] More JSDoc cleanup --- README.md | 64 +++++++++++++++++++++++++++++++++------------------ lib/errors.js | 9 -------- lib/h3core.js | 60 +++++++++++++++++++++++++++-------------------- package.json | 4 ++-- yarn.lock | 2 +- 5 files changed, 79 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 4103cc5..fe2f3c3 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ const coordinates = h3.cellsToMultiPolygon(hexagons, true); * [.H3Index](#module_h3.H3Index) : string * [.H3IndexInput](#module_h3.H3IndexInput) : string \| Array.<number> * [.CoordIJ](#module_h3.CoordIJ) : Object + * [.H3Error](#module_h3.H3Error) ⇐ Error * * * @@ -236,7 +237,7 @@ Get the indices of all icosahedron faces intersected by a given H3 index **Returns**: Array.<number> - Indices (0-19) of all intersected faces **Throws**: -- H3Error Error if input is invalid +- H3Error If input is invalid | Param | Type | Description | @@ -268,7 +269,7 @@ Get the hexagon containing a lat,lon point **Returns**: H3Index - H3 index **Throws**: -- H3Error Error if input is invalid +- H3Error If input is invalid | Param | Type | Description | @@ -288,7 +289,7 @@ Get the lat,lon center of a given hexagon **Returns**: Array.<number> - Point as a [lat, lng] pair **Throws**: -- H3Error Error if input is invalid +- H3Error If input is invalid | Param | Type | Description | @@ -308,7 +309,7 @@ function may return up to 10 vertices. **Returns**: Array.<Array.<number>> - Array of [lat, lng] pairs **Throws**: -- H3Error Error if input is invalid +- H3Error If input is invalid | Param | Type | Description | @@ -327,7 +328,7 @@ Get the parent of the given hexagon at a particular resolution **Returns**: H3Index - H3 index of parent, or null for invalid input **Throws**: -- H3Error Error if input is invalid +- H3Error If input is invalid | Param | Type | Description | @@ -346,7 +347,7 @@ Get the children/descendents of the given hexagon at a particular resolution **Returns**: Array.<H3Index> - H3 indexes of children, or empty array for invalid input **Throws**: -- H3Error Error if resolution is invalid or output is too large for JS +- H3Error If resolution is invalid or output is too large for JS | Param | Type | Description | @@ -365,7 +366,7 @@ Get the center child of the given hexagon at a particular resolution **Returns**: H3Index - H3 index of child, or null for invalid input **Throws**: -- H3Error Error if resolution is invalid +- H3Error If resolution is invalid | Param | Type | Description | @@ -384,7 +385,7 @@ Get all hexagons in a k-ring around a given center. The order of the hexagons is **Returns**: Array.<H3Index> - H3 indexes for all hexagons in ring **Throws**: -- H3Error Error if input is invalid or output is too large for JS +- H3Error If input is invalid or output is too large for JS | Param | Type | Description | @@ -404,7 +405,7 @@ ordered by distance from the origin. The order of the hexagons within each ring **Returns**: Array.<Array.<H3Index>> - Array of arrays with H3 indexes for all hexagons each ring **Throws**: -- H3Error Error if input is invalid or output is too large for JS +- H3Error If input is invalid or output is too large for JS | Param | Type | Description | @@ -425,7 +426,7 @@ Unlike kRing, this function will throw an error if there is a pentagon anywhere **Throws**: - Error If the algorithm could not calculate the ring -- H3Error Error if input is invalid +- H3Error If input is invalid | Param | Type | Description | @@ -448,7 +449,7 @@ expected to be holes. **Returns**: Array.<H3Index> - H3 indexes for all hexagons in polygon **Throws**: -- H3Error Error if input is invalid or output is too large for JS +- H3Error If input is invalid or output is too large for JS | Param | Type | Description | @@ -476,7 +477,7 @@ algorithm may produce unexpected or invalid polygons. **Returns**: Array.<Array.<Array.<Array.<number>>>> - MultiPolygon-style output. **Throws**: -- H3Error Error if input is invalid +- H3Error If input is invalid | Param | Type | Description | @@ -496,7 +497,7 @@ multiple levels that represents the same area. **Returns**: Array.<H3Index> - Compacted H3 indexes **Throws**: -- H3Error Error if the input is invalid (e.g. duplicate hexagons) +- H3Error If the input is invalid (e.g. duplicate hexagons) | Param | Type | Description | @@ -514,7 +515,7 @@ Uncompact a compacted set of hexagons to hexagons of the same resolution **Returns**: Array.<H3Index> - The uncompacted H3 indexes **Throws**: -- H3Error Error if the input is invalid (e.g. invalid resolution) +- H3Error If the input is invalid (e.g. invalid resolution) | Param | Type | Description | @@ -533,7 +534,7 @@ Whether two H3 indexes are neighbors (share an edge) **Returns**: boolean - Whether the hexagons share an edge **Throws**: -- H3Error Error if the input is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -552,7 +553,7 @@ Get an H3 index representing a unidirectional edge for a given origin and destin **Returns**: H3Index - H3 index of the edge, or null if no edge is shared **Throws**: -- H3Error Error if the input is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -571,7 +572,7 @@ Get the origin hexagon from an H3 index representing a unidirectional edge **Returns**: H3Index - H3 index of the edge origin **Throws**: -- H3Error Error if the input is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -589,7 +590,7 @@ Get the destination hexagon from an H3 index representing a unidirectional edge **Returns**: H3Index - H3 index of the edge destination **Throws**: -- H3Error Error if the input is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -621,7 +622,7 @@ Get the [origin, destination] pair represented by a unidirectional edge **Returns**: Array.<H3Index> - [origin, destination] pair as H3 indexes **Throws**: -- H3Error Error if the input is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -640,7 +641,7 @@ every neighbor) **Returns**: Array.<H3Index> - List of unidirectional edges **Throws**: -- H3Error Error if the input is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -659,7 +660,7 @@ cross the edge of an icosahedron face, this may return 3 coordinates. **Returns**: Array.<Array.<number>> - Array of geo coordinate pairs **Throws**: -- H3Error Error if the input is invalid +- H3Error If the input is invalid | Param | Type | Description | @@ -680,7 +681,7 @@ on opposite sides of a pentagon. **Returns**: number - Distance between hexagons **Throws**: -- H3Error Error if input is invalid or the distance could not be calculated +- H3Error If input is invalid or the distance could not be calculated | Param | Type | Description | @@ -712,7 +713,7 @@ Notes: **Returns**: Array.<H3Index> - H3 indexes connecting origin and destination **Throws**: -- H3Error Error if input is invalid or the line cannot be calculated +- H3Error If input is invalid or the line cannot be calculated | Param | Type | Description | @@ -1052,6 +1053,23 @@ Coordinates as an `{i, j}` pair | j | number | +* * * + + + +### h3.H3Error ⇐ Error +Custom JS Error with an attached error code. Error codes come from the +core H3 library and can be found [in the H3 docs](https://h3geo.org/docs/next/library/errors#table-of-error-codes). + +**Extends**: Error +**Properties** + +| Name | Type | +| --- | --- | +| message | string | +| code | number | + + * * * diff --git a/lib/errors.js b/lib/errors.js index c041b7f..b4357ac 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -60,15 +60,6 @@ const H3_ERROR_MSGS = { export const E_UNKNOWN_UNIT = 1000; export const E_ARRAY_LENGTH = 1001; -/** - * Custom JS Error with an attached error code. Error codes come from the - * core H3 library and can be found [in the H3 docs](https://h3geo.org/docs/next/library/errors#table-of-error-codes). - * @static - * @typedef {string} H3Error - * @extends {Error} - * @property {number} code - */ - /** * Error messages for errors thrown in the binding code. These don't strictly * need error codes, but it's simpler to treat all of the errors consistently diff --git a/lib/h3core.js b/lib/h3core.js index 27102f8..7aa6cf7 100644 --- a/lib/h3core.js +++ b/lib/h3core.js @@ -82,6 +82,16 @@ const SZ_COORDIJ = H3.sizeOfCoordIJ(); * @property {number} j */ +/** + * Custom JS Error with an attached error code. Error codes come from the + * core H3 library and can be found [in the H3 docs](https://h3geo.org/docs/next/library/errors#table-of-error-codes). + * @static + * @typedef H3Error + * @extends Error + * @property {string} message + * @property {number} code + */ + // ---------------------------------------------------------------------------- // Unit constants @@ -112,7 +122,7 @@ export const UNITS = { * Validate a resolution, throwing an error if invalid * @private * @param {unknown} res Value to validate - * @throws {H3Error} Error if invalid + * @throws {H3Error} If invalid */ function validateRes(res) { if (typeof res !== 'number' || res < 0 || res > 15 || Math.floor(res) !== res) { @@ -129,7 +139,7 @@ const MAX_JS_ARRAY_LENGTH = Math.pow(2, 32) - 1; * of data that won't even fit in an output array * @private * @param {number} length Length to validate - * @throws {H3Error} Error if invalid + * @throws {H3Error} If invalid */ function validateArrayLength(length) { if (length > MAX_JS_ARRAY_LENGTH) { @@ -596,7 +606,7 @@ export function getBaseCellNumber(h3Index) { * @static * @param {H3IndexInput} h3Index H3 index to get faces for * @return {number[]} Indices (0-19) of all intersected faces - * @throws {H3Error} Error if input is invalid + * @throws {H3Error} If input is invalid */ export function getIcosahedronFaces(h3Index) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -638,7 +648,7 @@ export function getResolution(h3Index) { * @param {number} lng Longtitude of point * @param {number} res Resolution of hexagons to return * @return {H3Index} H3 index - * @throws {H3Error} Error if input is invalid + * @throws {H3Error} If input is invalid */ export function latLngToCell(lat, lng, res) { const latLng = C._malloc(SZ_LATLNG); @@ -660,7 +670,7 @@ export function latLngToCell(lat, lng, res) { * @static * @param {H3IndexInput} h3Index H3 index * @return {number[]} Point as a [lat, lng] pair - * @throws {H3Error} Error if input is invalid + * @throws {H3Error} If input is invalid */ export function cellToLatLng(h3Index) { const latLng = C._malloc(SZ_LATLNG); @@ -681,7 +691,7 @@ export function cellToLatLng(h3Index) { * @param {H3Index} h3Index H3 index * @param {boolean} [formatAsGeoJson] Whether to provide GeoJSON output: [lng, lat], closed loops * @return {number[][]} Array of [lat, lng] pairs - * @throws {H3Error} Error if input is invalid + * @throws {H3Error} If input is invalid */ export function cellToBoundary(h3Index, formatAsGeoJson) { const cellBoundary = C._malloc(SZ_CELLBOUNDARY); @@ -703,7 +713,7 @@ export function cellToBoundary(h3Index, formatAsGeoJson) { * @param {H3IndexInput} h3Index H3 index to get parent for * @param {number} res Resolution of hexagon to return * @return {H3Index} H3 index of parent, or null for invalid input - * @throws {H3Error} Error if input is invalid + * @throws {H3Error} If input is invalid */ export function cellToParent(h3Index, res) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -722,7 +732,7 @@ export function cellToParent(h3Index, res) { * @param {H3IndexInput} h3Index H3 index to get children for * @param {number} res Resolution of hexagons to return * @return {H3Index[]} H3 indexes of children, or empty array for invalid input - * @throws {H3Error} Error if resolution is invalid or output is too large for JS + * @throws {H3Error} If resolution is invalid or output is too large for JS */ export function cellToChildren(h3Index, res) { // Bad input in this case can potentially result in high computation volume @@ -754,7 +764,7 @@ export function cellToChildren(h3Index, res) { * @param {H3IndexInput} h3Index H3 index to get center child for * @param {number} res Resolution of hexagon to return * @return {H3Index} H3 index of child, or null for invalid input - * @throws {H3Error} Error if resolution is invalid + * @throws {H3Error} If resolution is invalid */ export function cellToCenterChild(h3Index, res) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -773,7 +783,7 @@ export function cellToCenterChild(h3Index, res) { * @param {H3IndexInput} h3Index H3 index of center hexagon * @param {number} ringSize Radius of k-ring * @return {H3Index[]} H3 indexes for all hexagons in ring - * @throws {H3Error} Error if input is invalid or output is too large for JS + * @throws {H3Error} If input is invalid or output is too large for JS */ export function gridDisk(h3Index, ringSize) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -801,7 +811,7 @@ export function gridDisk(h3Index, ringSize) { * @param {H3IndexInput} h3Index H3 index of center hexagon * @param {number} ringSize Radius of k-ring * @return {H3Index[][]} Array of arrays with H3 indexes for all hexagons each ring - * @throws {H3Error} Error if input is invalid or output is too large for JS + * @throws {H3Error} If input is invalid or output is too large for JS */ export function gridDiskDistances(h3Index, ringSize) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -846,7 +856,7 @@ export function gridDiskDistances(h3Index, ringSize) { * @param {number} ringSize Radius of ring * @return {H3Index[]} H3 indexes for all hexagons in ring * @throws {Error} If the algorithm could not calculate the ring - * @throws {H3Error} Error if input is invalid + * @throws {H3Error} If input is invalid */ export function gridRingUnsafe(h3Index, ringSize) { const maxCount = ringSize === 0 ? 1 : 6 * ringSize; @@ -872,7 +882,7 @@ export function gridRingUnsafe(h3Index, ringSize) { * @param {boolean} [isGeoJson] Whether to expect GeoJson-style [lng, lat] * pairs instead of [lat, lng] * @return {H3Index[]} H3 indexes for all hexagons in polygon - * @throws {H3Error} Error if input is invalid or output is too large for JS + * @throws {H3Error} If input is invalid or output is too large for JS */ export function polygonToCells(coordinates, res, isGeoJson) { validateRes(res); @@ -920,7 +930,7 @@ export function polygonToCells(coordinates, res, isGeoJson) { * @param {boolean} [formatAsGeoJson] Whether to provide GeoJSON output: * [lng, lat], closed loops * @return {number[][][][]} MultiPolygon-style output. - * @throws {H3Error} Error if input is invalid + * @throws {H3Error} If input is invalid */ export function cellsToMultiPolygon(h3Indexes, formatAsGeoJson) { // Early exit on empty input @@ -950,7 +960,7 @@ export function cellsToMultiPolygon(h3Indexes, formatAsGeoJson) { * @static * @param {H3IndexInput[]} h3Set H3 indexes to compact * @return {H3Index[]} Compacted H3 indexes - * @throws {H3Error} Error if the input is invalid (e.g. duplicate hexagons) + * @throws {H3Error} If the input is invalid (e.g. duplicate hexagons) */ export function compactCells(h3Set) { if (!h3Set || !h3Set.length) { @@ -977,7 +987,7 @@ export function compactCells(h3Set) { * @param {H3IndexInput[]} compactedSet H3 indexes to uncompact * @param {number} res The resolution to uncompact to * @return {H3Index[]} The uncompacted H3 indexes - * @throws {H3Error} Error if the input is invalid (e.g. invalid resolution) + * @throws {H3Error} If the input is invalid (e.g. invalid resolution) */ export function uncompactCells(compactedSet, res) { validateRes(res); @@ -1029,7 +1039,7 @@ export function uncompactCells(compactedSet, res) { * @param {H3IndexInput} origin Origin hexagon index * @param {H3IndexInput} destination Destination hexagon index * @return {boolean} Whether the hexagons share an edge - * @throws {H3Error} Error if the input is invalid + * @throws {H3Error} If the input is invalid */ export function areNeighborCells(origin, destination) { const [oLower, oUpper] = h3IndexToSplitLong(origin); @@ -1049,7 +1059,7 @@ export function areNeighborCells(origin, destination) { * @param {H3IndexInput} origin Origin hexagon index * @param {H3IndexInput} destination Destination hexagon index * @return {H3Index} H3 index of the edge, or null if no edge is shared - * @throws {H3Error} Error if the input is invalid + * @throws {H3Error} If the input is invalid */ export function cellsToDirectedEdge(origin, destination) { const [oLower, oUpper] = h3IndexToSplitLong(origin); @@ -1068,7 +1078,7 @@ export function cellsToDirectedEdge(origin, destination) { * @static * @param {H3IndexInput} edgeIndex H3 index of the edge * @return {H3Index} H3 index of the edge origin - * @throws {H3Error} Error if the input is invalid + * @throws {H3Error} If the input is invalid */ export function getDirectedEdgeOrigin(edgeIndex) { const [lower, upper] = h3IndexToSplitLong(edgeIndex); @@ -1086,7 +1096,7 @@ export function getDirectedEdgeOrigin(edgeIndex) { * @static * @param {H3IndexInput} edgeIndex H3 index of the edge * @return {H3Index} H3 index of the edge destination - * @throws {H3Error} Error if the input is invalid + * @throws {H3Error} If the input is invalid */ export function getDirectedEdgeDestination(edgeIndex) { const [lower, upper] = h3IndexToSplitLong(edgeIndex); @@ -1115,7 +1125,7 @@ export function isValidDirectedEdge(edgeIndex) { * @static * @param {H3IndexInput} edgeIndex H3 index of the edge * @return {H3Index[]} [origin, destination] pair as H3 indexes - * @throws {H3Error} Error if the input is invalid + * @throws {H3Error} If the input is invalid */ export function directedEdgeToCells(edgeIndex) { const [lower, upper] = h3IndexToSplitLong(edgeIndex); @@ -1135,7 +1145,7 @@ export function directedEdgeToCells(edgeIndex) { * @static * @param {H3IndexInput} h3Index H3 index of the origin hexagon * @return {H3Index[]} List of unidirectional edges - * @throws {H3Error} Error if the input is invalid + * @throws {H3Error} If the input is invalid */ export function originToDirectedEdges(h3Index) { const [lower, upper] = h3IndexToSplitLong(h3Index); @@ -1156,7 +1166,7 @@ export function originToDirectedEdges(h3Index) { * @param {H3IndexInput} edgeIndex H3 index of the edge * @param {boolean} [formatAsGeoJson] Whether to provide GeoJSON output: [lng, lat] * @return {number[][]} Array of geo coordinate pairs - * @throws {H3Error} Error if the input is invalid + * @throws {H3Error} If the input is invalid */ export function directedEdgeToBoundary(edgeIndex, formatAsGeoJson) { const cellBoundary = C._malloc(SZ_CELLBOUNDARY); @@ -1177,7 +1187,7 @@ export function directedEdgeToBoundary(edgeIndex, formatAsGeoJson) { * @param {H3IndexInput} origin Origin hexagon index * @param {H3IndexInput} destination Destination hexagon index * @return {number} Distance between hexagons - * @throws {H3Error} Error if input is invalid or the distance could not be calculated + * @throws {H3Error} If input is invalid or the distance could not be calculated */ export function gridDistance(origin, destination) { const [oLower, oUpper] = h3IndexToSplitLong(origin); @@ -1211,7 +1221,7 @@ export function gridDistance(origin, destination) { * @param {H3IndexInput} origin Origin hexagon index * @param {H3IndexInput} destination Destination hexagon index * @return {H3Index[]} H3 indexes connecting origin and destination - * @throws {H3Error} Error if input is invalid or the line cannot be calculated + * @throws {H3Error} If input is invalid or the line cannot be calculated */ export function gridPathCells(origin, destination) { const [oLower, oUpper] = h3IndexToSplitLong(origin); diff --git a/package.json b/package.json index 5a4e043..6415f21 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "scripts": { "build-update-h3": "bash scripts/update-h3.sh", "build-emscripten": "yarn build-update-h3 && yarn docker-emscripten", - "build-docs": "jsdoc2md --no-cache --global-index-format grouped --partial doc-files/scope.hbs --helper ./doc-files/insert-version.js --separators --template doc-files/README.tmpl.md lib/h3core.js > README.md", + "build-docs": "jsdoc2md --no-cache --global-index-format grouped --partial doc-files/scope.hbs --helper ./doc-files/insert-version.js --separators --template doc-files/README.tmpl.md lib/h3core.js lib/errors.js > README.md", "build-tsd": "jsdoc -t node_modules/tsd-jsdoc/dist -d console lib/h3core.js | sed 's/\"h3\"/\"h3-js\"/g' > dist/types.d.ts", "bundle-umd": "microbundle --name h3 --format=umd", "bundle-cjs": "microbundle --format=cjs --no-compress", @@ -80,7 +80,7 @@ "prettier": "^1.12.1", "rollup": "^1.7.0", "tape": "^5.5.3", - "tsd-jsdoc": "^2.3.1", + "tsd-jsdoc": "^2.5.0", "typescript": "^3.6.3" }, "resolutions": { diff --git a/yarn.lock b/yarn.lock index 6d58fae..bee2bfe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7307,7 +7307,7 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= -tsd-jsdoc@^2.3.1: +tsd-jsdoc@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tsd-jsdoc/-/tsd-jsdoc-2.5.0.tgz#0677aa952e1a8e3ebbb5bcf7d6e2f0301d71e151" integrity sha512-80fcJLAiUeerg4xPftp+iEEKWUjJjHk9AvcHwJqA8Zw0R4oASdu3kT/plE/Zj19QUTz8KupyOX25zStlNJjS9g==