bbox2extent
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -5,4 +5,12 @@ # bbox2extent change log | ||
## 1.1.0 | ||
## [1.1.1] - 2015-08-03 | ||
### Fixed | ||
* Use `Error` when returning errors | ||
### Changed | ||
* Moved to `koopjs` org | ||
## [1.1.0] - 2015-03-27 | ||
### Added | ||
@@ -16,6 +24,10 @@ * add support for reverse operation ([#2](https://github.com/ngoldman/bbox2extent/issues/2)) | ||
## 1.0.1 | ||
## [1.0.1] - 2015-03-19 | ||
* fix usage error in readme | ||
## 1.0.0 | ||
## 1.0.0 - 2015-03-19 | ||
* first implementation | ||
[1.1.1]: https://github.com/koopjs/bbox2extent/compare/v1.1.0...v1.1.1 | ||
[1.1.0]: https://github.com/koopjs/bbox2extent/compare/v1.0.1...v1.1.0 | ||
[1.0.1]: https://github.com/koopjs/bbox2extent/compare/v1.0.0...v1.0.1 |
@@ -8,3 +8,3 @@ module.exports = bbox2extent | ||
if (!isArray || !isValid) { | ||
var err = 'invalid bbox array' | ||
var err = new Error('invalid bbox array') | ||
if (callback) return callback(err) | ||
@@ -37,3 +37,3 @@ else return console.error(err) | ||
if (!isObject || !isValid) { | ||
var err = 'invalid extent object' | ||
var err = new Error('invalid extent object') | ||
if (callback) return callback(err) | ||
@@ -40,0 +40,0 @@ else return console.error(err) |
{ | ||
"name": "bbox2extent", | ||
"description": "Transform a GeoJSON bounding box into an Esri-formatted extent object.", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "Nate Goldman <nate@ngoldman.me>", | ||
"bugs": { | ||
"url": "https://github.com/ngoldman/bbox2extent/issues" | ||
"url": "https://github.com/koopjs/bbox2extent/issues" | ||
}, | ||
"homepage": "https://github.com/ngoldman/bbox2extent", | ||
"devDependencies": { | ||
"standard": "^3.3.0", | ||
"tap-spec": "^2.2.2", | ||
"tape": "^3.5.0" | ||
}, | ||
"homepage": "https://github.com/koopjs/bbox2extent", | ||
"keywords": [ | ||
@@ -22,12 +27,7 @@ "arcgis", | ||
"type": "git", | ||
"url": "https://github.com/ngoldman/bbox2extent.git" | ||
"url": "https://github.com/koopjs/bbox2extent.git" | ||
}, | ||
"scripts": { | ||
"test": "standard && node test | tap-spec" | ||
}, | ||
"devDependencies": { | ||
"standard": "^3.3.0", | ||
"tap-spec": "^2.2.2", | ||
"tape": "^3.5.0" | ||
} | ||
} |
# bbox2extent | ||
> Transform a GeoJSON bounding box into an Esri-formatted extent object. | ||
[![](https://img.shields.io/npm/v/bbox2extent.svg?style=flat-square)](https://www.npmjs.com/package/bbox2extent) | ||
[![](https://img.shields.io/travis/ngoldman/bbox2extent.svg?style=flat-square)](https://travis-ci.org/ngoldman/bbox2extent) | ||
[![](https://img.shields.io/travis/koopjs/bbox2extent.svg?style=flat-square)](https://travis-ci.org/koopjs/bbox2extent) | ||
Transform a GeoJSON bounding box into an Esri-formatted extent object. | ||
## Install | ||
@@ -19,4 +21,14 @@ ``` | ||
var extent = bbox2extent(bbox) | ||
// { | ||
// xmin: 100, | ||
// ymin: 0, | ||
// xmax: 105, | ||
// ymax: 1, | ||
// spatialReference: { | ||
// wkid: 4326, | ||
// latestWkid: 4326 | ||
// } | ||
// } | ||
// OR | ||
// -- OR -- | ||
@@ -58,3 +70,3 @@ bbox2extent(bbox, function (err, extent) { | ||
// OR | ||
// -- OR -- | ||
@@ -79,2 +91,2 @@ extent2bbox(extent, function (err, bbox) { | ||
[ISC](LICENSE.md) | ||
[ISC](LICENSE) |
@@ -27,3 +27,3 @@ var bbox2extent = require('..') | ||
test('bbox2extent null island', function (t) { | ||
test('bbox2extent: null island', function (t) { | ||
t.deepEqual(bbox2extent(bboxNull), extentNull) | ||
@@ -33,3 +33,3 @@ t.end() | ||
test('bbox2extent portland parks', function (t) { | ||
test('bbox2extent: portland parks', function (t) { | ||
t.deepEqual(bbox2extent(bboxPortlandParks), extentPortlandParks) | ||
@@ -39,3 +39,12 @@ t.end() | ||
test('extent2bbox null island', function (t) { | ||
test('bbox2extent: invalid bbox array error', function (t) { | ||
bbox2extent(extentPortlandParks, function (err, extent) { | ||
t.ok(err instanceof Error, 'returns a valid error object') | ||
t.equal(err.message, 'invalid bbox array', 'returns correct error message') | ||
t.notOk(extent, 'does not return extent') | ||
t.end() | ||
}) | ||
}) | ||
test('extent2bbox: null island', function (t) { | ||
t.deepEqual(extent2bbox(extentNull), bboxNull) | ||
@@ -45,5 +54,14 @@ t.end() | ||
test('extent2bbox portland parks', function (t) { | ||
test('extent2bbox: portland parks', function (t) { | ||
t.deepEqual(extent2bbox(extentPortlandParks), bboxPortlandParks) | ||
t.end() | ||
}) | ||
test('extent2bbox: invalid extent object error', function (t) { | ||
extent2bbox(bboxPortlandParks, function (err, extent) { | ||
t.ok(err instanceof Error, 'returns a valid error object') | ||
t.equal(err.message, 'invalid extent object', 'returns correct error message') | ||
t.notOk(extent, 'does not return extent') | ||
t.end() | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
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
8336
95
90