function(baseDir, importPath) {
    var parts = importPath.split('/');
    var pathname = path.join(baseDir, importPath);

    if (parts[0] === 'node_modules') {
        // Gets all but the first element of array (i.e. node_modules).
        importPath = parts.slice(1).join('/');
    }

    // Returns an array of all parent node_modules directories.
    var dirs = findNodeModules({
        cwd: baseDir,
        relative: false
    });

    _.each(dirs, function(dir) {
        if (fs.existsSync(path.join(dir, importPath))) {
            pathname = path.join(dir, importPath);
            return false; // Exits iteration by returning false.
        }
    });

    return pathname;
}
function(baseDir, importPath) {
    var parts = importPath.split('/');
    var pathname = path.join(baseDir, importPath);

    if (parts[0] === 'node_modules') {
        
        importPath = parts.slice(1).join('/');
    }

    
    var dirs = findNodeModules({
        cwd: baseDir,
        relative: false
    });

    _.each(dirs, function(dir) {
        if (fs.existsSync(path.join(dir, importPath))) {
            pathname = path.join(dir, importPath);
            return false; 
        }
    });

    return pathname;
}
function ( baseDir , importPath ) { var parts = importPath . split ( '/' ) ; var pathname = path . join ( baseDir , importPath ) ; if ( parts [ 0 ] === 'node_modules' ) { // Gets all but the first element of array (i.e. node_modules). importPath = parts . slice ( 1 ) . join ( '/' ) ; } // Returns an array of all parent node_modules directories. var dirs = findNodeModules ( { cwd : baseDir , relative : false } ) ; _ . each ( dirs , function ( dir ) { if ( fs . existsSync ( path . join ( dir , importPath ) ) ) { pathname = path . join ( dir , importPath ) ; return false ; // Exits iteration by returning false. } } ) ; return pathname ; }
Finds the the import path from parent node_modules. @see {@link https://github.com/cheton/browserify-css/pull/21} for further information.
Finds the the import path from parent node_modules .