@turf/random
Advanced tools
Comparing version 5.0.4 to 5.1.0
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)<[Point](http://geojson.org/geojson-spec.html#point)>** GeoJSON FeatureCollection of points | ||
Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)<[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)<[Point](http://geojson.org/geojson-spec.html#point)>** GeoJSON FeatureCollection of points | ||
Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)<[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)<[Point](http://geojson.org/geojson-spec.html#point)>** GeoJSON FeatureCollection of points | ||
Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)<[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: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
28777
7
506
0
6
Updated@turf/helpers@^5.1.0