New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

extent

Package Overview
Dependencies
Maintainers
20
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extent - npm Package Compare versions

Comparing version
0.3.0
to
0.3.1
+5
-0
CHANGELOG.md

@@ -0,1 +1,6 @@

## 0.4.0
* Added shortcut initializer with `[w, s, e, n]` coords.
* Added `.intersect()` method
## 0.3.0

@@ -2,0 +7,0 @@

+18
-4
module.exports = Extent;
function Extent() {
function Extent(bbox) {
if (!(this instanceof Extent)) {
return new Extent();
return new Extent(bbox);
}
this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
this._valid = false;
this._bbox = bbox || [Infinity, Infinity, -Infinity, -Infinity];
this._valid = !!bbox;
}

@@ -62,2 +62,16 @@

Extent.prototype.intersect = function(_) {
if (!this._valid) return null;
var other;
if (_ instanceof Extent) { other = _.bbox(); } else { other = _; }
return !(
this._bbox[0] > other[2] ||
this._bbox[2] < other[0] ||
this._bbox[3] < other[1] ||
this._bbox[1] > other[3]
);
};
Extent.prototype._fastContains = function() {

@@ -64,0 +78,0 @@ if (!this._valid) return new Function('return null;');

+1
-1
{
"name": "extent",
"version": "0.3.0",
"version": "0.3.1",
"description": "a geographic extent object",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -13,2 +13,6 @@ [![Build Status](https://travis-ci.org/mapbox/extent.svg)](https://travis-ci.org/mapbox/extent)

### `extent([w, s, e, n])`
Create a new extent object, given bounds as an array.
### `extent.include([lon, lat])`

@@ -15,0 +19,0 @@

@@ -115,1 +115,11 @@ var test = require('tap').test,

});
test('intersect', function(t) {
var bbox1 = [0,0,1,1];
var bbox2 = [0.5,0.5,2,2];
t.equals(Extent(bbox1).intersect(bbox2), true);
t.equals(Extent(bbox2).intersect(bbox1), true)
t.end()
})