source: trip-planner-front/node_modules/resolve-cwd/readme.md@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1# resolve-cwd [![Build Status](https://travis-ci.org/sindresorhus/resolve-cwd.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-cwd)
2
3> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from the current working directory
4
5
6## Install
7
8```
9$ npm install --save resolve-cwd
10```
11
12
13## Usage
14
15```js
16const resolveCwd = require('resolve-cwd');
17
18console.log(__dirname);
19//=> '/Users/sindresorhus/rainbow'
20
21console.log(process.cwd());
22//=> '/Users/sindresorhus/unicorn'
23
24resolveCwd('./foo');
25//=> '/Users/sindresorhus/unicorn/foo.js'
26```
27
28
29## API
30
31### resolveCwd(moduleId)
32
33Like `require()`, throws when the module can't be found.
34
35### resolveCwd.silent(moduleId)
36
37Returns `null` instead of throwing when the module can't be found.
38
39#### moduleId
40
41Type: `string`
42
43What you would use in `require()`.
44
45
46## Related
47
48- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path
49- [req-from](https://github.com/sindresorhus/req-from) - Require a module from a given path
50- [req-cwd](https://github.com/sindresorhus/req-cwd) - Require a module from the current working directory
51- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point
52- [lazy-req](https://github.com/sindresorhus/lazy-req) - Require modules lazily
53
54
55## License
56
57MIT © [Sindre Sorhus](https://sindresorhus.com)
Note: See TracBrowser for help on using the repository browser.