Skip to content

Instantly share code, notes, and snippets.

@twhid
Created June 11, 2015 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twhid/7281eb172347ef0a3447 to your computer and use it in GitHub Desktop.
Save twhid/7281eb172347ef0a3447 to your computer and use it in GitHub Desktop.
One-liner to resolve the directory path of a module using the built-in Node.js algorithm
var moduleDir = require.resolve('module/package').replace('package.json', '');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment