Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@turf/kinks
Advanced tools
@turf/kinks is a module in the Turf.js library that is used to detect self-intersections (kinks) in GeoJSON polygons. This is useful for validating and cleaning up spatial data to ensure that polygons are well-formed and do not contain any self-intersecting lines.
Detecting Kinks in Polygons
This feature allows you to detect self-intersections in a given GeoJSON polygon. The code sample creates a polygon with a self-intersection and uses the `turf.kinks` function to find and log the kinks.
const turf = require('@turf/turf');
const polygon = turf.polygon([[
[-12.034835, 8.901183],
[-12.060413, 8.899826],
[-12.03638, 8.873199],
[-12.034835, 8.901183]
]]);
const kinks = turf.kinks(polygon);
console.log(kinks);
JSTS (JavaScript Topology Suite) is a JavaScript library of spatial predicates and functions for processing geometry. It provides more comprehensive geometry operations compared to @turf/kinks, including robust algorithms for intersection, union, and difference operations.
Martinez Polygon Clipping is a library for performing boolean operations on polygons, such as union, intersection, and difference. While it does not specifically focus on detecting kinks, it can be used to handle complex polygon operations and ensure valid geometries.
Takes a linestring, multi-linestring, multi-polygon or polygon and returns points at all self-intersections.
featureIn
Feature<(LineString | MultiLineString | MultiPolygon | Polygon)> input featurevar poly = turf.polygon([[
[-12.034835, 8.901183],
[-12.060413, 8.899826],
[-12.03638, 8.873199],
[-12.059383, 8.871418],
[-12.034835, 8.901183]
]]);
var kinks = turf.kinks(poly);
//addToMap
var addToMap = [poly, kinks]
Returns FeatureCollection<Point> self-intersections
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/kinks
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf kinks module
The npm package @turf/kinks receives a total of 749,505 weekly downloads. As such, @turf/kinks popularity was classified as popular.
We found that @turf/kinks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.