This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/resolve-cwd
cranberry ed23347e56 Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
..
node_modules/resolve-from Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
index.js Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
license Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
package.json Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
readme.md Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00

readme.md

resolve-cwd Build Status

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

Install

$ npm install --save resolve-cwd

Usage

const resolveCwd = require('resolve-cwd');

console.log(__dirname);
//=> '/Users/sindresorhus/rainbow'

console.log(process.cwd());
//=> '/Users/sindresorhus/unicorn'

resolveCwd('./foo');
//=> '/Users/sindresorhus/unicorn/foo.js'

API

resolveCwd(moduleId)

Like require(), throws when the module cant be found.

resolveCwd.silent(moduleId)

Returns null instead of throwing when the module cant be found.

moduleId

Type: string

What you would use in require().

  • resolve-from - Resolve the path of a module from a given path
  • req-from - Require a module from a given path
  • req-cwd - Require a module from the current working directory
  • resolve-pkg - Resolve the path of a package regardless of it having an entry point
  • lazy-req - Require modules lazily

License

MIT © Sindre Sorhus