New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@turf/buffer

Package Overview
Dependencies
Maintainers
4
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/buffer - npm Package Compare versions

Comparing version 5.0.5 to 5.1.0

main.mjs

3

index.d.ts

@@ -14,3 +14,2 @@

Units,
FeatureGeometryCollection
} from '@turf/helpers';

@@ -30,5 +29,5 @@

declare function buffer<Geom extends MultiPoint | MultiLineString | MultiPolygon>(feature: FeatureCollection<Geom>, radius?: number, options?: Options): FeatureCollection<MultiPolygon>;
declare function buffer(feature: FeatureCollection<any> | FeatureGeometryCollection | GeometryCollection, radius?: number, options?: Options): FeatureCollection<Polygon | MultiPolygon>;
declare function buffer(feature: FeatureCollection<any> | Feature<GeometryCollection> | GeometryCollection, radius?: number, options?: Options): FeatureCollection<Polygon | MultiPolygon>;
declare function buffer(feature: Feature<any> | GeometryObject, radius?: number, options?: Options): Feature<Polygon | MultiPolygon>;
export default buffer;

@@ -21,3 +21,3 @@ import center from '@turf/center';

* @param {number} radius distance to draw the buffer (negative values are allowed)
* @param {Object} [options] Optional parameters
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units="kilometers"] any of the options supported by turf units

@@ -24,0 +24,0 @@ * @param {number} [options.steps=64] number of steps

@@ -25,3 +25,3 @@ 'use strict';

* @param {number} radius distance to draw the buffer (negative values are allowed)
* @param {Object} [options] Optional parameters
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units="kilometers"] any of the options supported by turf units

@@ -44,9 +44,9 @@ * @param {number} [options.steps=64] number of steps

// validation
if (!geojson) throw new Error('geojson is required');
if (typeof options !== 'object') throw new Error('options must be an object');
if (typeof steps !== 'number') throw new Error('steps must be an number');
if (!geojson) { throw new Error('geojson is required'); }
if (typeof options !== 'object') { throw new Error('options must be an object'); }
if (typeof steps !== 'number') { throw new Error('steps must be an number'); }
// Allow negative buffers ("erosion") or zero-sized buffers ("repair geometry")
if (radius === undefined) throw new Error('radius is required');
if (steps <= 0) throw new Error('steps must be greater than 0');
if (radius === undefined) { throw new Error('radius is required'); }
if (steps <= 0) { throw new Error('steps must be greater than 0'); }

@@ -62,3 +62,3 @@ // default params

var buffered = bufferFeature(geometry, radius, units, steps);
if (buffered) results.push(buffered);
if (buffered) { results.push(buffered); }
});

@@ -71,3 +71,3 @@ return helpers.featureCollection(results);

meta.featureEach(multiBuffered, function (buffered) {
if (buffered) results.push(buffered);
if (buffered) { results.push(buffered); }
});

@@ -100,3 +100,3 @@ }

var buffered = bufferFeature(geometry, radius, units, steps);
if (buffered) results.push(buffered);
if (buffered) { results.push(buffered); }
});

@@ -129,3 +129,3 @@ return helpers.featureCollection(results);

// Detect if empty geometries
if (coordsIsNaN(buffered.coordinates)) return undefined;
if (coordsIsNaN(buffered.coordinates)) { return undefined; }

@@ -154,3 +154,3 @@ // Unproject coordinates (convert to Degrees)

function coordsIsNaN(coords) {
if (Array.isArray(coords[0])) return coordsIsNaN(coords[0]);
if (Array.isArray(coords[0])) { return coordsIsNaN(coords[0]); }
return isNaN(coords[0]);

@@ -168,3 +168,3 @@ }

function projectCoords(coords, proj) {
if (typeof coords[0] !== 'object') return proj(coords);
if (typeof coords[0] !== 'object') { return proj(coords); }
return coords.map(function (coord) {

@@ -184,3 +184,3 @@ return projectCoords(coord, proj);

function unprojectCoords(coords, proj) {
if (typeof coords[0] !== 'object') return proj.invert(coords);
if (typeof coords[0] !== 'object') { return proj.invert(coords); }
return coords.map(function (coord) {

@@ -187,0 +187,0 @@ return unprojectCoords(coord, proj);

{
"name": "@turf/buffer",
"version": "5.0.5",
"version": "5.1.0",
"description": "turf buffer module",
"main": "main",
"module": "index",
"jsnext:main": "index",
"main": "main.js",
"module": "main.mjs",
"types": "index.d.ts",

@@ -12,3 +11,4 @@ "files": [

"index.d.ts",
"main.js"
"main.js",
"main.mjs"
],

@@ -47,6 +47,7 @@ "scripts": {

"@std/esm": "*",
"@turf/truncate": "*",
"@turf/truncate": "^5.1.0",
"benchmark": "*",
"load-json-file": "*",
"rollup": "*",
"rollup-plugin-buble": "*",
"tape": "*",

@@ -56,7 +57,7 @@ "write-json-file": "*"

"dependencies": {
"@turf/bbox": "^5.0.4",
"@turf/center": "^5.0.4",
"@turf/helpers": "^5.0.4",
"@turf/meta": "^5.0.4",
"@turf/projection": "^5.0.4",
"@turf/bbox": "^5.1.0",
"@turf/center": "^5.1.0",
"@turf/helpers": "^5.1.0",
"@turf/meta": "^5.1.0",
"@turf/projection": "^5.1.0",
"d3-geo": "1.7.1",

@@ -63,0 +64,0 @@ "turf-jsts": "*"

@@ -17,5 +17,5 @@ # @turf/buffer

- `geojson` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;any>)** input to be buffered
- `geojson` **([FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;any>)** input to be buffered
- `radius` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** distance to draw the buffer (negative values are allowed)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional parameters
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional parameters (optional, default `{}`)
- `options.units` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** any of the options supported by turf units (optional, default `"kilometers"`)

@@ -34,3 +34,3 @@ - `options.steps` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** number of steps (optional, default `64`)

Returns **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;([Polygon](http://geojson.org/geojson-spec.html#polygon) \| [MultiPolygon](http://geojson.org/geojson-spec.html#multipolygon))> | [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined))** buffered features
Returns **([FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;([Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7))> | [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined))** buffered features

@@ -37,0 +37,0 @@ <!-- This file is automatically generated. Please don't edit it directly:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc