lib/index.js
function getPrefix(mod) {
  var n = 'node_modules'
  var i = mod.lastIndexOf(n)
  return ~i ? mod.slice(0, i + n.length) : ''
}
function getPrefix(mod) {
  var n = 'node_modules'
  var i = mod.lastIndexOf(n)
  return ~i ? mod.slice(0, i + n.length) : ''
}
function getPrefix ( mod ) { var n = 'node_modules' var i = mod . lastIndexOf ( n ) return ~ i ? mod . slice ( 0 , i + n . length ) : '' }
Returns the path up to the last occurence of `node_modules` or an
empty string if the path does not contain a node_modules dir.
Returns the path up to the last occurence of node_modules or an empty string if the path does not contain a node_modules dir .