Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
const express = require("express");
const router = express.Router();
const browserslist = require("browserslist");
const bv = require("browserslist/package.json").version;
const cv = require("caniuse-db/package.json").version;
const caniuse = require("caniuse-db/data.json").agents;
const GA_ID = process.env.GA_ID;
let caniuseRegion;
function getCoverage(data, version) {
const lastVersion = Object.keys(data).sort((a, b) => {
return parseInt(b) - parseInt(a);
})[0];
// If specific version coverage is missing, fall back to "version zero"
return data[version] !== undefined ? data[version] : data[lastVersion];
}
function getRegionCoverage(region, id, version) {
if (!caniuseRegion) {
caniuseRegion = require(`caniuse-db/region-usage-json/${region}.json`);