Socket
Socket
Sign inDemoInstall

@turf/random

Package Overview
Dependencies
Maintainers
4
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/random - npm Package Compare versions

Comparing version 5.0.4 to 5.1.0

main.mjs

30

main.js

@@ -18,6 +18,6 @@ 'use strict';

function randomPosition(bbox) {
if (helpers.isObject(bbox)) bbox = bbox.bbox;
if (bbox && !Array.isArray(bbox)) throw new Error('bbox is invalid');
if (bbox) return coordInBBox(bbox);
else return [lon(), lat()];
if (helpers.isObject(bbox)) { bbox = bbox.bbox; }
if (bbox && !Array.isArray(bbox)) { throw new Error('bbox is invalid'); }
if (bbox) { return coordInBBox(bbox); }
else { return [lon(), lat()]; }
}

@@ -40,5 +40,5 @@

options = options || {};
if (!helpers.isObject(options)) throw new Error('options is invalid');
if (!helpers.isObject(options)) { throw new Error('options is invalid'); }
var bbox = options.bbox;
if (count === undefined || count === null) count = 1;
if (count === undefined || count === null) { count = 1; }

@@ -69,11 +69,11 @@ var features = [];

options = options || {};
if (!helpers.isObject(options)) throw new Error('options is invalid');
if (!helpers.isObject(options)) { throw new Error('options is invalid'); }
var bbox = options.bbox;
var num_vertices = options.num_vertices;
var max_radial_length = options.max_radial_length;
if (count === undefined || count === null) count = 1;
if (count === undefined || count === null) { count = 1; }
// Validation
if (!helpers.isNumber(num_vertices)) num_vertices = 10;
if (!helpers.isNumber(max_radial_length)) max_radial_length = 10;
if (!helpers.isNumber(num_vertices)) { num_vertices = 10; }
if (!helpers.isNumber(max_radial_length)) { max_radial_length = 10; }

@@ -129,3 +129,3 @@ var features = [];

options = options || {};
if (!helpers.isObject(options)) throw new Error('options is invalid');
if (!helpers.isObject(options)) { throw new Error('options is invalid'); }
var bbox = options.bbox;

@@ -135,8 +135,8 @@ var num_vertices = options.num_vertices;

var max_rotation = options.max_rotation;
if (count === undefined || count === null) count = 1;
if (count === undefined || count === null) { count = 1; }
// Default parameters
if (!helpers.isNumber(num_vertices) || num_vertices < 2) num_vertices = 10;
if (!helpers.isNumber(max_length)) max_length = 0.0001;
if (!helpers.isNumber(max_rotation)) max_rotation = Math.PI / 8;
if (!helpers.isNumber(num_vertices) || num_vertices < 2) { num_vertices = 10; }
if (!helpers.isNumber(max_length)) { max_length = 0.0001; }
if (!helpers.isNumber(max_rotation)) { max_rotation = Math.PI / 8; }

@@ -143,0 +143,0 @@ var features = [];

{
"name": "@turf/random",
"version": "5.0.4",
"version": "5.1.0",
"description": "turf random 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"
],

@@ -18,3 +18,4 @@ "scripts": {

"test": "node -r @std/esm test.js",
"bench": "node -r @std/esm bench.js"
"bench": "node -r @std/esm bench.js",
"docs": "node ../../scripts/generate-readmes"
},

@@ -40,6 +41,7 @@ "repository": {

"rollup": "*",
"rollup-plugin-buble": "*",
"tape": "*"
},
"dependencies": {
"@turf/helpers": "^5.0.4"
"@turf/helpers": "^5.1.0"
},

@@ -46,0 +48,0 @@ "@std/esm": {

@@ -7,3 +7,3 @@ # @turf/random

Random Position
Returns a random position within a [box](bounding).

@@ -25,3 +25,3 @@ **Parameters**

Random Point
Returns a random [point](point).

@@ -41,7 +41,7 @@ **Parameters**

Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>** GeoJSON FeatureCollection of points
Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)>** GeoJSON FeatureCollection of points
## randomPolygon
Random Polygon
Returns a random [polygon](polygon).

@@ -63,7 +63,7 @@ **Parameters**

Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>** GeoJSON FeatureCollection of points
Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)>** GeoJSON FeatureCollection of points
## randomLineString
Random LineString
Returns a random [linestring](linestring).

@@ -86,3 +86,3 @@ **Parameters**

Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>** GeoJSON FeatureCollection of points
Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)>** GeoJSON FeatureCollection of points

@@ -89,0 +89,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