Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

resolve-from

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resolve-from

Resolve the path of a module like `require.resolve()` but from a given path

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
97M
increased by13.76%
Maintainers
1
Weekly downloads
 
Created

What is resolve-from?

The resolve-from npm package is a module that allows you to resolve the path of a module like require.resolve() but from a given path. It is useful for situations where you need to resolve modules from a different directory than the current file's directory.

What are resolve-from's main functionalities?

Resolve the path of a module from a given path

This feature allows you to resolve the path of a module from a specific directory. You provide the directory as the first argument and the module name as the second argument. It returns the resolved path to the module.

const resolveFrom = require('resolve-from');
const modulePath = resolveFrom('/some/path', 'some-module');

Silently resolve the path of a module or return null

This feature is similar to the first, but it will return null instead of throwing an error if the module cannot be found. This is useful for cases where you want to check for a module's existence without causing an exception.

const resolveFrom = require('resolve-from');
const modulePath = resolveFrom.silent('/some/path', 'non-existent-module');

Other packages similar to resolve-from

Keywords

FAQs

Package last updated on 15 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc