Here is how I am using line-intersect module
package.json
@turf/line-intersect": "^6.0.0"
index.js
const lineintersect = require('@turf/line-intersect');
const intersecting = lineintersect(feature);
Following is the error:
TypeError: lineintersect is not a function
But this works fine with the old version i.e. 4.4.0
Ref: https://github.com/mapbox/osm-compare/pull/196/commits/1b8089c93707da3eb85d1232e1d63189e167a99d
cc @DenisCarriere
Hi @amishas157
Unfortunately @DenisCarriere has been tinkering with some typescript related things and a few things seem to have gone awry. Simple solution at the moment is to stick with v5 from npm.
Cheers
Rowan
Hi @amishas157
Closing the loop on this - with the current v6 publishing most modules are now exposed as .default
So here is a fuller snippet
const lineIntersect = require('@turf/line-intersect').default;
const helpers = require('@turf/helpers');
var line1 = helpers.lineString([[126, -11], [129, -21]]);
var line2 = helpers.lineString([[123, -18], [131, -14]]);
var intersects = lineIntersect(line1, line2);
Hope that helps
Unfortunately, I don't think we will be able to get around that issue.
If you're still using CommonJS, you will need to include .default to the v6.0 modules.
Most helpful comment
Hi @amishas157
Closing the loop on this - with the current v6 publishing most modules are now exposed as
.defaultSo here is a fuller snippet
const lineIntersect = require('@turf/line-intersect').default; const helpers = require('@turf/helpers'); var line1 = helpers.lineString([[126, -11], [129, -21]]); var line2 = helpers.lineString([[123, -18], [131, -14]]); var intersects = lineIntersect(line1, line2);Hope that helps