Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bbox-dateline

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bbox-dateline - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

7

CHANGELOG.md
# Changelog
## 1.2.0 - 2017-05-29
- Drop Rollup
- Update typescript definition
- Add Coverage to tests
- Include yarn.lock
## 1.1.0 - 2017-03-20

@@ -4,0 +11,0 @@

7

index.d.ts
/// <reference types="geojson" />
type Features = GeoJSON.FeatureCollection<any>
type Feature = GeoJSON.Feature<any>
type Geoms = GeoJSON.Feature<any> | GeoJSON.FeatureCollection<any> | GeoJSON.GeometryObject | GeoJSON.GeometryCollection;
type BBox = [number, number, number, number];
type Center = [number, number];
export function bbox(bbox: BBox | Feature | Features): BBox;
export function center(center: Center | BBox | Feature | Features): BBox;
export function bbox(bbox: BBox | Geoms): BBox;
export function center(center: Center | BBox | Geoms): BBox;
export function latitude(lat: number): number;
export function longitude(lng: number): number;

@@ -66,3 +66,3 @@ var turfBBox = require('@turf/bbox')

*
* @param {[number, number]|BBox|FeatureCollection|Feature<any>} center Center [lng, lat], BBox [west, south, east, south] or GeoJSON Feature
* @param {[number, number]|BBox|FeatureCollection|Feature<any>} coord Center [lng, lat], BBox [west, south, east, south] or GeoJSON Feature
* @returns {[number, number]} valid center coordinate

@@ -73,10 +73,9 @@ * @example

*/
function center (center) {
var coords
if (!center) throw new Error('center is required')
function center (coord) {
if (!coord) throw new Error('coord is required')
// Support BBox [west, south, east, north]
if (Array.isArray(center)) {
if (center.length === 4) {
var bbox = center
if (Array.isArray(coord)) {
if (coord.length === 4) {
var bbox = coord
var west = bbox[0]

@@ -86,13 +85,10 @@ var south = bbox[1]

var north = bbox[3]
coords = [(west + east) / 2, (south + north) / 2]
// Support Center [lng, lat]
} else coords = [center[0], center[1]]
coord = [(west + east) / 2, (south + north) / 2]
}
// Support any GeoJSON
} else coords = turfCenter(center).geometry.coordinates
} else coord = turfCenter(coord).geometry.coordinates
if (coords.length !== 2) throw new Error('center must have 2 numbers')
var lng = longitude(coords[0])
var lat = latitude(coords[1])
if (coord.length < 2) throw new Error('center requires at least 2 numbers')
var lng = longitude(coord[0])
var lat = latitude(coord[1])

@@ -99,0 +95,0 @@ return [lng, lat]

{
"name": "bbox-dateline",
"version": "1.1.1",
"version": "1.2.0",
"description": "Modifies a BBox to fit within the bounds of the International Date Line",

@@ -9,15 +9,9 @@ "main": "index.js",

"index.js",
"index.d.ts",
"docs"
"index.d.ts"
],
"scripts": {
"prepublish": "npm run test && npm run build && npm run docs",
"pretest": "npm run lint",
"test": "node test.js",
"pretest": "standard index.js",
"test": "tap test.js",
"bench": "node bench.js",
"lint": "standard index.js",
"build": "npm run rollup && npm run uglify",
"docs": "documentation readme index.js --shallow --section=API --markdown-toc",
"rollup": "rollup -c rollup.config.js",
"uglify": "uglifyjs docs/bbox-dateline.js -c -m > docs/bbox-dateline.min.js"
"docs": "documentation readme index.js --shallow --section=API --markdown-toc"
},

@@ -31,6 +25,7 @@ "keywords": [

],
"author": "Denis Carriere",
"author": "Denis Carriere <@DenisCarriere>",
"license": "MIT",
"devDependencies": {
"@turf/bbox-polygon": "^3.13.0",
"@turf/helpers": "^4.3.0",
"@types/geojson": "^1.0.0",

@@ -40,12 +35,5 @@ "benchmark": "^1.0.0",

"load-json-file": "^2.0.0",
"rollup": "^0.41.5",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-json": "^2.1.0",
"rollup-plugin-node-builtins": "^2.1.0",
"rollup-plugin-node-globals": "^1.1.0",
"rollup-plugin-node-resolve": "^2.0.0",
"standard": "^9.0.1",
"tape": "^3.5.0",
"tap": "^10.3.2",
"typescript": "^2.2.1",
"uglifyjs": "^2.4.10",
"write-json-file": "^2.0.0"

@@ -52,0 +40,0 @@ },

@@ -9,3 +9,3 @@ # BBox Date Line

> Modifies a BBox to fit within the bounds of the International Date Line.
> Modifies a BBox to fit within 180° longitude & 90° latitude.

@@ -12,0 +12,0 @@ ## Install

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