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

require-resolve

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-resolve

Use the node way to resolve required path to absolute path.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
59K
decreased by-30.59%
Maintainers
1
Weekly downloads
 
Created
Source

require-resolve

NPM version Build Status Dependency Status Code Climate Coverage Status

Use the node way to resolve required path to absolute path.

The node way

Install

$ npm install --save require-resolve

Usage

var requireResolve = require('../'),
  path = require('path');

// Resolve a absolute file
console.log(requireResolve(__filename));

// Resolve a relative file
console.log(requireResolve('./example/simple.js', path.dirname(path.dirname(__filename))));


// output:
/*
{
  src: '/Users/{your_name}/Workspace/require-resolve/example/simple.js',
  pkg: {
    name: 'require-resolve',
    version: '0.0.1',
    main: 'src/require-resolve.js',
    root: '/Users/{your_name}/Workspace/require-resolve'
  }
}
*/


// Resolve a node module file
console.log(requireResolve('glup', __filename));
console.log(requireResolve('glup/taskTree', __filename));

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using gulp.

License

Copyright (c) 2015 Zhonglei Qiu. Licensed under the MIT license.

Keywords

FAQs

Package last updated on 21 Mar 2015

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