UNPKG

climb-lookup

Version:

a lookup climbing recursively file like a require.

404 lines (288 loc) 13.9 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <base data-ice="baseUrl" href="../"> <title data-ice="title">Function | API Document</title> <link type="text/css" rel="stylesheet" href="css/style.css"> <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css"> <script src="script/prettify/prettify.js"></script> <script src="script/manual.js"></script> </head> <body class="layout-container" data-ice="rootContainer"> <header> <a href="./">Home</a> <a href="identifiers.html">Reference</a> <a href="source.html">Source</a> <a data-ice="repoURL" href="https://github.com/59naga/climb-lookup.git" class="repo-url-github">Repository</a> <div class="search-box"> <span> <img src="./image/search.png"> <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span> </span> <ul class="search-result"></ul> </div> </header> <nav class="navigation" data-ice="nav"><div> <ul> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getPaths">getPaths</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-lookup">lookup</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-lookupSync">lookupSync</a></span></span></li> </ul> </div> </nav> <div class="content" data-ice="content"><h1 data-ice="title">Function</h1> <div data-ice="summaries"><table class="summary" data-ice="summary"> <thead><tr><td data-ice="title" colspan="3">Static Public Summary</td></tr></thead> <tbody> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="function/index.html#static-function-getPaths">getPaths</a></span></span><span data-ice="signature">(filePath: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>): <span>array</span></span> </p> </div> <div> <div data-ice="description"><p>Get recursively climbing paths.</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="function/index.html#static-function-lookup">lookup</a></span></span><span data-ice="signature">(file: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>, options: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span>, callback: <span>lookedupAbsolutePath</span>)</span> </p> </div> <div> <div data-ice="description"><p>lookup climbing recursively file like a <code>require</code>.</p> </div> </div> </td> <td> </td> </tr> <tr data-ice="target"> <td> <span class="access" data-ice="access">public</span> <span class="override" data-ice="override"></span> </td> <td> <div> <p> <span data-ice="name"><span><a href="function/index.html#static-function-lookupSync">lookupSync</a></span></span><span data-ice="signature">(file: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>, options: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span></span> </p> </div> <div> <div data-ice="description"><p>Synchronous version of lookup</p> </div> </div> </td> <td> </td> </tr> </tbody> </table> </div> <div data-ice="details"><h2 data-ice="title">Static Public </h2> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="static-function-getPaths"> <span class="access" data-ice="access">public</span> <span data-ice="name">getPaths</span><span data-ice="signature">(filePath: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>): <span>array</span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/index.js.html#lineNumber16">source</a></span></span> </span> </h3> <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import {getPaths} from &apos;<span><a href="file/src/index.js.html#lineNumber16">climb-lookup/src/index.js</a></span>&apos;</code></pre></div> <div data-ice="description"><p>Get recursively climbing paths.</p> </div> <div data-ice="properties"><div data-ice="properties"> <h4 data-ice="title">Params:</h4> <table class="params"> <thead> <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> </thead> <tbody> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">filePath</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>base path</p> </td> </tr> </tbody> </table> </div> </div> <div class="return-params" data-ice="returnParams"> <h4>Return:</h4> <table> <tr> <td class="return-type" data-ice="returnType"><span>array</span></td> <td class="return-desc" data-ice="returnDescription"><p>paths - an abosolute file paths from filePath to root</p> </td> </tr> </table> <div data-ice="returnProperties"> </div> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="static-function-lookup"> <span class="access" data-ice="access">public</span> <span data-ice="name">lookup</span><span data-ice="signature">(file: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>, options: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span>, callback: <span>lookedupAbsolutePath</span>)</span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/index.js.html#lineNumber41">source</a></span></span> </span> </h3> <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import {lookup} from &apos;<span><a href="file/src/index.js.html#lineNumber41">climb-lookup/src/index.js</a></span>&apos;</code></pre></div> <div data-ice="description"><p>lookup climbing recursively file like a <code>require</code>.</p> </div> <div data-ice="properties"><div data-ice="properties"> <h4 data-ice="title">Params:</h4> <table class="params"> <thead> <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> </thead> <tbody> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">file</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>lookup file name</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">options</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></td> <td data-ice="appendix"><ul><li>optional</li></ul></td> <td data-ice="description"></td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">options.cwd</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: process.cwd()</li></ul></td> <td data-ice="description"><p>begin path</p> </td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">options.mode</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: null</li></ul></td> <td data-ice="description"><p>pass to fs.accessSync as 2nd argument</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">callback</td> <td data-ice="type"><span>lookedupAbsolutePath</span></td> <td data-ice="appendix"></td> <td data-ice="description"></td> </tr> </tbody> </table> </div> </div> </div> <div class="detail" data-ice="detail"> <h3 data-ice="anchor" id="static-function-lookupSync"> <span class="access" data-ice="access">public</span> <span data-ice="name">lookupSync</span><span data-ice="signature">(file: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>, options: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span></span> <span class="right-info"> <span data-ice="source"><span><a href="file/src/index.js.html#lineNumber79">source</a></span></span> </span> </h3> <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import {lookupSync} from &apos;<span><a href="file/src/index.js.html#lineNumber79">climb-lookup/src/index.js</a></span>&apos;</code></pre></div> <div data-ice="description"><p>Synchronous version of lookup</p> </div> <div data-ice="properties"><div data-ice="properties"> <h4 data-ice="title">Params:</h4> <table class="params"> <thead> <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> </thead> <tbody> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">file</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span></td> <td data-ice="appendix"></td> <td data-ice="description"><p>lookup file name</p> </td> </tr> <tr data-ice="property" data-depth="0"> <td data-ice="name" data-depth="0">options</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></td> <td data-ice="appendix"><ul><li>optional</li></ul></td> <td data-ice="description"></td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">options.cwd</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: process.cwd()</li></ul></td> <td data-ice="description"><p>begin path</p> </td> </tr> <tr data-ice="property" data-depth="1"> <td data-ice="name" data-depth="1">options.mode</td> <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></td> <td data-ice="appendix"><ul><li>optional</li> <li>default: null</li></ul></td> <td data-ice="description"><p>pass to fs.accessSync as 2nd argument</p> </td> </tr> </tbody> </table> </div> </div> <div class="return-params" data-ice="returnParams"> <h4>Return:</h4> <table> <tr> <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span></td> <td class="return-desc" data-ice="returnDescription"><p>lookedupPath - a found absolute file path</p> </td> </tr> </table> <div data-ice="returnProperties"> </div> </div> <div data-ice="throwWrap"> <h4>Throw:</h4> <table> <tbody> <tr class="throw" data-ice="throw"> <td><p data-ice="throwName"><span>*</span></p></td> <td data-ice="throwDesc"><p>if no such paths</p> </td> </tr> </tbody> </table> </div> </div> </div> </div> <footer class="footer"> Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(0.4.5)</span></a> </footer> <script src="script/search_index.js"></script> <script src="script/search.js"></script> <script src="script/pretty-print.js"></script> <script src="script/inherited-summary.js"></script> <script src="script/test-summary.js"></script> <script src="script/inner-link.js"></script> <script src="script/patch-for-local.js"></script> </body> </html>