Skip to content

Commit

Permalink
Replace turf-is-clockwise with @turf/boolean-clockwise
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Aug 2, 2017
1 parent c025209 commit 5806e4c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 28 deletions.
8 changes: 4 additions & 4 deletions packages/turf-rewind/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var meta = require('@turf/meta');
var getCoords = require('@turf/invariant').getCoords;
var isClockWise = require('turf-is-clockwise');
var booleanClockwise = require('@turf/boolean-clockwise');
var featureCollection = require('@turf/helpers').featureCollection;
var geomEach = meta.geomEach;
var featureEach = meta.featureEach;
Expand Down Expand Up @@ -103,7 +103,7 @@ function rewind(geojson, reverse) {
* @returns {void} mutates coordinates
*/
function rewindLineString(coords, reverse) {
if (isClockWise(coords) === reverse) coords.reverse();
if (booleanClockwise(coords) === reverse) coords.reverse();
}

/**
Expand All @@ -116,12 +116,12 @@ function rewindLineString(coords, reverse) {
*/
function rewindPolygon(coords, reverse) {
// outer ring
if (isClockWise(coords[0]) !== reverse) {
if (booleanClockwise(coords[0]) !== reverse) {
coords[0].reverse();
}
// inner rings
for (var i = 1; i < coords.length; i++) {
if (isClockWise(coords[i]) === reverse) {
if (booleanClockwise(coords[i]) === reverse) {
coords[i].reverse();
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-rewind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"write-json-file": "^2.0.0"
},
"dependencies": {
"@turf/boolean-clockwise": "^4.6.0",
"@turf/helpers": "^4.6.0",
"@turf/invariant": "^4.6.0",
"@turf/meta": "^4.6.0",
"turf-is-clockwise": "^1.0.0"
"@turf/meta": "^4.6.0"
}
}
64 changes: 42 additions & 22 deletions packages/turf-rewind/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,27 @@
# yarn lockfile v1


balanced-match@^0.4.1:
version "0.4.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
"@turf/boolean-clockwise@^4.6.0":
version "4.6.0"
resolved "https://registry.yarnpkg.com/@turf/boolean-clockwise/-/boolean-clockwise-4.6.0.tgz#eea88565e9faae7d9c04ed472f62664d2e777fc8"
dependencies:
"@turf/invariant" "^4.6.0"

"@turf/helpers@^4.6.0":
version "4.6.0"
resolved "https://registry.yarnpkg.com/@turf/helpers/-/helpers-4.6.0.tgz#12398733b8ae28420df6166fa44c7ee8ffd6414c"

"@turf/invariant@^4.6.0":
version "4.6.0"
resolved "https://registry.yarnpkg.com/@turf/invariant/-/invariant-4.6.0.tgz#ba61401d537543f81ccfc588e12bb0d8e653dd80"

"@turf/meta@^4.6.0":
version "4.6.0"
resolved "https://registry.yarnpkg.com/@turf/meta/-/meta-4.6.0.tgz#0d3f9a218e58d1c5e5deedf467c3321dd61203f3"

balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"

benchmark@^2.1.4:
version "2.1.4"
Expand All @@ -14,10 +32,10 @@ benchmark@^2.1.4:
platform "^1.3.3"

brace-expansion@^1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59"
version "1.1.8"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
dependencies:
balanced-match "^0.4.1"
balanced-match "^1.0.0"
concat-map "0.0.1"

concat-map@0.0.1:
Expand Down Expand Up @@ -84,7 +102,7 @@ function-bind@^1.0.2, function-bind@^1.1.0, function-bind@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771"

glob@~7.1.1:
glob@~7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
Expand Down Expand Up @@ -179,9 +197,9 @@ minimist@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

object-inspect@~1.2.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.2.2.tgz#c82115e4fcc888aea14d64c22e4f17f6a70d5e5a"
object-inspect@~1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.3.0.tgz#5b1eb8e6742e2ee83342a637034d844928ba2f6d"

object-keys@^1.0.8:
version "1.0.11"
Expand All @@ -203,6 +221,10 @@ path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"

path-parse@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"

pify@^2.0.0, pify@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
Expand All @@ -211,9 +233,11 @@ platform@^1.3.3:
version "1.3.4"
resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.4.tgz#6f0fb17edaaa48f21442b3a975c063130f1c3ebd"

resolve@~1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
resolve@~1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86"
dependencies:
path-parse "^1.0.5"

resumer@~0.0.0:
version "0.0.0"
Expand Down Expand Up @@ -244,19 +268,19 @@ strip-bom@^3.0.0:
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"

tape@^4.6.3:
version "4.6.3"
resolved "https://registry.yarnpkg.com/tape/-/tape-4.6.3.tgz#637e77581e9ab2ce17577e9bd4ce4f575806d8b6"
version "4.8.0"
resolved "https://registry.yarnpkg.com/tape/-/tape-4.8.0.tgz#f6a9fec41cc50a1de50fa33603ab580991f6068e"
dependencies:
deep-equal "~1.0.1"
defined "~1.0.0"
for-each "~0.3.2"
function-bind "~1.1.0"
glob "~7.1.1"
glob "~7.1.2"
has "~1.0.1"
inherits "~2.0.3"
minimist "~1.2.0"
object-inspect "~1.2.1"
resolve "~1.1.7"
object-inspect "~1.3.0"
resolve "~1.4.0"
resumer "~0.0.0"
string.prototype.trim "~1.1.2"
through "~2.3.8"
Expand All @@ -265,10 +289,6 @@ through@~2.3.4, through@~2.3.8:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"

turf-is-clockwise@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/turf-is-clockwise/-/turf-is-clockwise-1.0.0.tgz#dc22e5ffd4cf10934683aa004627cff87a6dfe91"

wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
Expand Down

0 comments on commit 5806e4c

Please sign in to comment.