{"_id":"escalade","_rev":"3618272","name":"escalade","description":"A tiny (183B to 210B) and fast utility to ascend parent directories","dist-tags":{"latest":"3.2.0"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"time":{"modified":"2024-10-08T07:10:44.000Z","created":"2020-06-19T05:33:38.006Z","3.2.0":"2024-08-29T22:59:36.690Z","3.1.2":"2024-02-05T16:31:59.413Z","3.1.1":"2020-10-13T06:03:44.007Z","3.1.0":"2020-09-14T17:35:53.351Z","3.0.2":"2020-07-14T16:31:24.535Z","3.0.1":"2020-06-21T06:40:01.316Z","3.0.0":"2020-06-20T04:24:29.337Z","2.0.0":"2020-06-20T01:36:48.148Z","1.0.0":"2020-06-19T19:18:40.240Z","0.0.0":"2020-06-19T05:33:38.006Z"},"users":{},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"versions":{"3.2.0":{"name":"escalade","version":"3.2.0","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"A tiny (183B to 210B) and fast utility to ascend parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":[{"import":{"types":"./index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./index.d.ts","default":"./dist/index.js"}},"./dist/index.js"],"./sync":[{"import":{"types":"./sync/index.d.mts","default":"./sync/index.mjs"},"require":{"types":"./sync/index.d.ts","default":"./sync/index.js"}},"./sync/index.js"]},"modes":{"sync":"src/sync.js","default":"src/async.js"},"engines":{"node":">=6"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":["find","parent","parents","directory","search","walk"],"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"_id":"escalade@3.2.0","gitHead":"fa5be167391581849cff04dbc75dc2978744b642","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"shasum":"011a3f69856ba189dffa7dc8fcce99d2a87903e5","size":4483,"noattachment":false,"key":"/escalade/-/escalade-3.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-3.2.0.tgz"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_3.2.0_1724972376536_0.0521928522218551"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-08-29T22:59:36.690Z","publish_time":1724972376690,"_source_registry_name":"default","_cnpm_publish_time":1724972376690},"3.1.2":{"name":"escalade","version":"3.1.2","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"A tiny (183B to 210B) and fast utility to ascend parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":[{"types":"./index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./dist/index.js"],"./sync":[{"types":"./sync/index.d.ts","import":"./sync/index.mjs","require":"./sync/index.js"},"./sync/index.js"]},"modes":{"sync":"src/sync.js","default":"src/async.js"},"engines":{"node":">=6"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":["find","parent","parents","directory","search","walk"],"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"_id":"escalade@3.1.2","gitHead":"35bbaa0e19f12cb9515542a25eba5ee9f3900d6f","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"shasum":"54076e9ab29ea5bf3d8f1ed62acffbb88272df27","size":4347,"noattachment":false,"key":"/escalade/-/escalade-3.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-3.1.2.tgz"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_3.1.2_1707150719202_0.9356232642555491"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-02-05T16:31:59.413Z","publish_time":1707150719413,"_source_registry_name":"default","_cnpm_publish_time":1707150719413},"3.1.1":{"name":"escalade","version":"3.1.1","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"A tiny (183B to 210B) and fast utility to ascend parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":[{"import":"./dist/index.mjs","require":"./dist/index.js"},"./dist/index.js"],"./sync":[{"import":"./sync/index.mjs","require":"./sync/index.js"},"./sync/index.js"]},"modes":{"sync":"src/sync.js","default":"src/async.js"},"engines":{"node":">=6"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":["find","parent","parents","directory","search","walk"],"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"gitHead":"2477005062cdbd8407afc90d3f48f4930354252b","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_id":"escalade@3.1.1","_nodeVersion":"14.10.1","_npmVersion":"6.14.8","dist":{"shasum":"d8cfdc7000965c5a0174b4a82eaa5c0552742e40","size":4312,"noattachment":false,"key":"/escalade/-/escalade-3.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-3.1.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_3.1.1_1602569023852_0.8272593854757944"},"_hasShrinkwrap":false,"publish_time":1602569024007,"_cnpm_publish_time":1602569024007},"3.1.0":{"name":"escalade","version":"3.1.0","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"A tiny (183B to 210B) and fast utility to ascend parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./sync":{"import":"./sync/index.mjs","require":"./sync/index.js"}},"modes":{"sync":"src/sync.js","default":"src/async.js"},"engines":{"node":">=6"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":["find","parent","parents","directory","search","walk"],"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"gitHead":"717487994128bd22bc8bc4318496fadbf5cab746","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_id":"escalade@3.1.0","_nodeVersion":"14.10.0","_npmVersion":"6.14.8","dist":{"shasum":"e8e2d7c7a8b76f6ee64c2181d6b8151441602d4e","size":4296,"noattachment":false,"key":"/escalade/-/escalade-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-3.1.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_3.1.0_1600104953222_0.47528761525994767"},"_hasShrinkwrap":false,"publish_time":1600104953351,"_cnpm_publish_time":1600104953351},"3.0.2":{"name":"escalade","version":"3.0.2","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"A tiny (183B to 210B) and fast utility to ascend parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./sync":{"import":"./sync/index.mjs","require":"./sync/index.js"}},"modes":{"sync":"src/sync.js","default":"src/async.js"},"engines":{"node":">=6"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":["find","parent","parents","directory","search","walk"],"devDependencies":{"bundt":"1.0.1","esm":"3.2.25","uvu":"0.0.11"},"gitHead":"00e5a242da88a09034d7784df686d14f246cd28e","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_id":"escalade@3.0.2","_nodeVersion":"12.18.2","_npmVersion":"6.14.5","dist":{"shasum":"6a580d70edb87880f22b4c91d0d56078df6962c4","size":4093,"noattachment":false,"key":"/escalade/-/escalade-3.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-3.0.2.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_3.0.2_1594744284416_0.41136776208533954"},"_hasShrinkwrap":false,"publish_time":1594744284535,"_cnpm_publish_time":1594744284535},"3.0.1":{"name":"escalade","version":"3.0.1","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"A tiny (183B to 210B) and fast utility to ascend parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./sync":{"import":"./sync/index.mjs","require":"./sync/index.js"}},"modes":{"sync":"src/sync.js","default":"src/async.js"},"engines":{"node":">=6"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":["find","parent","parents","directory","search","walk"],"devDependencies":{"bundt":"1.0.1","esm":"3.2.25","uvu":"0.0.11"},"gitHead":"9a40c76dbb54c4df6eb3468473b3cf6cf3f903de","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_id":"escalade@3.0.1","_nodeVersion":"12.18.1","_npmVersion":"6.14.5","dist":{"shasum":"52568a77443f6927cd0ab9c73129137533c965ed","size":4095,"noattachment":false,"key":"/escalade/-/escalade-3.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-3.0.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_3.0.1_1592721601176_0.3074567859393793"},"_hasShrinkwrap":false,"publish_time":1592721601316,"_cnpm_publish_time":1592721601316},"3.0.0":{"name":"escalade","version":"3.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"A tiny (183B to 210B) and fast utility to ascend parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{"./":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./sync":{"import":"./sync/index.mjs","require":"./sync/index.js"}},"modes":{"sync":"src/sync.js","default":"src/async.js"},"engines":{"node":">=6"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":["find","parent","parents","directory","search","walk"],"devDependencies":{"bundt":"1.0.1","esm":"3.2.25","uvu":"0.0.11"},"gitHead":"aac99f4eb8fb8ce98b5143029dc328c83cdfc4d8","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_id":"escalade@3.0.0","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"shasum":"79b81f3c4bebb9c1727f0adba4b0f9d0ff050ca9","size":4096,"noattachment":false,"key":"/escalade/-/escalade-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-3.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_3.0.0_1592627069201_0.6863596103425054"},"_hasShrinkwrap":false,"publish_time":1592627069337,"_cnpm_publish_time":1592627069337},"2.0.0":{"name":"escalade","version":"2.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"A tiny (196B to 224B) and fast utility to ascend parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{"./":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./sync":{"import":"./sync/index.mjs","require":"./sync/index.js"}},"modes":{"sync":"src/sync.js","default":"src/async.js"},"engines":{"node":">=6"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":["find","parent","parents","directory","search","walk"],"devDependencies":{"bundt":"1.0.1","esm":"3.2.25","uvu":"0.0.11"},"gitHead":"fafa75c0978b608d50c4dec271be4fefeb1be411","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_id":"escalade@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"0a526670b38a29dd68cf82a019ac0e19599a4bd8","size":4158,"noattachment":false,"key":"/escalade/-/escalade-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-2.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_2.0.0_1592617007996_0.4323706808823915"},"_hasShrinkwrap":false,"publish_time":1592617008148,"_cnpm_publish_time":1592617008148},"1.0.0":{"name":"escalade","version":"1.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"A tiny (186B to 214B) and fast utility to ascend parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{"./":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./sync":{"import":"./sync/index.mjs","require":"./sync/index.js"}},"modes":{"sync":"src/sync.js","default":"src/async.js"},"engines":{"node":">=6"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":["find","parent","parents","directory","search","walk"],"devDependencies":{"bundt":"1.0.1","esm":"3.2.25","uvu":"0.0.11"},"gitHead":"97381e2b163b3ba3617eea146844dc74c491e25d","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_id":"escalade@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"eba62cba84324dd46dc2ae4fbc15dd5088813e13","size":4058,"noattachment":false,"key":"/escalade/-/escalade-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-1.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_1.0.0_1592594320131_0.3712813635301244"},"_hasShrinkwrap":false,"publish_time":1592594320240,"_cnpm_publish_time":1592594320240},"0.0.0":{"name":"escalade","version":"0.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/escalade.git"},"description":"Scale parent directories","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=8"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i fixtures"},"keywords":[],"devDependencies":{"bundt":"1.0.1","esm":"3.2.25","uvu":"0.0.11"},"bugs":{"url":"https://github.com/lukeed/escalade/issues"},"homepage":"https://github.com/lukeed/escalade#readme","_id":"escalade@0.0.0","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"shasum":"6417618198af1c944a48940b06c19a58d6df2dd4","size":1125,"noattachment":false,"key":"/escalade/-/escalade-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/escalade/download/escalade-0.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escalade_0.0.0_1592544817862_0.7997921389561231"},"_hasShrinkwrap":false,"publish_time":1592544818006,"_cnpm_publish_time":1592544818006}},"readme":"# escalade [![CI](https://github.com/lukeed/escalade/workflows/CI/badge.svg)](https://github.com/lukeed/escalade/actions) [![licenses](https://licenses.dev/b/npm/escalade)](https://licenses.dev/npm/escalade) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/escalade)](https://codecov.io/gh/lukeed/escalade)\n\n> A tiny (183B to 210B) and [fast](#benchmarks) utility to ascend parent directories\n\nWith [escalade](https://en.wikipedia.org/wiki/Escalade), you can scale parent directories until you've found what you're looking for.<br>Given an input file or directory, `escalade` will continue executing your callback function until either:\n\n1) the callback returns a truthy value\n2) `escalade` has reached the system root directory (eg, `/`)\n\n> **Important:**<br>Please note that `escalade` only deals with direct ancestry – it will not dive into parents' sibling directories.\n\n---\n\n**Notice:** As of v3.1.0, `escalade` now includes [Deno support](http://deno.land/x/escalade)! Please see [Deno Usage](#deno) below.\n\n---\n\n## Install\n\n```\n$ npm install --save escalade\n```\n\n\n## Modes\n\nThere are two \"versions\" of `escalade` available:\n\n#### \"async\"\n> **Node.js:** >= 8.x<br>\n> **Size (gzip):** 210 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/escalade/dist/index.js), [ES Module](https://unpkg.com/escalade/dist/index.mjs)\n\nThis is the primary/default mode. It makes use of `async`/`await` and [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original).\n\n#### \"sync\"\n> **Node.js:** >= 6.x<br>\n> **Size (gzip):** 183 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/escalade/sync/index.js), [ES Module](https://unpkg.com/escalade/sync/index.mjs)\n\nThis is the opt-in mode, ideal for scenarios where `async` usage cannot be supported.\n\n\n## Usage\n\n***Example Structure***\n\n```\n/Users/lukeed\n  └── oss\n    ├── license\n    └── escalade\n      ├── package.json\n      └── test\n        └── fixtures\n          ├── index.js\n          └── foobar\n            └── demo.js\n```\n\n***Example Usage***\n\n```js\n//~> demo.js\nimport { join } from 'path';\nimport escalade from 'escalade';\n\nconst input = join(__dirname, 'demo.js');\n// or: const input = __dirname;\n\nconst pkg = await escalade(input, (dir, names) => {\n  console.log('~> dir:', dir);\n  console.log('~> names:', names);\n  console.log('---');\n\n  if (names.includes('package.json')) {\n    // will be resolved into absolute\n    return 'package.json';\n  }\n});\n\n//~> dir: /Users/lukeed/oss/escalade/test/fixtures/foobar\n//~> names: ['demo.js']\n//---\n//~> dir: /Users/lukeed/oss/escalade/test/fixtures\n//~> names: ['index.js', 'foobar']\n//---\n//~> dir: /Users/lukeed/oss/escalade/test\n//~> names: ['fixtures']\n//---\n//~> dir: /Users/lukeed/oss/escalade\n//~> names: ['package.json', 'test']\n//---\n\nconsole.log(pkg);\n//=> /Users/lukeed/oss/escalade/package.json\n\n// Now search for \"missing123.txt\"\n// (Assume it doesn't exist anywhere!)\nconst missing = await escalade(input, (dir, names) => {\n  console.log('~> dir:', dir);\n  return names.includes('missing123.txt') && 'missing123.txt';\n});\n\n//~> dir: /Users/lukeed/oss/escalade/test/fixtures/foobar\n//~> dir: /Users/lukeed/oss/escalade/test/fixtures\n//~> dir: /Users/lukeed/oss/escalade/test\n//~> dir: /Users/lukeed/oss/escalade\n//~> dir: /Users/lukeed/oss\n//~> dir: /Users/lukeed\n//~> dir: /Users\n//~> dir: /\n\nconsole.log(missing);\n//=> undefined\n```\n\n> **Note:** To run the above example with \"sync\" mode, import from `escalade/sync` and remove the `await` keyword.\n\n\n## API\n\n### escalade(input, callback)\nReturns: `string|void` or `Promise<string|void>`\n\nWhen your `callback` locates a file, `escalade` will resolve/return with an absolute path.<br>\nIf your `callback` was never satisfied, then `escalade` will resolve/return with nothing (undefined).\n\n> **Important:**<br>The `sync` and `async` versions share the same API.<br>The **only** difference is that `sync` is not Promise-based.\n\n#### input\nType: `string`\n\nThe path from which to start ascending.\n\nThis may be a file or a directory path.<br>However, when `input` is a file, `escalade` will begin with its parent directory.\n\n> **Important:** Unless given an absolute path, `input` will be resolved from `process.cwd()` location.\n\n#### callback\nType: `Function`\n\nThe callback to execute for each ancestry level. It always is given two arguments:\n\n1) `dir` - an absolute path of the current parent directory\n2) `names` - a list (`string[]`) of contents _relative to_ the `dir` parent\n\n> **Note:** The `names` list can contain names of files _and_ directories.\n\nWhen your callback returns a _falsey_ value, then `escalade` will continue with `dir`'s parent directory, re-invoking your callback with new argument values.\n\nWhen your callback returns a string, then `escalade` stops iteration immediately.<br>\nIf the string is an absolute path, then it's left as is. Otherwise, the string is resolved into an absolute path _from_ the `dir` that housed the satisfying condition.\n\n> **Important:** Your `callback` can be a `Promise/AsyncFunction` when using the \"async\" version of `escalade`.\n\n## Benchmarks\n\n> Running on Node.js v10.13.0\n\n```\n# Load Time\n  find-up         3.891ms\n  escalade        0.485ms\n  escalade/sync   0.309ms\n\n# Levels: 6 (target = \"foo.txt\"):\n  find-up          x 24,856 ops/sec ±6.46% (55 runs sampled)\n  escalade         x 73,084 ops/sec ±4.23% (73 runs sampled)\n  find-up.sync     x  3,663 ops/sec ±1.12% (83 runs sampled)\n  escalade/sync    x  9,360 ops/sec ±0.62% (88 runs sampled)\n\n# Levels: 12 (target = \"package.json\"):\n  find-up          x 29,300 ops/sec ±10.68% (70 runs sampled)\n  escalade         x 73,685 ops/sec ± 5.66% (66 runs sampled)\n  find-up.sync     x  1,707 ops/sec ± 0.58% (91 runs sampled)\n  escalade/sync    x  4,667 ops/sec ± 0.68% (94 runs sampled)\n\n# Levels: 18 (target = \"missing123.txt\"):\n  find-up          x 21,818 ops/sec ±17.37% (14 runs sampled)\n  escalade         x 67,101 ops/sec ±21.60% (20 runs sampled)\n  find-up.sync     x  1,037 ops/sec ± 2.86% (88 runs sampled)\n  escalade/sync    x  1,248 ops/sec ± 0.50% (93 runs sampled)\n```\n\n## Deno\n\nAs of v3.1.0, `escalade` is available on the Deno registry.\n\nPlease note that the [API](#api) is identical and that there are still [two modes](#modes) from which to choose:\n\n```ts\n// Choose \"async\" mode\nimport escalade from 'https://deno.land/escalade/async.ts';\n\n// Choose \"sync\" mode\nimport escalade from 'https://deno.land/escalade/sync.ts';\n```\n\n> **Important:** The `allow-read` permission is required!\n\n\n## Related\n\n- [premove](https://github.com/lukeed/premove) - A tiny (247B) utility to remove items recursively\n- [totalist](https://github.com/lukeed/totalist) - A tiny (195B to 224B) utility to recursively list all (total) files in a directory\n- [mk-dirs](https://github.com/lukeed/mk-dirs) - A tiny (420B) utility to make a directory and its parents, recursively\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","_attachments":{},"homepage":"https://github.com/lukeed/escalade#readme","bugs":{"url":"https://github.com/lukeed/escalade/issues"},"license":"MIT"}