From 6ec34ff4b681550c63a2cde0dfb50a2a3847429f Mon Sep 17 00:00:00 2001 From: Christian Klaussner Date: Mon, 4 Dec 2017 20:13:40 +0100 Subject: [PATCH] Remove Underscore --- check-npm-versions.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/check-npm-versions.js b/check-npm-versions.js index 3078329..9c91447 100644 --- a/check-npm-versions.js +++ b/check-npm-versions.js @@ -1,5 +1,4 @@ import semver from 'semver'; -import { _ } from 'meteor/underscore'; // Returns: // - true if a version of the package in the range is installed @@ -7,7 +6,7 @@ import { _ } from 'meteor/underscore'; // - version# if incompatible version is installed const compatibleVersionIsInstalled = (name, range) => { try { - const installedVersion = require(`${name}/package.json`).version; + const installedVersion = require(`${name}/package.json`).version; if (semver.satisfies(installedVersion, range)) { return true; } else { @@ -27,19 +26,24 @@ const compatibleVersionIsInstalled = (name, range) => { export const checkNpmVersions = (packages, packageName) => { const failures = {}; - _.forEach(packages, (range, name) => { + + Object.keys(packages).forEach((name) => { + const range = packages[name]; const failure = compatibleVersionIsInstalled(name, range); + if (failure !== true) { failures[name] = failure; } }); - if (_.keys(failures).length === 0) { + if (Object.keys(failures).length === 0) { return true; } const errors = []; - _.forEach(failures, (installed, name) => { + + Object.keys(failures).forEach((name) => { + const installed = failures[name]; const requirement = `${name}@${packages[name]}`; if (installed) {