@turf/boolean-equal 7.0.0-alpha.2 → 7.1.0-alpha.7

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
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## booleanEqual
6
6
 
7
- Determines whether two geometries or features of the same type have identical X,Y coordinate values and properties.
7
+ Determine whether two geometries of the same type have identical X,Y coordinate values.
8
8
  See [http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm][1]
9
9
 
10
10
  ### Parameters
@@ -21,17 +21,11 @@ See [http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relatio
21
21
  var pt1 = turf.point([0, 0]);
22
22
  var pt2 = turf.point([0, 0]);
23
23
  var pt3 = turf.point([1, 1]);
24
- var pt4 = turf.point([0, 0], {prop: 'A'});
25
- var pt5 = turf.point([0, 0], {prop: 'B'});
26
24
 
27
25
  turf.booleanEqual(pt1, pt2);
28
26
  //= true
29
27
  turf.booleanEqual(pt2, pt3);
30
28
  //= false
31
- turf.booleanEqual(pt4, pt5);
32
- //= false
33
- turf.booleanEqual(pt4.geometry, pt5.geometry);
34
- //= true
35
29
  ```
36
30
 
37
31
  Returns **[boolean][6]** true if the objects are equal, false otherwise
@@ -48,26 +42,21 @@ Returns **[boolean][6]** true if the objects are equal, false otherwise
48
42
 
49
43
  [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
50
44
 
51
- <!-- This file is automatically generated. Please don't edit it directly:
52
- if you find an error, edit the source file (likely index.js), and re-run
53
- ./scripts/generate-readmes in the turf project. -->
45
+ <!-- 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. -->
54
46
 
55
47
  ---
56
48
 
57
- This module is part of the [Turfjs project](http://turfjs.org/), an open source
58
- module collection dedicated to geographic algorithms. It is maintained in the
59
- [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
60
- PRs and issues.
49
+ This 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.
61
50
 
62
51
  ### Installation
63
52
 
64
- Install this module individually:
53
+ Install this single module individually:
65
54
 
66
55
  ```sh
67
56
  $ npm install @turf/boolean-equal
68
57
  ```
69
58
 
70
- Or install the Turf module that includes it as a function:
59
+ Or install the all-encompassing @turf/turf module that includes all modules as functions:
71
60
 
72
61
  ```sh
73
62
  $ npm install @turf/turf
@@ -76,4 +65,4 @@ $ npm install @turf/turf
76
65
 
77
66
  ### Diagrams
78
67
 
79
- ![esri-equals](diagrams/esri-equals.gif)
68
+ ![esri-equals](diagrams/esri-equals.gif)
@@ -0,0 +1,24 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
2
+ var _geojsonequalityts = require('geojson-equality-ts');
3
+ var _cleancoords = require('@turf/clean-coords');
4
+ var _invariant = require('@turf/invariant');
5
+ function booleanEqual(feature1, feature2, options = {}) {
6
+ let precision = options.precision;
7
+ precision = precision === void 0 || precision === null || isNaN(precision) ? 6 : precision;
8
+ if (typeof precision !== "number" || !(precision >= 0)) {
9
+ throw new Error("precision must be a positive number");
10
+ }
11
+ const type1 = _invariant.getGeom.call(void 0, feature1).type;
12
+ const type2 = _invariant.getGeom.call(void 0, feature2).type;
13
+ if (type1 !== type2)
14
+ return false;
15
+ return _geojsonequalityts.geojsonEquality.call(void 0, _cleancoords.cleanCoords.call(void 0, feature1), _cleancoords.cleanCoords.call(void 0, feature2), {
16
+ precision
17
+ });
18
+ }
19
+ var turf_boolean_equal_default = booleanEqual;
20
+
21
+
22
+
23
+ exports.booleanEqual = booleanEqual; exports.default = turf_boolean_equal_default;
24
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AACA,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAsBxB,SAAS,aACP,UACA,UACA,UAEI,CAAC,GACI;AACT,MAAI,YAAY,QAAQ;AAExB,cACE,cAAc,UAAa,cAAc,QAAQ,MAAM,SAAS,IAC5D,IACA;AAEN,MAAI,OAAO,cAAc,YAAY,EAAE,aAAa,IAAI;AACtD,UAAM,IAAI,MAAM,qCAAqC;AAAA,EACvD;AAEA,QAAM,QAAQ,QAAQ,QAAQ,EAAE;AAChC,QAAM,QAAQ,QAAQ,QAAQ,EAAE;AAChC,MAAI,UAAU;AAAO,WAAO;AAE5B,SAAO,gBAAgB,YAAY,QAAQ,GAAG,YAAY,QAAQ,GAAG;AAAA,IACnE;AAAA,EACF,CAAC;AACH;AAGA,IAAO,6BAAQ","sourcesContent":["import { Feature, Geometry } from \"geojson\";\nimport { geojsonEquality } from \"geojson-equality-ts\";\nimport { cleanCoords } from \"@turf/clean-coords\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Determine whether two geometries of the same type have identical X,Y coordinate values.\n * See http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm\n *\n * @name booleanEqual\n * @param {Geometry|Feature} feature1 GeoJSON input\n * @param {Geometry|Feature} feature2 GeoJSON input\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.precision=6] decimal precision to use when comparing coordinates\n * @returns {boolean} true if the objects are equal, false otherwise\n * @example\n * var pt1 = turf.point([0, 0]);\n * var pt2 = turf.point([0, 0]);\n * var pt3 = turf.point([1, 1]);\n *\n * turf.booleanEqual(pt1, pt2);\n * //= true\n * turf.booleanEqual(pt2, pt3);\n * //= false\n */\nfunction booleanEqual(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry,\n options: {\n precision?: number;\n } = {}\n): boolean {\n let precision = options.precision;\n\n precision =\n precision === undefined || precision === null || isNaN(precision)\n ? 6\n : precision;\n\n if (typeof precision !== \"number\" || !(precision >= 0)) {\n throw new Error(\"precision must be a positive number\");\n }\n\n const type1 = getGeom(feature1).type;\n const type2 = getGeom(feature2).type;\n if (type1 !== type2) return false;\n\n return geojsonEquality(cleanCoords(feature1), cleanCoords(feature2), {\n precision,\n });\n}\n\nexport { booleanEqual };\nexport default booleanEqual;\n"]}
@@ -0,0 +1,27 @@
1
+ import { Feature, Geometry } from 'geojson';
2
+
3
+ /**
4
+ * Determine whether two geometries of the same type have identical X,Y coordinate values.
5
+ * See http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm
6
+ *
7
+ * @name booleanEqual
8
+ * @param {Geometry|Feature} feature1 GeoJSON input
9
+ * @param {Geometry|Feature} feature2 GeoJSON input
10
+ * @param {Object} [options={}] Optional parameters
11
+ * @param {number} [options.precision=6] decimal precision to use when comparing coordinates
12
+ * @returns {boolean} true if the objects are equal, false otherwise
13
+ * @example
14
+ * var pt1 = turf.point([0, 0]);
15
+ * var pt2 = turf.point([0, 0]);
16
+ * var pt3 = turf.point([1, 1]);
17
+ *
18
+ * turf.booleanEqual(pt1, pt2);
19
+ * //= true
20
+ * turf.booleanEqual(pt2, pt3);
21
+ * //= false
22
+ */
23
+ declare function booleanEqual(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry, options?: {
24
+ precision?: number;
25
+ }): boolean;
26
+
27
+ export { booleanEqual, booleanEqual as default };
@@ -1,4 +1,5 @@
1
- import { Feature, Geometry } from "geojson";
1
+ import { Feature, Geometry } from 'geojson';
2
+
2
3
  /**
3
4
  * Determine whether two geometries of the same type have identical X,Y coordinate values.
4
5
  * See http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm
@@ -22,4 +23,5 @@ import { Feature, Geometry } from "geojson";
22
23
  declare function booleanEqual(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry, options?: {
23
24
  precision?: number;
24
25
  }): boolean;
25
- export default booleanEqual;
26
+
27
+ export { booleanEqual, booleanEqual as default };
@@ -0,0 +1,24 @@
1
+ // index.ts
2
+ import { geojsonEquality } from "geojson-equality-ts";
3
+ import { cleanCoords } from "@turf/clean-coords";
4
+ import { getGeom } from "@turf/invariant";
5
+ function booleanEqual(feature1, feature2, options = {}) {
6
+ let precision = options.precision;
7
+ precision = precision === void 0 || precision === null || isNaN(precision) ? 6 : precision;
8
+ if (typeof precision !== "number" || !(precision >= 0)) {
9
+ throw new Error("precision must be a positive number");
10
+ }
11
+ const type1 = getGeom(feature1).type;
12
+ const type2 = getGeom(feature2).type;
13
+ if (type1 !== type2)
14
+ return false;
15
+ return geojsonEquality(cleanCoords(feature1), cleanCoords(feature2), {
16
+ precision
17
+ });
18
+ }
19
+ var turf_boolean_equal_default = booleanEqual;
20
+ export {
21
+ booleanEqual,
22
+ turf_boolean_equal_default as default
23
+ };
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, Geometry } from \"geojson\";\nimport { geojsonEquality } from \"geojson-equality-ts\";\nimport { cleanCoords } from \"@turf/clean-coords\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Determine whether two geometries of the same type have identical X,Y coordinate values.\n * See http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm\n *\n * @name booleanEqual\n * @param {Geometry|Feature} feature1 GeoJSON input\n * @param {Geometry|Feature} feature2 GeoJSON input\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.precision=6] decimal precision to use when comparing coordinates\n * @returns {boolean} true if the objects are equal, false otherwise\n * @example\n * var pt1 = turf.point([0, 0]);\n * var pt2 = turf.point([0, 0]);\n * var pt3 = turf.point([1, 1]);\n *\n * turf.booleanEqual(pt1, pt2);\n * //= true\n * turf.booleanEqual(pt2, pt3);\n * //= false\n */\nfunction booleanEqual(\n feature1: Feature<any> | Geometry,\n feature2: Feature<any> | Geometry,\n options: {\n precision?: number;\n } = {}\n): boolean {\n let precision = options.precision;\n\n precision =\n precision === undefined || precision === null || isNaN(precision)\n ? 6\n : precision;\n\n if (typeof precision !== \"number\" || !(precision >= 0)) {\n throw new Error(\"precision must be a positive number\");\n }\n\n const type1 = getGeom(feature1).type;\n const type2 = getGeom(feature2).type;\n if (type1 !== type2) return false;\n\n return geojsonEquality(cleanCoords(feature1), cleanCoords(feature2), {\n precision,\n });\n}\n\nexport { booleanEqual };\nexport default booleanEqual;\n"],"mappings":";AACA,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAsBxB,SAAS,aACP,UACA,UACA,UAEI,CAAC,GACI;AACT,MAAI,YAAY,QAAQ;AAExB,cACE,cAAc,UAAa,cAAc,QAAQ,MAAM,SAAS,IAC5D,IACA;AAEN,MAAI,OAAO,cAAc,YAAY,EAAE,aAAa,IAAI;AACtD,UAAM,IAAI,MAAM,qCAAqC;AAAA,EACvD;AAEA,QAAM,QAAQ,QAAQ,QAAQ,EAAE;AAChC,QAAM,QAAQ,QAAQ,QAAQ,EAAE;AAChC,MAAI,UAAU;AAAO,WAAO;AAE5B,SAAO,gBAAgB,YAAY,QAAQ,GAAG,YAAY,QAAQ,GAAG;AAAA,IACnE;AAAA,EACF,CAAC;AACH;AAGA,IAAO,6BAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/boolean-equal",
3
- "version": "7.0.0-alpha.2",
3
+ "version": "7.1.0-alpha.7+0ce6ecca0",
4
4
  "description": "turf boolean-equal module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -29,49 +29,53 @@
29
29
  "equal",
30
30
  "boolean-equal"
31
31
  ],
