{"id":25054738,"url":"https://github.com/denniscual/find-text","last_synced_at":"2025-03-31T07:44:17.483Z","repository":{"id":57236340,"uuid":"135377994","full_name":"denniscual/find-text","owner":"denniscual","description":"Fast, minimal, and easy to use tool for finding text across multiple files","archived":false,"fork":false,"pushed_at":"2018-05-31T16:59:05.000Z","size":96,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T08:44:25.465Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denniscual.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-30T02:36:31.000Z","updated_at":"2018-05-31T17:02:56.000Z","dependencies_parsed_at":"2022-08-23T15:51:03.009Z","dependency_job_id":null,"html_url":"https://github.com/denniscual/find-text","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denniscual%2Ffind-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denniscual%2Ffind-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denniscual%2Ffind-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denniscual%2Ffind-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denniscual","download_url":"https://codeload.github.com/denniscual/find-text/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246436092,"owners_count":20776964,"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","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":"2025-02-06T12:18:25.121Z","updated_at":"2025-03-31T07:44:17.462Z","avatar_url":"https://github.com/denniscual.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## find-text\nFast, minimal, and easy to use tool for finding text across multiple files. It is tiny (3.78kb bundle size, including dependecies) file.\n\n[![NPM](https://img.shields.io/npm/v/find-text.svg)](https://www.npmjs.com/package/find-text) [![Build Status](https://travis-ci.org/denniscual/storext.svg?branch=master)](https://travis-ci.org/denniscual/find-text) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Install\n\n```bash\nnpm install find-text\n```\n\n## Usage\n\nThe module exposes two API's `findText` and `findTextInFiles`.\n\n### findText\n\n```js\nimport { findText } from 'find-text'\n\n/**\n * findText :: (String, String) =\u003e Promise\n *\n * Find the text on the given file.\n */\nfindText('TODO', '/Users/user/Desktop/sample/src/users.js')\n  .then((results) =\u003e {\n    console.log(results) // See below the shape of result output\n  })\n  .catch((err) =\u003e {\n    // Error object\n    console.log(err)\n  })\n```\n\nThe result contains the `fileName`, `matches`, and `count` of matches in the file.\n\n```js\nconst result = {\n  fileName: 'src/users.js', // current working directory path is omitted\n  matches: [{\n    text: '// TODO: Add update user API', // line in found text\n    lineNumber: 5\n  }],\n  count: 1\n}\n```\n\n### findTextInFiles\n\n```js\nimport { findTextInFiles } from 'find-text'\n\n/**\n * findTextInFiles :: (String, String) =\u003e Promise\n *\n * Find the text in the files which are resided at the given directory. \n */\nfindTextInFiles('TODO', 'src/users.js')\n  .then((results) =\u003e {\n    console.log(results) // See below the shape of results output\n  })\n  .catch((err) =\u003e {\n    // Error object\n    console.log(err)\n  })\n```\n\nThe results is an array of object (the output returned by `findText`)\n\n```js\nconst results = [\n  {\n    fileName: 'src/users.js', \n    matches: [{\n      text: '// TODO: Add update user API',\n      lineNumber: 5\n    }],\n    count: 1\n  }\n]\n```\n\n## API\n\n### findText :: (String, String) =\u003e Promise \n\nFind the text on the given file. When the text is not found in the given file, it returns empty object.\n\nPromise is rejected when passing path which is not exist.\n\n#### text\n\nType: `string`\n\nThe string you want to search for.\n\n#### path\n\nType: `string`\n\nThe path you want to search in.\n\n### findTextInFiles :: (String, String) =\u003e Promise\n\nFind the text in the files which are resided at the given directory. It recursively reads the nested files which match for the pattern.\n\nIt returns empty array when passing not found text or no files are matched for the given pattern.\n\n#### text\n\nType: `string`\n\nThe string you want to search for.\n\n#### pattern\n\nType: `string`|`string[]`\n\nPattern to be matched. It supports negated pattern. For more information about pattern, check [micromatch](https://github.com/micromatch/micromatch)\n\n## Changelog\n\nThis project adheres to [Semantic Versioning](http://semver.org/).\nEvery release, along with the migration instructions, is documented on the Github [Releases](https://github.com/denniscual/find-text/releases) page.\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenniscual%2Ffind-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenniscual%2Ffind-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenniscual%2Ffind-text/lists"}