return the closest parent or current directory that contains a package.json
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.travis.yml
README.md
index.js
package.json

README.md

Build Status

packageroot

return the closest parent or current directory that contains a package.json

example

var packageroot = require('packageroot');

packageroot('./',function(err,root){
  console.log(root);
  // if im in /root/package/test it would print 
  // /root/package 
});