src/npm.js
function getUnsatisfiedDeps(deps, versions, options) {
	const ownDependencies = getOwnDependencies(options);

	return deps.filter(dep => {
		const required = versions[dep];

		if (required && !semver.validRange(required)) {
			throw new MrmError(
				`Invalid npm version: ${required}. Use proper semver range syntax.`
			);
		}

		const installed = getInstalledVersion(dep);

		// Package isn’t installed yet
		if (!installed) {
			return true;
		}

		// Module is installed but not in package.json dependencies
		if (!ownDependencies[dep]) {
			return true;
		}

		// No required version specified
		if (!required) {
			// Install if the pacakge isn’t installed
			return !installed;
		}

		// Install if installed version doesn't satisfy range
		return !semver.satisfies(installed, required);
	});
}
function getUnsatisfiedDeps(deps, versions, options) {
	const ownDependencies = getOwnDependencies(options);

	return deps.filter(dep => {
		const required = versions[dep];

		if (required && !semver.validRange(required)) {
			throw new MrmError(
				`Invalid npm version: ${required}. Use proper semver range syntax.`
			);
		}

		const installed = getInstalledVersion(dep);

		// Package isn’t installed yet
		if (!installed) {
			return true;
		}

		// Module is installed but not in package.json dependencies
		if (!ownDependencies[dep]) {
			return true;
		}

		// No required version specified
		if (!required) {
			// Install if the pacakge isn’t installed
			return !installed;
		}

		// Install if installed version doesn't satisfy range
		return !semver.satisfies(installed, required);
	});
}
function getUnsatisfiedDeps ( deps , versions , options ) { const ownDependencies = getOwnDependencies ( options ) ; return deps . filter ( dep => { const required = versions [ dep ] ; if ( required && ! semver . validRange ( required ) ) { throw new MrmError ( ` ${ required } ` ) ; } const installed = getInstalledVersion ( dep ) ; // Package isn’t installed yet if ( ! installed ) { return true ; } // Module is installed but not in package.json dependencies if ( ! ownDependencies [ dep ] ) { return true ; } // No required version specified if ( ! required ) { // Install if the pacakge isn’t installed return ! installed ; } // Install if installed version doesn't satisfy range return ! semver . satisfies ( installed , required ) ; } ) ; }
Return only not installed dependencies, or dependencies which installed
version doesn't satisfy range.

@param {string[]} deps
@param {object} [versions]
@return {string[]}
Return only not installed dependencies or dependencies which installed version doesn t satisfy range .