function mapping(map) {
const hash = Object.create(null)
Object.assign(hash, map)
Object.freeze(hash)
for (let key in hash) {
if (typeof hash[key] != "string") throw new Error(hash)
}
function get(id) {
if (id in hash) return hash[id]
throw new Error("Unknown key:", id)
}
get.keys = Object.freeze(Object.keys(hash))
return Object.freeze(get)
}
module.exports = mapping;