Big update!Announcing Socket for GitHub 1.0. Learn more
Socket
BlogLoveFAQ
Install
Log in

resolve-cwd

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Issues
File Explorer

Advanced tools

resolve-cwd

Resolve the path of a module like `require.resolve()` but from the current working directory

    3.0.0latest

Version published
Maintainers
1
Weekly downloads
22,724,161
decreased by-3.76%

Weekly downloads

Changelog

Source

Breaking:

  • Require Node.js 8 (#4) b070276
  • Return undefined instead of null when the module can't be found when using resolveCwd.silent() (#4) b070276

Enhancements:

  • Add TypeScript definition (#4) b070276

https://github.com/sindresorhus/resolve-cwd/compare/v2.0.0...v3.0.0

Readme

Source

resolve-cwd Build Status

Resolve the path of a module like require.resolve() but from the current working directory

Install

$ npm install resolve-cwd

Usage

const resolveCwd = require('resolve-cwd'); console.log(__dirname); //=> '/Users/sindresorhus/rainbow' console.log(process.cwd()); //=> '/Users/sindresorhus/unicorn' console.log(resolveCwd('./foo')); //=> '/Users/sindresorhus/unicorn/foo.js'

API

resolveCwd(moduleId)

Like require(), throws when the module can't be found.

resolveCwd.silent(moduleId)

Returns undefined instead of throwing when the module can't be found.

moduleId

Type: string

What you would use in require().

  • resolve-from - Resolve the path of a module from a given path
  • import-from - Import a module from a given path
  • import-cwd - Import a module from the current working directory
  • resolve-pkg - Resolve the path of a package regardless of it having an entry point
  • import-lazy - Import a module lazily
  • resolve-global - Resolve the path of a globally installed module

License

MIT © Sindre Sorhus

Keywords

FAQs

What is resolve-cwd?

Resolve the path of a module like `require.resolve()` but from the current working directory

Is resolve-cwd popular?

The npm package resolve-cwd receives a total of 18,399,793 weekly downloads. As such, resolve-cwd popularity was classified as popular.

Is resolve-cwd well maintained?

We found that resolve-cwd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 30 Apr 2019
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc