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

slippy-tile

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slippy-tile - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

.nyc_output/220f77594004e0818fb1fc0c06524526.json

5

CHANGELOG.md
# Changelog
## 1.2.1 - 2016-10-20
- Added DigitalGlobe as provider
- Converted `source.json` to `providers.yml`
## 1.1.0 - 2016-10-14

@@ -4,0 +9,0 @@

9

HEADER.md

@@ -30,3 +30,3 @@ [![Build Status](https://travis-ci.org/DenisCarriere/slippy-tile.svg?branch=master)](https://travis-ci.org/DenisCarriere/slippy-tile)

|-------------------------------|---------------------|
| OSM (Default) | osm, osm-standard
| OSM (Default) | osm
| OSM Cycle Map | osm-cycle

@@ -37,6 +37,6 @@ | OSM Humanitarian | osm-hot

| OSM Lyrk | osm-lyrk
| Bing Imagery | bing, imagery, bing-imagery
| Bing Imagery | bing-imagery
| Strava Cycling & Running | strava
| National Geographic World Map | natgeo
| ESRI Imagery | esri, esri-imagery
| ESRI Imagery | esri-imagery
| ESRI Ocean Basemap | esri-ocean

@@ -46,3 +46,6 @@ | ESRI USA Topo Maps | esri-usa-topo

| ESRI World Topographic Map | esri-topo
| DigitalGlobe Imagery | digitalgloble-imagery
| DigitalGlobe Hybrid | digitalgloble-hybrid
## Scheme

@@ -49,0 +52,0 @@

@@ -12,4 +12,3 @@ "use strict";

const rp = require('request-promise');
const path = require('path');
const sources = require(path.join(__dirname, 'utils', 'sources.json'));
const providers_1 = require('./utils/providers');
/**

@@ -27,3 +26,3 @@ * Substitutes the given tile information [x,y,zoom] to the URL tile scheme.

const [x, y, zoom] = tile;
let url = sourceLookup(scheme);
let url = providerLookup(scheme);
url = url.replace(/{(zoom|z)}/, String(zoom));

@@ -86,5 +85,5 @@ url = url.replace(/{x}/, String(x));

/**
* Source Lookup
* Provider Lookup
*
* @param {string} source Source unique key
* @param {string} provider Provider unique key
* @returns {string} scheme Tile scheme URL

@@ -95,12 +94,12 @@ * @example

*/
function sourceLookup(source) {
if (source) {
const key = source.toLowerCase().trim();
if (sources[key] !== undefined) {
return sources[key].scheme;
function providerLookup(provider) {
if (provider) {
const key = provider.toLowerCase().trim();
if (providers_1.providers[key] !== undefined) {
return providers_1.providers[key].scheme;
}
}
return source;
return provider;
}
exports.sourceLookup = sourceLookup;
exports.providerLookup = providerLookup;
/**

@@ -107,0 +106,0 @@ * Sample an item from a given list

import * as mercator from 'global-mercator'
import * as rp from 'request-promise'
import * as path from 'path'
import { providers } from './utils/providers'
export interface Source {
name: string
scheme: string
description: string
attribution: string
format: string
}
interface Sources { [key: string]: Source }
const sources: Sources = require(path.join(__dirname, 'utils', 'sources.json'))
/**

@@ -32,3 +22,3 @@ * Tile [x, y, zoom]

const [x, y, zoom] = tile
let url = sourceLookup(scheme)
let url = providerLookup(scheme)
url = url.replace(/{(zoom|z)}/, String(zoom))

@@ -83,5 +73,5 @@ url = url.replace(/{x}/, String(x))

/**
* Source Lookup
* Provider Lookup
*
* @param {string} source Source unique key
* @param {string} provider Provider unique key
* @returns {string} scheme Tile scheme URL

@@ -92,10 +82,10 @@ * @example

*/
export function sourceLookup(source: string) {
if (source) {
const key = source.toLowerCase().trim()
if (sources[key] !== undefined) {
return sources[key].scheme
export function providerLookup(provider: string) {
if (provider) {
const key = provider.toLowerCase().trim()
if (providers[key] !== undefined) {
return providers[key].scheme
}
}
return source
return provider
}

@@ -102,0 +92,0 @@

{
"name": "slippy-tile",
"version": "1.1.1",
"version": "1.2.0",
"description": "Helps convert Slippy Map url tile schemas",

@@ -10,3 +10,3 @@ "main": "index.js",

"test": "tsc && npm run lint && nyc ava",
"docs": "tsc && cat HEADER.md > README.md && documentation build index.js -c documentation.yml -f md >> README.md",
"docs": "tsc && cat HEADER.md > README.md && documentation build index.js -c documentation.yml -f md >> README.md && cat CHANGELOG.md >> README.md",
"lint": "tsc && tslint index.ts test.ts && documentation lint index.js"

@@ -28,2 +28,3 @@ },

"devDependencies": {
"@types/js-yaml": "^3.5.28",
"ava": "^0.16.0",

@@ -59,6 +60,7 @@ "coveralls": "^2.11.14",

"@types/bluebird": "^3.0.35",
"@types/request": "^0.0.31",
"@types/request-promise": "^3.0.32",
"@types/request": "^0.0.31",
"bluebird": "^3.4.6",
"global-mercator": "^1.3.2",
"js-yaml": "^3.6.1",
"request": "^2.75.0",

@@ -65,0 +67,0 @@ "request-promise": "^4.1.1"

@@ -30,3 +30,3 @@ [![Build Status](https://travis-ci.org/DenisCarriere/slippy-tile.svg?branch=master)](https://travis-ci.org/DenisCarriere/slippy-tile)

|-------------------------------|---------------------|
| OSM (Default) | osm, osm-standard
| OSM (Default) | osm
| OSM Cycle Map | osm-cycle

@@ -37,6 +37,6 @@ | OSM Humanitarian | osm-hot

| OSM Lyrk | osm-lyrk
| Bing Imagery | bing, imagery, bing-imagery
| Bing Imagery | bing-imagery
| Strava Cycling & Running | strava
| National Geographic World Map | natgeo
| ESRI Imagery | esri, esri-imagery
| ESRI Imagery | esri-imagery
| ESRI Ocean Basemap | esri-ocean

@@ -46,3 +46,6 @@ | ESRI USA Topo Maps | esri-usa-topo

| ESRI World Topographic Map | esri-topo
| DigitalGlobe Imagery | digitalgloble-imagery
| DigitalGlobe Hybrid | digitalgloble-hybrid
## Scheme

@@ -124,9 +127,9 @@

# sourceLookup
# providerLookup
Source Lookup
Provider Lookup
**Parameters**
- `source` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Source unique key
- `provider` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Provider unique key

@@ -158,1 +161,18 @@ **Examples**

Returns **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))** Single item from the list
# Changelog
## 1.2.1 - 2016-10-20
- Added DigitalGlobe as provider
- Converted `source.json` to `providers.yml`
## 1.1.0 - 2016-10-14
- Changed default function to `url`
- Added `download` feature
- Fallbacks, request-promise dependency for downloading Tile data Buffer
- Update docs
## 1.0.0 - 2016-10-13
First Stable release of `slippy-tile`.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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