0.1.1 • Published 6 years ago

world-heritage-image v0.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

world-heritage-image

npm version Build Status Greenkeeper badge dependency status dev dependency status license chat on gitter

Installation

npm install world-heritage-image

Usage

image(id)

const heritageImage = require('world-heritage-image')

heritage(heritageID).then(…)

Returns a Promise that will resolve in a wikimedia commons photo file name:

heritage(3).then(console.log) // => 'Aachener Dom.jpg'
heritage(402384).then(console.log) // => null

Workflow example

You can combine this module with [world-heritage](https://github.com/juliuste/world-heritage) and `commons-photo-url:

const heritage = require('world-heritage')
const image = require('world-heritage-image')
const commons = require('commons-photo-url')

heritage()
.then((list) => list.map(x => x.id)) // UNESCO heritage ids
.then((ids) => Promise.all(
    ids.map(image)
))
.then((fileNames) => fileNames.filter((f) => !!f)) // remove heritage sites that lack a wikimedia commons image
.then((fileNames) => fileNames.map((f) => commons(f, commons.sizes.medium)))
.then(console.log)

// => [url1, url2, …]

See also

Contributing

If you found a bug, want to propose a feature or feel the urge to complain about your life, feel free to visit the issues page.