{"_id":"@1-/find","_rev":"2-bf82f2548baff7e742e5d840fc275c13","name":"@1-/find","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@1-/find","version":"0.1.0","keywords":["find","directory","parent","walk","lookup"],"author":{"name":"x-at-01@googlegroups.com"},"license":"MulanPSL-2.0","_id":"@1-/find@0.1.0","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/webc-site/npm/tree/main/find","bugs":{"url":"https://github.com/webc-site/npm/issues"},"dist":{"shasum":"df5f7b9001a58742e316bf8c868c9fc782d4cca7","tarball":"https://registry.npmjs.org/@1-/find/-/find-0.1.0.tgz","fileCount":3,"integrity":"sha512-DKEV8WS8utc5x+E0GI4Wz/6b7gvR1jryj7rSeLhG9pbh/3BWccHtZoJSfo7UROhmMqDV5f/2BviZV9wMeNcOtQ==","signatures":[{"sig":"MEQCIARz+lI1M6yWVBCnTN3Gt2bRpmy4rYJk0BaMe1U9XRyYAiAEg4zMDQ8+1lmVg57SZIxKmXzh1Xe405foFpvFl/dmuw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5208},"type":"module","exports":{".":"./_.js","./*":"./*"},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/webc-site/npm.git","type":"git"},"_npmVersion":"11.13.0","description":"Locate directory containing target file by walking up / 向上递归查找包含指定目标的目录","directories":{},"_nodeVersion":"26.2.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/find_0.1.0_1780972625572_0.9721195890133012","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@1-/find","version":"0.1.1","description":"Locate directory containing target file by walking up / 向上递归查找包含指定目标的目录","keywords":["find","directory","parent","walk","lookup"],"homepage":"https://github.com/webc-site/npm/tree/main/find","license":"MulanPSL-2.0","author":{"name":"x-at-01@googlegroups.com"},"repository":{"type":"git","url":"git+https://github.com/webc-site/npm.git"},"type":"module","exports":{".":"./_.js","./*":"./*"},"_id":"@1-/find@0.1.1","bugs":{"url":"https://github.com/webc-site/npm/issues"},"_nodeVersion":"26.2.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-U5K9KG6SbNeitE+Z2Coejz1C4l87Y+EEKf49RssQL09PS5pI8qRDYNJ85TSXd2vYqSCStH53n/ySLnV/CCQ0LA==","shasum":"a4ffb1495e1d595d274e4307f20a39a24519f390","tarball":"https://registry.npmjs.org/@1-/find/-/find-0.1.1.tgz","fileCount":3,"unpackedSize":4506,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDOr2v91exfL/1IloUjgIq7AC+zccfPkxqhj7ZfrF6ubwIhAOKRbzVjcvoNg3Ge8KXdBf8lMacos/iu8Wky18VK1ar7"}]},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"directories":{},"maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/find_0.1.1_1780980754678_0.8579901694169352"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-09T02:37:05.257Z","modified":"2026-06-09T04:52:34.920Z","0.1.0":"2026-06-09T02:37:05.725Z","0.1.1":"2026-06-09T04:52:34.813Z"},"bugs":{"url":"https://github.com/webc-site/npm/issues"},"author":{"name":"x-at-01@googlegroups.com"},"license":"MulanPSL-2.0","homepage":"https://github.com/webc-site/npm/tree/main/find","keywords":["find","directory","parent","walk","lookup"],"repository":{"type":"git","url":"git+https://github.com/webc-site/npm.git"},"description":"Locate directory containing target file by walking up / 向上递归查找包含指定目标的目录","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"readme":"[English](#en) | [中文](#zh)\n\n---\n\n<a id=\"en\"></a>\n# @1-/find : Locate directory containing target file by walking up parent paths\n\n## Features\n\nTraverses directory tree upward from starting path.\n\nLocates target file or folder.\n\nReturns directory path containing target, or `undefined` if not found.\n\nZero dependencies, using Node.js native modules.\n\n## Usage\n\n```javascript\nimport find from \"@1-/find\";\n\nconst rootDir = find(import.meta.dirname, \"package.json\");\nconsole.log(rootDir); // Outputs directory path containing package.json\n```\n\n## Design\n\nThe module accepts starting directory path and target name.\n\nIt checks for target existence at current level.\n\nIf target is absent, it retrieves parent directory.\n\nWhen parent directory equals current directory (indicating root boundary), the loop terminates and returns `undefined`.\n\nOtherwise, the current directory updates to parent directory to repeat the lookup.\n\n![](https://i-01.eu.org/I2Mt3xF4lO7p7gx8v0SG0g)\n\n## Tech Stack\n\n- JavaScript (ES Module)\n- Bun (Test runner)\n- Node.js native modules (`node:fs`, `node:path`)\n\n## Code Structure\n\n```\n.\n├── src/\n│   └── _.js            # Core implementation\n├── tests/\n│   └── _.test.js       # Test suite\n├── readme/\n│   ├── en/\n│   │   └── README.md    # English documentation\n│   └── zh/\n│       └── README.md    # Chinese documentation\n├── package.json\n└── README.mdt\n```\n\n## History\n\nTraversing upward to locate configurations is standard practice in software engineering.\n\nTools like Git and npm employ this strategy to locate workspace roots.\n\nThe pattern dates back to Unix hierarchical file systems, solving configuration lookups in nested directories.\n## About\n\nThis library is developed by [WebC.site](https://webc.site).\n\n[WebC.site](https://webc.site): A new paradigm of web development for AI\n\n---\n\n<a id=\"zh\"></a>\n# @1-/find : 向上递归查找包含指定目标的目录\n\n## 功能介绍\n\n从起点目录出发，向上逐级检索。\n\n定位目标文件或目录。\n\n返回包含目标的目录路径，未找到时返回 `undefined`。\n\n无需外部依赖，直接基于 Node.js 原生模块。\n\n## 使用演示\n\n```javascript\nimport find from \"@1-/find\";\n\nconst rootDir = find(import.meta.dirname, \"package.json\");\nconsole.log(rootDir); // 输出包含 package.json 的目录路径\n```\n\n## 设计思路\n\n模块接收起点路径与目标名称。\n\n在循环中检测当前目录下是否存在目标。\n\n若不存在目标，获取父目录。\n\n若父目录与当前目录相同（说明已到达根目录），则退出循环并返回 `undefined`。\n\n否则，更新当前目录为父目录并继续循环。\n\n![](https://i-01.eu.org/-pORtoo3vOlHG1XL8AHXWg)\n\n## 技术栈\n\n- JavaScript (ES Module)\n- Bun (测试运行器)\n- Node.js 原生模块 (`node:fs`, `node:path`)\n\n## 代码结构\n\n```\n.\n├── src/\n│   └── _.js            # 核心实现\n├── tests/\n│   └── _.test.js       # 测试文件\n├── readme/\n│   ├── en/\n│   │   └── README.md    # 英文文档\n│   └── zh/\n│       └── README.md    # 中文文档\n├── package.json\n└── README.mdt\n```\n\n## 历史故事\n\n向上递归寻找配置是软件工程的常用设计。\n\nGit 与 npm 等工具均采用此逻辑定位工作区根目录。\n\n该设计源于 Unix 早期分层文件系统的检索机制，解决嵌套子路径定位全局配置的难题。\n## 关于\n\n本库由 [WebC.site](https://webc.site) 开发。\n\n[WebC.site](https://webc.site) : 面向人工智能的网站开发新范式\n","readmeFilename":"README.md"}