@turf/line-slice 7.1.0-alpha.70 → 7.2.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/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +10 -10
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-line-slice/dist/cjs/index.cjs","../../index.js"],"names":[],"mappings":"AAAA;ACAA,4CAAmC;AACnC,wCAAyC;AACzC,iEAAmC;AA+BnC,SAAS,SAAA,CAAU,OAAA,EAAS,MAAA,EAAQ,IAAA,EAAM;AAExC,EAAA,IAAI,OAAA,EAAS,kCAAA,IAAc,CAAA;AAC3B,EAAA,GAAA,CAAI,gCAAA,IAAY,EAAA,IAAM,YAAA;AACpB,IAAA,MAAM,IAAI,KAAA,CAAM,2BAA2B,CAAA;AAE7C,EAAA,IAAI,YAAA,EAAc,oDAAA,IAAmB,EAAM,OAAO,CAAA;AAClD,EAAA,IAAI,WAAA,EAAa,oDAAA,IAAmB,EAAM,MAAM,CAAA;AAChD,EAAA,IAAI,IAAA;AACJ,EAAA,GAAA,CAAI,WAAA,CAAY,UAAA,CAAW,MAAA,GAAS,UAAA,CAAW,UAAA,CAAW,KAAA,EAAO;AAC/D,IAAA,KAAA,EAAO,CAAC,WAAA,EAAa,UAAU,CAAA;AAAA,EACjC,EAAA,KAAO;AACL,IAAA,KAAA,EAAO,CAAC,UAAA,EAAY,WAAW,CAAA;AAAA,EACjC;AACA,EAAA,IAAI,WAAA,EAAa,CAAC,IAAA,CAAK,CAAC,CAAA,CAAE,QAAA,CAAS,WAAW,CAAA;AAC9C,EAAA,IAAA,CAAA,IACM,EAAA,EAAI,IAAA,CAAK,CAAC,CAAA,CAAE,UAAA,CAAW,MAAA,EAAQ,CAAA,EACnC,EAAA,EAAI,IAAA,CAAK,CAAC,CAAA,CAAE,UAAA,CAAW,MAAA,EAAQ,CAAA,EAC/B,CAAA,EAAA,EACA;AACA,IAAA,UAAA,CAAW,IAAA,CAAK,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EAC3B;AACA,EAAA,UAAA,CAAW,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA,CAAE,QAAA,CAAS,WAAW,CAAA;AAC5C,EAAA,OAAO,iCAAA,UAAW,EAAY,IAAA,CAAK,UAAU,CAAA;AAC/C;AAGA,IAAO,wBAAA,EAAQ,SAAA;ADpCf;AACE;AACA;AACF,yEAAC","file":"/home/runner/work/turf/turf/packages/turf-line-slice/dist/cjs/index.cjs","sourcesContent":[null,"import { getCoords, getType } from \"@turf/invariant\";\nimport { lineString as linestring } from \"@turf/helpers\";\nimport { nearestPointOnLine } from \"@turf/nearest-point-on-line\";\n\n/**\n * Takes a {@link LineString|line}, a start {@link Point}, and a stop point\n * and returns a subsection of the line in-between those points.\n * The start & stop points don't need to fall exactly on the line.\n *\n * This can be useful for extracting only the part of a route between waypoints.\n *\n * @function\n * @param {Coord} startPt starting point\n * @param {Coord} stopPt stopping point\n * @param {Feature<LineString>|LineString} line line to slice\n * @returns {Feature<LineString>} sliced line\n * @example\n * var line = turf.lineString([\n * [-77.031669, 38.878605],\n * [-77.029609, 38.881946],\n * [-77.020339, 38.884084],\n * [-77.025661, 38.885821],\n * [-77.021884, 38.889563],\n * [-77.019824, 38.892368]\n * ]);\n * var start = turf.point([-77.029609, 38.881946]);\n * var stop = turf.point([-77.021884, 38.889563]);\n *\n * var sliced = turf.lineSlice(start, stop, line);\n *\n * //addToMap\n * var addToMap = [start, stop, line]\n */\nfunction lineSlice(startPt, stopPt, line) {\n // Validation\n var coords = getCoords(line);\n if (getType(line) !== \"LineString\")\n throw new Error(\"line must be a LineString\");\n\n var startVertex = nearestPointOnLine(line, startPt);\n var stopVertex = nearestPointOnLine(line, stopPt);\n var ends;\n if (startVertex.properties.index <= stopVertex.properties.index) {\n ends = [startVertex, stopVertex];\n } else {\n ends = [stopVertex, startVertex];\n }\n var clipCoords = [ends[0].geometry.coordinates];\n for (\n var i = ends[0].properties.index + 1;\n i < ends[1].properties.index + 1;\n i++\n ) {\n clipCoords.push(coords[i]);\n }\n clipCoords.push(ends[1].geometry.coordinates);\n return linestring(clipCoords, line.properties);\n}\n\nexport { lineSlice };\nexport default lineSlice;\n"]}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.js"],"sourcesContent":["import { getCoords, getType } from \"@turf/invariant\";\nimport { lineString as linestring } from \"@turf/helpers\";\nimport { nearestPointOnLine } from \"@turf/nearest-point-on-line\";\n\n/**\n * Takes a {@link LineString|line}, a start {@link Point}, and a stop point\n * and returns a subsection of the line in-between those points.\n * The start & stop points don't need to fall exactly on the line.\n *\n * This can be useful for extracting only the part of a route between waypoints.\n *\n * @
|
|
1
|
+
{"version":3,"sources":["../../index.js"],"sourcesContent":["import { getCoords, getType } from \"@turf/invariant\";\nimport { lineString as linestring } from \"@turf/helpers\";\nimport { nearestPointOnLine } from \"@turf/nearest-point-on-line\";\n\n/**\n * Takes a {@link LineString|line}, a start {@link Point}, and a stop point\n * and returns a subsection of the line in-between those points.\n * The start & stop points don't need to fall exactly on the line.\n *\n * This can be useful for extracting only the part of a route between waypoints.\n *\n * @function\n * @param {Coord} startPt starting point\n * @param {Coord} stopPt stopping point\n * @param {Feature<LineString>|LineString} line line to slice\n * @returns {Feature<LineString>} sliced line\n * @example\n * var line = turf.lineString([\n * [-77.031669, 38.878605],\n * [-77.029609, 38.881946],\n * [-77.020339, 38.884084],\n * [-77.025661, 38.885821],\n * [-77.021884, 38.889563],\n * [-77.019824, 38.892368]\n * ]);\n * var start = turf.point([-77.029609, 38.881946]);\n * var stop = turf.point([-77.021884, 38.889563]);\n *\n * var sliced = turf.lineSlice(start, stop, line);\n *\n * //addToMap\n * var addToMap = [start, stop, line]\n */\nfunction lineSlice(startPt, stopPt, line) {\n // Validation\n var coords = getCoords(line);\n if (getType(line) !== \"LineString\")\n throw new Error(\"line must be a LineString\");\n\n var startVertex = nearestPointOnLine(line, startPt);\n var stopVertex = nearestPointOnLine(line, stopPt);\n var ends;\n if (startVertex.properties.index <= stopVertex.properties.index) {\n ends = [startVertex, stopVertex];\n } else {\n ends = [stopVertex, startVertex];\n }\n var clipCoords = [ends[0].geometry.coordinates];\n for (\n var i = ends[0].properties.index + 1;\n i < ends[1].properties.index + 1;\n i++\n ) {\n clipCoords.push(coords[i]);\n }\n clipCoords.push(ends[1].geometry.coordinates);\n return linestring(clipCoords, line.properties);\n}\n\nexport { lineSlice };\nexport default lineSlice;\n"],"mappings":";AAAA,SAAS,WAAW,eAAe;AACnC,SAAS,cAAc,kBAAkB;AACzC,SAAS,0BAA0B;AA+BnC,SAAS,UAAU,SAAS,QAAQ,MAAM;AAExC,MAAI,SAAS,UAAU,IAAI;AAC3B,MAAI,QAAQ,IAAI,MAAM;AACpB,UAAM,IAAI,MAAM,2BAA2B;AAE7C,MAAI,cAAc,mBAAmB,MAAM,OAAO;AAClD,MAAI,aAAa,mBAAmB,MAAM,MAAM;AAChD,MAAI;AACJ,MAAI,YAAY,WAAW,SAAS,WAAW,WAAW,OAAO;AAC/D,WAAO,CAAC,aAAa,UAAU;AAAA,EACjC,OAAO;AACL,WAAO,CAAC,YAAY,WAAW;AAAA,EACjC;AACA,MAAI,aAAa,CAAC,KAAK,CAAC,EAAE,SAAS,WAAW;AAC9C,WACM,IAAI,KAAK,CAAC,EAAE,WAAW,QAAQ,GACnC,IAAI,KAAK,CAAC,EAAE,WAAW,QAAQ,GAC/B,KACA;AACA,eAAW,KAAK,OAAO,CAAC,CAAC;AAAA,EAC3B;AACA,aAAW,KAAK,KAAK,CAAC,EAAE,SAAS,WAAW;AAC5C,SAAO,WAAW,YAAY,KAAK,UAAU;AAC/C;AAGA,IAAO,0BAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/line-slice",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "turf line-slice module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,22 +54,22 @@
|
|
|
54
54
|
"test:tape": "tsx test.ts"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@turf/truncate": "^7.
|
|
57
|
+
"@turf/truncate": "^7.2.0",
|
|
58
58
|
"@types/benchmark": "^2.1.5",
|
|
59
|
-
"@types/tape": "^4.
|
|
59
|
+
"@types/tape": "^4.13.4",
|
|
60
60
|
"benchmark": "^2.1.4",
|
|
61
61
|
"load-json-file": "^7.0.1",
|
|
62
62
|
"npm-run-all": "^4.1.5",
|
|
63
|
-
"tape": "^5.
|
|
64
|
-
"tsup": "^8.
|
|
65
|
-
"tsx": "^4.
|
|
63
|
+
"tape": "^5.9.0",
|
|
64
|
+
"tsup": "^8.3.5",
|
|
65
|
+
"tsx": "^4.19.2",
|
|
66
66
|
"write-json-file": "^5.0.0"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@turf/helpers": "^7.
|
|
70
|
-
"@turf/invariant": "^7.
|
|
71
|
-
"@turf/nearest-point-on-line": "^7.
|
|
69
|
+
"@turf/helpers": "^7.2.0",
|
|
70
|
+
"@turf/invariant": "^7.2.0",
|
|
71
|
+
"@turf/nearest-point-on-line": "^7.2.0",
|
|
72
72
|
"@types/geojson": "^7946.0.10"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
|
|
75
75
|
}
|