32
- "main": "dist/js/index.js",
33
- "module": "dist/es/index.js",
32
+ "type": "module",
33
+ "main": "dist/cjs/index.cjs",
34
+ "module": "dist/esm/index.js",
35
+ "types": "dist/esm/index.d.ts",
34
36
  "exports": {
35
37
  "./package.json": "./package.json",
36
38
  ".": {
37
- "types": "./dist/js/index.d.ts",
38
- "import": "./dist/es/index.js",
39
- "require": "./dist/js/index.js"
39
+ "import": {
40
+ "types": "./dist/esm/index.d.ts",
41
+ "default": "./dist/esm/index.js"
42
+ },
43
+ "require": {
44
+ "types": "./dist/cjs/index.d.cts",
45
+ "default": "./dist/cjs/index.cjs"
46
+ }
40
47
  }
41
48
  },
42
- "types": "dist/js/index.d.ts",
43
49
  "sideEffects": false,
44
50
  "files": [
45
51
  "dist"
46
52
  ],
47
53
  "scripts": {
48
- "bench": "tsx bench.js",
49
- "build": "npm-run-all build:*",
50
- "build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
51
- "build:js": "tsc",
52
- "docs": "tsx ../../scripts/generate-readmes",
53
- "test": "npm-run-all test:*",
54
- "test:tape": "tsx test.js"
54
+ "bench": "tsx bench.ts",
55
+ "build": "tsup --config ../../tsup.config.ts",
56
+ "docs": "tsx ../../scripts/generate-readmes.ts",
57
+ "test": "npm-run-all --npm-path npm test:*",
58
+ "test:tape": "tsx test.ts"
55
59
  },
