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 fs = require("fs");
const path = require("path");
const semver = require("semver");
const flattenDeep = require("lodash/flattenDeep");
const isEqual = require("lodash/isEqual");
const mapValues = require("lodash/mapValues");
const pickBy = require("lodash/pickBy");
const unreleasedLabels = require("../data/unreleased-labels");
const electronToChromiumVersions = require("electron-to-chromium").versions;
const electronToChromiumKeys = Object.keys(
electronToChromiumVersions
).reverse();
const chromiumToElectronMap = electronToChromiumKeys.reduce((all, electron) => {
all[electronToChromiumVersions[electron]] = +electron;
return all;
}, {});
const chromiumToElectronVersions = Object.keys(chromiumToElectronMap);
const findClosestElectronVersion = targetVersion => {
const chromiumVersionsLength = chromiumToElectronVersions.length;
const maxChromium = +chromiumToElectronVersions[chromiumVersionsLength - 1];
if (targetVersion > maxChromium) return null;
const closestChrome = chromiumToElectronVersions.find(
version => targetVersion <= version
);