@turf/boolean-equal 7.0.0-alpha.0 → 7.0.0-alpha.110

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
@@ -42,26 +42,21 @@ Returns **[boolean][6]** true if the objects are equal, false otherwise
42
42
 
43
43
  [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
44
44
 
45
- <!-- This file is automatically generated. Please don't edit it directly:
46
- if you find an error, edit the source file (likely index.js), and re-run
47
- ./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. -->
48
46
 
49
47
  ---
50
48
 
51
- This module is part of the [Turfjs project](http://turfjs.org/), an open source
52
- module collection dedicated to geographic algorithms. It is maintained in the
53
- [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
54
- 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.
55
50
 
56
51
  ### Installation
57
52
 
58
- Install this module individually:
53
+ Install this single module individually:
59
54
 
60
55
  ```sh
61
56
  $ npm install @turf/boolean-equal
62
57
  ```
63
58
 
64
- 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:
65
60
 
66
61
  ```sh
67
62
  $ npm install @turf/turf
@@ -0,0 +1,27 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // index.ts
5
+ var _helpers = require('@turf/helpers');
6
+ var _cleancoords = require('@turf/clean-coords');
7
+ var _invariant = require('@turf/invariant');
8
+ function booleanEqual(feature1, feature2, options = {}) {
9
+ let precision = options.precision;
10
+ precision = precision === void 0 || precision === null || isNaN(precision) ? 6 : precision;
11
+ if (typeof precision !== "number" || !(precision >= 0)) {
12
+ throw new Error("precision must be a positive number");
13
+ }
14
+ const type1 = _invariant.getGeom.call(void 0, feature1).type;
15
+ const type2 = _invariant.getGeom.call(void 0, feature2).type;
16
+ if (type1 !== type2)
17
+ return false;
18
+ const equality = new (0, _helpers.GeojsonEquality)({ precision });
19
+ return equality.compare(_cleancoords.cleanCoords.call(void 0, feature1), _cleancoords.cleanCoords.call(void 0, feature2));
20
+ }
21
+ __name(booleanEqual, "booleanEqual");
22
+ var turf_boolean_equal_default = booleanEqual;
23
+
24
+
25
+
26
+ exports.booleanEqual = booleanEqual; exports.default = turf_boolean_equal_default;
27
+ //# 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,QAAM,WAAW,IAAI,gBAAgB,EAAE,UAAqB,CAAC;AAC7D,SAAO,SAAS,QAAQ,YAAY,QAAQ,GAAG,YAAY,QAAQ,CAAC;AACtE;AAxBS;AA2BT,IAAO,6BAAQ","sourcesContent":["import { Feature, Geometry } from \"geojson\";\nimport { GeojsonEquality } from \"@turf/helpers\";\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 const equality = new GeojsonEquality({ precision: precision });\n return equality.compare(cleanCoords(feature1), cleanCoords(feature2));\n}\n\nexport { booleanEqual };\nexport default booleanEqual;\n"]}
@@ -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,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 };
@@ -0,0 +1,27 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // index.ts
5
+ import { GeojsonEquality } from "@turf/helpers";
6
+ import { cleanCoords } from "@turf/clean-coords";
7
+ import { getGeom } from "@turf/invariant";
8
+ function booleanEqual(feature1, feature2, options = {}) {
9
+ let precision = options.precision;
10
+ precision = precision === void 0 || precision === null || isNaN(precision) ? 6 : precision;
11
+ if (typeof precision !== "number" || !(precision >= 0)) {
12
+ throw new Error("precision must be a positive number");
13
+ }
14
+ const type1 = getGeom(feature1).type;
15
+ const type2 = getGeom(feature2).type;
16
+ if (type1 !== type2)
17
+ return false;
18
+ const equality = new GeojsonEquality({ precision });
19
+ return equality.compare(cleanCoords(feature1), cleanCoords(feature2));
20
+ }
21
+ __name(booleanEqual, "booleanEqual");
22
+ var turf_boolean_equal_default = booleanEqual;
23
+ export {
24
+ booleanEqual,
25
+ turf_boolean_equal_default as default
26
+ };
27
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, Geometry } from \"geojson\";\nimport { GeojsonEquality } from \"@turf/helpers\";\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 const equality = new GeojsonEquality({ precision: precision });\n return equality.compare(cleanCoords(feature1), cleanCoords(feature2));\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,QAAM,WAAW,IAAI,gBAAgB,EAAE,UAAqB,CAAC;AAC7D,SAAO,SAAS,QAAQ,YAAY,QAAQ,GAAG,YAAY,QAAQ,CAAC;AACtE;AAxBS;AA2BT,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.0",
3
+ "version": "7.0.0-alpha.110+1411d63a7",
4
4
  "description": "turf boolean-equal module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -29,48 +29,52 @@
29
29
  "equal",
30
30
  "boolean-equal"
31
31
  ],
32
- "main": "dist/js/index.js",
33
- "module": "dist/es/index.js",
32
+ "type": "commonjs",
33
+ "main": "dist/cjs/index.cjs",
34
+ "module": "dist/esm/index.mjs",
35
+ "types": "dist/cjs/index.d.ts",
34
36
  "exports": {
35
37
  "./package.json": "./package.json",
36
38
  ".": {
37
- "import": "./dist/es/index.js",
38
- "require": "./dist/js/index.js"
39
+ "import": {
40
+ "types": "./dist/esm/index.d.mts",
41
+ "default": "./dist/esm/index.mjs"
42
+ },
43
+ "require": {
44
+ "types": "./dist/cjs/index.d.ts",
45
+ "default": "./dist/cjs/index.cjs"
46
+ }
39
47
  }
40
48
  },
41
- "types": "dist/js/index.d.ts",
42
49
  "sideEffects": false,
43
50
  "files": [
44
51
  "dist"
45
52
  ],
46
53
  "scripts": {
47
- "bench": "ts-node bench.js",
48
- "build": "npm-run-all build:*",
49
- "build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
50
- "build:js": "tsc",
51
- "docs": "node ../../scripts/generate-readmes",
52
- "test": "npm-run-all test:*",
53
- "test:tape": "ts-node -r esm 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"
54
59
  },
55
60
  "devDependencies": {
56
- "@types/geojson-equality": "^0.2.0",
57
- "@types/tape": "*",
58
- "benchmark": "*",
61
+ "@types/benchmark": "^2.1.5",
62
+ "@types/tape": "^4.2.32",
63
+ "benchmark": "^2.1.4",
59
64
  "boolean-shapely": "*",
60
- "glob": "*",
61
- "load-json-file": "*",
62
- "npm-run-all": "*",
63
- "tape": "*",
64
- "ts-node": "*",
65
- "tslint": "*",
66
- "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"
67
72
  },
68
73
  "dependencies": {
69
- "@turf/clean-coords": "^7.0.0-alpha.0",
70
- "@turf/helpers": "^7.0.0-alpha.0",
71
- "@turf/invariant": "^7.0.0-alpha.0",
72
- "geojson-equality": "0.1.6",
73
- "tslib": "^2.3.0"
74
+ "@turf/clean-coords": "^7.0.0-alpha.110+1411d63a7",
75
+ "@turf/helpers": "^7.0.0-alpha.110+1411d63a7",
76
+ "@turf/invariant": "^7.0.0-alpha.110+1411d63a7",
77
+ "tslib": "^2.6.2"
74
78
  },
75
- "gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
79
+ "gitHead": "1411d63a74c275c9216fe48e9d3cb2d48a359068"
76
80
  }
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;