diff --git a/app.js b/app.js index 341985ba..eb1f9c8f 100644 --- a/app.js +++ b/app.js @@ -11,17 +11,14 @@ const logger = require('morgan'); const errorHandler = require('errorhandler'); const renderer = require('connect-renderer'); -const app = module.exports = connect(); +const app = (module.exports = connect()); process.env.PORT ??= 3000; process.env.SITE_URL ??= `http://localhost:${process.env.PORT}`; process.env.NODE_ENV ??= 'development'; const root = path.join(__dirname, 'public'); -const { - SITE_URL: siteUrl, - LIFTIE_STATIC_HOST: staticHost = '' -} = process.env; +const { SITE_URL: siteUrl, LIFTIE_STATIC_HOST: staticHost = '' } = process.env; const cachify = cachifyStatic(root); @@ -36,10 +33,12 @@ app.locals = { } }; -app.use(renderer(`${__dirname}/views`).engine('jade', { - compile: require('@pirxpilot/jade-core').compile, - options: { compileDebug: process.env.NODE_ENV !== 'production' } -})); +app.use( + renderer(`${__dirname}/views`).engine('jade', { + compile: require('@pirxpilot/jade-core').compile, + options: { compileDebug: process.env.NODE_ENV !== 'production' } + }) +); app.use(logger('dev')); app.use(cookieParser()); diff --git a/lib/checker.js b/lib/checker.js index d1a35ebb..2cbc7f56 100644 --- a/lib/checker.js +++ b/lib/checker.js @@ -11,5 +11,5 @@ function checkNames(requested, valid, all) { if (typeof requested === 'string') { requested = requested.split(','); } - return requested.filter((item) => valid[item]); + return requested.filter(item => valid[item]); } diff --git a/lib/cli/fetch.js b/lib/cli/fetch.js index 1e7717b8..513d5dc8 100644 --- a/lib/cli/fetch.js +++ b/lib/cli/fetch.js @@ -16,10 +16,7 @@ function fetchExample(resortId) { } } -program - .arguments('') - .action(fetchExample) - .parse(process.argv); +program.arguments('').action(fetchExample).parse(process.argv); if (!done) { program.outputHelp(); diff --git a/lib/cli/for-each-resort.js b/lib/cli/for-each-resort.js index dc29e184..20cd0bbd 100644 --- a/lib/cli/for-each-resort.js +++ b/lib/cli/for-each-resort.js @@ -10,9 +10,6 @@ function forEachResort(fn) { console.error(err); process.exit(1); } - dirents - .filter(dirent => dirent.isDirectory()) - .forEach(({ name }) => fn(name)); + dirents.filter(dirent => dirent.isDirectory()).forEach(({ name }) => fn(name)); }); - } diff --git a/lib/cli/generate.js b/lib/cli/generate.js index a861398d..e2b07b40 100644 --- a/lib/cli/generate.js +++ b/lib/cli/generate.js @@ -8,7 +8,8 @@ const curl = require('./curl'); const dirs = require('./dirs'); let fname; -const schema = [{ +const schema = [ + { name: 'id', description: 'Short name of the resort [acme]', type: 'string', @@ -51,9 +52,7 @@ const schema = [{ } ]; -program - .option('-j, --json ', 'JSON file with resort data', String) - .parse(process.argv); +program.option('-j, --json ', 'JSON file with resort data', String).parse(process.argv); if (program.json) { fname = path.resolve(program.json); @@ -106,7 +105,6 @@ function generate(resort) { curl(json.url, resort.id); } - function write(dst, json) { console.log('Generating %s...', dst); fs.writeFileSync(dst, JSON.stringify(json, null, 2)); @@ -135,7 +133,7 @@ function execute(conf) { schema[2].before = splitHost; conf = conf || {}; prompt.override = conf; - prompt.addProperties(conf, schema, (err) => { + prompt.addProperties(conf, schema, err => { if (err) { console.error(err); process.exit(-1); diff --git a/lib/cli/noaa.js b/lib/cli/noaa.js index df26e95c..bee31882 100644 --- a/lib/cli/noaa.js +++ b/lib/cli/noaa.js @@ -35,17 +35,24 @@ function noaaForResort(resortId, { overwrite }) { superagent(url) .accept('application/geo+json') .set('User-Agent', userAgent) - .then((res) => { - const { body: { properties: { gridId, gridX, gridY } } } = res; - const noaa = `${gridId}/${gridX},${gridY}`; - if (overwrite) { - descriptor.noaa = noaa; - writeDescriptor(resortId, descriptor); + .then( + res => { + const { + body: { + properties: { gridId, gridX, gridY } + } + } = res; + const noaa = `${gridId}/${gridX},${gridY}`; + if (overwrite) { + descriptor.noaa = noaa; + writeDescriptor(resortId, descriptor); + } + console.log(resortId, noaa); + }, + e => { + console.error('Cannot find NOAA station for:', resortId, e.response.text); } - console.log(resortId, noaa); - }, (e) => { - console.error('Cannot find NOAA station for:', resortId, e.response.text); - }); + ); } function descriptorPath(resortId, absolute) { diff --git a/lib/client/boot/height.js b/lib/client/boot/height.js index 4ac8bfe6..54effbc5 100644 --- a/lib/client/boot/height.js +++ b/lib/client/boot/height.js @@ -9,10 +9,13 @@ function notify() { if (!widget) { return; } - window.parent.postMessage({ - height: widget.scrollHeight, - resort: window.location.pathname.split('/').pop() - }, '*'); + window.parent.postMessage( + { + height: widget.scrollHeight, + resort: window.location.pathname.split('/').pop() + }, + '*' + ); } function postHeight() { diff --git a/lib/client/resort/lifts.js b/lib/client/resort/lifts.js index e86e9211..9b5d679f 100644 --- a/lib/client/resort/lifts.js +++ b/lib/client/resort/lifts.js @@ -9,17 +9,17 @@ const states = ['open', 'hold', 'scheduled', 'closed']; function renderStatus(node, status) { dom.removeAllChildren(node); if (status) { - node.innerHTML = Object.keys(status).map(name => { - const klass = `status ls-${status[name]}`; - return `
  • ${name}
  • `; - }).join(''); + node.innerHTML = Object.keys(status) + .map(name => { + const klass = `status ls-${status[name]}`; + return `
  • ${name}
  • `; + }) + .join(''); } } function renderStats(node, stats) { - states.forEach(s => - node.querySelector(`.ls-${s}`).innerHTML = stats ? stats[s] : 0 - ); + states.forEach(s => (node.querySelector(`.ls-${s}`).innerHTML = stats ? stats[s] : 0)); } function renderColorBar(node, percentage) { diff --git a/lib/client/resort/webcams.js b/lib/client/resort/webcams.js index 1a5a22c8..281a50cb 100644 --- a/lib/client/resort/webcams.js +++ b/lib/client/resort/webcams.js @@ -9,7 +9,6 @@ module.exports.type = 'webcams'; const DELAY = 15 * 60 * 1000; // update every 15 minutes - function swiper(el) { const ui = { swipe: swipe(el.swipe), @@ -45,7 +44,6 @@ function swiper(el) { }; } - function render(div, webcams) { let cams; let timer; diff --git a/lib/client/state/index.js b/lib/client/state/index.js index 522fae82..5d757604 100644 --- a/lib/client/state/index.js +++ b/lib/client/state/index.js @@ -45,18 +45,14 @@ function state(nodes, st, keys) { state[id] = classList.contains(st); }); - const selected = Object.keys(state) - .filter(id => state[id]); + const selected = Object.keys(state).filter(id => state[id]); write(selected); return selected; } - function save() { - const selected = nodes - .filter(n => n.classList.contains(st)) - .map(n => n.dataset.resort); + const selected = nodes.filter(n => n.classList.contains(st)).map(n => n.dataset.resort); write(selected); return selected; diff --git a/lib/client/stats/index.js b/lib/client/stats/index.js index 7486cc35..0511113d 100644 --- a/lib/client/stats/index.js +++ b/lib/client/stats/index.js @@ -10,7 +10,5 @@ function stats() { const data = JSON.parse(pie.dataset.stats); let ac = 0; const { style } = pie; - Object.entries(data.percentage).forEach( - ([key, value]) => style.setProperty(`--${key}`, `${ac += value}%`) - ); + Object.entries(data.percentage).forEach(([key, value]) => style.setProperty(`--${key}`, `${(ac += value)}%`)); } diff --git a/lib/embed/index.js b/lib/embed/index.js index 8eee94a7..5b0eec46 100644 --- a/lib/embed/index.js +++ b/lib/embed/index.js @@ -1,18 +1,17 @@ /*global document, window */ function el(attrs) { - const attrStr = Object.keys(attrs).map((attr) => `${attr}="${attrs[attr]}"`).join(' '); + const attrStr = Object.keys(attrs) + .map(attr => `${attr}="${attrs[attr]}"`) + .join(' '); - return ['' - ].join(''); + return [''].join(''); } function addWidget(parent, resort, style) { const query = style ? `?style=${encodeURIComponent(style)}` : ''; let html = el({ - 'class': `lift-status ${resort}`, + class: `lift-status ${resort}`, src: `https://liftie.info/widget/resort/${resort}${query}`, scrolling: 'no' }); @@ -39,7 +38,7 @@ function embed() { let i; const els = document.querySelectorAll('.liftie-widget[data-resort]'); if (els.length) { - window.addEventListener("message", receiveMessage, false); + window.addEventListener('message', receiveMessage, false); } for (i = 0; i < els.length; i++) { addWidget(els[i], els[i].getAttribute('data-resort'), els[i].getAttribute('data-style')); diff --git a/lib/lifts/index.js b/lib/lifts/index.js index 49bb9c11..bf6ca1b0 100644 --- a/lib/lifts/index.js +++ b/lib/lifts/index.js @@ -27,7 +27,7 @@ function getRequestFnAndUrl(resort) { url: resort.dataUrl }; } - if (typeof (resort.getUrl) === 'function') { + if (typeof resort.getUrl === 'function') { return { fn: pipe, url: resort.getUrl() @@ -46,7 +46,7 @@ function fetch(resort, fn) { if (!resort._parseFn) { resort._parseFn = getParseFn(resort.id); } - debug("Fetch lift status for %s", resort.id); + debug('Fetch lift status for %s', resort.id); const rfau = resort._rfau; rfau.fn(rfau.url, resort._parseFn, (_err, data) => { Promise.resolve(data).then((data, err) => { diff --git a/lib/lifts/parse.js b/lib/lifts/parse.js index c869ebb6..3e8f2455 100644 --- a/lib/lifts/parse.js +++ b/lib/lifts/parse.js @@ -3,12 +3,10 @@ const debug = require('debug')('liftie:lifts'); module.exports = getParseFn; - /** * catch exceptions thrown by parse */ function getParseFn(resortId) { - const descriptor = require(`../resorts/${resortId}`); const parse = typeof descriptor === 'function' ? descriptor : collectParse; diff --git a/lib/lifts/parser.js b/lib/lifts/parser.js index 1d9110dd..4bbf290b 100644 --- a/lib/lifts/parser.js +++ b/lib/lifts/parser.js @@ -1,13 +1,12 @@ const { nextTick } = require('node:process'); const { DomHandler, Text } = require('domhandler'); const { ElementType } = require('domelementtype'); -const { WritableStream } = require("htmlparser2/WritableStream"); +const { WritableStream } = require('htmlparser2/WritableStream'); module.exports = parserStream; parserStream.html = parseHtml; - function parseHtml(html, parse, fn) { const stream = parserStream(parse, fn); stream.write(html); diff --git a/lib/lifts/request.js b/lib/lifts/request.js index ea318374..54724338 100644 --- a/lib/lifts/request.js +++ b/lib/lifts/request.js @@ -3,7 +3,6 @@ const superagent = require('superagent'); const userAgent = 'Mozilla/5.0 (compatible; Liftie/1.0; +https://liftie.info)'; module.exports = ({ host, pathname, query, http2 }) => { - const req = superagent .agent() .get(host + pathname) diff --git a/lib/lifts/rest.js b/lib/lifts/rest.js index 7931a21c..f3010ba1 100644 --- a/lib/lifts/rest.js +++ b/lib/lifts/rest.js @@ -7,9 +7,7 @@ module.exports = rest; function rest(url, parse, fn) { const fullUrl = url.host + url.pathname; - const request = url.body ? - superagent.post(fullUrl).send(url.body) : - superagent.get(fullUrl); + const request = url.body ? superagent.post(fullUrl).send(url.body) : superagent.get(fullUrl); if (url.query) { request.query(url.query); @@ -18,13 +16,10 @@ function rest(url, parse, fn) { request.http2(true); } - request - .set('User-Agent', userAgent) - .set('Accept', 'application/json') - .on('error', fn); + request.set('User-Agent', userAgent).set('Accept', 'application/json').on('error', fn); request.then( - (res) => { + res => { let { body, text } = res; if (url.html) { return parseHtml(body, parse, fn); diff --git a/lib/lifts/stats.js b/lib/lifts/stats.js index 44f3919d..e3c462c9 100644 --- a/lib/lifts/stats.js +++ b/lib/lifts/stats.js @@ -17,7 +17,7 @@ function percentage(status) { } return states.reduce((memo, s) => { //console.log('status', s, status[s]); - memo[s] = Math.floor(status[s] * 1000 / all) / 10; + memo[s] = Math.floor((status[s] * 1000) / all) / 10; return memo; }, empty()); } @@ -36,7 +36,7 @@ function summary(arr) { if (!s) { return sum; } - states.forEach((state) => { + states.forEach(state => { sum[state] += s[state] || 0; }); return sum; diff --git a/lib/loader.js b/lib/loader.js index 95f19c9f..fa303268 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -4,14 +4,12 @@ module.exports = load; async function load() { const names = await fs.readdir(`${__dirname}/resorts`); - const entries = names.map( - id => [ + const entries = names.map(id => [ + id, + { id, - { - id, - ...require(`./resorts/${id}/resort.json`) - } - ] - ); + ...require(`./resorts/${id}/resort.json`) + } + ]); return Object.fromEntries(entries); } diff --git a/lib/loaders.js b/lib/loaders.js index fbb6923e..66361677 100644 --- a/lib/loaders.js +++ b/lib/loaders.js @@ -14,9 +14,7 @@ function register(loader) { } function appendResorts(data, resorts) { - Object.entries(resorts).forEach( - ([id, resort]) => data[id] ||= resort - ); + Object.entries(resorts).forEach(([id, resort]) => (data[id] ||= resort)); return data; } diff --git a/lib/opening.js b/lib/opening.js index ba4630c8..d15e668c 100644 --- a/lib/opening.js +++ b/lib/opening.js @@ -23,6 +23,6 @@ function ifNotOpenYet(opening) { } function fetch(resort, fn) { - debug("Calculate opening for %s", resort.id); + debug('Calculate opening for %s', resort.id); process.nextTick(fn.bind(null, null, ifNotOpenYet(resort.opening))); } diff --git a/lib/plugins.js b/lib/plugins.js index ef9c5e21..efd5af7c 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -5,7 +5,7 @@ function register(name, module) { } function forEach(fn) { - Object.keys(plugins).forEach((name) => { + Object.keys(plugins).forEach(name => { fn(name, plugins[name]); }); } diff --git a/lib/resorts/alta/index.js b/lib/resorts/alta/index.js index 43a9ac24..c94688ab 100644 --- a/lib/resorts/alta/index.js +++ b/lib/resorts/alta/index.js @@ -16,11 +16,10 @@ function parse(dom) { .map(script => allText(script).trim()) .find(script => script.includes('window.Alta = ')); - const liftStatus = extractLiftData(dataScript) - .reduce((ls, { name, open }) => { - ls[name] = open ? 'open' : 'closed'; - return ls; - }, {}); + const liftStatus = extractLiftData(dataScript).reduce((ls, { name, open }) => { + ls[name] = open ? 'open' : 'closed'; + return ls; + }, {}); debug('Alta Lift Status:', liftStatus); return liftStatus; diff --git a/lib/resorts/blue-mountain-pa/index.js b/lib/resorts/blue-mountain-pa/index.js index 3e0915ae..5f10de79 100644 --- a/lib/resorts/blue-mountain-pa/index.js +++ b/lib/resorts/blue-mountain-pa/index.js @@ -5,7 +5,7 @@ module.exports = { status: { child: '1/0/0', attribute: 'src', - fn: src => src.includes('EASIEST-9') ? 'open' : 'closed', - }, - }, + fn: src => (src.includes('EASIEST-9') ? 'open' : 'closed') + } + } }; diff --git a/lib/resorts/bogusbasin/index.js b/lib/resorts/bogusbasin/index.js index fc9c9fe3..ee3275d0 100644 --- a/lib/resorts/bogusbasin/index.js +++ b/lib/resorts/bogusbasin/index.js @@ -6,15 +6,13 @@ const coerce = require('../../tools/coerce'); module.exports = parse; function parse(dom) { - const dataScript = select(dom, 'x-filterable-lift-trail-status') - .map(script => script.attribs['data-data'].trim()); + const dataScript = select(dom, 'x-filterable-lift-trail-status').map(script => script.attribs['data-data'].trim()); const data = JSON.parse(dataScript); - const liftStatus = data.lifts - .reduce((ls, lift) => { - ls[lift['title']] = coerce(lift['openingStatus']); - return ls; - }, {}); + const liftStatus = data.lifts.reduce((ls, lift) => { + ls[lift['title']] = coerce(lift['openingStatus']); + return ls; + }, {}); debug('Bogus Basin Lift Status:', liftStatus); return liftStatus; diff --git a/lib/resorts/brettonwoods/index.js b/lib/resorts/brettonwoods/index.js index 052126f4..75e88ff1 100644 --- a/lib/resorts/brettonwoods/index.js +++ b/lib/resorts/brettonwoods/index.js @@ -6,11 +6,11 @@ const debug = require('debug')('liftie:resort:brettonwoods'); function parse(dom) { const liftStatus = {}; - select(dom, '#trail-content > div:nth-of-type(-n + 2)').forEach((div) => { + select(dom, '#trail-content > div:nth-of-type(-n + 2)').forEach(div => { let name; let status; - div.children.forEach((node) => { + div.children.forEach(node => { if (node.type === 'text') { name = domutil.findText(node); if (name) { diff --git a/lib/resorts/bridger-bowl/index.js b/lib/resorts/bridger-bowl/index.js index 762e9d35..3e904926 100644 --- a/lib/resorts/bridger-bowl/index.js +++ b/lib/resorts/bridger-bowl/index.js @@ -1,4 +1,4 @@ -const debug = require("debug")("liftie:resort:bridger-bowl"); +const debug = require('debug')('liftie:resort:bridger-bowl'); const coerce = require('../../tools/coerce'); @@ -7,9 +7,7 @@ module.exports = parse; function parse({ data } = {}) { const ls = data?.lift_status ?? []; const liftStatus = {}; - ls.forEach( - ({ display_name, status }) => liftStatus[display_name] = coerce(status) - ); - debug("Lift Status", liftStatus); + ls.forEach(({ display_name, status }) => (liftStatus[display_name] = coerce(status))); + debug('Lift Status', liftStatus); return liftStatus; } diff --git a/lib/resorts/cannon/index.js b/lib/resorts/cannon/index.js index 6c144aa1..29279f57 100644 --- a/lib/resorts/cannon/index.js +++ b/lib/resorts/cannon/index.js @@ -9,6 +9,3 @@ module.exports = { } } }; - - - diff --git a/lib/resorts/cervino/index.js b/lib/resorts/cervino/index.js index 547cfd9c..77a55793 100644 --- a/lib/resorts/cervino/index.js +++ b/lib/resorts/cervino/index.js @@ -11,7 +11,7 @@ module.exports = { child: '.', attribute: 'class', regex: /impianto-status-([FPO])/, - fn: (s) => { + fn: s => { switch (s) { case 'F': return 'closed'; @@ -20,7 +20,7 @@ module.exports = { case 'O': return 'open'; } - }, - }, - }, + } + } + } }; diff --git a/lib/resorts/chamonix/index.js b/lib/resorts/chamonix/index.js index 3a32417e..7c46023e 100644 --- a/lib/resorts/chamonix/index.js +++ b/lib/resorts/chamonix/index.js @@ -5,8 +5,8 @@ module.exports = { parse: { name: { child: '2', - fn: toTitleCase, + fn: toTitleCase }, - status: '0', - }, + status: '0' + } }; diff --git a/lib/resorts/chinapeak/index.js b/lib/resorts/chinapeak/index.js index 9b45ffaf..a80855a0 100644 --- a/lib/resorts/chinapeak/index.js +++ b/lib/resorts/chinapeak/index.js @@ -3,7 +3,7 @@ module.exports = { parse: { name: { child: 0, - fn: s => s.trim().slice(0, -1), + fn: s => s.trim().slice(0, -1) }, status: 1 } diff --git a/lib/resorts/cranmore-mountain/index.js b/lib/resorts/cranmore-mountain/index.js index f807e05c..71f03a28 100644 --- a/lib/resorts/cranmore-mountain/index.js +++ b/lib/resorts/cranmore-mountain/index.js @@ -2,6 +2,6 @@ module.exports = { selector: 'h2:contains(Lifts) + div.datatable div.row[id]', parse: { name: '0', - status: '1/0', + status: '1/0' } }; diff --git a/lib/resorts/flims-laax-falera/index.js b/lib/resorts/flims-laax-falera/index.js index 9739c6ef..8f067ca3 100644 --- a/lib/resorts/flims-laax-falera/index.js +++ b/lib/resorts/flims-laax-falera/index.js @@ -5,7 +5,7 @@ module.exports = { status: { child: '0', attribute: 'class', - regex: /indicator (open|closed|in-preparation)$/, + regex: /indicator (open|closed|in-preparation)$/ } } }; diff --git a/lib/resorts/hoodoo/index.js b/lib/resorts/hoodoo/index.js index 9842f05e..c317837f 100644 --- a/lib/resorts/hoodoo/index.js +++ b/lib/resorts/hoodoo/index.js @@ -4,7 +4,7 @@ module.exports = { name: 0, status: { child: 1, - fn: s => s === 'CLOSED' ? 'closed' : 'open' + fn: s => (s === 'CLOSED' ? 'closed' : 'open') } } }; diff --git a/lib/resorts/jackson-hole/index.js b/lib/resorts/jackson-hole/index.js index a6ea3633..0c87c52a 100644 --- a/lib/resorts/jackson-hole/index.js +++ b/lib/resorts/jackson-hole/index.js @@ -6,10 +6,9 @@ module.exports = parse; function parse(data) { const liftStatus = {}; - Object.values(data.lifts) - .forEach(({ name, openingStatus }) => { - liftStatus[name] = coerce(openingStatus); - }); + Object.values(data.lifts).forEach(({ name, openingStatus }) => { + liftStatus[name] = coerce(openingStatus); + }); debug('Lift Status:', liftStatus); return liftStatus; diff --git a/lib/resorts/kitzbuehel/index.js b/lib/resorts/kitzbuehel/index.js index 3bc91d16..bd96f0b9 100644 --- a/lib/resorts/kitzbuehel/index.js +++ b/lib/resorts/kitzbuehel/index.js @@ -1,9 +1,4 @@ -const states = [ - '?', - 'open', - 'closed' -]; - +const states = ['?', 'open', 'closed']; module.exports = { selector: '.lifts li[data-locationid] > a', diff --git a/lib/resorts/monte-amiata/index.js b/lib/resorts/monte-amiata/index.js index d9dec52a..9df14d3e 100644 --- a/lib/resorts/monte-amiata/index.js +++ b/lib/resorts/monte-amiata/index.js @@ -6,14 +6,14 @@ module.exports = { child: '1/0', attribute: 'src', regex: /(rosso|verde)\.png$/, - fn: (s) => { + fn: s => { switch (s) { case 'verde': return 'open'; case 'rosso': return 'closed'; } - }, - }, - }, + } + } + } }; diff --git a/lib/resorts/monterosa/index.js b/lib/resorts/monterosa/index.js index 8c8b2254..10e3d1e9 100644 --- a/lib/resorts/monterosa/index.js +++ b/lib/resorts/monterosa/index.js @@ -2,10 +2,10 @@ module.exports = { selector: ".modulo-impianti__img.skirama div.skirama-icon[data-type='lift']", parse: { name: { - attribute: 'title', + attribute: 'title' }, status: { - attribute: 'data-status', + attribute: 'data-status' } } }; diff --git a/lib/resorts/morzine/index.js b/lib/resorts/morzine/index.js index d91a52dc..b6d342b0 100644 --- a/lib/resorts/morzine/index.js +++ b/lib/resorts/morzine/index.js @@ -1,3 +1,3 @@ module.exports = { - selector: '.remontees_secteur .row .col2', + selector: '.remontees_secteur .row .col2' }; diff --git a/lib/resorts/mt-hotham/index.js b/lib/resorts/mt-hotham/index.js index b9b656af..d6c103c3 100644 --- a/lib/resorts/mt-hotham/index.js +++ b/lib/resorts/mt-hotham/index.js @@ -5,19 +5,19 @@ module.exports = parse; // see: wmPopulateLiftStatus in https://www.mthotham.com.au/Portals/_default/skins/hotham/dist/js/wm-ajax2.js - const KEY_TO_NAME = { - 'TheVillage': 'Audi Quattro', - 'BigDExpress': 'Big D', - 'BlueRibbon': 'Blue Ribbon', - 'TheDrift': 'The Drift', - 'Gotcha': 'Gotcha', - 'HeavenlyValley': 'Heavenly Valley', - 'Keoghs': 'Keogh\'s', - 'TheOrchard': 'Orchard', - 'PlaygroundMidStation': 'Playground', - 'RoadRunner': 'Road Runner', - 'TheSummit': 'Summit', - 'SummitTrainer': 'Summit Trainer', - 'DinnerPlain': 'Dinner Plain', + TheVillage: 'Audi Quattro', + BigDExpress: 'Big D', + BlueRibbon: 'Blue Ribbon', + TheDrift: 'The Drift', + Gotcha: 'Gotcha', + HeavenlyValley: 'Heavenly Valley', + Keoghs: "Keogh's", + TheOrchard: 'Orchard', + PlaygroundMidStation: 'Playground', + RoadRunner: 'Road Runner', + TheSummit: 'Summit', + SummitTrainer: 'Summit Trainer', + DinnerPlain: 'Dinner Plain' }; function parse(data) { diff --git a/lib/resorts/mt-seymour/index.js b/lib/resorts/mt-seymour/index.js index 1aad478f..188ceec5 100644 --- a/lib/resorts/mt-seymour/index.js +++ b/lib/resorts/mt-seymour/index.js @@ -4,7 +4,7 @@ module.exports = { name: '0', status: { child: '1', - fn: status => status === 'Closed' ? 'closed' : 'open' + fn: status => (status === 'Closed' ? 'closed' : 'open') } } }; diff --git a/lib/resorts/ovindoli/index.js b/lib/resorts/ovindoli/index.js index b95689c0..615366d8 100644 --- a/lib/resorts/ovindoli/index.js +++ b/lib/resorts/ovindoli/index.js @@ -5,6 +5,6 @@ module.exports = { status: { child: '2/0/0/1', regex: /(Aperto|Chiuso)/ - }, - }, + } + } }; diff --git a/lib/resorts/paganella/index.js b/lib/resorts/paganella/index.js index 021ef1c8..a7181d4d 100644 --- a/lib/resorts/paganella/index.js +++ b/lib/resorts/paganella/index.js @@ -5,6 +5,6 @@ module.exports = { status: { child: '3/0', attribute: 'alt' - }, - }, + } + } }; diff --git a/lib/resorts/pats-peak/index.js b/lib/resorts/pats-peak/index.js index b5c71abb..8b48e054 100644 --- a/lib/resorts/pats-peak/index.js +++ b/lib/resorts/pats-peak/index.js @@ -4,7 +4,7 @@ module.exports = parse; function parse(data) { const liftStatus = {}; - data.Lifts.forEach((lift) => { + data.Lifts.forEach(lift => { liftStatus[lift.Name.trim()] = lift.Status.Open ? 'open' : 'closed'; }); diff --git a/lib/resorts/peio/index.js b/lib/resorts/peio/index.js index e015c656..b71f3c68 100644 --- a/lib/resorts/peio/index.js +++ b/lib/resorts/peio/index.js @@ -1,4 +1,4 @@ -const { allText } = require("../../tools/domutil"); +const { allText } = require('../../tools/domutil'); const STATUS = { check: 'open', diff --git a/lib/resorts/perisher/index.js b/lib/resorts/perisher/index.js index 7e354db6..78832c55 100644 --- a/lib/resorts/perisher/index.js +++ b/lib/resorts/perisher/index.js @@ -4,7 +4,7 @@ module.exports = { name: '../+', status: { child: '.', - attribute: 'alt', + attribute: 'alt' } } }; diff --git a/lib/resorts/pontedilegno-tonale/index.js b/lib/resorts/pontedilegno-tonale/index.js index 3f9ed226..c9109b9f 100644 --- a/lib/resorts/pontedilegno-tonale/index.js +++ b/lib/resorts/pontedilegno-tonale/index.js @@ -5,7 +5,7 @@ module.exports = { status: { child: '0/0', attribute: 'src', - regex: /\/([a-z]+)-icon.svg$/, + regex: /\/([a-z]+)-icon.svg$/ // fn: s => s.slice(0, -3) } } diff --git a/lib/resorts/red-mountain/index.js b/lib/resorts/red-mountain/index.js index cdd2db67..8001ce53 100644 --- a/lib/resorts/red-mountain/index.js +++ b/lib/resorts/red-mountain/index.js @@ -5,6 +5,6 @@ module.exports = parse; function parse(data) { const lifts = data?.MountainReport?.Lifts ?? []; const liftStatus = {}; - lifts.forEach(({ Name, Status }) => liftStatus[Name] = coerce(Status)); + lifts.forEach(({ Name, Status }) => (liftStatus[Name] = coerce(Status))); return liftStatus; } diff --git a/lib/resorts/roccaraso/index.js b/lib/resorts/roccaraso/index.js index 1f70bb76..9cdbc129 100644 --- a/lib/resorts/roccaraso/index.js +++ b/lib/resorts/roccaraso/index.js @@ -6,14 +6,14 @@ module.exports = { child: '0', attribute: 'class', regex: /ic_stato([0-9])/, - fn: (s) => { + fn: s => { switch (s) { case '1': return 'open'; case '0': return 'closed'; } - }, - }, - }, + } + } + } }; diff --git a/lib/resorts/sasquatch-mountain/index.js b/lib/resorts/sasquatch-mountain/index.js index 0801ab1b..07a8b9c4 100644 --- a/lib/resorts/sasquatch-mountain/index.js +++ b/lib/resorts/sasquatch-mountain/index.js @@ -1,13 +1,13 @@ const code2status = { // see: `DecodeStatus` in https://skiron.intermaps.com/js/sdds_data.js - '7': 'closed', - '94': 'closed', - '169': 'open', - '126': 'hold', - '205': 'open', - '412': 'open', - '128': 'closed', - '229': 'closed', + 7: 'closed', + 94: 'closed', + 169: 'open', + 126: 'hold', + 205: 'open', + 412: 'open', + 128: 'closed', + 229: 'closed' }; module.exports = { diff --git a/lib/resorts/serfaus-fiss-ladis/index.js b/lib/resorts/serfaus-fiss-ladis/index.js index a5bd3e86..20ee1151 100644 --- a/lib/resorts/serfaus-fiss-ladis/index.js +++ b/lib/resorts/serfaus-fiss-ladis/index.js @@ -1,5 +1,5 @@ module.exports = { - selector: "#lifte div > table > tbody > tr", + selector: '#lifte div > table > tbody > tr', parse: { name: '1', status: { diff --git a/lib/resorts/shawnee-mountain/index.js b/lib/resorts/shawnee-mountain/index.js index 3f390ac7..145baacb 100644 --- a/lib/resorts/shawnee-mountain/index.js +++ b/lib/resorts/shawnee-mountain/index.js @@ -1,14 +1,12 @@ -const debug = require("debug")("liftie:resort:shawnee-mountain"); +const debug = require('debug')('liftie:resort:shawnee-mountain'); module.exports = parse; function parse({ addtl: { lifts } }) { const liftStatus = {}; - Object.values(lifts).forEach( - ({ friendly, open }) => liftStatus[friendly] = open ? 'open' : 'closed' - ); + Object.values(lifts).forEach(({ friendly, open }) => (liftStatus[friendly] = open ? 'open' : 'closed')); - debug("Lift Status", liftStatus); + debug('Lift Status', liftStatus); return liftStatus; } diff --git a/lib/resorts/silver-star/index.js b/lib/resorts/silver-star/index.js index ea8e8b9b..db509cfb 100644 --- a/lib/resorts/silver-star/index.js +++ b/lib/resorts/silver-star/index.js @@ -5,7 +5,7 @@ function parse({ winter }) { const ls = {}; Object.values(winter).forEach(({ lifts }) => { - Object.values(lifts).forEach(({ name, status }) => ls[name] = coerce(status)); + Object.values(lifts).forEach(({ name, status }) => (ls[name] = coerce(status))); }); return ls; diff --git a/lib/resorts/skiwelt/index.js b/lib/resorts/skiwelt/index.js index 55b45399..b61d3242 100644 --- a/lib/resorts/skiwelt/index.js +++ b/lib/resorts/skiwelt/index.js @@ -1,11 +1,11 @@ module.exports = { - selector: "div.wrapper > div.row", + selector: 'div.wrapper > div.row', parse: { name: '2/0', status: { child: '.', attribute: 'data-state', - fn: s => s === '1' ? 'open' : 'closed' + fn: s => (s === '1' ? 'open' : 'closed') } } }; diff --git a/lib/resorts/snowbird/index.js b/lib/resorts/snowbird/index.js index 4ecb85a0..67f6df3d 100644 --- a/lib/resorts/snowbird/index.js +++ b/lib/resorts/snowbird/index.js @@ -3,7 +3,5 @@ const coerce = require('../../tools/coerce'); module.exports = parse; function parse(lifts) { - return Object.fromEntries( - lifts.map(({ name, status }) => [name, coerce(status)]) - ); + return Object.fromEntries(lifts.map(({ name, status }) => [name, coerce(status)])); } diff --git a/lib/resorts/sun-peaks/index.js b/lib/resorts/sun-peaks/index.js index 3b4d9e41..34f4215b 100644 --- a/lib/resorts/sun-peaks/index.js +++ b/lib/resorts/sun-peaks/index.js @@ -6,7 +6,7 @@ module.exports = { child: '1/0', attribute: 'class', regex: /-([a-z]+)$/, - fn: s => s === 'tick' ? 'open' : s + fn: s => (s === 'tick' ? 'open' : s) } } }; diff --git a/lib/resorts/sunshine-village/index.js b/lib/resorts/sunshine-village/index.js index 36bd75e7..decb7ee5 100644 --- a/lib/resorts/sunshine-village/index.js +++ b/lib/resorts/sunshine-village/index.js @@ -4,7 +4,7 @@ const coerce = require('../../tools/coerce'); const lifts = [ 'Angel', 'Wolverine', - 'Goat\'s Eye', + "Goat's Eye", 'Jackrabbit', 'Teepee Town', 'Divide', diff --git a/lib/resorts/tahoe-donner/index.js b/lib/resorts/tahoe-donner/index.js index 2eea576e..906ed1cc 100644 --- a/lib/resorts/tahoe-donner/index.js +++ b/lib/resorts/tahoe-donner/index.js @@ -1,7 +1,7 @@ const states = { - 'check': 'open', - 'clock': 'scheduled', - 'times': 'closed' + check: 'open', + clock: 'scheduled', + times: 'closed' }; module.exports = { diff --git a/lib/resorts/val-gardena/index.js b/lib/resorts/val-gardena/index.js index 1462d602..006c8f14 100644 --- a/lib/resorts/val-gardena/index.js +++ b/lib/resorts/val-gardena/index.js @@ -9,7 +9,7 @@ module.exports = { status: { child: '0', attribute: 'class', - regex: / ([a-z]+)$/, + regex: / ([a-z]+)$/ } } }; diff --git a/lib/resorts/valdisere/index.js b/lib/resorts/valdisere/index.js index e6c1eb2f..cb009b00 100644 --- a/lib/resorts/valdisere/index.js +++ b/lib/resorts/valdisere/index.js @@ -1,19 +1,18 @@ module.exports = { - selector: - '.lift-status-pop-in:contains(Lifts) + .lifts-and-trails-subsection .lift-status-datum', + selector: '.lift-status-pop-in:contains(Lifts) + .lifts-and-trails-subsection .lift-status-datum', parse: { name: '1', status: { child: '2/0/1', attribute: 'fill', - fn: (s) => { + fn: s => { switch (s) { case '#1ABC9C': return 'open'; case '#ED2559': return 'closed'; } - }, - }, - }, + } + } + } }; diff --git a/lib/resorts/whistler-blackcomb/index.js b/lib/resorts/whistler-blackcomb/index.js index f6735d34..ea9027b5 100644 --- a/lib/resorts/whistler-blackcomb/index.js +++ b/lib/resorts/whistler-blackcomb/index.js @@ -5,9 +5,10 @@ module.exports = { parse: { name: { attribute: 'name', - fn: s => toTitleCase(s) - .replace(/(\d+)Th/, '$1th') - .replace(/t.bar/i, 'T-Bar') + fn: s => + toTitleCase(s) + .replace(/(\d+)Th/, '$1th') + .replace(/t.bar/i, 'T-Bar') }, status: { attribute: 'status' diff --git a/lib/resorts/whitefish/index.js b/lib/resorts/whitefish/index.js index 2fb8551b..c5e9abc0 100644 --- a/lib/resorts/whitefish/index.js +++ b/lib/resorts/whitefish/index.js @@ -4,7 +4,7 @@ module.exports = { name: '0/0', status: { child: '1/0/0', - attribute: 'alt', + attribute: 'alt' } } }; diff --git a/lib/resorts/windham/index.js b/lib/resorts/windham/index.js index c9a1f5d7..913ac289 100644 --- a/lib/resorts/windham/index.js +++ b/lib/resorts/windham/index.js @@ -5,7 +5,7 @@ module.exports = { status: { child: '+/+/0', attribute: 'alt', - fn: text => /open/i.test(text) ? 'open' : 'closed' + fn: text => (/open/i.test(text) ? 'open' : 'closed') } } }; diff --git a/lib/routes/canonical.js b/lib/routes/canonical.js index a8c58015..671dca5e 100644 --- a/lib/routes/canonical.js +++ b/lib/routes/canonical.js @@ -2,5 +2,8 @@ module.exports = canonical; // converts 'Names Like This' into 'names-like-this' function canonical(str) { - return str.split(' ').map((s) => s.toLowerCase()).join('-'); + return str + .split(' ') + .map(s => s.toLowerCase()) + .join('-'); } diff --git a/lib/routes/data.js b/lib/routes/data.js index 368cabe8..30a58a52 100644 --- a/lib/routes/data.js +++ b/lib/routes/data.js @@ -10,7 +10,6 @@ module.exports = data; /*global setInterval */ - // data structure function data() { const // meta and data for each resort @@ -38,7 +37,7 @@ function data() { function fetchStatusAll() { const now = Date.now(); - Object.keys(cache).forEach((id) => { + Object.keys(cache).forEach(id => { const resort = cache[id]; const data = resort.data; const meta = resort.meta; @@ -50,7 +49,7 @@ function data() { return; } if (meta.fetchInProgress[plugin]) { - debug("Fetch in progress: %s for %s", plugin, id); + debug('Fetch in progress: %s for %s', plugin, id); return; } // fetch only if it's been really long time, or if it was sufficienly long time and @@ -70,7 +69,7 @@ function data() { } function initCache(resorts) { - Object.keys(resorts).forEach((id) => { + Object.keys(resorts).forEach(id => { const resort = resorts[id]; const info = { meta: resort, @@ -86,7 +85,7 @@ function data() { info.meta.id = id; info.meta.fetchInProgress = {}; info.data.timestamp = {}; - plugins.forEach((plugin) => { + plugins.forEach(plugin => { info.meta.fetchInProgress[plugin] = false; info.data.timestamp[plugin] = 0; }); @@ -95,7 +94,7 @@ function data() { } function prefetch(fn) { - db.onload((count) => { + db.onload(count => { debug('Found %d resorts in cache', count); Object.keys(cache).forEach(db.read); fetchStatusAll(); @@ -106,7 +105,7 @@ function data() { function getData(requestedNames, fn) { const names = checkNames(requestedNames, cache, my.names); - const result = names.map((id) => { + const result = names.map(id => { const resort = cache[id]; if (requestedNames) { // only increment counter if resort specifically requested @@ -120,7 +119,7 @@ function data() { } function getMeta(fn) { - const result = my.names.map((id) => { + const result = my.names.map(id => { const meta = cache[id].meta; return { id: meta.id, @@ -142,15 +141,17 @@ function data() { } function getFiltered(fn) { - return my.names.filter((id) => fn(cache[id].data)); + return my.names.filter(id => fn(cache[id].data)); } function getStats(requestedNames) { const names = checkNames(requestedNames, cache, my.names); - return stats.summary(names.map((id) => { - const lifts = cache[id].data.lifts; - return lifts?.stats; - })); + return stats.summary( + names.map(id => { + const lifts = cache[id].data.lifts; + return lifts?.stats; + }) + ); } function init(fn) { @@ -159,10 +160,9 @@ function data() { initCache(data); my.tags = tags(data); my.all = Object.keys(cache); - my.names = my.all.filter((id) => !(data[id].no?.lifts)); + my.names = my.all.filter(id => !data[id].no?.lifts); prefetch(fn); }); - } return { diff --git a/lib/routes/database.js b/lib/routes/database.js index e5589b31..e7bb2cfa 100644 --- a/lib/routes/database.js +++ b/lib/routes/database.js @@ -15,7 +15,7 @@ function database(cache) { const info = { timestamp: cache[id].data.timestamp }; - plugins.forEach((plugin) => { + plugins.forEach(plugin => { const chunk = cache[id].data[plugin]; if (chunk) { info[plugin] = chunk; @@ -29,7 +29,7 @@ function database(cache) { if (!info) { return; } - plugins.forEach((plugin) => { + plugins.forEach(plugin => { const chunk = info[plugin]; if (chunk) { cache[id].data[plugin] = chunk; @@ -44,9 +44,7 @@ function database(cache) { if (!loaded) { loaded = db.load(); } - loaded - .then(c => process.nextTick(fn, null, c)) - .catch(e => process.nextTick(fn, e)); + loaded.then(c => process.nextTick(fn, null, c)).catch(e => process.nextTick(fn, e)); } return { diff --git a/lib/routes/headers.js b/lib/routes/headers.js index e66bca29..7f2e4163 100644 --- a/lib/routes/headers.js +++ b/lib/routes/headers.js @@ -1,22 +1,14 @@ const crypto = require('node:crypto'); -module.exports = [ - csp, - referrer, - feature, - link -]; +module.exports = [csp, referrer, feature, link]; -const { - LIFTIE_STATIC_HOST: staticHost = '', - LIFTIE_CSP_ENFORCE, - CSP_REPORT_URI -} = process.env; +const { LIFTIE_STATIC_HOST: staticHost = '', LIFTIE_CSP_ENFORCE, CSP_REPORT_URI } = process.env; const scriptHost = staticHost ? staticHost : `'self'`; - -const CSP_HEADER_NAME = toBoolean(LIFTIE_CSP_ENFORCE) ? 'Content-Security-Policy' : 'Content-Security-Policy-Report-Only'; +const CSP_HEADER_NAME = toBoolean(LIFTIE_CSP_ENFORCE) + ? 'Content-Security-Policy' + : 'Content-Security-Policy-Report-Only'; const cspPolicy = [ `base-uri 'self'`, @@ -29,9 +21,7 @@ const cspPolicy = [ const reportTo = JSON.stringify({ group: 'csp', max_age: 10886400, - endpoints: [ - { "url": CSP_REPORT_URI } - ] + endpoints: [{ url: CSP_REPORT_URI }] }); function csp(_req, res, next) { @@ -54,9 +44,9 @@ function feature(_req, res, next) { next(); } - function link(_req, res, next) { - const preloadLinks = [{ + const preloadLinks = [ + { path: '/stylesheets/fonts/lift-status.woff2', as: 'font', type: 'font/woff2' @@ -72,11 +62,7 @@ function link(_req, res, next) { next(); function linkHeader({ path, as, type }) { - const fields = [ - `<${staticHost}${res.locals.cachify(path)}>`, - 'rel=preload', - `as=${as}` - ]; + const fields = [`<${staticHost}${res.locals.cachify(path)}>`, 'rel=preload', `as=${as}`]; if (type) { fields.push(`type=${type}`); diff --git a/lib/routes/index.js b/lib/routes/index.js index 3e98798b..1705b238 100644 --- a/lib/routes/index.js +++ b/lib/routes/index.js @@ -17,7 +17,6 @@ function title(suffix) { return t; } - function renderResorts(req, res, next) { const opts = req.opts || {}; @@ -42,7 +41,7 @@ function renderResorts(req, res, next) { title: title(res.locals.title), all: req.data.all(), tags: req.data.tags(), - resorts: items, + resorts: items }); }); } @@ -109,7 +108,7 @@ function sitemap(req, res) { } function absent(req, res, next) { - req.requested = req.data.filtered((resort) => { + req.requested = req.data.filtered(resort => { const hasLists = resort.lifts?.status && Object.keys(resort.lifts.status).length; return !hasLists; }); @@ -118,13 +117,13 @@ function absent(req, res, next) { } function confused(req, res, next) { - req.requested = req.data.filtered((resort) => resort.opening && resort.lifts.stats && resort.lifts.stats.open); + req.requested = req.data.filtered(resort => resort.opening && resort.lifts.stats && resort.lifts.stats.open); res.locals.title = 'Confused'; next(); } function closed(req, res, next) { - req.requested = req.data.filtered((resort) => resort.opening); + req.requested = req.data.filtered(resort => resort.opening); res.locals.title = 'Closed'; next(); } @@ -181,9 +180,7 @@ function routes(app) { t = canonical(t); if (tags[t]) { // permanent redirect to canonical form of the tag - return res - .writeHead( 301, { location: `/tag/${encodeURIComponent(t)}` }) - .end(); + return res.writeHead(301, { location: `/tag/${encodeURIComponent(t)}` }).end(); } return res.writeHead(404, `Invalid tag name: ${req.params.tag}`).end(); } diff --git a/lib/routes/plan.js b/lib/routes/plan.js index 92b60fab..20775919 100644 --- a/lib/routes/plan.js +++ b/lib/routes/plan.js @@ -1,4 +1,4 @@ -const qs = require("qs"); +const qs = require('qs'); module.exports = addToTrip; diff --git a/lib/routes/service-worker.js b/lib/routes/service-worker.js index 5db54484..af89e534 100644 --- a/lib/routes/service-worker.js +++ b/lib/routes/service-worker.js @@ -3,11 +3,7 @@ const fs = require('node:fs'); module.exports = renderServiceWorker; -const { - NODE_ENV, - SITE_URL: siteUrl, - LIFTIE_STATIC_HOST: staticHost = '' -} = process.env; +const { NODE_ENV, SITE_URL: siteUrl, LIFTIE_STATIC_HOST: staticHost = '' } = process.env; const DEBUG = NODE_ENV !== 'production'; @@ -25,9 +21,7 @@ function fixName(filename) { if (DEBUG) { return filename; } - return filename - .replace(/.css$/, '.min.css') - .replace(/.js$/, '.min.js'); + return filename.replace(/.css$/, '.min.css').replace(/.js$/, '.min.js'); } async function minify({ debug, vars, script }) { @@ -55,12 +49,12 @@ function createServiceWorkerScript({ cachify }) { const serviceWorkerOptions = { version: require('../../package.json').version, prefetch: [ - '/img/noaa-logo.svg', - '/scripts/liftie.js', - '/stylesheets/style.css', - '/stylesheets/fonts/lift-status.woff2', - '/stylesheets/fonts/iconvault_forecastfont.woff2' - ] + '/img/noaa-logo.svg', + '/scripts/liftie.js', + '/stylesheets/style.css', + '/stylesheets/fonts/lift-status.woff2', + '/stylesheets/fonts/iconvault_forecastfont.woff2' + ] .map(fixName) .map(f => staticHost + cachify(f)), liftieHost: siteUrl, diff --git a/lib/routes/sorter.js b/lib/routes/sorter.js index 8c20b14f..1b24d0a6 100644 --- a/lib/routes/sorter.js +++ b/lib/routes/sorter.js @@ -12,8 +12,8 @@ function getOpenResorts(cookie) { function sortByOpen(resorts) { const open = []; const closed = []; - resorts = _.sortBy(resorts, (r) => r.name); - resorts.forEach((r) => { + resorts = _.sortBy(resorts, r => r.name); + resorts.forEach(r => { const arr = r.open ? open : closed; arr.push(r); }); @@ -26,7 +26,7 @@ function markOpen(resorts, cookie) { // no cookie and a lot of resorts - display everything as closed openList = []; } - resorts.forEach((resort) => { + resorts.forEach(resort => { resort.open = !openList || openList.indexOf(resort.id) > -1; }); if (openList) { diff --git a/lib/routes/sw.template.js b/lib/routes/sw.template.js index ab39ad1e..bdd73d1a 100644 --- a/lib/routes/sw.template.js +++ b/lib/routes/sw.template.js @@ -16,7 +16,7 @@ function getCacheName(url) { const handler = HOSTNAME_2_CACHENAME[url.hostname]; if (handler) { // if handler is the function call it, otherwise return it as a cachename - return (typeof handler === 'function') ? handler(url) : handler; + return typeof handler === 'function' ? handler(url) : handler; } } @@ -37,9 +37,11 @@ function liftieHostHandler(url) { } // some other things that we can try in cache first - if (url.pathname.startsWith('/apple-touch-icon') || + if ( + url.pathname.startsWith('/apple-touch-icon') || url.pathname.startsWith('/img/') || - url.pathname === '/favicon.ico') { + url.pathname === '/favicon.ico' + ) { return CURRENT_CACHES.cf; } @@ -47,7 +49,7 @@ function liftieHostHandler(url) { return CURRENT_CACHES.nf; } -self.addEventListener('install', (event) => { +self.addEventListener('install', event => { const urlsToPrefetch = options.prefetch; console.log('Handling install event. Resources to pre-fetch:', urlsToPrefetch); @@ -55,43 +57,39 @@ self.addEventListener('install', (event) => { event.waitUntil( caches .open(CURRENT_CACHES.cf) - .then((cache) => cache - .addAll(urlsToPrefetch) - .then(() => { - console.log('All resources have been fetched and cached.'); - return self.skipWaiting(); - })) - .catch((error) => { + .then(cache => + cache.addAll(urlsToPrefetch).then(() => { + console.log('All resources have been fetched and cached.'); + return self.skipWaiting(); + }) + ) + .catch(error => { console.error('Pre-fetching failed:', error); }) ); }); -self.addEventListener('activate', (event) => { - const expectedCacheNames = Object.keys(CURRENT_CACHES) - .reduce((names, key) => { - names[CURRENT_CACHES[key]] = true; - return names; - }, Object.create(null)); +self.addEventListener('activate', event => { + const expectedCacheNames = Object.keys(CURRENT_CACHES).reduce((names, key) => { + names[CURRENT_CACHES[key]] = true; + return names; + }, Object.create(null)); event.waitUntil( - caches - .keys() - .then((cacheNames) => Promise.all( - cacheNames.map((cacheName) => { - if (!expectedCacheNames[cacheName]) { - console.log('Deleting out of date cache:', cacheName); - return caches.delete(cacheName); - } - }) - ) - .then(self.clients.claim())) + caches.keys().then(cacheNames => + Promise.all( + cacheNames.map(cacheName => { + if (!expectedCacheNames[cacheName]) { + console.log('Deleting out of date cache:', cacheName); + return caches.delete(cacheName); + } + }) + ).then(self.clients.claim()) + ) ); }); - function addToCache(request, response, url, cacheName) { - // check if it's OK to cache response // we only cache 2xx responses, opaque responses don't have status but we can check their type function okToCache() { @@ -113,46 +111,45 @@ function addToCache(request, response, url, cacheName) { return response; } const responseToCache = response.clone(); - return caches.open(cacheName).then((cache) => { + return caches.open(cacheName).then(cache => { // console.log('Caching the response to', request.url); cache.put(request, responseToCache); }); } function cacheFirst(event, url, cacheName) { - return caches - .match(event.request) - .then((response) => { - const request = event.request; + return caches.match(event.request).then(response => { + const request = event.request; - if (response) { - // console.log('Found response in cache:', response); - return response; - } + if (response) { + // console.log('Found response in cache:', response); + return response; + } - // console.log('No response found in cache. About to fetch from network...'); - return fetch(request).then((response) => { + // console.log('No response found in cache. About to fetch from network...'); + return fetch(request) + .then(response => { // console.log('Response from network is:', response); addToCache(event.request, response, url, cacheName); // console.log('Not caching the response to', event.request.url); return response; }) - .catch((error) => { - console.error('Fetching failed:', error); - throw error; - }); - }); + .catch(error => { + console.error('Fetching failed:', error); + throw error; + }); + }); } function networkFirst(event, url, cacheName) { return fetch(event.request) - .then((response) => { + .then(response => { addToCache(event.request, response, url, cacheName); return response; }) - .catch((error) => { + .catch(error => { console.error('Fetching failed:', error); - return caches.match(event.request).then((response) => { + return caches.match(event.request).then(response => { if (response) { return response; } @@ -166,7 +163,7 @@ const FETCH_HANDLERS = {}; FETCH_HANDLERS[CURRENT_CACHES.cf] = cacheFirst; FETCH_HANDLERS[CURRENT_CACHES.nf] = networkFirst; -self.addEventListener('fetch', (event) => { +self.addEventListener('fetch', event => { if (event.request.method !== 'GET') { // only handle GET requests return; diff --git a/lib/routes/tags.js b/lib/routes/tags.js index 6c9f2c9d..277ac7b7 100644 --- a/lib/routes/tags.js +++ b/lib/routes/tags.js @@ -13,12 +13,12 @@ module.exports = tags; function tags(objects) { const result = Object.create(null); - Object.keys(objects).forEach((n) => { + Object.keys(objects).forEach(n => { const o = objects[n]; if (!o.tags) { return; } - o.tags.forEach((tag) => { + o.tags.forEach(tag => { if (!tag) { return; } @@ -34,8 +34,10 @@ function tags(objects) { }); // resort keys lexicographically - return Object.keys(result).sort().reduce((memo, key) => { - memo[key] = result[key]; - return memo; - }, Object.create(null)); + return Object.keys(result) + .sort() + .reduce((memo, key) => { + memo[key] = result[key]; + return memo; + }, Object.create(null)); } diff --git a/lib/tools/aspen.js b/lib/tools/aspen.js index af3d12f5..7012d4af 100644 --- a/lib/tools/aspen.js +++ b/lib/tools/aspen.js @@ -6,7 +6,7 @@ module.exports = parse; function parse(data) { const liftStatus = {}; - data.liftStatuses.forEach((lift) => { + data.liftStatuses.forEach(lift => { liftStatus[lift.liftName] = coerce(lift.status); }); diff --git a/lib/tools/coerce.js b/lib/tools/coerce.js index cceca74c..e068b54f 100644 --- a/lib/tools/coerce.js +++ b/lib/tools/coerce.js @@ -3,76 +3,75 @@ const debug = require('debug')('liftie:coerce'); module.exports = coerceStatus; const map = { - 'o': 'open', - 'op': 'open', - 'opn': 'open', - 'y': 'open', - 'yes': 'open', - 'ok': 'open', - 'open': 'open', - 'opened': 'open', - 'green': 'open', - 'checkmark': 'open', - 'ouvert': 'open', - 'ouverte': 'open', - 'on': 'open', - '1': 'open', - 'check': 'open', - 'true': 'open', - 'aperta': 'open', - 'aperto': 'open', - 'normal': 'open', + o: 'open', + op: 'open', + opn: 'open', + y: 'open', + yes: 'open', + ok: 'open', + open: 'open', + opened: 'open', + green: 'open', + checkmark: 'open', + ouvert: 'open', + ouverte: 'open', + on: 'open', + 1: 'open', + check: 'open', + true: 'open', + aperta: 'open', + aperto: 'open', + normal: 'open', - 'n': 'closed', - 'x': 'closed', - 'no': 'closed', - 'cl': 'closed', - 'cls': 'closed', - 'close': 'closed', - 'closed': 'closed', - 'closedfortheday': 'closed', - 'cross': 'closed', - 'geschlossen': 'closed', - 'blank': 'closed', - 'red': 'closed', - 'ferme': 'closed', - 'fermée': 'closed', - 'f': 'closed', - '3': 'closed', - 'off': 'closed', - 'false': 'closed', - 'chiusa': 'closed', - 'chiuso': 'closed', - 'closedforseason': 'closed', - 'cerrado': 'closed', + n: 'closed', + x: 'closed', + no: 'closed', + cl: 'closed', + cls: 'closed', + close: 'closed', + closed: 'closed', + closedfortheday: 'closed', + cross: 'closed', + geschlossen: 'closed', + blank: 'closed', + red: 'closed', + ferme: 'closed', + fermée: 'closed', + f: 'closed', + 3: 'closed', + off: 'closed', + false: 'closed', + chiusa: 'closed', + chiuso: 'closed', + closedforseason: 'closed', + cerrado: 'closed', - 'h': 'hold', - 'hd': 'hold', - 'hold': 'hold', - 'windhold': 'hold', - 'weatherhold': 'hold', - 'maintenancehold': 'hold', - 'safety': 'hold', - 'onhold': 'hold', - 'standby': 'hold', - 'code': 'hold', - 'caution': 'hold', - 'condicional': 'hold', + h: 'hold', + hd: 'hold', + hold: 'hold', + windhold: 'hold', + weatherhold: 'hold', + maintenancehold: 'hold', + safety: 'hold', + onhold: 'hold', + standby: 'hold', + code: 'hold', + caution: 'hold', + condicional: 'hold', - 'scheduled': 'scheduled', - 'onschedule': 'scheduled', - 'expected': 'scheduled', - 'delay': 'scheduled', - 'delayed': 'scheduled', - 'prevision': 'scheduled', - 'blue': 'scheduled', - 'p': 'scheduled', - '2': 'scheduled', + scheduled: 'scheduled', + onschedule: 'scheduled', + expected: 'scheduled', + delay: 'scheduled', + delayed: 'scheduled', + prevision: 'scheduled', + blue: 'scheduled', + p: 'scheduled', + 2: 'scheduled', 'in-preparations': 'scheduled', "En cours d'ouverture": 'scheduled' }; - /** * More flexible slice. If from, or to are strings we determine their position in the string * and slice appropriately. In all other cases it works like normal slice diff --git a/lib/tools/dolomitisuperski.js b/lib/tools/dolomitisuperski.js index 9e024bce..a5c16f1b 100644 --- a/lib/tools/dolomitisuperski.js +++ b/lib/tools/dolomitisuperski.js @@ -6,14 +6,14 @@ module.exports = { child: '3', attribute: 'class', regex: /\b(red|green)\b/, - fn: (s) => { + fn: s => { switch (s) { case 'green': return 'open'; default: return 'closed'; } - }, - }, - }, + } + } + } }; diff --git a/lib/tools/domutil.js b/lib/tools/domutil.js index 77dbb1ca..f0feacef 100644 --- a/lib/tools/domutil.js +++ b/lib/tools/domutil.js @@ -100,18 +100,20 @@ function text(node, descriptor) { // parseFn can be either a function that calculates { name, status } pair // or an object with paths to name and status function collect(dom, selector, parse = { name: 0, status: 1 }) { - - const parseFn = (typeof parse === 'function') ? parse : (node) => { - if (parse.filter && !parse.filter(node)) { - return; - } - const name = text(node, parse.name); - if (!name) { - return; - } - const status = text(node, parse.status); - return { name, status }; - }; + const parseFn = + typeof parse === 'function' + ? parse + : node => { + if (parse.filter && !parse.filter(node)) { + return; + } + const name = text(node, parse.name); + if (!name) { + return; + } + const status = text(node, parse.status); + return { name, status }; + }; const ls = {}; diff --git a/lib/tools/infosnow.js b/lib/tools/infosnow.js index 3dde78ea..fe966ef8 100644 --- a/lib/tools/infosnow.js +++ b/lib/tools/infosnow.js @@ -6,22 +6,19 @@ function parse(dom) { const nodes = select(dom, '.block table tr'); let liftStatus; - nodes.some((node) => { - + nodes.some(node => { if (domutil.childText(node, 0).split(' ').shift() !== 'Lifts') { return; } - liftStatus = domutil.collect(node.parent.parent.parent, '.content table tr .icon[src*="status"]', (node) => ({ - name: node.parent.next.next.children[0].data, - status: node.attribs.src.split('/').pop().slice(0, -4) - })); + liftStatus = domutil.collect(node.parent.parent.parent, '.content table tr .icon[src*="status"]', node => ({ + name: node.parent.next.next.children[0].data, + status: node.attribs.src.split('/').pop().slice(0, -4) + })); return true; }); - debug('Infosnow APGSGA Lift Status:', liftStatus); return liftStatus; } - module.exports = parse; diff --git a/lib/tools/intrawest.js b/lib/tools/intrawest.js index c481f5ac..d8bb3513 100644 --- a/lib/tools/intrawest.js +++ b/lib/tools/intrawest.js @@ -2,7 +2,6 @@ const coerce = require('./coerce'); // common parser for Intrawest http://www.intrawest.com/about-us/who-we-are.aspx module.exports = parse; - function parse(lifts) { return lifts.reduce((ls, { Name: name, StatusEnglish: status }) => { ls[name] = coerce(status); diff --git a/lib/tools/limiter.js b/lib/tools/limiter.js index 6794b923..97040ea5 100644 --- a/lib/tools/limiter.js +++ b/lib/tools/limiter.js @@ -15,9 +15,7 @@ function Limiter(...args) { } function limit(fn) { - return hasTokens() ? - removeToken().then(() => fn(), fn) : - process.nextTick(fn, { fetchLater: true }); + return hasTokens() ? removeToken().then(() => fn(), fn) : process.nextTick(fn, { fetchLater: true }); } function argsToLimiters(args) { diff --git a/lib/tools/lumiplan.js b/lib/tools/lumiplan.js index 89120ef7..8f624e72 100644 --- a/lib/tools/lumiplan.js +++ b/lib/tools/lumiplan.js @@ -1,4 +1,4 @@ -const toTitleCase = require("to-title-case"); +const toTitleCase = require('to-title-case'); module.exports = { selector: '.text:contains(Lifts) + .prl_affichage .prl_group', diff --git a/lib/tools/prism.js b/lib/tools/prism.js index 218cac00..b0acad93 100644 --- a/lib/tools/prism.js +++ b/lib/tools/prism.js @@ -2,7 +2,7 @@ const domutil = require('./domutil'); const debug = require('debug')('liftie:resort'); function parse(dom) { - const liftStatus = domutil.collect(dom, '.lift_list_table tbody tr', (tr) => { + const liftStatus = domutil.collect(dom, '.lift_list_table tbody tr', tr => { const last = tr.children[tr.children.length - 1]; let status = domutil.findText(last); diff --git a/lib/tools/turismofvg.js b/lib/tools/turismofvg.js index 111eb23f..53e05fc2 100644 --- a/lib/tools/turismofvg.js +++ b/lib/tools/turismofvg.js @@ -3,12 +3,12 @@ module.exports = { selector: '[class*="c-snowreportdetail__tablerowcontent@landscape"]', parse: { name: { - child: '1/0', + child: '1/0' }, status: { child: '0', attribute: 'class', - regex: /o\-status\-\-(\w+)$/, - }, - }, + regex: /o\-status\-\-(\w+)$/ + } + } }; diff --git a/lib/tools/vail.js b/lib/tools/vail.js index 3692dc32..f5dd9908 100644 --- a/lib/tools/vail.js +++ b/lib/tools/vail.js @@ -7,7 +7,6 @@ const select = require('../select'); const request = require('../lifts/request'); const htmlparser = require('htmlparser2'); - module.exports = parse; const statuses = ['closed', 'open', 'hold', 'scheduled']; @@ -23,11 +22,10 @@ function parseLiftStatus(dom) { .map(script => domutil.allText(script).trim()) .find(script => script.includes('TerrainStatusFeed = {')); - const liftStatus = extractLiftData(dataScript) - .reduce((liftStatus, { Name, Status }) => { - liftStatus[Name.trim()] = statuses[Status]; - return liftStatus; - }, {}); + const liftStatus = extractLiftData(dataScript).reduce((liftStatus, { Name, Status }) => { + liftStatus[Name.trim()] = statuses[Status]; + return liftStatus; + }, {}); debug('vail Lift Status:', liftStatus); return liftStatus; @@ -36,12 +34,14 @@ function parseLiftStatus(dom) { function followWaitingRoom(waitingRoom) { const pathParts = waitingRoom.split("'"); const redirectUrl = { - host: "https://waitingroom.snow.com", + host: 'https://waitingroom.snow.com', pathname: pathParts[1] }; return request(redirectUrl) - .on('error', () => { return {}; }) + .on('error', () => { + return {}; + }) .then(({ text }) => { if (!text) { return {}; @@ -52,7 +52,6 @@ function followWaitingRoom(waitingRoom) { // common parser for Vail Resorts lift status function parse(dom) { - const waitingRoom = select(dom, 'script') .map(script => domutil.allText(script).trim()) .find(script => script.includes("document.location.href = '/?c=vailresorts")); diff --git a/lib/weather/icons.js b/lib/weather/icons.js index b4b2c920..dbfac1fa 100644 --- a/lib/weather/icons.js +++ b/lib/weather/icons.js @@ -36,7 +36,7 @@ const DAY = { blizzard: ['windysnowcloud', 'icon-snowy'], fog: ['basenone', 'icon-mist'], cold: ['basecloud', 'icon-frosty'], - hot: ['basenone', 'icon-sun'], + hot: ['basenone', 'icon-sun'] }; const NIGHT = { @@ -69,7 +69,7 @@ const NIGHT = { blizzard: ['windysnowcloud', 'icon-snowy icon-night'], fog: ['basenone', 'icon-mist icon-night'], - cold: ['basecloud', 'icon-frosty icon-night'], + cold: ['basecloud', 'icon-frosty icon-night'] }; const ICONS = { DAY, NIGHT }; diff --git a/lib/weather/noaa.js b/lib/weather/noaa.js index cc655741..646e3680 100644 --- a/lib/weather/noaa.js +++ b/lib/weather/noaa.js @@ -6,20 +6,12 @@ module.exports = fetch; const userAgent = 'Mozilla/5.0 (compatible; Liftie/1.0; +https://liftie.info)'; -const { - LIFTIE_STATIC_HOST: staticHost = '' -} = process.env; +const { LIFTIE_STATIC_HOST: staticHost = '' } = process.env; function normalize(data, ll) { debug('weather %j', data.properties.periods); - const { - endTime, - temperature, - icon, - shortForecast, - detailedForecast - } = data.properties.periods[0]; + const { endTime, temperature, icon, shortForecast, detailedForecast } = data.properties.periods[0]; return { date: endTime.slice(0, 10), @@ -39,7 +31,7 @@ function normalize(data, ll) { } function fetch(resort, fn) { - debug("fetch weather from NOAA for %s", resort.id); + debug('fetch weather from NOAA for %s', resort.id); const { ll } = resort; @@ -47,11 +39,7 @@ function fetch(resort, fn) { return process.nextTick(fn); } const url = `https://api.weather.gov/gridpoints/${resort.noaa}/forecast`; - superagent(url) - .redirects(0) - .accept('application/geo+json') - .set('User-Agent', userAgent) - .then(onData, onError); + superagent(url).redirects(0).accept('application/geo+json').set('User-Agent', userAgent).then(onData, onError); function onError(err) { debug('NOAA API error', err); diff --git a/lib/weather/openweather.js b/lib/weather/openweather.js index db009b54..21bd355b 100644 --- a/lib/weather/openweather.js +++ b/lib/weather/openweather.js @@ -22,7 +22,6 @@ function snowInInches(snow) { return Math.round(snow); } - const PERIODS = { d: 'day', n: 'night' @@ -35,10 +34,10 @@ const KEYS = { '03': 'sct', // scattered clouds '04': 'bkn', // broken clouds '09': 'rain_showers', // shower rain - '10': 'rain', // rain - '11': 'tsra', // thunderstorm - '13': 'snow', // snow - '50': 'fog', // mist + 10: 'rain', // rain + 11: 'tsra', // thunderstorm + 13: 'snow', // snow + 50: 'fog' // mist }; function icons(code) { @@ -76,7 +75,7 @@ function sanitize({ city, list }) { } function fetch(resort, appid, fn) { - limit((err) => { + limit(err => { if (err) { debug('Weather API limit %s', resort.id); return fn(err); diff --git a/lib/webcams.js b/lib/webcams.js index 6523fc62..1f986347 100644 --- a/lib/webcams.js +++ b/lib/webcams.js @@ -8,7 +8,7 @@ const userAgent = 'Mozilla/5.0 (compatible; Liftie/1.0; +https://liftie.info)'; module.exports = fetch; module.exports.interval = { - active: 8.5 * minute, // v3 API images are only valid for 10 minutes + active: 8.5 * minute, // v3 API images are only valid for 10 minutes inactive: Number.POSITIVE_INFINITY }; @@ -18,7 +18,6 @@ const notice = `Webcams provided by add a webcam `; - function convert({ title, images, urls }) { const name = title.replace(/'/g, '''); return { @@ -29,7 +28,6 @@ function convert({ title, images, urls }) { }; } - function getStatic({ webcams }) { if (webcams?.length) { return webcams; @@ -37,20 +35,22 @@ function getStatic({ webcams }) { } function fetch(resort, fn) { - debug("Fetching webcams for %s", resort.id); + debug('Fetching webcams for %s', resort.id); const { WEBCAMS_API_KEY } = process.env; if (!resort.ll || !WEBCAMS_API_KEY) { debug('API key not defined', resort.ll, process.env); return process.nextTick(fn, null, getStatic(resort)); } - limit((err) => { + limit(err => { if (err) { debug('webcams API limit %s', resort.id); return fn(err); } - debug("fetch webcams from Windy for %s", resort.id); + debug('fetch webcams from Windy for %s', resort.id); - const { ll: [lon, lat] } = resort; + const { + ll: [lon, lat] + } = resort; const url = new URL('https://api.windy.com/webcams/api/v3/webcams'); const { searchParams: sp } = url; sp.set('limit', 5); @@ -59,7 +59,7 @@ function fetch(resort, fn) { superagent(url) .set('User-Agent', userAgent) .accept('application/json') - .set("x-windy-api-key", WEBCAMS_API_KEY) + .set('x-windy-api-key', WEBCAMS_API_KEY) .then(onData, onError); function onError(err) { diff --git a/meta/descriptor-update/split.js b/meta/descriptor-update/split.js index f4b873b0..6013ff00 100644 --- a/meta/descriptor-update/split.js +++ b/meta/descriptor-update/split.js @@ -35,7 +35,6 @@ function update(name) { writeFile(path.join(dir, 'index.js'), js); } - const dir = path.resolve(__dirname, prefix); readdir(dir) diff --git a/templates/index.js b/templates/index.js index addbbedd..34a3daac 100644 --- a/templates/index.js +++ b/templates/index.js @@ -3,7 +3,8 @@ module.exports = { parse: { filter: node => node.children, // if present skips nodes for which filter is falsy name: '0/1', // example of a simple path descriptor - index, ',', '..', '+', '-' are supported. Here 0/1 just means "use the second child of the first child." - status: { // example of a compound descriptor child. attribute, regex, fn - can be specified + status: { + // example of a compound descriptor child. attribute, regex, fn - can be specified child: '+/1', attribute: 'alt', regex: /-([a-z]+)$/, diff --git a/templates/test.js b/templates/test.js index e4f275ad..a9e7d704 100644 --- a/templates/test.js +++ b/templates/test.js @@ -1,5 +1,5 @@ const lifts = require('../lifts'); lifts('${ id }', 'html', { - 'lift 1': 'open', + 'lift 1': 'open' }); diff --git a/test/checker.js b/test/checker.js index 2350a0db..3b8f02e2 100644 --- a/test/checker.js +++ b/test/checker.js @@ -4,7 +4,7 @@ const check = require('../lib/checker'); test('stats should return valid names when requested not specified', () => { const valid = ['a', 'b', 'c']; - valid.forEach((v) => { + valid.forEach(v => { valid[v] = true; }); assert.deepEqual(check(null, valid, valid), valid); @@ -12,7 +12,7 @@ test('stats should return valid names when requested not specified', () => { test('stats should filter out invalid names', () => { const valid = ['a', 'b', 'c']; - valid.forEach((v) => { + valid.forEach(v => { valid[v] = true; }); assert.deepEqual(check('a', valid), ['a']); @@ -22,7 +22,7 @@ test('stats should filter out invalid names', () => { test('stats should work with Arrays', () => { const valid = ['a', 'b', 'c']; - valid.forEach((v) => { + valid.forEach(v => { valid[v] = true; }); assert.deepEqual(check(['a'], valid), ['a']); diff --git a/test/lifts/index.js b/test/lifts/index.js index 1a62fdeb..7baf1aef 100644 --- a/test/lifts/index.js +++ b/test/lifts/index.js @@ -8,26 +8,24 @@ const makeParse = require('../../lib/lifts/parse'); module.exports = testResort; function testResort(name, ext, expected, opts = {}) { - const filename = `${__dirname}/../resorts/example/${name}.${ext}`; const parse = makeParse(name); - function testHTML(_t, done) { const stream = createReadStream(filename); stream.on('error', done); - stream.pipe(parser(parse, (err, status) => { - assert.ifError(err); - assert.deepEqual(status, expected, `lifts should match for ${name}, received: ${JSON.stringify(status)}`); - done(); - })); + stream.pipe( + parser(parse, (err, status) => { + assert.ifError(err); + assert.deepEqual(status, expected, `lifts should match for ${name}, received: ${JSON.stringify(status)}`); + done(); + }) + ); } function testJSON(_t, done) { - const asyncParse = parse.isAsync ? - parse : - (data, fn) => process.nextTick(fn, null, parse(data)); + const asyncParse = parse.isAsync ? parse : (data, fn) => process.nextTick(fn, null, parse(data)); const data = require(filename); @@ -37,7 +35,6 @@ function testResort(name, ext, expected, opts = {}) { }); } - const tested = ext === 'json' ? testJSON : testHTML; test(`${name} should return lift status`, opts, tested); } diff --git a/test/lifts/stats.js b/test/lifts/stats.js index 2f8981a4..80e9a10c 100644 --- a/test/lifts/stats.js +++ b/test/lifts/stats.js @@ -19,20 +19,20 @@ test('stats should report 0 for empty', () => { test('stats should count all status', () => { const status = { - 'n1': 'open', - 'n2': 'open', - 'n3': 'closed', - 'n4': 'open', - 'n5': 'open', - 'n6': 'scheduled', - 'n7': 'open', - 'n8': 'closed', - 'n9': 'closed', - 'n11': 'hold', - 'n12': 'hold', - 'n13': 'closed', - 'n14': 'scheduled', - 'n17': 'scheduled' + n1: 'open', + n2: 'open', + n3: 'closed', + n4: 'open', + n5: 'open', + n6: 'scheduled', + n7: 'open', + n8: 'closed', + n9: 'closed', + n11: 'hold', + n12: 'hold', + n13: 'closed', + n14: 'scheduled', + n17: 'scheduled' }; assert.deepEqual(stats(status), { open: 5, @@ -64,34 +64,38 @@ test('stats.summary should calculate summary for empty stats', () => { }); test('stats.summary should calculate summary for array of stats', () => { - assert.deepEqual(stats.summary([{ - open: 5, - closed: 4, - hold: 2, - scheduled: 3 - }, + assert.deepEqual( + stats.summary([ + { + open: 5, + closed: 4, + hold: 2, + scheduled: 3 + }, + { + open: 10, + closed: 1 + }, + null, + {}, + { + open: 1, + closed: 2, + hold: 3, + scheduled: 4 + } + ]), { - open: 10, - closed: 1 - }, - null, - {}, - { - open: 1, - closed: 2, - hold: 3, - scheduled: 4 + open: 16, + closed: 7, + hold: 5, + scheduled: 7, + percentage: { + open: 45.7, + closed: 20, + hold: 14.2, + scheduled: 20 + } } - ]), { - open: 16, - closed: 7, - hold: 5, - scheduled: 7, - percentage: { - open: 45.7, - closed: 20, - hold: 14.2, - scheduled: 20 - } - }); + ); }); diff --git a/test/opening.js b/test/opening.js index 875bff15..12122be8 100644 --- a/test/opening.js +++ b/test/opening.js @@ -4,7 +4,7 @@ const opening = require('../lib/opening'); const day = require('../lib/tools/millis').day; function iso(millis) { - millis -= (new Date().getTimezoneOffset()) * 60 * 1000; + millis -= new Date().getTimezoneOffset() * 60 * 1000; const date = new Date(millis); return date.toISOString().slice(0, 10); } @@ -22,38 +22,50 @@ test('opening should be empty for missing dates', (_t, done) => { }); test('opening should be empty for invalid dates', (_t, done) => { - opening({ - opening: 'abc' - }, (err, od) => { - assert.ok(!od); - done(err); - }); + opening( + { + opening: 'abc' + }, + (err, od) => { + assert.ok(!od); + done(err); + } + ); }); test('opening should be empty for past dates', (_t, done) => { - opening({ - opening: past - }, (err, od) => { - assert.ok(!od); - done(err); - }); + opening( + { + opening: past + }, + (err, od) => { + assert.ok(!od); + done(err); + } + ); }); test('opening should be empty for today', (_t, done) => { - opening({ - opening: today - }, (err, od) => { - assert.ok(!od); - done(err); - }); + opening( + { + opening: today + }, + (err, od) => { + assert.ok(!od); + done(err); + } + ); }); test('opening should be present for future dates', (_t, done) => { - opening({ - opening: future - }, (err, od) => { - assert.ok(od); - assert.equal(od, future); - done(err); - }); + opening( + { + opening: future + }, + (err, od) => { + assert.ok(od); + assert.equal(od, future); + done(err); + } + ); }); diff --git a/test/resorts/3cime.js b/test/resorts/3cime.js index a4239704..6ef72b69 100644 --- a/test/resorts/3cime.js +++ b/test/resorts/3cime.js @@ -33,5 +33,5 @@ lifts('3cime', 'html', { Kameriot: 'closed', Sonnleiten: 'closed', Cenerentola: 'closed', - "Col d'la Tenda": 'closed', + "Col d'la Tenda": 'closed' }); diff --git a/test/resorts/abasin.js b/test/resorts/abasin.js index c696ccae..1ccbbbb0 100644 --- a/test/resorts/abasin.js +++ b/test/resorts/abasin.js @@ -8,6 +8,6 @@ lifts('abasin', 'html', { 'Zuma Lift': 'closed', 'Beavers': 'closed', 'Molly Hogan Lift': 'closed', - 'Molly\'s Magic Carpet': 'closed', + "Molly's Magic Carpet": 'closed', 'Pika Place Carpet': 'closed' }); diff --git a/test/resorts/alpe-lusia-san-pellegrino.js b/test/resorts/alpe-lusia-san-pellegrino.js index 156dd309..476c0843 100644 --- a/test/resorts/alpe-lusia-san-pellegrino.js +++ b/test/resorts/alpe-lusia-san-pellegrino.js @@ -24,5 +24,5 @@ lifts('alpe-lusia-san-pellegrino', 'html', { 'Le Buse - Laresei': 'closed', 'Molino - Le Buse': 'closed', 'Castelir - Fassane': 'closed', - 'Fassane - Morea': 'closed', + 'Fassane - Morea': 'closed' }); diff --git a/test/resorts/alyeska.js b/test/resorts/alyeska.js index 089c8def..6b847b6a 100644 --- a/test/resorts/alyeska.js +++ b/test/resorts/alyeska.js @@ -5,5 +5,5 @@ lifts('alyeska', 'html', { 'Glacier Bowl Express': 'closed', 'Ted’s Express': 'closed', 'Bear Cub Quad': 'closed', - 'Chair 7': 'closed', + 'Chair 7': 'closed' }); diff --git a/test/resorts/arabba.js b/test/resorts/arabba.js index 0891aaa9..96dc2835 100644 --- a/test/resorts/arabba.js +++ b/test/resorts/arabba.js @@ -26,5 +26,5 @@ lifts('arabba', 'html', { 'Banc - Serauta': 'closed', 'Serauta- P.Rocca': 'closed', Padon: 'closed', - 'Campo Scuola': 'closed', + 'Campo Scuola': 'closed' }); diff --git a/test/resorts/aspen-mountain.js b/test/resorts/aspen-mountain.js index 4978c247..8e65c17b 100644 --- a/test/resorts/aspen-mountain.js +++ b/test/resorts/aspen-mountain.js @@ -8,5 +8,5 @@ lifts('aspen-mountain', 'json', { 'Bell Mountain': 'closed', 'F.I.S.': 'closed', 'Ajax Express': 'open', - 'Gent\'s Ridge': 'open' + "Gent's Ridge": 'open' }); diff --git a/test/resorts/berkshire-east.js b/test/resorts/berkshire-east.js index 5e19568d..3d272a88 100644 --- a/test/resorts/berkshire-east.js +++ b/test/resorts/berkshire-east.js @@ -1,9 +1,9 @@ -const lifts = require("../lifts"); +const lifts = require('../lifts'); -lifts("berkshire-east", "html", { - "T-Bar Express Quad": "open", - "Summit Quad": "open", - "Top Notch Double": "open", - "Wilderness Peak Quad": "open", - "Bobcat Magic Carpet": "open", +lifts('berkshire-east', 'html', { + 'T-Bar Express Quad': 'open', + 'Summit Quad': 'open', + 'Top Notch Double': 'open', + 'Wilderness Peak Quad': 'open', + 'Bobcat Magic Carpet': 'open' }); diff --git a/test/resorts/big-white.js b/test/resorts/big-white.js index bb09c4ba..0f9d7884 100644 --- a/test/resorts/big-white.js +++ b/test/resorts/big-white.js @@ -15,5 +15,5 @@ lifts('big-white', 'html', { 'Kids Carpet': 'open', 'Snow Ghost Express 6 Pack': 'scheduled', 'TELUS Park Chair': 'open', - 'Tube Park Lift': "open" + 'Tube Park Lift': 'open' }); diff --git a/test/resorts/blue-mountain-pa.js b/test/resorts/blue-mountain-pa.js index 7577dd31..852e5b53 100644 --- a/test/resorts/blue-mountain-pa.js +++ b/test/resorts/blue-mountain-pa.js @@ -12,5 +12,5 @@ lifts('blue-mountain-pa', 'html', { 'Valley School Triple': 'closed', 'Valley Conveyor Lower': 'closed', 'Valley Conveyor Middle': 'closed', - 'Valley Conveyor Upper': 'closed', + 'Valley Conveyor Upper': 'closed' }); diff --git a/test/resorts/bogusbasin.js b/test/resorts/bogusbasin.js index 580ffc55..792a079b 100644 --- a/test/resorts/bogusbasin.js +++ b/test/resorts/bogusbasin.js @@ -1,14 +1,14 @@ -const lifts = require("../lifts"); +const lifts = require('../lifts'); -lifts("bogusbasin", "html", { - "Deer Point Express": "open", - "Morning Star Express": "open", - "Superior Express": "open", - "Showcase Chair": "closed", - "Bitterroot Chair": "closed", - "Pine Creek Express": "open", - "Coach Chairlift": "open", - "Easy Rider Carpet": "open", - "Discovery Carpet": "open", - "Explorer Carpet": "open", +lifts('bogusbasin', 'html', { + 'Deer Point Express': 'open', + 'Morning Star Express': 'open', + 'Superior Express': 'open', + 'Showcase Chair': 'closed', + 'Bitterroot Chair': 'closed', + 'Pine Creek Express': 'open', + 'Coach Chairlift': 'open', + 'Easy Rider Carpet': 'open', + 'Discovery Carpet': 'open', + 'Explorer Carpet': 'open' }); diff --git a/test/resorts/boreal.js b/test/resorts/boreal.js index 8411f053..64112923 100644 --- a/test/resorts/boreal.js +++ b/test/resorts/boreal.js @@ -1,12 +1,12 @@ const lifts = require('../lifts'); lifts('boreal', 'json', { - '49er Triple Chairlift': 'closed', - 'Accelerator Express Quad Charilift': 'closed', - 'California Cruiser Quad Chairlift': 'closed', - 'Castle Peak Quad Chairlift': 'closed', - 'Cedar Ridge Triple Chairlift': 'closed', - 'Discovery Carpet': 'closed', - 'Lost Dutchman Triple Chairlift': 'closed', - 'Tahoe Tubing Carpet': 'closed' + '49er Triple Chairlift': 'closed', + 'Accelerator Express Quad Charilift': 'closed', + 'California Cruiser Quad Chairlift': 'closed', + 'Castle Peak Quad Chairlift': 'closed', + 'Cedar Ridge Triple Chairlift': 'closed', + 'Discovery Carpet': 'closed', + 'Lost Dutchman Triple Chairlift': 'closed', + 'Tahoe Tubing Carpet': 'closed' }); diff --git a/test/resorts/brettonwoods.js b/test/resorts/brettonwoods.js index 7ea92b96..499a8584 100644 --- a/test/resorts/brettonwoods.js +++ b/test/resorts/brettonwoods.js @@ -5,7 +5,7 @@ lifts('brettonwoods', 'html', { 'Rosebrook Summit Express': 'closed', 'Bethlehem Express': 'closed', 'Telegraph T-Bar': 'closed', - 'Fabyan\'s Express Triple': 'closed', + "Fabyan's Express Triple": 'closed', 'West Mountain Express': 'closed', 'Learning Center Quad': 'closed', 'Wonder Carpet': 'closed', diff --git a/test/resorts/bridger-bowl.js b/test/resorts/bridger-bowl.js index eaddce28..f5e413d8 100644 --- a/test/resorts/bridger-bowl.js +++ b/test/resorts/bridger-bowl.js @@ -3,9 +3,9 @@ const lifts = require('../lifts'); lifts('bridger-bowl', 'json', { 'Alpine': 'open', 'Bridger': 'open', - 'Pierre\'s Knob': 'open', + "Pierre's Knob": 'open', 'Powder Park': 'open', - 'Schlasman\'s': 'open', + "Schlasman's": 'open', 'Snowflake': 'open', 'Sunnyside': 'open', 'Virginia City': 'open', diff --git a/test/resorts/bromley-mountain.js b/test/resorts/bromley-mountain.js index 5a807c62..fdd7e0bd 100644 --- a/test/resorts/bromley-mountain.js +++ b/test/resorts/bromley-mountain.js @@ -8,5 +8,5 @@ lifts('bromley-mountain', 'html', { 'East Meadow Chairlift': 'closed', 'Alpine Chairlift': 'closed', 'Blue Ribbon Quad': 'closed', - 'Lord\'s Prayer T-Bar': 'closed' + "Lord's Prayer T-Bar": 'closed' }); diff --git a/test/resorts/burke-mountain.js b/test/resorts/burke-mountain.js index d7f1ec4f..685f236e 100644 --- a/test/resorts/burke-mountain.js +++ b/test/resorts/burke-mountain.js @@ -1,10 +1,10 @@ const lifts = require('../lifts'); lifts('burke-mountain', 'html', { - "MidBurke Express": "closed", - "Poma": "closed", - "Willoughby Quad": "closed", - "Sherburne Express": "closed", - "JBar": "closed", - "Magic Carpet": "closed" + 'MidBurke Express': 'closed', + 'Poma': 'closed', + 'Willoughby Quad': 'closed', + 'Sherburne Express': 'closed', + 'JBar': 'closed', + 'Magic Carpet': 'closed' }); diff --git a/test/resorts/caberfae-peaks.js b/test/resorts/caberfae-peaks.js index dbdb6d89..61d3ed06 100644 --- a/test/resorts/caberfae-peaks.js +++ b/test/resorts/caberfae-peaks.js @@ -1,7 +1,7 @@ const lifts = require('../lifts'); lifts('caberfae-peaks', 'html', { - 'Vista 1561\' Triple Chairlift': 'open', + "Vista 1561' Triple Chairlift": 'open', 'Shelter Double Chairlift': 'open', 'North Peak Quad Chairlift': 'closed', 'South Peak Triple Chairlift': 'open', diff --git a/test/resorts/campo-felice.js b/test/resorts/campo-felice.js index f83894af..af98ef27 100644 --- a/test/resorts/campo-felice.js +++ b/test/resorts/campo-felice.js @@ -15,5 +15,5 @@ lifts('campo-felice', 'html', { 'Tappeto Innamorati': 'closed', 'Skilift Snow Park': 'closed', 'Tappeto scuola (Snow Tubing)': 'closed', - 'Tappeto Scuola Campo Felice': 'closed', + 'Tappeto Scuola Campo Felice': 'closed' }); diff --git a/test/resorts/canada-olympic-park.js b/test/resorts/canada-olympic-park.js index 386f2438..1b33ef68 100644 --- a/test/resorts/canada-olympic-park.js +++ b/test/resorts/canada-olympic-park.js @@ -6,5 +6,5 @@ lifts('canada-olympic-park', 'html', { 'Progression Carpet': 'open', 'Gold Carpet': 'open', 'Silver Carpet': 'open', - 'Bronze Carpet': 'open', + 'Bronze Carpet': 'open' }); diff --git a/test/resorts/cervino.js b/test/resorts/cervino.js index 4ab10321..6553bd4f 100644 --- a/test/resorts/cervino.js +++ b/test/resorts/cervino.js @@ -17,5 +17,5 @@ lifts('cervino', 'html', { '88 Pass/testa Ii': 'closed', '83 Plateau-rosa': 'closed', '84 Ventina': 'closed', - '85 Matter': 'closed', + '85 Matter': 'closed' }); diff --git a/test/resorts/chamonix.js b/test/resorts/chamonix.js index 3e26946e..49cc0ad6 100644 --- a/test/resorts/chamonix.js +++ b/test/resorts/chamonix.js @@ -20,5 +20,5 @@ lifts('chamonix', 'html', { Planards: 'closed', 'Luge De Chamonix': 'hold', "Parc D'attractions": 'hold', - 'Tc Flegere': 'closed', + 'Tc Flegere': 'closed' }); diff --git a/test/resorts/chinapeak.js b/test/resorts/chinapeak.js index f4b7ef69..b23f1f77 100644 --- a/test/resorts/chinapeak.js +++ b/test/resorts/chinapeak.js @@ -9,5 +9,5 @@ lifts('chinapeak', 'html', { 'Chair 7': 'closed', 'Kids Carpet': 'closed', 'Boulder Carpet': 'closed', - 'Juniper Carpet': 'closed', + 'Juniper Carpet': 'closed' }); diff --git a/test/resorts/civetta.js b/test/resorts/civetta.js index ec0f5519..fe66b59a 100644 --- a/test/resorts/civetta.js +++ b/test/resorts/civetta.js @@ -27,5 +27,5 @@ lifts('civetta', 'html', { 'Rio Canedo': 'closed', 'Santa Fosca': 'closed', 'Pescul-Fedare': 'closed', - 'Fedare-Pescul': 'closed', + 'Fedare-Pescul': 'closed' }); diff --git a/test/resorts/copper.js b/test/resorts/copper.js index fcd95271..ec15c225 100644 --- a/test/resorts/copper.js +++ b/test/resorts/copper.js @@ -1,27 +1,27 @@ const lifts = require('../lifts'); lifts('copper', 'json', { - 'American Eagle': 'open', - 'American Flyer': 'closed', - 'Black Jack': 'closed', - 'Celebrity Ridge': 'closed', - 'Easy Rider': 'open', - 'Kokomo Express': 'closed', - 'Mountain Chief': 'closed', - 'Slingshot/Glide': 'closed', - 'Stinger Too': 'closed', - 'Storm King': 'open', - 'Super Bee': 'closed', - 'Three Bears': 'closed', - 'Timberline Express': 'closed', - 'Woodward Express': 'closed', - Alpine: 'closed', - Excelerator: 'open', - Gem: 'open', - Lumberjack: 'closed', - Pitchfork: 'open', - Rendezvous: 'closed', - Resolution: 'closed', - Rugrat: 'closed', - Sierra: 'closed' + 'American Eagle': 'open', + 'American Flyer': 'closed', + 'Black Jack': 'closed', + 'Celebrity Ridge': 'closed', + 'Easy Rider': 'open', + 'Kokomo Express': 'closed', + 'Mountain Chief': 'closed', + 'Slingshot/Glide': 'closed', + 'Stinger Too': 'closed', + 'Storm King': 'open', + 'Super Bee': 'closed', + 'Three Bears': 'closed', + 'Timberline Express': 'closed', + 'Woodward Express': 'closed', + Alpine: 'closed', + Excelerator: 'open', + Gem: 'open', + Lumberjack: 'closed', + Pitchfork: 'open', + Rendezvous: 'closed', + Resolution: 'closed', + Rugrat: 'closed', + Sierra: 'closed' }); diff --git a/test/resorts/cortina-d-ampezzo.js b/test/resorts/cortina-d-ampezzo.js index 0a968c47..c80e58c7 100644 --- a/test/resorts/cortina-d-ampezzo.js +++ b/test/resorts/cortina-d-ampezzo.js @@ -36,5 +36,5 @@ lifts('cortina-d-ampezzo', 'html', { Loita: 'closed', Donariè: 'closed', Tambres: 'closed', - 'San Marco': 'closed', + 'San Marco': 'closed' }); diff --git a/test/resorts/courchevel.js b/test/resorts/courchevel.js index 02043fcb..5f7b4731 100644 --- a/test/resorts/courchevel.js +++ b/test/resorts/courchevel.js @@ -56,5 +56,5 @@ lifts('courchevel', 'html', { Mickey: 'scheduled', 'Petit Moriond': 'scheduled', Mine: 'scheduled', - Sheriff: 'scheduled', + Sheriff: 'scheduled' }); diff --git a/test/resorts/cranmore-mountain.js b/test/resorts/cranmore-mountain.js index 6574bae4..dba3422a 100644 --- a/test/resorts/cranmore-mountain.js +++ b/test/resorts/cranmore-mountain.js @@ -1,15 +1,15 @@ -const lifts = require("../lifts"); +const lifts = require('../lifts'); -lifts("cranmore-mountain", "html", { - "C-More Double": "open", - "Flying Carpet": "closed", - "Lookout Triple": "closed", - "Magic Carpet": "open", - "Schneider Triple": "closed", - "Skimobile Express": "open", - "South Quad": "open", - "Giant Swing": "open", - "Mountain Coaster": "open", - "Soaring Eagle": "open", - "Tubing Park": "open", +lifts('cranmore-mountain', 'html', { + 'C-More Double': 'open', + 'Flying Carpet': 'closed', + 'Lookout Triple': 'closed', + 'Magic Carpet': 'open', + 'Schneider Triple': 'closed', + 'Skimobile Express': 'open', + 'South Quad': 'open', + 'Giant Swing': 'open', + 'Mountain Coaster': 'open', + 'Soaring Eagle': 'open', + 'Tubing Park': 'open' }); diff --git a/test/resorts/cransmontana.js b/test/resorts/cransmontana.js index e4508cca..f3a862bc 100644 --- a/test/resorts/cransmontana.js +++ b/test/resorts/cransmontana.js @@ -1,12 +1,12 @@ const lifts = require('../lifts'); lifts('cransmontana', 'xml', { - '1 Crans Cry D\'er': 'open', + "1 Crans Cry D'er": 'open', '4 Chetseron T 1': 'open', - '6 Cry D\'er T2': 'open', + "6 Cry D'er T2": 'open', '9 Merignou': 'open', '22 Montana Sup': 'open', - '22 Montana-c. D\'er': 'open', + "22 Montana-c. D'er": 'open', '24 Verdets': 'open', '27 Pas-du-loup': 'open', '41 Bellalui': 'scheduled', diff --git a/test/resorts/cypress-mountain.js b/test/resorts/cypress-mountain.js index 09f36299..339942d4 100644 --- a/test/resorts/cypress-mountain.js +++ b/test/resorts/cypress-mountain.js @@ -6,5 +6,5 @@ lifts('cypress-mountain', 'html', { 'Raven Ridge': 'open', 'Easy Rider': 'open', 'Sky Chair': 'open', - 'Midway Chair': 'open', + 'Midway Chair': 'open' }); diff --git a/test/resorts/folgaria.js b/test/resorts/folgaria.js index 813e758a..ff0f73cb 100644 --- a/test/resorts/folgaria.js +++ b/test/resorts/folgaria.js @@ -5,7 +5,7 @@ lifts('folgaria', 'html', { 'Baby Coston': 'open', 'Coston - Monte Coston': 'open', 'Tre Sassi - Monte Coston': 'open', - 'Val delle Lanze - Costa d\'Agra': 'open', + "Val delle Lanze - Costa d'Agra": 'open', 'Malga Piovernetta - Monte Pioverna': 'open', 'Malga Piovernetta - Termental': 'open', 'Baby Passo Coe': 'open', diff --git a/test/resorts/folgarida-marilleva.js b/test/resorts/folgarida-marilleva.js index bb4fc99f..c0907bed 100644 --- a/test/resorts/folgarida-marilleva.js +++ b/test/resorts/folgarida-marilleva.js @@ -6,7 +6,7 @@ lifts('folgarida-marilleva', 'html', { 'Casina': 'closed', 'Marilleva 900': 'closed', 'Ometto': 'closed', - 'Albare\'': 'closed', + "Albare'": 'closed', 'Biancaneve': 'closed', 'Marilleva': 'closed', 'Doss della Pesa': 'closed', diff --git a/test/resorts/forni.js b/test/resorts/forni.js index 93f57849..1719a075 100644 --- a/test/resorts/forni.js +++ b/test/resorts/forni.js @@ -8,5 +8,5 @@ lifts('forni', 'html', { '105 Seggiovia Cimacuta - 3 posti': 'closed', '106 Tappeto Davost': 'closed', '107 Sciovia Davost': 'closed', - '108 Tappeto Primi Passi': 'closed', + '108 Tappeto Primi Passi': 'closed' }); diff --git a/test/resorts/jackson-hole.js b/test/resorts/jackson-hole.js index 564b849a..01f50913 100644 --- a/test/resorts/jackson-hole.js +++ b/test/resorts/jackson-hole.js @@ -5,7 +5,7 @@ lifts('jackson-hole', 'json', { 'Apres Vous Quad': 'closed', 'Bridger Gondola': 'closed', 'Casper Quad': 'closed', - 'Eagle\'s Rest Quad': 'closed', + "Eagle's Rest Quad": 'closed', 'Marmot Double': 'closed', 'Moose Creek Quad': 'closed', 'Sublette Quad': 'closed', @@ -13,5 +13,5 @@ lifts('jackson-hole', 'json', { 'Teewinot Quad': 'closed', 'Teton Lift Quad': 'closed', 'Thunder Quad': 'closed', - 'Union Pass Quad': 'closed', + 'Union Pass Quad': 'closed' }); diff --git a/test/resorts/jiminypeak.js b/test/resorts/jiminypeak.js index e5bd27d4..dfe98f65 100644 --- a/test/resorts/jiminypeak.js +++ b/test/resorts/jiminypeak.js @@ -1,7 +1,7 @@ const lifts = require('../lifts'); lifts('jiminypeak', 'html', { - 'Alex\'s Park Carpet Lift': 'closed', + "Alex's Park Carpet Lift": 'closed', 'Triple Chair': 'closed', 'Grand Slam': 'closed', 'Novice Triple': 'closed', diff --git a/test/resorts/killington.js b/test/resorts/killington.js index 423053fd..c5b46cc6 100644 --- a/test/resorts/killington.js +++ b/test/resorts/killington.js @@ -1,26 +1,26 @@ const lifts = require('../lifts'); lifts('killington', 'json', { - 'Alpine Training Venue Poma': 'closed', - 'Bear Mountain Quad': 'closed', - 'Canyon Quad': 'closed', - 'K-1 Express Gondola': 'scheduled', - 'Learn To Carpet': 'closed', - 'Needles Eye Express Quad': 'closed', - 'North Ridge Quad': 'scheduled', - 'Northbrook Quad': 'closed', - 'Progression Carpet I': 'closed', - 'Progression Carpet II': 'closed', - 'Ramshead Express Quad': 'closed', - 'Skye Peak Express Quad': 'closed', - 'Skyeship Express Gondola Stage I': 'closed', - 'Skyeship Express Gondola Stage II': 'closed', - 'Snowdon Six Express': 'closed', - 'Snowdon Triple': 'closed', - 'Snowshed Double': 'closed', - 'Snowshed Express Quad': 'closed', - 'South Ridge Quad': 'closed', - 'Sunrise Village Triple': 'closed', - 'Superstar Express Quad': 'closed', - 'Tubing Park Tow': 'closed' + 'Alpine Training Venue Poma': 'closed', + 'Bear Mountain Quad': 'closed', + 'Canyon Quad': 'closed', + 'K-1 Express Gondola': 'scheduled', + 'Learn To Carpet': 'closed', + 'Needles Eye Express Quad': 'closed', + 'North Ridge Quad': 'scheduled', + 'Northbrook Quad': 'closed', + 'Progression Carpet I': 'closed', + 'Progression Carpet II': 'closed', + 'Ramshead Express Quad': 'closed', + 'Skye Peak Express Quad': 'closed', + 'Skyeship Express Gondola Stage I': 'closed', + 'Skyeship Express Gondola Stage II': 'closed', + 'Snowdon Six Express': 'closed', + 'Snowdon Triple': 'closed', + 'Snowshed Double': 'closed', + 'Snowshed Express Quad': 'closed', + 'South Ridge Quad': 'closed', + 'Sunrise Village Triple': 'closed', + 'Superstar Express Quad': 'closed', + 'Tubing Park Tow': 'closed' }); diff --git a/test/resorts/kitzbuehel.js b/test/resorts/kitzbuehel.js index 198e0e3f..80891469 100644 --- a/test/resorts/kitzbuehel.js +++ b/test/resorts/kitzbuehel.js @@ -58,5 +58,5 @@ lifts('kitzbuehel', 'html', { 'G10 Panoramabahn II': 'open', 'G11 Sun Kid Resterhöhe': 'closed', 'H1 Bichlalm': 'open', - 'Schneekatze': 'closed', + 'Schneekatze': 'closed' }); diff --git a/test/resorts/lamolina.js b/test/resorts/lamolina.js index 5dc21e33..b6cac8b0 100644 --- a/test/resorts/lamolina.js +++ b/test/resorts/lamolina.js @@ -4,5 +4,5 @@ lifts('lamolina', 'html', { 'CT Johan Cruyff': 'closed', 'TSD Cap de Comella': 'closed', 'TCB Cadí-Moixeró - Part 1': 'closed', - 'TCB Cadí-Moixeró - Part II': 'closed', + 'TCB Cadí-Moixeró - Part II': 'closed' }); diff --git a/test/resorts/laplagne.js b/test/resorts/laplagne.js index c0e3bd34..1c7dfcb9 100644 --- a/test/resorts/laplagne.js +++ b/test/resorts/laplagne.js @@ -74,5 +74,5 @@ lifts('laplagne', 'html', { Gentil: 'closed', Grangette: 'closed', Grenouilles: 'scheduled', - Montalbert: 'scheduled', + Montalbert: 'scheduled' }); diff --git a/test/resorts/lesarcs.js b/test/resorts/lesarcs.js index 4bef3e62..4554feec 100644 --- a/test/resorts/lesarcs.js +++ b/test/resorts/lesarcs.js @@ -53,5 +53,5 @@ lifts('lesarcs', 'html', { Parchey: 'scheduled', '1Er Virages': 'scheduled', Cabri: 'scheduled', - '1Ere Glisse': 'scheduled', + '1Ere Glisse': 'scheduled' }); diff --git a/test/resorts/lesmenuires.js b/test/resorts/lesmenuires.js index 3f1e3535..bec47ef6 100644 --- a/test/resorts/lesmenuires.js +++ b/test/resorts/lesmenuires.js @@ -29,5 +29,5 @@ lifts('lesmenuires', 'html', { Menuires: 'scheduled', 'Jardin Enfants': 'scheduled', Stade: 'scheduled', - Pelvoux: 'scheduled', + Pelvoux: 'scheduled' }); diff --git a/test/resorts/mad-river-glen.js b/test/resorts/mad-river-glen.js index 19a05263..1960ee98 100644 --- a/test/resorts/mad-river-glen.js +++ b/test/resorts/mad-river-glen.js @@ -5,5 +5,5 @@ lifts('mad-river-glen', 'html', { 'Sunnyside Double Chair': 'open', 'Birdland Double Chair': 'closed', 'Practice Slope Chair': 'closed', - 'Callie\'s Corner Handle Tow': 'open' + "Callie's Corner Handle Tow": 'open' }); diff --git a/test/resorts/madonna-di-campiglio.js b/test/resorts/madonna-di-campiglio.js index 530bf331..1acee159 100644 --- a/test/resorts/madonna-di-campiglio.js +++ b/test/resorts/madonna-di-campiglio.js @@ -8,17 +8,17 @@ lifts('madonna-di-campiglio', 'html', { 'Genziana': 'closed', 'Spinale': 'open', 'Spinale 2': 'closed', - 'Nube d\'Argento': 'closed', - 'Nube d\'Oro': 'closed', + "Nube d'Argento": 'closed', + "Nube d'Oro": 'closed', 'Boch': 'closed', - 'Groste\' 1': 'open', - 'Groste\' 2': 'open', - 'Groste\'': 'closed', + "Groste' 1": 'open', + "Groste' 2": 'open', + "Groste'": 'closed', 'Rododendro': 'closed', 'Vagliana': 'closed', '5 Laghi': 'open', 'Miramonti': 'closed', 'Patascoss': 'closed', 'Pancugolo': 'closed', - 'Carlo Magno': 'closed', + 'Carlo Magno': 'closed' }); diff --git a/test/resorts/manning-park.js b/test/resorts/manning-park.js index aac2227e..41d5b40b 100644 --- a/test/resorts/manning-park.js +++ b/test/resorts/manning-park.js @@ -5,5 +5,5 @@ lifts('manning-park', 'html', { 'Blue Chair': 'closed', 'Handle Tow': 'open', 'T-Bar': 'closed', - 'Polar Coaster Tube Park': 'closed', + 'Polar Coaster Tube Park': 'closed' }); diff --git a/test/resorts/megeve.js b/test/resorts/megeve.js index 12332de4..f050f6c8 100644 --- a/test/resorts/megeve.js +++ b/test/resorts/megeve.js @@ -84,5 +84,5 @@ lifts('megeve', 'html', { 'Tk Debutant': 'open', 'Tk Gouet': 'open', 'Tk Plateau': 'open', - 'Tk Vanay': 'open', + 'Tk Vanay': 'open' }); diff --git a/test/resorts/meribel.js b/test/resorts/meribel.js index e03ddad3..2b1a09b6 100644 --- a/test/resorts/meribel.js +++ b/test/resorts/meribel.js @@ -41,5 +41,5 @@ lifts('meribel', 'html', { Plattières: 'scheduled', Bouquetin: 'scheduled', Chatelet: 'scheduled', - 'Plan Des Mains': 'scheduled', + 'Plan Des Mains': 'scheduled' }); diff --git a/test/resorts/montegenevre.js b/test/resorts/montegenevre.js index 0a7b5215..cfce59d9 100644 --- a/test/resorts/montegenevre.js +++ b/test/resorts/montegenevre.js @@ -1,26 +1,26 @@ const lifts = require('../lifts'); lifts('montegenevre', 'html', { - "SC LA DURANCE": "closed", - "SC L'ALP": "closed", - "SC L'ALPET": "closed", - "SC LE CLOT": "closed", - "SC LE COL": "closed", - "SC LE QUERELAY": "closed", - "SC LES 3 FOURNEOUS": "closed", - "SC OBELISQUE": "closed", - "SG2 LE CHALVET SUP.": "closed", - "SG2 ROCHER ROUGE": "closed", - "SG4 LA CRETE": "closed", - "SG4 LE BROUSSET": "closed", - "SG4 LE MONTQUITAINE": "closed", - "SG4 LE ROCHER DE L'AIGLE": "closed", - "SG4 LE TREMPLIN": "closed", - "SG4 OBSERVATOIRE": "closed", - "SG4 PRARIAL": "closed", - "SG4* LES GONDRANS": "closed", - "TC6* LE CHALVET": "closed", - "TP LA BUTTE": "closed", - "TX* LES CHALMETTES": "closed", - "TX* SERRE THIBAUD": "closed" + 'SC LA DURANCE': 'closed', + "SC L'ALP": 'closed', + "SC L'ALPET": 'closed', + 'SC LE CLOT': 'closed', + 'SC LE COL': 'closed', + 'SC LE QUERELAY': 'closed', + 'SC LES 3 FOURNEOUS': 'closed', + 'SC OBELISQUE': 'closed', + 'SG2 LE CHALVET SUP.': 'closed', + 'SG2 ROCHER ROUGE': 'closed', + 'SG4 LA CRETE': 'closed', + 'SG4 LE BROUSSET': 'closed', + 'SG4 LE MONTQUITAINE': 'closed', + "SG4 LE ROCHER DE L'AIGLE": 'closed', + 'SG4 LE TREMPLIN': 'closed', + 'SG4 OBSERVATOIRE': 'closed', + 'SG4 PRARIAL': 'closed', + 'SG4* LES GONDRANS': 'closed', + 'TC6* LE CHALVET': 'closed', + 'TP LA BUTTE': 'closed', + 'TX* LES CHALMETTES': 'closed', + 'TX* SERRE THIBAUD': 'closed' }); diff --git a/test/resorts/monterosa.js b/test/resorts/monterosa.js index 2a147c63..e6e83e5b 100644 --- a/test/resorts/monterosa.js +++ b/test/resorts/monterosa.js @@ -24,5 +24,4 @@ lifts('monterosa', 'html', { 'TAPIS ROULANT WOLD': 'closed', 'TAPIS ROULANT PIANALUNGA': 'closed', 'CIMALEGNA-SALATI': 'closed' - }); diff --git a/test/resorts/morzine.js b/test/resorts/morzine.js index 7f51dd39..f7a94341 100644 --- a/test/resorts/morzine.js +++ b/test/resorts/morzine.js @@ -1,86 +1,86 @@ const lifts = require('../lifts'); lifts('morzine', 'html', { - "FIL-NEIGE EBAUDS": "closed", - "TAPIS CHAVANNES": "closed", - "TAPIS PLATAIS": "closed", - "TC CHAVANNES": "closed", - "TC CHERY": "closed", - "TC du Pleney": "closed", - "TD4 CHOUCAS": "closed", - "TD4 INTRETS": "closed", - "TD4 LINDARETS": "closed", - "TD4 MOSSETTES": "closed", - "TD4 ZORE": "closed", - "TD6 BROCHEAUX": "closed", - "TD6 CASES": "closed", - "TD6 CHAUX FLEURIE": "closed", - "TD6 FORNET": "closed", - "TD6 GRANDES COMBES": "closed", - "TD6 LECHERE": "closed", - "TD6 PROCLOU": "closed", - "TD6 PROLAYS": "closed", - "TD6 SERAUSSAIX": "closed", - "TD6 STADE": "closed", - "TELECORDE MOUILLE AU BLE": "closed", - "TK BOULE DE GOMME": "closed", - "TK GRAND CRY": "closed", - "TK MOUILLE AU ROI": "closed", - "TK STADE": "closed", - "TK SUPER CHERY": "closed", - "TK TETE DES CRETS": "closed", - "TK TURCHE": "closed", - "TK VIEUX CHENE": "closed", - "TK des Prés": "closed", - "TK du Bouchet": "closed", - "TK du Mas Verjus": "closed", - "TK du Poireau 1": "closed", - "TK du Poireau 2": "closed", - "TLC ARDENT": "closed", - "TLC SUPER": "closed", - "TPH PRODAINS 3S": "closed", - "TPH Pointe de Nyon": "closed", - "TS CHERY NORD": "closed", - "TS CROIX": "closed", - "TS FOLLIETS DU GOLF": "closed", - "TS GRANDE OURSE": "closed", - "TS Les Têtes": "closed", - "TS PLANEYS": "closed", - "TS POINTE": "closed", - "TS Pointe de Nyon": "closed", - "TS ROSTA": "closed", - "TS d'Atray": "closed", - "TS de Nabor": "closed", - "TS de la Crusaz": "closed", - "TS des Fys": "closed", - "TS des Mouilles": "closed", - "TS des Raverettes": "closed", - "TS du Belvédère": "closed", - "TS du Pré Favre": "closed", - "TS3 CUBORE": "closed", - "TS3 PLATEAU": "closed", - "TS6 TOUR": "closed", - "TSD CHAVANNES EXPRESS": "closed", - "TSD Chamossière": "closed", - "TSD GRAINS D'OR EXPRESS": "closed", - "TSD Les Troncs": "closed", - "TSD NAUCHETS EXPRESS": "closed", - "TSD PERRIERES EXPRESS": "closed", - "TSD RANFOILLY EXPRESS": "closed", - "TSD la Charniaz": "closed", - "TSK ARARE 2": "closed", - "TSK ARARE1": "closed", - "TSK BARMETTES": "closed", - "TSK BARON": "closed", - "TSK CHAPELLE": "closed", - "TSK CHAVANETTE 1": "closed", - "TSK CHAVANETTE 2": "closed", - "TSK DES TRASHERS": "closed", - "TSK DROMONTS 1": "closed", - "TSK DROMONTS 2": "closed", - "TSK ECOLES 1": "closed", - "TSK ECOLES 2": "closed", - "TSK PRODAINS": "closed", - "TSK SURF": "closed", - "Tapis Viking": "closed", + 'FIL-NEIGE EBAUDS': 'closed', + 'TAPIS CHAVANNES': 'closed', + 'TAPIS PLATAIS': 'closed', + 'TC CHAVANNES': 'closed', + 'TC CHERY': 'closed', + 'TC du Pleney': 'closed', + 'TD4 CHOUCAS': 'closed', + 'TD4 INTRETS': 'closed', + 'TD4 LINDARETS': 'closed', + 'TD4 MOSSETTES': 'closed', + 'TD4 ZORE': 'closed', + 'TD6 BROCHEAUX': 'closed', + 'TD6 CASES': 'closed', + 'TD6 CHAUX FLEURIE': 'closed', + 'TD6 FORNET': 'closed', + 'TD6 GRANDES COMBES': 'closed', + 'TD6 LECHERE': 'closed', + 'TD6 PROCLOU': 'closed', + 'TD6 PROLAYS': 'closed', + 'TD6 SERAUSSAIX': 'closed', + 'TD6 STADE': 'closed', + 'TELECORDE MOUILLE AU BLE': 'closed', + 'TK BOULE DE GOMME': 'closed', + 'TK GRAND CRY': 'closed', + 'TK MOUILLE AU ROI': 'closed', + 'TK STADE': 'closed', + 'TK SUPER CHERY': 'closed', + 'TK TETE DES CRETS': 'closed', + 'TK TURCHE': 'closed', + 'TK VIEUX CHENE': 'closed', + 'TK des Prés': 'closed', + 'TK du Bouchet': 'closed', + 'TK du Mas Verjus': 'closed', + 'TK du Poireau 1': 'closed', + 'TK du Poireau 2': 'closed', + 'TLC ARDENT': 'closed', + 'TLC SUPER': 'closed', + 'TPH PRODAINS 3S': 'closed', + 'TPH Pointe de Nyon': 'closed', + 'TS CHERY NORD': 'closed', + 'TS CROIX': 'closed', + 'TS FOLLIETS DU GOLF': 'closed', + 'TS GRANDE OURSE': 'closed', + 'TS Les Têtes': 'closed', + 'TS PLANEYS': 'closed', + 'TS POINTE': 'closed', + 'TS Pointe de Nyon': 'closed', + 'TS ROSTA': 'closed', + "TS d'Atray": 'closed', + 'TS de Nabor': 'closed', + 'TS de la Crusaz': 'closed', + 'TS des Fys': 'closed', + 'TS des Mouilles': 'closed', + 'TS des Raverettes': 'closed', + 'TS du Belvédère': 'closed', + 'TS du Pré Favre': 'closed', + 'TS3 CUBORE': 'closed', + 'TS3 PLATEAU': 'closed', + 'TS6 TOUR': 'closed', + 'TSD CHAVANNES EXPRESS': 'closed', + 'TSD Chamossière': 'closed', + "TSD GRAINS D'OR EXPRESS": 'closed', + 'TSD Les Troncs': 'closed', + 'TSD NAUCHETS EXPRESS': 'closed', + 'TSD PERRIERES EXPRESS': 'closed', + 'TSD RANFOILLY EXPRESS': 'closed', + 'TSD la Charniaz': 'closed', + 'TSK ARARE 2': 'closed', + 'TSK ARARE1': 'closed', + 'TSK BARMETTES': 'closed', + 'TSK BARON': 'closed', + 'TSK CHAPELLE': 'closed', + 'TSK CHAVANETTE 1': 'closed', + 'TSK CHAVANETTE 2': 'closed', + 'TSK DES TRASHERS': 'closed', + 'TSK DROMONTS 1': 'closed', + 'TSK DROMONTS 2': 'closed', + 'TSK ECOLES 1': 'closed', + 'TSK ECOLES 2': 'closed', + 'TSK PRODAINS': 'closed', + 'TSK SURF': 'closed', + 'Tapis Viking': 'closed' }); diff --git a/test/resorts/mt-buller.js b/test/resorts/mt-buller.js index 79ab7c92..530423a5 100644 --- a/test/resorts/mt-buller.js +++ b/test/resorts/mt-buller.js @@ -7,7 +7,7 @@ lifts('mt-buller', 'html', { 'Bourke Street Carpet': 'closed', 'Bull Run': 'closed', 'Canyon Tows': 'closed', - 'Cattleman\'s Carpets': 'closed', + "Cattleman's Carpets": 'closed', 'Federation': 'closed', 'Gliders Carpet': 'closed', 'Grimus': 'closed', diff --git a/test/resorts/mt-hotham.js b/test/resorts/mt-hotham.js index c26ece20..4530668a 100644 --- a/test/resorts/mt-hotham.js +++ b/test/resorts/mt-hotham.js @@ -7,11 +7,11 @@ lifts('mt-hotham', 'json', { 'The Drift': 'closed', 'Gotcha': 'closed', 'Heavenly Valley': 'closed', - 'Keogh\'s': 'closed', + "Keogh's": 'closed', 'Orchard': 'closed', 'Playground': 'closed', 'Road Runner': 'closed', 'Summit': 'closed', 'Summit Trainer': 'closed', - 'Dinner Plain': 'closed', + 'Dinner Plain': 'closed' }); diff --git a/test/resorts/mt-seymour.js b/test/resorts/mt-seymour.js index da4e5c50..5b82953f 100644 --- a/test/resorts/mt-seymour.js +++ b/test/resorts/mt-seymour.js @@ -4,5 +4,5 @@ lifts('mt-seymour', 'html', { 'Lodge Chair': 'open', 'Mystery Peak Express': 'open', 'Brockton Chair': 'open', - 'Goldie Magic Carpet': 'open', + 'Goldie Magic Carpet': 'open' }); diff --git a/test/resorts/mtbachelor.js b/test/resorts/mtbachelor.js index dfe5baee..af6a1646 100644 --- a/test/resorts/mtbachelor.js +++ b/test/resorts/mtbachelor.js @@ -1,21 +1,21 @@ const lifts = require('../lifts'); lifts('mtbachelor', 'json', { - 'Chipmunk Carpet': 'closed', - 'Early Riser': 'closed', - 'First Rays': 'closed', - 'Lava Tube': 'closed', - 'Little Pine (Summer)': 'closed', - 'Little Pine (Winter) ': 'closed', - 'Pine Marten (Summer)': 'closed', - 'Pine Marten (Winter)': 'closed', - 'Red Chair': 'closed', - 'Skyliner Express': 'closed', - Alpenglow: 'closed', - Cloudchaser: 'closed', - Northwest: 'closed', - Outback: 'closed', - Rainbow: 'closed', - Summit: 'closed', - Sunrise: 'closed' + 'Chipmunk Carpet': 'closed', + 'Early Riser': 'closed', + 'First Rays': 'closed', + 'Lava Tube': 'closed', + 'Little Pine (Summer)': 'closed', + 'Little Pine (Winter) ': 'closed', + 'Pine Marten (Summer)': 'closed', + 'Pine Marten (Winter)': 'closed', + 'Red Chair': 'closed', + 'Skyliner Express': 'closed', + Alpenglow: 'closed', + Cloudchaser: 'closed', + Northwest: 'closed', + Outback: 'closed', + Rainbow: 'closed', + Summit: 'closed', + Sunrise: 'closed' }); diff --git a/test/resorts/mtbrighton.js b/test/resorts/mtbrighton.js index 87240579..5e26fd54 100644 --- a/test/resorts/mtbrighton.js +++ b/test/resorts/mtbrighton.js @@ -25,5 +25,5 @@ lifts('mtbrighton', 'html', { 'Sunrise Bowl': 'closed', 'Ledges': 'closed', 'Gopher': 'closed', - 'Riglet Park': 'closed', + 'Riglet Park': 'closed' }); diff --git a/test/resorts/ovindoli.js b/test/resorts/ovindoli.js index 6848d92d..721f8140 100644 --- a/test/resorts/ovindoli.js +++ b/test/resorts/ovindoli.js @@ -11,5 +11,5 @@ lifts('ovindoli', 'html', { 'M - Fonte Fredda - Monte Freddo': 'closed', 'H - Campetto degli Alpini - Monte Freddo': 'closed', 'I - Kids': 'closed', - 'L - Belvedere': 'closed', + 'L - Belvedere': 'closed' }); diff --git a/test/resorts/paganella.js b/test/resorts/paganella.js index 1480c672..db6a8794 100644 --- a/test/resorts/paganella.js +++ b/test/resorts/paganella.js @@ -19,5 +19,5 @@ lifts('paganella', 'html', { 'Tapis R. Rolly Marchi': 'closed', 'Tapis R. Primi Passi Rindole': 'closed', 'Tapis R. Snowpark Dosson': 'closed', - 'Tapis R. Primi Passi Pingu': 'closed', + 'Tapis R. Primi Passi Pingu': 'closed' }); diff --git a/test/resorts/palisades.js b/test/resorts/palisades.js index bf949b75..3caaa164 100644 --- a/test/resorts/palisades.js +++ b/test/resorts/palisades.js @@ -13,7 +13,7 @@ lifts('palisades', 'json', { 'Resort Chair': 'closed', 'SnoVentures Carpet': 'closed', 'Wa She Shu': 'closed', - 'Bailey\'s Beach': 'closed', + "Bailey's Beach": 'closed', 'Belmont': 'closed', 'Big Blue Express': 'closed', 'Broken Arrow': 'closed', @@ -29,5 +29,5 @@ lifts('palisades', 'json', { 'The Pulley': 'closed', 'Boomer': 'closed', 'Shaka': 'closed', - 'Wylee': 'closed', + 'Wylee': 'closed' }); diff --git a/test/resorts/parkcity.js b/test/resorts/parkcity.js index 255f0073..a040b7b2 100644 --- a/test/resorts/parkcity.js +++ b/test/resorts/parkcity.js @@ -17,7 +17,7 @@ lifts('parkcity', 'html', { 'Iron Mtn. Express': 'closed', 'Jupiter Lift': 'hold', 'King Con Lift': 'closed', - 'McConkey\'s Lift': 'hold', + "McConkey's Lift": 'hold', 'Mine Cart': 'closed', 'Motherlode Lift': 'closed', 'Mule Train': 'closed', diff --git a/test/resorts/perisher.js b/test/resorts/perisher.js index 2062bbda..d4ad0572 100644 --- a/test/resorts/perisher.js +++ b/test/resorts/perisher.js @@ -34,8 +34,8 @@ lifts('perisher', 'html', { 'Hume T-Bar': 'closed', 'Captain Cook J-Bar': 'closed', 'Scott J-Bar': 'closed', - 'Zoe\'s Ski Carpet': 'closed', - 'Harry\'s & Herman\'s Ski Carpet': 'closed', + "Zoe's Ski Carpet": 'closed', + "Harry's & Herman's Ski Carpet": 'closed', 'Ridge Quad Chair': 'closed', 'Summit Quad Chair*': 'closed', 'Pony Ride Carpet': 'closed', diff --git a/test/resorts/piancavallo.js b/test/resorts/piancavallo.js index e17d8528..fe1c1140 100644 --- a/test/resorts/piancavallo.js +++ b/test/resorts/piancavallo.js @@ -12,5 +12,5 @@ lifts('piancavallo', 'html', { '109 Tappeto Caprioli': 'closed', '110 Tappeto Bambi': 'closed', '111 Tappeto Busa': 'closed', - '112 Tappeto Tremol': 'closed', + '112 Tappeto Tremol': 'closed' }); diff --git a/test/resorts/pico.js b/test/resorts/pico.js index 965e04a1..b1d3442a 100644 --- a/test/resorts/pico.js +++ b/test/resorts/pico.js @@ -1,11 +1,11 @@ const lifts = require('../lifts'); lifts('pico', 'json', { - 'Bonanza Double': 'closed', - 'Bonanza Rope Tow': 'closed', - 'Golden Express Quad': 'closed', - 'Knomes Knoll Triple': 'closed', - 'Little Pico Triple': 'closed', - 'Outpost Double': 'closed', - 'Summit Express Quad': 'closed' + 'Bonanza Double': 'closed', + 'Bonanza Rope Tow': 'closed', + 'Golden Express Quad': 'closed', + 'Knomes Knoll Triple': 'closed', + 'Little Pico Triple': 'closed', + 'Outpost Double': 'closed', + 'Summit Express Quad': 'closed' }); diff --git a/test/resorts/pinzolo.js b/test/resorts/pinzolo.js index 43f4f1a3..f3e4537c 100644 --- a/test/resorts/pinzolo.js +++ b/test/resorts/pinzolo.js @@ -3,7 +3,7 @@ const lifts = require('../lifts'); lifts('pinzolo', 'html', { 'Tulot - Malga Cioca': 'closed', 'Pinzolo - Pra Rodont': 'open', - 'Pra\' Rodont - Doss del Sabion': 'open', + "Pra' Rodont - Doss del Sabion": 'open', 'Tapis Roulant - Fiocco di neve': 'closed', 'Tapis Roulant Biancaneve': 'closed', 'Fossadei - Malga Cioca': 'closed', @@ -11,7 +11,7 @@ lifts('pinzolo', 'html', { 'Grual - Zapel': 'closed', 'Malga Grual - Doss del Sabion': 'closed', 'Grual - Monte Grual': 'closed', - 'Puza dai Fo\' - Monte Grual': 'closed', + "Puza dai Fo' - Monte Grual": 'closed', 'Pinzolo Campiglio express I Puza dai Fo-Plaza': 'closed', 'Pinzolo Campiglio express II Plaza-Colarin': 'open', 'Pinzolo Campiglio express III Colarin-Patascoss': 'open' diff --git a/test/resorts/plan-de-corones.js b/test/resorts/plan-de-corones.js index 422e0a6e..53744ff8 100644 --- a/test/resorts/plan-de-corones.js +++ b/test/resorts/plan-de-corones.js @@ -34,5 +34,5 @@ lifts('plan-de-corones', 'html', { 'Sompunt/Sponata-Piculin': 'closed', 'Piculin-Sponata/Sompunt': 'closed', 'Pichl Gsies': 'closed', - 'Treno Versciaco - Perca': 'closed', + 'Treno Versciaco - Perca': 'closed' }); diff --git a/test/resorts/pontedilegno-tonale.js b/test/resorts/pontedilegno-tonale.js index dd8cce45..a6b62ae5 100644 --- a/test/resorts/pontedilegno-tonale.js +++ b/test/resorts/pontedilegno-tonale.js @@ -3,7 +3,7 @@ const lifts = require('../lifts'); lifts('pontedilegno-tonale', 'html', { 'Casola': 'closed', 'Valbione': 'closed', - 'Corno d\'Aola': 'closed', + "Corno d'Aola": 'closed', 'Angelo': 'closed', 'Campo Scuola Cida': 'closed', 'Sozzine': 'closed', diff --git a/test/resorts/ravascletto-zoncolan.js b/test/resorts/ravascletto-zoncolan.js index c3a51c9e..8127a1ca 100644 --- a/test/resorts/ravascletto-zoncolan.js +++ b/test/resorts/ravascletto-zoncolan.js @@ -13,5 +13,5 @@ lifts('ravascletto-zoncolan', 'html', { '110 Tappeto Cima Zoncolan': 'closed', '111 Tappeti Madessa (1,2,3)': 'closed', 'Pradibosco|Skilift': 'closed', - 'Pradibosco|Tappeto': 'closed', + 'Pradibosco|Tappeto': 'closed' }); diff --git a/test/resorts/rio-pusteria-bressanone.js b/test/resorts/rio-pusteria-bressanone.js index 2e15ec81..268fcb3a 100644 --- a/test/resorts/rio-pusteria-bressanone.js +++ b/test/resorts/rio-pusteria-bressanone.js @@ -25,5 +25,5 @@ lifts('rio-pusteria-bressanone', 'html', { Plose: 'closed', Maders: 'closed', Lüsen: 'closed', - Filler: 'closed', + Filler: 'closed' }); diff --git a/test/resorts/roccaraso.js b/test/resorts/roccaraso.js index 746074fd..1748206e 100644 --- a/test/resorts/roccaraso.js +++ b/test/resorts/roccaraso.js @@ -22,5 +22,5 @@ lifts('roccaraso', 'html', { Pizzalto: 'closed', 'Paradiso 1 e 2': 'closed', 'Gravare-ToppeTes': 'closed', - 'Pizzalto-Gravare': 'closed', + 'Pizzalto-Gravare': 'closed' }); diff --git a/test/resorts/san-martino-di-castrozza-passo-rolle.js b/test/resorts/san-martino-di-castrozza-passo-rolle.js index 979542bc..77cab31d 100644 --- a/test/resorts/san-martino-di-castrozza-passo-rolle.js +++ b/test/resorts/san-martino-di-castrozza-passo-rolle.js @@ -22,5 +22,5 @@ lifts('san-martino-di-castrozza-passo-rolle', 'html', { Colverde: 'closed', Rosetta: 'closed', 'Prà delle Nasse 1': 'closed', - 'Prà delle Nasse 2': 'closed', + 'Prà delle Nasse 2': 'closed' }); diff --git a/test/resorts/sappada.js b/test/resorts/sappada.js index 46889164..d3bbbe81 100644 --- a/test/resorts/sappada.js +++ b/test/resorts/sappada.js @@ -8,5 +8,5 @@ lifts('sappada', 'html', { '105 Seggiovia Pian dei Nidi - 2 posti': 'closed', '106 Seggiovia Eiben Col dei Mughi - 2 posti': 'closed', '107 Sciovia Campetto 1': 'closed', - '108 Sciovia Campetto 2': 'closed', + '108 Sciovia Campetto 2': 'closed' }); diff --git a/test/resorts/sasquatch-mountain.js b/test/resorts/sasquatch-mountain.js index e247e78c..30b9fd98 100644 --- a/test/resorts/sasquatch-mountain.js +++ b/test/resorts/sasquatch-mountain.js @@ -4,5 +4,5 @@ lifts('sasquatch-mountain', 'xml', { 'A- Yeti Cruiser Quad': 'closed', 'B- Whistlepunk Double': 'open', 'Littlefoot Carpet Lift': 'open', - 'D- Sasquatch Triple': 'open', + 'D- Sasquatch Triple': 'open' }); diff --git a/test/resorts/sauris.js b/test/resorts/sauris.js index 51565bdc..c0278623 100644 --- a/test/resorts/sauris.js +++ b/test/resorts/sauris.js @@ -4,5 +4,5 @@ lifts('sauris', 'html', { '101 Sciovia Richelan': 'closed', '102 Tappeto Sauris di Sopra': 'closed', '103 Sciovia Sauris di Sotto': 'closed', - '104 Tappeto Sauris di Sotto': 'closed', + '104 Tappeto Sauris di Sotto': 'closed' }); diff --git a/test/resorts/sauze.js b/test/resorts/sauze.js index 461f2519..dbac5ddd 100644 --- a/test/resorts/sauze.js +++ b/test/resorts/sauze.js @@ -1,17 +1,17 @@ const lifts = require('../lifts'); lifts('sauze', 'html', { - "SC BOURGET": "closed", - "SC RIO NERO": "closed", - "SC TUASSIERES": "closed", - "SG2 COLO'": "closed", - "SG3 COTE FAURE": "closed", - "SG3 TRIPLEX": "closed", - "SG4 CHAMONIER": "closed", - "SG4 CLOTES": "closed", - "SG4* JOUV.-SPORTINIA": "closed", - "SG4* LAGO NERO": "closed", - "SG4* ROCCE NERE": "closed", - "SG4* SPORTINIA": "closed", - "TP MINISPORTINIA": "closed" + 'SC BOURGET': 'closed', + 'SC RIO NERO': 'closed', + 'SC TUASSIERES': 'closed', + "SG2 COLO'": 'closed', + 'SG3 COTE FAURE': 'closed', + 'SG3 TRIPLEX': 'closed', + 'SG4 CHAMONIER': 'closed', + 'SG4 CLOTES': 'closed', + 'SG4* JOUV.-SPORTINIA': 'closed', + 'SG4* LAGO NERO': 'closed', + 'SG4* ROCCE NERE': 'closed', + 'SG4* SPORTINIA': 'closed', + 'TP MINISPORTINIA': 'closed' }); diff --git a/test/resorts/sella.js b/test/resorts/sella.js index 03ed495d..5519e347 100644 --- a/test/resorts/sella.js +++ b/test/resorts/sella.js @@ -4,5 +4,5 @@ lifts('sella', 'html', { '101 Telecabina Canin - 16 posti': 'closed', '102 Funifor Prevala - 100 posti': 'closed', '103 Seggiovia Gilberti - 2 posti': 'closed', - '104 Tappeto Campo Scuola': 'closed', + '104 Tappeto Campo Scuola': 'closed' }); diff --git a/test/resorts/sestriere.js b/test/resorts/sestriere.js index 4ebc4955..68108ad9 100644 --- a/test/resorts/sestriere.js +++ b/test/resorts/sestriere.js @@ -1,23 +1,23 @@ const lifts = require('../lifts'); lifts('sestriere', 'html', { - "FV PATTEMOUCHE": "open", - "SC BABY DX": "open", - "SC BABY SX": "open", - "SC COMBETTA": "closed", - "SC LA MOTTA": "closed", - "SC ORSIERA": "open", - "SC SISES": "closed", - "SG4 CAPRET": "closed", - "SG4 GARNEL": "open", - "SG4 NUBE D'ARGENTO": "closed", - "SG4* BANCHETTA": "open", - "SG4* CIT ROC": "open", - "SG4* NUOVA NUBE": "open", - "SG4* TREBIALS": "open", - "TC8* SESTR.- FRAITEVE": "open", - "TP JOLLY SX": "open", - "TP. ANFITEATRO": "open", - "TP. JOLLY DX": "open", - "TP. PRINCIPI": "open", + 'FV PATTEMOUCHE': 'open', + 'SC BABY DX': 'open', + 'SC BABY SX': 'open', + 'SC COMBETTA': 'closed', + 'SC LA MOTTA': 'closed', + 'SC ORSIERA': 'open', + 'SC SISES': 'closed', + 'SG4 CAPRET': 'closed', + 'SG4 GARNEL': 'open', + "SG4 NUBE D'ARGENTO": 'closed', + 'SG4* BANCHETTA': 'open', + 'SG4* CIT ROC': 'open', + 'SG4* NUOVA NUBE': 'open', + 'SG4* TREBIALS': 'open', + 'TC8* SESTR.- FRAITEVE': 'open', + 'TP JOLLY SX': 'open', + 'TP. ANFITEATRO': 'open', + 'TP. JOLLY DX': 'open', + 'TP. PRINCIPI': 'open' }); diff --git a/test/resorts/shawnee-peak.js b/test/resorts/shawnee-peak.js index f02d8364..ae955862 100644 --- a/test/resorts/shawnee-peak.js +++ b/test/resorts/shawnee-peak.js @@ -1,7 +1,7 @@ const lifts = require('../lifts'); lifts('shawnee-peak', 'html', { - 'Li\'l Pine Beginner Carpet': 'closed', + "Li'l Pine Beginner Carpet": 'closed', 'Pine Quad': 'closed', 'Rabbit Run': 'closed', 'Snow Pine Carpet': 'closed', diff --git a/test/resorts/skiwelt.js b/test/resorts/skiwelt.js index 893f1990..b2f2cd59 100644 --- a/test/resorts/skiwelt.js +++ b/test/resorts/skiwelt.js @@ -20,10 +20,10 @@ lifts('skiwelt', 'html', { 'Vetterstätt': 'closed', Kirchbichl: 'closed', Schmiedalm: 'closed', - 'Ellmi\'s Zauberteppich I': 'closed', - 'Ellmi \'s Zauberteppich II': 'closed', + "Ellmi's Zauberteppich I": 'closed', + "Ellmi 's Zauberteppich II": 'closed', Hausberg: 'closed', - 'Ellmi\'s 6er': 'closed', + "Ellmi's 6er": 'closed', Kaiserexpress: 'closed', 'Köglbahn': 'closed', Almbahn: 'closed', diff --git a/test/resorts/smuggs.js b/test/resorts/smuggs.js index 740bef34..f27502b8 100644 --- a/test/resorts/smuggs.js +++ b/test/resorts/smuggs.js @@ -1,12 +1,12 @@ -const lifts = require("../lifts"); +const lifts = require('../lifts'); -lifts("smuggs", "html", { - "Mogul Mouse's Magic Lift": "open", - "Morse Highlands Lift": "open", - "Sir Henry's Glider Lift": "open", - "Village Lift": "open", - "Sterling Lift": "open", - "Sterling T-Bar Lift": "open", - "Madonna I Lift": "open", - "Madonna II Lift": "open", +lifts('smuggs', 'html', { + "Mogul Mouse's Magic Lift": 'open', + 'Morse Highlands Lift': 'open', + "Sir Henry's Glider Lift": 'open', + 'Village Lift': 'open', + 'Sterling Lift': 'open', + 'Sterling T-Bar Lift': 'open', + 'Madonna I Lift': 'open', + 'Madonna II Lift': 'open' }); diff --git a/test/resorts/snowmass.js b/test/resorts/snowmass.js index 6e7efdf3..51008073 100644 --- a/test/resorts/snowmass.js +++ b/test/resorts/snowmass.js @@ -11,7 +11,7 @@ lifts('snowmass', 'json', { 'Elk Camp Gondola': 'open', 'Village Express': 'open', 'Coney Glade': 'closed', - 'Sam\'s Knob': 'open', + "Sam's Knob": 'open', 'Campground': 'closed', 'Big Burn': 'open', 'Sheer Bliss': 'closed', diff --git a/test/resorts/sugarbowl.js b/test/resorts/sugarbowl.js index e851437d..48d76c5f 100644 --- a/test/resorts/sugarbowl.js +++ b/test/resorts/sugarbowl.js @@ -6,7 +6,7 @@ lifts('sugarbowl', 'html', { 'Disney Express': 'scheduled', 'Summit Chair': 'closed', 'Christmas Tree Express': 'scheduled', - 'Crow\'s Peak': 'scheduled', + "Crow's Peak": 'scheduled', 'Jerome Hill Express': 'scheduled', 'Village Tow': 'scheduled', 'White Pine (Beginner)': 'scheduled', diff --git a/test/resorts/sugarbush.js b/test/resorts/sugarbush.js index f0374cdc..6a6c044a 100644 --- a/test/resorts/sugarbush.js +++ b/test/resorts/sugarbush.js @@ -4,7 +4,7 @@ lifts('sugarbush', 'json', { 'Castlerock Double': 'closed', 'Gate House Express Quad': 'closed', 'Green Mountain Express Quad': 'closed', - 'Heaven\'s Gate Triple': 'scheduled', + "Heaven's Gate Triple": 'scheduled', 'Inverness Quad': 'closed', 'North Lynx Triple': 'closed', 'North Ridge Express Quad': 'closed', @@ -13,7 +13,7 @@ lifts('sugarbush', 'json', { 'Summit Quad': 'closed', 'Sunshine Quad': 'closed', 'Super Bravo Express Quad': 'open', - 'Tommy\'s Toy': 'closed', + "Tommy's Toy": 'closed', 'Valley House Quad': 'closed', 'Village Quad': 'closed', 'Welcome Mat': 'closed' diff --git a/test/resorts/sunshine-village.js b/test/resorts/sunshine-village.js index 216d39f4..79974b49 100644 --- a/test/resorts/sunshine-village.js +++ b/test/resorts/sunshine-village.js @@ -3,7 +3,7 @@ const lifts = require('../lifts'); lifts('sunshine-village', 'json', { 'Angel': 'open', 'Wolverine': 'open', - 'Goat\'s Eye': 'open', + "Goat's Eye": 'open', 'Jackrabbit': 'open', 'Teepee Town': 'open', 'Divide': 'open', diff --git a/test/resorts/sunvalley.js b/test/resorts/sunvalley.js index 19e51134..b8c2f015 100644 --- a/test/resorts/sunvalley.js +++ b/test/resorts/sunvalley.js @@ -7,7 +7,7 @@ lifts('sunvalley', 'html', { '#04 Cold Springs': 'closed', '#05 Lookout Express': 'closed', '#07 Greyhawk': 'closed', - '#08 Frenchman\'s': 'closed', + "#08 Frenchman's": 'closed', '#10 Challenger': 'closed', '#11 Lookout': 'closed', '#12 Seattle Ridge': 'closed', diff --git a/test/resorts/tarvisio.js b/test/resorts/tarvisio.js index 9a65eee7..33fab30c 100644 --- a/test/resorts/tarvisio.js +++ b/test/resorts/tarvisio.js @@ -13,5 +13,5 @@ lifts('tarvisio', 'html', { "110 Seggiovia Duca d'Aosta -3 posti": 'closed', '111 Seggiovia Florianca - 4 posti': 'closed', '112 Seggiovia Hütte - 2 posti': 'closed', - '113 Seggiovia Prasnig - 4 posti': 'closed', + '113 Seggiovia Prasnig - 4 posti': 'closed' }); diff --git a/test/resorts/telluride.js b/test/resorts/telluride.js index 0b3ae593..e0d949a3 100644 --- a/test/resorts/telluride.js +++ b/test/resorts/telluride.js @@ -17,5 +17,5 @@ lifts('telluride', 'html', { 'Lynx': 'closed', 'Gold Hill Express': 'closed', 'Revelation Lift': 'closed', - 'North Meadows Carpet': 'closed', + 'North Meadows Carpet': 'closed' }); diff --git a/test/resorts/tignes.js b/test/resorts/tignes.js index d553a4f7..ce8035f4 100644 --- a/test/resorts/tignes.js +++ b/test/resorts/tignes.js @@ -15,5 +15,5 @@ lifts('tignes', 'html', { 'Fil Neige Replat': 'closed', Funiculaire: 'closed', 'Tp De Grande Motte': 'closed', - 'Tsd De La Vanoise': 'closed', + 'Tsd De La Vanoise': 'closed' }); diff --git a/test/resorts/vail.js b/test/resorts/vail.js index b25ab80a..f6d10876 100644 --- a/test/resorts/vail.js +++ b/test/resorts/vail.js @@ -6,7 +6,7 @@ lifts('vail', 'html', { 'Born Free Express #8': 'closed', 'Cascade Village #20': 'closed', 'Eagle Bahn Gondola #19': 'scheduled', - 'Earl\'s Express #38': 'closed', + "Earl's Express #38": 'closed', 'Elvis Bahn #25': 'closed', 'Game Creek Express #7': 'closed', 'Golden Peak T-Bar': 'closed', @@ -22,9 +22,9 @@ lifts('vail', 'html', { 'Northwoods Express #11': 'scheduled', 'Orient Express #21': 'closed', 'Patty Bahn': 'closed', - 'Pete\'s Express #39': 'closed', + "Pete's Express #39": 'closed', 'Pride Express #26': 'closed', - 'Rip\'s Ride Carpet #29': 'closed', + "Rip's Ride Carpet #29": 'closed', 'Riva Bahn Express #6': 'scheduled', 'Skyline Express #37': 'closed', 'Sourdough Express #14': 'closed', diff --git a/test/resorts/val-di-fassa.js b/test/resorts/val-di-fassa.js index 98c15340..ec394e94 100644 --- a/test/resorts/val-di-fassa.js +++ b/test/resorts/val-di-fassa.js @@ -54,5 +54,5 @@ lifts('val-di-fassa', 'html', { 'Pra di Tori': 'closed', 'Le Pope': 'closed', 'Golf II': 'closed', - 'Skibus Vigo di Fassa - Carezza': 'closed', + 'Skibus Vigo di Fassa - Carezza': 'closed' }); diff --git a/test/resorts/val-di-fiemme.js b/test/resorts/val-di-fiemme.js index f85f5bc2..cec7eca0 100644 --- a/test/resorts/val-di-fiemme.js +++ b/test/resorts/val-di-fiemme.js @@ -45,5 +45,5 @@ lifts('val-di-fiemme', 'html', { Obereggen: 'open', Laner: 'open', Deutschnofen: 'closed', - Panorama: 'closed', + Panorama: 'closed' }); diff --git a/test/resorts/val-gardena.js b/test/resorts/val-gardena.js index 466a2296..6b929448 100644 --- a/test/resorts/val-gardena.js +++ b/test/resorts/val-gardena.js @@ -73,7 +73,7 @@ lifts('val-gardena', 'html', { 'Mezdì': 'closed', 'Monte Piz - Rif. Icaro': 'closed', 'Paradiso': 'closed', - 'Punta d\'Oro': 'closed', + "Punta d'Oro": 'closed', 'Sanon': 'closed', 'Seiser Alm Aerial Cableway': 'closed', 'Spitzbuehl': 'closed', diff --git a/test/resorts/valdisere.js b/test/resorts/valdisere.js index 03e9d4c4..27d6a8a1 100644 --- a/test/resorts/valdisere.js +++ b/test/resorts/valdisere.js @@ -38,5 +38,5 @@ lifts('valdisere', 'html', { 'Tk Legettaz': 'closed', 'Tk Savonette': 'closed', 'Tapis Pim Pam': 'closed', - 'Tapis Poum': 'closed', + 'Tapis Poum': 'closed' }); diff --git a/test/resorts/whistler-blackcomb.js b/test/resorts/whistler-blackcomb.js index 8d46dc5c..28bde45b 100644 --- a/test/resorts/whistler-blackcomb.js +++ b/test/resorts/whistler-blackcomb.js @@ -18,7 +18,7 @@ lifts('whistler-blackcomb', 'xml', { 'Creek Side Gondola': 'closed', 'Emerald Express': 'closed', 'Fitzsimmons Express': 'closed', - 'Franz\'s Chair': 'closed', + "Franz's Chair": 'closed', 'Garbanzo Express': 'closed', 'Harmony Express': 'closed', 'Olympic Chair': 'closed', diff --git a/test/resorts/whitefish.js b/test/resorts/whitefish.js index 8abb28d2..9ca0747a 100644 --- a/test/resorts/whitefish.js +++ b/test/resorts/whitefish.js @@ -16,5 +16,5 @@ lifts('whitefish', 'html', { 'T-Bar 1 - Heritage': 'closed', 'T-Bar 2 - Bigfoot': 'closed', 'Big Easy Carpet': 'open', - '2 Easy Carpet': 'closed', + '2 Easy Carpet': 'closed' }); diff --git a/test/routes/sorter.js b/test/routes/sorter.js index 76814c2a..f0f4063a 100644 --- a/test/routes/sorter.js +++ b/test/routes/sorter.js @@ -3,10 +3,10 @@ const assert = require('node:assert/strict'); const sorter = require('../../lib/routes/sorter'); function id2resorts(commaSeparatedIds) { - return commaSeparatedIds.split(',').map((id) => ({ - id, - name: id.toUpperCase() - })); + return commaSeparatedIds.split(',').map(id => ({ + id, + name: id.toUpperCase() + })); } test('sorter should mark all as open if no cookie', () => { @@ -14,7 +14,7 @@ test('sorter should mark all as open if no cookie', () => { resorts = sorter(resorts, {}); - resorts.forEach((r) => { + resorts.forEach(r => { assert.ok(r.open); }); }); @@ -24,7 +24,7 @@ test('sorter should mark none as open if no cookie and at least 5 resorts', () = resorts = sorter(resorts, {}); - resorts.forEach((r) => { + resorts.forEach(r => { assert.ok(!r.open); }); }); @@ -36,7 +36,7 @@ test('sorter should mark none as open if empty cookie', () => { 'resorts-open': '' }); - resorts.forEach((r) => { + resorts.forEach(r => { assert.ok(!r.open); }); }); @@ -48,12 +48,11 @@ test('sorter should mark none as open if cookie has unknown names', () => { 'resorts-open': 'x,y' }); - resorts.forEach((r) => { + resorts.forEach(r => { assert.ok(!r.open); }); }); - test('sorter should mark mark and sort if cookie present', () => { let resorts = id2resorts('a,e,c,d,b'); diff --git a/test/routes/tags.js b/test/routes/tags.js index 679bc59f..529fd0e8 100644 --- a/test/routes/tags.js +++ b/test/routes/tags.js @@ -4,10 +4,10 @@ const tags = require('../../lib/routes/tags'); test('tags should classify object according to tags', () => { const objs = { - 'a': 't3,t2,t1', - 'b': 't2', - 'c': 't1,t2', - 'd': '' + a: 't3,t2,t1', + b: 't2', + c: 't1,t2', + d: '' }; function load(name) { @@ -17,7 +17,7 @@ test('tags should classify object according to tags', () => { }; } - Object.keys(objs).forEach((n) => { + Object.keys(objs).forEach(n => { objs[n] = load(n); }); const tt = tags(objs); @@ -30,8 +30,8 @@ test('tags should classify object according to tags', () => { test('tags should conver names to cannonical form', () => { const objs = { - 'a': 'Nice Tag,Another Tag', - 'b': 'Another Tag' + a: 'Nice Tag,Another Tag', + b: 'Another Tag' }; function load(name) { @@ -41,7 +41,7 @@ test('tags should conver names to cannonical form', () => { }; } - Object.keys(objs).forEach((n) => { + Object.keys(objs).forEach(n => { objs[n] = load(n); }); const tt = tags(objs); diff --git a/test/weather/noaa.js b/test/weather/noaa.js index dce39dda..f365b48e 100644 --- a/test/weather/noaa.js +++ b/test/weather/noaa.js @@ -5,29 +5,35 @@ const noaa = require('../../lib/weather/noaa'); require('../replay'); test('noaa should return empty forecast if location is missing', (_t, done) => { - noaa({ - ll: [0, 0] - }, (err, forecast) => { - assert.ifError(err); - assert.ok(!forecast); - done(); - }); + noaa( + { + ll: [0, 0] + }, + (err, forecast) => { + assert.ifError(err); + assert.ok(!forecast); + done(); + } + ); }); test('noaa should return forecast for valid location', (_t, done) => { - noaa({ - // Killington, VT - noaa: 'BTV/107,21', - ll: [-72.7933, 43.6647] - }, (err, forecast) => { - assert.ifError(err); - assert.ok(forecast); - assert.deepEqual(forecast.icon, ['icon-cloud', 'icon-sunny']); - assert.equal(forecast.date, '2019-01-02'); - assert.equal(forecast.text, 'Partly sunny, with a high near 25. East wind around 3 mph.'); - assert.equal(forecast.conditions, 'Partly Sunny'); - assert.equal(typeof forecast.temperature, 'object'); - assert.equal(forecast.temperature.max, 25); - done(); - }); + noaa( + { + // Killington, VT + noaa: 'BTV/107,21', + ll: [-72.7933, 43.6647] + }, + (err, forecast) => { + assert.ifError(err); + assert.ok(forecast); + assert.deepEqual(forecast.icon, ['icon-cloud', 'icon-sunny']); + assert.equal(forecast.date, '2019-01-02'); + assert.equal(forecast.text, 'Partly sunny, with a high near 25. East wind around 3 mph.'); + assert.equal(forecast.conditions, 'Partly Sunny'); + assert.equal(typeof forecast.temperature, 'object'); + assert.equal(forecast.temperature.max, 25); + done(); + } + ); }); diff --git a/test/weather/openweather.js b/test/weather/openweather.js index b921ab97..1e9cc815 100644 --- a/test/weather/openweather.js +++ b/test/weather/openweather.js @@ -5,26 +5,30 @@ const openweather = require('../../lib/weather/openweather'); require('../replay'); test('openweather should return forecast', (_t, done) => { - openweather({ - // Killington, VT - ll: [-72.7933, 43.6647] - }, 'testkey', (err, forecast) => { - assert.ifError(err); - assert.ok(forecast); - assert.deepEqual(forecast.icon, ['basenone', 'icon-moon']); - assert.equal(forecast.date, '2019-01-05'); - assert.equal(forecast.text, 'clear sky'); - assert.equal(forecast.conditions, 'Clear'); - assert.equal(forecast.snow, 0); - assert.equal(typeof forecast.temperature, 'object'); - assert.equal(forecast.temperature.max, 26); - assert.equal(forecast.temperature.min, 26); - assert.deepEqual(forecast.notice, { - href: 'https://openweathermap.org/city/5234158', - img: 'https://openweathermap.org/themes/openweathermap/assets/vendor/owm/img/logo_OpenWeatherMap_orange.svg', - width: 160, - site: 'openweathermap.org' - }); - done(); - }); + openweather( + { + // Killington, VT + ll: [-72.7933, 43.6647] + }, + 'testkey', + (err, forecast) => { + assert.ifError(err); + assert.ok(forecast); + assert.deepEqual(forecast.icon, ['basenone', 'icon-moon']); + assert.equal(forecast.date, '2019-01-05'); + assert.equal(forecast.text, 'clear sky'); + assert.equal(forecast.conditions, 'Clear'); + assert.equal(forecast.snow, 0); + assert.equal(typeof forecast.temperature, 'object'); + assert.equal(forecast.temperature.max, 26); + assert.equal(forecast.temperature.min, 26); + assert.deepEqual(forecast.notice, { + href: 'https://openweathermap.org/city/5234158', + img: 'https://openweathermap.org/themes/openweathermap/assets/vendor/owm/img/logo_OpenWeatherMap_orange.svg', + width: 160, + site: 'openweathermap.org' + }); + done(); + } + ); }); diff --git a/test/webcams.js b/test/webcams.js index 5be76f3c..9547c39f 100644 --- a/test/webcams.js +++ b/test/webcams.js @@ -17,23 +17,26 @@ test('webcams should return no webcams if location is missing', (_t, done) => { }); test('webcams should return webcams for valid location', (_t, done) => { - webcams({ - counter: 1, - ll: [7.98, 46.54] // from API examples https://windy.com/webcams/1697038975' - }, (err, webcams) => { - delete process.env.WEBCAMS_API_KEY; - - assert.ifError(err); - assert.ok(webcams); - assert.ok(webcams.length > 0); - - const webcam = webcams[0]; - - assert.equal(webcam.name, 'Fieschertal: Jungfraujoch'); - assert.equal(webcam.source, 'https://windy.com/webcams/1697038975'); - assert.match(webcam.image, /^https:\/\/images-webcams.windy.com\//); - assert.match(webcam.notice, /^Webcams provided by\n { + delete process.env.WEBCAMS_API_KEY; + + assert.ifError(err); + assert.ok(webcams); + assert.ok(webcams.length > 0); + + const webcam = webcams[0]; + + assert.equal(webcam.name, 'Fieschertal: Jungfraujoch'); + assert.equal(webcam.source, 'https://windy.com/webcams/1697038975'); + assert.match(webcam.image, /^https:\/\/images-webcams.windy.com\//); + assert.match(webcam.notice, /^Webcams provided by\n