56
60
  "devDependencies": {
57
- "@types/geojson-equality": "^0.2.0",
58
- "@types/tape": "*",
59
- "benchmark": "*",
61
+ "@types/benchmark": "^2.1.5",
62
+ "@types/tape": "^4.2.32",
63
+ "benchmark": "^2.1.4",
60
64
  "boolean-shapely": "*",
61
- "glob": "*",
62
- "load-json-file": "*",
63
- "npm-run-all": "*",
64
- "tape": "*",
65
- "tslint": "*",
66
- "tsx": "*",
67
- "typescript": "*"
65
+ "glob": "^10.3.10",
66
+ "load-json-file": "^7.0.1",
67
+ "npm-run-all": "^4.1.5",
68
+ "tape": "^5.7.2",
69
+ "tsup": "^8.0.1",
70
+ "tsx": "^4.6.2",
71
+ "typescript": "^5.2.2"
68
72
  },
69
73
  "dependencies": {
70
- "@turf/clean-coords": "^7.0.0-alpha.2",
71
- "@turf/helpers": "^7.0.0-alpha.2",
72
- "@turf/invariant": "^7.0.0-alpha.2",
73
- "geojson-equality": "0.1.6",
74
- "tslib": "^2.3.0"
74
+ "@turf/clean-coords": "^7.1.0-alpha.7+0ce6ecca0",
75
+ "@turf/helpers": "^7.1.0-alpha.7+0ce6ecca0",
76
+ "@turf/invariant": "^7.1.0-alpha.7+0ce6ecca0",
77
+ "geojson-equality-ts": "^1.0.2",
78
+ "tslib": "^2.6.2"
75
79
  },
