{"id":16667064,"url":"https://github.com/nijikokun/lua-find","last_synced_at":"2025-12-28T22:36:34.263Z","repository":{"id":66137192,"uuid":"145275387","full_name":"nijikokun/lua-find","owner":"nijikokun","description":"Javascript implementation of Lua's String.find functionality","archived":false,"fork":false,"pushed_at":"2018-08-19T05:43:05.000Z","size":2,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T16:51:09.633Z","etag":null,"topics":["find","javascript","lua","string"],"latest_commit_sha":null,"homepage":null,"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/nijikokun.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":"2018-08-19T05:18:14.000Z","updated_at":"2020-03-07T14:28:12.000Z","dependencies_parsed_at":"2023-07-17T13:17:18.843Z","dependency_job_id":null,"html_url":"https://github.com/nijikokun/lua-find","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nijikokun%2Flua-find","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nijikokun%2Flua-find/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nijikokun%2Flua-find/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nijikokun%2Flua-find/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nijikokun","download_url":"https://codeload.github.com/nijikokun/lua-find/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243312923,"owners_count":20271167,"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":["find","javascript","lua","string"],"created_at":"2024-10-12T11:13:00.244Z","updated_at":"2025-12-28T22:36:29.227Z","avatar_url":"https://github.com/nijikokun.png","language":"JavaScript","readme":"# lua-find [![NPM version](https://img.shields.io/npm/v/lua-find.svg?style=flat)](https://www.npmjs.com/package/lua-find) [![NPM monthly downloads](https://img.shields.io/npm/dm/lua-find.svg?style=flat)](https://npmjs.org/package/lua-find) [![NPM total downloads](https://img.shields.io/npm/dt/lua-find.svg?style=flat)](https://npmjs.org/package/lua-find)\n\nJavascript implementation of Lua's [String.find](http://lua-users.org/wiki/StringLibraryTutorial) functionality to allow Javascript users get back the start of a needle, and it's end. Using both plain text matching and regular expression matching.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```bash\n$ npm install lua-find --save\n```\n\n## Usage\n\n```js\nconst find = require('lua-find')\n```\n\nSee the [tests](./test.js) for more examples.\n\n### Pattern Example\n\n```js\nlet [start, end] = find('Hello World', /World/)\n// [ 6, 11 ]\n```\n\n```js\n// Pattern format also supports string based searches\nlet [start, end] = find('Hello World', 'World')\n// [ 6, 11 ]\n```\n\n### Plain format example\n\nUses `string.indexOf` to improve performance when the pattern is a string.\n\n```js\nlet [start, end] = find('Hello World', 'World', 0, true)\n// [ 6, 11 ]\n```\n\nIt also enforces patterns to be strings:\n\n```js\nlet [start, end] = find('Hello /World/', /World/, 0, true) \n// [ 6, 13 ]\n```\n\n### Starting position examples\n\nThe third argument is the `startingAt` property.\n\n```js\nlet [start, end] = find('Hello World, World Hello', 'Hello', 11, true)\n// [19, 24]\n```\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Running Tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can run tests with the following command:\n\n```sh\n$ npm test\n```\n\n### License\n\nCopyright © 2018, [Nijiko Yonskai](https://github.com/nijikokun).\nReleased under the [MIT License](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnijikokun%2Flua-find","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnijikokun%2Flua-find","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnijikokun%2Flua-find/lists"}