Socket
Socket
Sign inDemoInstall

load-from-cwd-or-npm

Package Overview
Dependencies
11
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.4 to 4.0.0-0

23

index.js

@@ -16,4 +16,4 @@ 'use strict';

if (argLen !== 1 && argLen !== 2) {
throw new RangeError(`Expected 1 or 2 arguments (<string>[, <Function>]), but got ${
if (argLen !== 1) {
throw new RangeError(`Expected 1 argument (<string>), but got ${
argLen === 0 ? 'no' : argLen

@@ -39,21 +39,6 @@ } arguments.`);

const modulePkgId = `${moduleId}/package.json`;
const tasks = [];
if (argLen === 2) {
if (typeof args[1] !== 'function') {
throw new TypeError(`Expected a function to compare two package versions, but got ${
inspectWithKind(args[1])
}.`);
}
console.error('The second parameter of `load-from-cwd-or-npm` is deprecated and will be removed in the next major version.');
} else {
tasks.push(resolveSemverFromNpm);
}
tasks.unshift(resolveFromNpm(modulePkgId));
try {
const [packageJsonPathFromNpm, semverPath] = await Promise.all(tasks);
const compareFn = argLen === 2 ? args[1] : require(semverPath).gte;
const [packageJsonPathFromNpm, semverPath] = await Promise.all([resolveFromNpm(modulePkgId), resolveSemverFromNpm]);
const compareFn = require(semverPath).gte;

@@ -60,0 +45,0 @@ if (compareFn((optional(modulePkgId) || {version: '0.0.0-0'}).version, require(packageJsonPathFromNpm).version)) {

4

package.json
{
"name": "load-from-cwd-or-npm",
"version": "3.0.4",
"version": "4.0.0-0",
"description": "Load a module from either CWD or npm CLI directory",

@@ -42,6 +42,4 @@ "repository": "shinnn/load-from-cwd-or-npm",

"eslint": "^5.16.0",
"lodash": "^4.17.11",
"nyc": "^14.1.1",
"nyc-config-common": "^1.0.1",
"osenv": "0.0.2",
"output-file": "^2.0.2",

@@ -48,0 +46,0 @@ "path-key": "^3.1.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc