"use strict"; const syncpipe = require("syncpipe"); const timezoneNames = require("./data/timezone-names"); let inverseMapping = syncpipe(timezoneNames, [ _ => _.map((name, i) => [ name, i ]), _ => new Map(_) ]); module.exports = function lookupTimezoneName(name) { if (inverseMapping.has(name)) { return inverseMapping.get(name); } else { // FIXME: Error type, clearer instructions for end users since this may also happen when our timezone list is outdated throw new Error(`Unknown timezone name`); } };