repl.txt (1275B)
1 2 {{alias}}( path[, options], clbk ) 3 Asynchronously resolves a path by walking parent directories. 4 5 If unable to resolve a path, the function returns `null` as the path result. 6 7 Parameters 8 ---------- 9 path: string 10 Path to resolve. 11 12 options: Object (optional) 13 Options. 14 15 options.dir: string (optional) 16 Base directory from which to search. Default: current working directory. 17 18 clbk: Function 19 Callback to invoke after resolving a path. 20 21 Examples 22 -------- 23 > function onPath( error, path ) { 24 ... if ( error ) { 25 ... console.error( error.message ); 26 ... } else { 27 ... console.log( path ); 28 ... } 29 ... }; 30 > {{alias}}( 'package.json', onPath ); 31 32 33 {{alias}}.sync( path[, options] ) 34 Synchronously resolves a path by walking parent directories. 35 36 Parameters 37 ---------- 38 path: string 39 Path to resolve. 40 41 options: Object (optional) 42 Options. 43 44 options.dir: string (optional) 45 Base directory from which to search. Default: current working directory. 46 47 Returns 48 ------- 49 out: string|null 50 Resolved path. 51 52 Examples 53 -------- 54 > var out = {{alias}}.sync( 'package.json' ); 55 56 See Also 57 -------- 58