Comparing version 0.15.0 to 0.16.0
@@ -23,2 +23,3 @@ "use_strict"; | ||
const scale = require("./scale.js"); | ||
const split = require("./split.js"); | ||
const validate = require("./validate.js"); | ||
@@ -49,2 +50,3 @@ const preciseValidate = require("./precise/validate.js"); | ||
scale, | ||
split, | ||
validate, | ||
@@ -51,0 +53,0 @@ preciseValidate, |
{ | ||
"name": "bbox-fns", | ||
"version": "0.15.0", | ||
"version": "0.16.0", | ||
"description": "Light-weight JavaScript Bounding Box Utility Functions", | ||
"main": "index.js", | ||
"main": "./index.js", | ||
"files": [ | ||
@@ -31,2 +31,3 @@ "index.js", | ||
"precise/validate.js", | ||
"split.js", | ||
"union.js", | ||
@@ -33,0 +34,0 @@ "validate.js" |
@@ -14,2 +14,3 @@ # bbox-fns: work in progress | ||
- [bboxPoint](#bboxPoint) | ||
- [bboxSize](#bboxSize) | ||
- [booleanContains](#booleanContains) | ||
@@ -28,2 +29,3 @@ - [booleanContainsPoint](#booleanContainsPoint) | ||
- [scale](#scale) | ||
- [split](#split) | ||
- [union](#union) | ||
@@ -273,2 +275,24 @@ - [validate](#validate) | ||
### split | ||
Split bounding box that crosses given x or y boundaries. For example, split a bbox that crosses the antimeridian into two bounding boxes. | ||
```js | ||
import split from "bbox-fns/split.js"; | ||
// split across the antimeridian | ||
split([-200, -90, 160, 90], { x: [-180, 180] }) | ||
[ | ||
[-200, -90, -180, 90], // overflow, left of antimeridian | ||
[-180, -90, 160, 90] // right of antimeridian | ||
] | ||
// split across the antimeridian and the poles | ||
split([-200, -90, 160, 100], { x: [-180, 180], y: [-90, 90] }) | ||
[ | ||
[-200,-90,-180,90], | ||
[-200,90,-180,100], | ||
[-180,-90,160,90], | ||
[-180,90,160,100] | ||
] | ||
``` | ||
### reproject | ||
@@ -345,2 +369,2 @@ Reproject a bounding box using the given reprojection function | ||
["0", "2.25", "16.666...", "50"] | ||
``` | ||
``` |
40668
30
755
367