76
- "gitHead": "dd35b52725945b4fa29a98d9a550733e06cc222e"
80
+ "gitHead": "0ce6ecca05829690270fec6d6bed2003495fe0ea"
77
81
  }
package/dist/es/index.js DELETED
@@ -1,40 +0,0 @@
1
- import GeojsonEquality from "geojson-equality";
2
- import cleanCoords from "@turf/clean-coords";
3
- import { getGeom } from "@turf/invariant";
4
- /**
5
- * Determine whether two geometries of the same type have identical X,Y coordinate values.
6
- * See http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm
7
- *
8
- * @name booleanEqual
9
- * @param {Geometry|Feature} feature1 GeoJSON input
10
- * @param {Geometry|Feature} feature2 GeoJSON input
11
- * @param {Object} [options={}] Optional parameters
12
- * @param {number} [options.precision=6] decimal precision to use when comparing coordinates
13
- * @returns {boolean} true if the objects are equal, false otherwise
14
- * @example
15
- * var pt1 = turf.point([0, 0]);
16
- * var pt2 = turf.point([0, 0]);
17
- * var pt3 = turf.point([1, 1]);
18
- *
19
- * turf.booleanEqual(pt1, pt2);
20
- * //= true
21
- * turf.booleanEqual(pt2, pt3);
22
- * //= false
23
- */
24
- function booleanEqual(feature1, feature2, options = {}) {
25
- let precision = options.precision;
26
- precision =
27
- precision === undefined || precision === null || isNaN(precision)
28
- ? 6
29
- : precision;
30
- if (typeof precision !== "number" || !(precision >= 0)) {
31
- throw new Error("precision must be a positive number");
32
- }
33
- const type1 = getGeom(feature1).type;
34
- const type2 = getGeom(feature2).type;
35
- if (type1 !== type2)
36
- return false;
37
- const equality = new GeojsonEquality({ precision: precision });
38
- return equality.compare(cleanCoords(feature1), cleanCoords(feature2));
39
- }
40
- export default booleanEqual;
@@ -1 +0,0 @@
1
- {"type":"module"}
package/dist/js/index.js DELETED
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const geojson_equality_1 = tslib_1.__importDefault(require("geojson-equality"));
5
- const clean_coords_1 = tslib_1.__importDefault(require("@turf/clean-coords"));
6
- const invariant_1 = require("@turf/invariant");
7
- /**
8
- * Determine whether two geometries of the same type have identical X,Y coordinate values.
9
- * See http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm
10
- *
11
- * @name booleanEqual
12
- * @param {Geometry|Feature} feature1 GeoJSON input
13
- * @param {Geometry|Feature} feature2 GeoJSON input
14
- * @param {Object} [options={}] Optional parameters
15
- * @param {number} [options.precision=6] decimal precision to use when comparing coordinates
16
- * @returns {boolean} true if the objects are equal, false otherwise
17
- * @example
18
- * var pt1 = turf.point([0, 0]);
19
- * var pt2 = turf.point([0, 0]);
20
- * var pt3 = turf.point([1, 1]);
21
- *
22
- * turf.booleanEqual(pt1, pt2);
23
- * //= true
24
- * turf.booleanEqual(pt2, pt3);
25
- * //= false
26
- */
27
- function booleanEqual(feature1, feature2, options = {}) {
28
- let precision = options.precision;
29
- precision =
30
- precision === undefined || precision === null || isNaN(precision)
31
- ? 6
32
- : precision;
33
- if (typeof precision !== "number" || !(precision >= 0)) {
34
- throw new Error("precision must be a positive number");
35
- }
36
- const type1 = invariant_1.getGeom(feature1).type;
37
- const type2 = invariant_1.getGeom(feature2).type;
38
- if (type1 !== type2)
39
- return false;
40
- const equality = new geojson_equality_1.default({ precision: precision });
41
- return equality.compare(clean_coords_1.default(feature1), clean_coords_1.default(feature2));
42
- }
43
- exports.default = booleanEqual;