Comparing version 3.0.2 to 3.1.0
@@ -6,3 +6,11 @@ # Change Log | ||
## [Unreleased] | ||
- *None* | ||
## [3.1.0] - 2018-08-13 | ||
### Added | ||
- Added binding for `h3Distance` (#15) | ||
### Changed | ||
- Updated the core library to 3.1.0 (#15) | ||
- Moved emscripten build to docker (#14) | ||
## [3.0.2] - 2018-07-26 | ||
@@ -9,0 +17,0 @@ ### Changed |
@@ -68,2 +68,3 @@ /* | ||
['getH3UnidirectionalEdgeBoundary', null, [H3_LOWER, H3_UPPER, POINTER]], | ||
['h3Distance', NUMBER, [H3_LOWER, H3_UPPER, H3_LOWER, H3_UPPER]], | ||
['hexAreaM2', NUMBER, [RESOLUTION]], | ||
@@ -70,0 +71,0 @@ ['hexAreaKm2', NUMBER, [RESOLUTION]], |
@@ -873,2 +873,22 @@ /* | ||
/** | ||
* Get the grid distance between two hex addresses. This function may fail | ||
* to find the distance between two indexes if they are very far apart or | ||
* on opposite sides of a pentagon. | ||
* | ||
* @param {String} origin Origin hexagon address | ||
* @param {String} destination Destination hexagon address | ||
* @return {Number} Distance between hexagons, or a negative | ||
* number if the distance could not be computed | ||
*/ | ||
function h3Distance(origin, destination) { | ||
var ref = h3AddressToSplitLong(origin); | ||
var oLower = ref[0]; | ||
var oUpper = ref[1]; | ||
var ref$1 = h3AddressToSplitLong(destination); | ||
var dLower = ref$1[0]; | ||
var dUpper = ref$1[1]; | ||
return H3.h3Distance(oLower, oUpper, dLower, dUpper); | ||
} | ||
// ---------------------------------------------------------------------------- | ||
@@ -963,2 +983,3 @@ // Public informational utilities | ||
getH3UnidirectionalEdgeBoundary: getH3UnidirectionalEdgeBoundary, | ||
h3Distance: h3Distance, | ||
hexArea: hexArea, | ||
@@ -965,0 +986,0 @@ edgeLength: edgeLength, |
@@ -68,2 +68,3 @@ /* | ||
['getH3UnidirectionalEdgeBoundary', null, [H3_LOWER, H3_UPPER, POINTER]], | ||
['h3Distance', NUMBER, [H3_LOWER, H3_UPPER, H3_LOWER, H3_UPPER]], | ||
['hexAreaM2', NUMBER, [RESOLUTION]], | ||
@@ -70,0 +71,0 @@ ['hexAreaKm2', NUMBER, [RESOLUTION]], |
@@ -831,2 +831,18 @@ /* | ||
/** | ||
* Get the grid distance between two hex addresses. This function may fail | ||
* to find the distance between two indexes if they are very far apart or | ||
* on opposite sides of a pentagon. | ||
* | ||
* @param {String} origin Origin hexagon address | ||
* @param {String} destination Destination hexagon address | ||
* @return {Number} Distance between hexagons, or a negative | ||
* number if the distance could not be computed | ||
*/ | ||
function h3Distance(origin, destination) { | ||
const [oLower, oUpper] = h3AddressToSplitLong(origin); | ||
const [dLower, dUpper] = h3AddressToSplitLong(destination); | ||
return H3.h3Distance(oLower, oUpper, dLower, dUpper); | ||
} | ||
// ---------------------------------------------------------------------------- | ||
@@ -919,2 +935,3 @@ // Public informational utilities | ||
getH3UnidirectionalEdgeBoundary, | ||
h3Distance, | ||
hexArea, | ||
@@ -921,0 +938,0 @@ edgeLength, |
{ | ||
"name": "h3-js", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "Emscripten transpiled libh3 'bindings' for Node/Web JS", | ||
@@ -36,3 +36,4 @@ "author": "David Ellis <d.f.ellis@ieee.org>", | ||
"prepublish": "yarn run dist", | ||
"build-emscripten": "./.build-emscripten.sh", | ||
"init-docker": "docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-tag-1.37.40-64bit bash", | ||
"build-emscripten": "docker exec -it emscripten bash .build-emscripten.sh", | ||
"cover": "istanbul cover -x out/*.js -- test/index.js", | ||
@@ -39,0 +40,0 @@ "prettier": "prettier --write --single-quote --no-bracket-spacing --print-width=100 'lib/**/*.js' 'build/**/*.js' 'test/**/*.js'" |
@@ -106,20 +106,11 @@ # h3-js | ||
You need to have emscripten's `emcc` in your `$PATH`. I highly recommend [the portable install](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) as easiest to update and maintain. | ||
The core library is transpiled using [emscripten](http://kripken.github.io/emscripten-site). The easiest way to build from source locally is by using Docker. Make sure Docker is installed, then: | ||
Once you finished the installation, run the following command to check the precompiled package versions: | ||
yarn init-docker | ||
yarn run build-emscripten | ||
emsdk list | ||
The build script uses the `H3_VERSION` file to determine the version of the core library to build. | ||
NOTE: The current `h3-js` is built with `emscripten-1.37.40`. Earlier or later versions MAY NOT WORK (emscripten does not follow semver, so patch updates may include breaking changes). | ||
Note that you'll need to add the emscripten PATH and env variables to your current terminal (unless you add this to your `.bash_profile`): | ||
source /path/to/emsdk_portable/emsdk_env.sh | ||
Then simply: | ||
yarn run build-emscripten | ||
The build script automatically uses the `package.json` version as the version of `libh3` to build, so these versions are completely in sync with the upstream C code. | ||
## Contributing | ||
@@ -126,0 +117,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
434660
3072
130