@turf/rewind 6.4.0 → 7.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,14 +6,15 @@
6
6
 
7
7
  Rewind [(Multi)LineString][1] or [(Multi)Polygon][2] outer ring counterclockwise and inner rings clockwise (Uses [Shoelace Formula][3]).
8
8
 
9
- **Parameters**
9
+ ### Parameters
10
10
 
11
- - `geojson` **[GeoJSON][4]** input GeoJSON Polygon
12
- - `options` **[Object][5]** Optional parameters (optional, default `{}`)
13
- - `options.reverse` **[boolean][6]** enable reverse winding (optional, default `false`)
14
- - `options.mutate` **[boolean][6]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
11
+ * `geojson` **[GeoJSON][4]** input GeoJSON Polygon
12
+ * `options` **[Object][5]** Optional parameters (optional, default `{}`)
15
13
 
16
- **Examples**
14
+ * `options.reverse` **[boolean][6]** enable reverse winding (optional, default `false`)
15
+ * `options.mutate` **[boolean][6]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
16
+
17
+ ### Examples
17
18
 
18
19
  ```javascript
19
20
  var polygon = turf.polygon([[[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]]);
package/dist/es/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import clone from '@turf/clone';
2
2
  import booleanClockwise from '@turf/boolean-clockwise';
3
- import { geomEach, featureEach } from '@turf/meta';
3
+ import { featureEach, geomEach } from '@turf/meta';
4
4
  import { getCoords } from '@turf/invariant';
5
- import { featureCollection, isObject } from '@turf/helpers';
5
+ import { isObject, featureCollection } from '@turf/helpers';
6
6
 
7
7
  /**
8
8
  * Rewind {@link LineString|(Multi)LineString} or {@link Polygon|(Multi)Polygon} outer ring counterclockwise and inner rings clockwise (Uses {@link http://en.wikipedia.org/wiki/Shoelace_formula|Shoelace Formula}).
package/dist/js/index.js CHANGED
@@ -1,13 +1,16 @@
1
1
  'use strict';
2
2
 
3
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
-
5
- var clone = _interopDefault(require('@turf/clone'));
6
- var booleanClockwise = _interopDefault(require('@turf/boolean-clockwise'));
3
+ var clone = require('@turf/clone');
4
+ var booleanClockwise = require('@turf/boolean-clockwise');
7
5
  var meta = require('@turf/meta');
8
6
  var invariant = require('@turf/invariant');
9
7
  var helpers = require('@turf/helpers');
10
8
 
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone);
12
+ var booleanClockwise__default = /*#__PURE__*/_interopDefaultLegacy(booleanClockwise);
13
+
11
14
  /**
12
15
  * Rewind {@link LineString|(Multi)LineString} or {@link Polygon|(Multi)Polygon} outer ring counterclockwise and inner rings clockwise (Uses {@link http://en.wikipedia.org/wiki/Shoelace_formula|Shoelace Formula}).
13
16
  *
@@ -40,7 +43,7 @@ function rewind(geojson, options) {
40
43
  throw new Error("<mutate> must be a boolean");
41
44
 
42
45
  // prevent input mutation
43
- if (mutate === false) geojson = clone(geojson);
46
+ if (mutate === false) geojson = clone__default['default'](geojson);
44
47
 
45
48
  // Support Feature Collection or Geometry Collection
46
49
  var results = [];
@@ -111,7 +114,7 @@ function rewindFeature(geojson, reverse) {
111
114
  * @returns {void} mutates coordinates
112
115
  */
113
116
  function rewindLineString(coords, reverse) {
114
- if (booleanClockwise(coords) === reverse) coords.reverse();
117
+ if (booleanClockwise__default['default'](coords) === reverse) coords.reverse();
115
118
  }
116
119
 
117
120
  /**
@@ -124,15 +127,16 @@ function rewindLineString(coords, reverse) {
124
127
  */
125
128
  function rewindPolygon(coords, reverse) {
126
129
  // outer ring
127
- if (booleanClockwise(coords[0]) !== reverse) {
130
+ if (booleanClockwise__default['default'](coords[0]) !== reverse) {
128
131
  coords[0].reverse();
129
132
  }
130
133
  // inner rings
131
134
  for (var i = 1; i < coords.length; i++) {
132
- if (booleanClockwise(coords[i]) === reverse) {
135
+ if (booleanClockwise__default['default'](coords[i]) === reverse) {
133
136
  coords[i].reverse();
134
137
  }
135
138
  }
136
139
  }
137
140
 
138
141
  module.exports = rewind;
142
+ module.exports.default = rewind;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/rewind",
3
- "version": "6.4.0",
3
+ "version": "7.0.0-alpha.0",
4
4
  "description": "turf rewind module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -18,6 +18,7 @@
18
18
  "type": "git",
19
19
  "url": "git://github.com/Turfjs/turf.git"
20
20
  },
21
+ "funding": "https://opencollective.com/turf",
21
22
  "publishConfig": {
22
23
  "access": "public"
23
24
  },
@@ -48,7 +49,7 @@
48
49
  "docs": "node ../../scripts/generate-readmes",
49
50
  "test": "npm-run-all test:*",
50
51
  "test:tape": "node -r esm test.js",
51
- "test:types": "tsc --esModuleInterop --noEmit types.ts"
52
+ "test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
52
53
  },
53
54
  "devDependencies": {
54
55
  "benchmark": "*",
@@ -59,11 +60,11 @@
59
60
  "write-json-file": "*"
60
61
  },
61
62
  "dependencies": {
62
- "@turf/boolean-clockwise": "^6.4.0",
63
- "@turf/clone": "^6.4.0",
64
- "@turf/helpers": "^6.4.0",
65
- "@turf/invariant": "^6.4.0",
66
- "@turf/meta": "^6.4.0"
63
+ "@turf/boolean-clockwise": "^7.0.0-alpha.0",
64
+ "@turf/clone": "^7.0.0-alpha.0",
65
+ "@turf/helpers": "^7.0.0-alpha.0",
66
+ "@turf/invariant": "^7.0.0-alpha.0",
67
+ "@turf/meta": "^7.0.0-alpha.0"
67
68
  },
68
- "gitHead": "1e62773cfc88c627cca8effcb5c14cfb65a905ac"
69
+ "gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
69
70
  }