{"id":13725322,"url":"https://github.com/lukeed/escalade","last_synced_at":"2025-10-09T18:23:26.397Z","repository":{"id":41555326,"uuid":"273568715","full_name":"lukeed/escalade","owner":"lukeed","description":"A tiny (183B to 210B) and fast utility to ascend parent directories","archived":false,"fork":false,"pushed_at":"2024-08-29T22:59:35.000Z","size":32,"stargazers_count":153,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-07T06:30:45.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukeed.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-19T19:11:52.000Z","updated_at":"2025-10-05T01:47:57.000Z","dependencies_parsed_at":"2024-06-18T12:38:24.093Z","dependency_job_id":"1950b17e-4437-4102-8409-ec3d5217ae6e","html_url":"https://github.com/lukeed/escalade","commit_stats":{"total_commits":47,"total_committers":4,"mean_commits":11.75,"dds":0.06382978723404253,"last_synced_commit":"fa5be167391581849cff04dbc75dc2978744b642"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/lukeed/escalade","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fescalade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fescalade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fescalade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fescalade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/escalade/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fescalade/sbom","scorecard":{"id":604431,"data":{"date":"2025-08-11","repo":{"name":"github.com/lukeed/escalade","commit":"fa5be167391581849cff04dbc75dc2978744b642"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":1,"reason":"Found 3/30 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeed/escalade/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeed/escalade/ci.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:21","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:29","Warn: downloadThenRun not pinned by hash: .github/workflows/ci.yml:36","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T01:15:20.397Z","repository_id":41555326,"created_at":"2025-08-21T01:15:20.397Z","updated_at":"2025-08-21T01:15:20.397Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278905124,"owners_count":26066227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T01:02:19.443Z","updated_at":"2025-10-09T18:23:26.367Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","funding_links":[],"categories":["others","JavaScript"],"sub_categories":[],"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\u003e 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.\u003cbr\u003eGiven 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\u003e **Important:**\u003cbr\u003ePlease 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\u003e **Node.js:** \u003e= 8.x\u003cbr\u003e\n\u003e **Size (gzip):** 210 bytes\u003cbr\u003e\n\u003e **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\u003e **Node.js:** \u003e= 6.x\u003cbr\u003e\n\u003e **Size (gzip):** 183 bytes\u003cbr\u003e\n\u003e **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//~\u003e 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) =\u003e {\n  console.log('~\u003e dir:', dir);\n  console.log('~\u003e 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//~\u003e dir: /Users/lukeed/oss/escalade/test/fixtures/foobar\n//~\u003e names: ['demo.js']\n//---\n//~\u003e dir: /Users/lukeed/oss/escalade/test/fixtures\n//~\u003e names: ['index.js', 'foobar']\n//---\n//~\u003e dir: /Users/lukeed/oss/escalade/test\n//~\u003e names: ['fixtures']\n//---\n//~\u003e dir: /Users/lukeed/oss/escalade\n//~\u003e names: ['package.json', 'test']\n//---\n\nconsole.log(pkg);\n//=\u003e /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) =\u003e {\n  console.log('~\u003e dir:', dir);\n  return names.includes('missing123.txt') \u0026\u0026 'missing123.txt';\n});\n\n//~\u003e dir: /Users/lukeed/oss/escalade/test/fixtures/foobar\n//~\u003e dir: /Users/lukeed/oss/escalade/test/fixtures\n//~\u003e dir: /Users/lukeed/oss/escalade/test\n//~\u003e dir: /Users/lukeed/oss/escalade\n//~\u003e dir: /Users/lukeed/oss\n//~\u003e dir: /Users/lukeed\n//~\u003e dir: /Users\n//~\u003e dir: /\n\nconsole.log(missing);\n//=\u003e undefined\n```\n\n\u003e **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\u003cstring|void\u003e`\n\nWhen your `callback` locates a file, `escalade` will resolve/return with an absolute path.\u003cbr\u003e\nIf your `callback` was never satisfied, then `escalade` will resolve/return with nothing (undefined).\n\n\u003e **Important:**\u003cbr\u003eThe `sync` and `async` versions share the same API.\u003cbr\u003eThe **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.\u003cbr\u003eHowever, when `input` is a file, `escalade` will begin with its parent directory.\n\n\u003e **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\u003e **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.\u003cbr\u003e\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\u003e **Important:** Your `callback` can be a `Promise/AsyncFunction` when using the \"async\" version of `escalade`.\n\n## Benchmarks\n\n\u003e 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\u003e **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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fescalade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Fescalade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fescalade/lists"}