{"id":15413387,"url":"https://github.com/simonwep/previous-index-of","last_synced_at":"2026-02-02T16:39:01.202Z","repository":{"id":51706147,"uuid":"211359447","full_name":"simonwep/previous-index-of","owner":"simonwep","description":"Find the previous index of a char-sequence at a given offset in a string","archived":false,"fork":false,"pushed_at":"2022-12-30T18:45:15.000Z","size":29,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T03:35:39.950Z","etag":null,"topics":["string","string-matching","util","utility-function"],"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/simonwep.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}},"created_at":"2019-09-27T16:23:58.000Z","updated_at":"2020-07-18T09:59:23.000Z","dependencies_parsed_at":"2023-01-31T13:20:26.492Z","dependency_job_id":null,"html_url":"https://github.com/simonwep/previous-index-of","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwep%2Fprevious-index-of","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwep%2Fprevious-index-of/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwep%2Fprevious-index-of/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwep%2Fprevious-index-of/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonwep","download_url":"https://codeload.github.com/simonwep/previous-index-of/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247515467,"owners_count":20951495,"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":["string","string-matching","util","utility-function"],"created_at":"2024-10-01T16:56:53.269Z","updated_at":"2026-02-02T16:39:01.166Z","avatar_url":"https://github.com/simonwep.png","language":"JavaScript","funding_links":["https://www.patreon.com/simonwep"],"categories":[],"sub_categories":[],"readme":"\u003ch3 align=center\u003e\n    \u003cp\u003ePrevious Index Of\u003c/p\u003e\n\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\n   \u003ca href=\"https://travis-ci.org/Simonwep/previous-index-of\"\u003e\u003cimg\n     alt=\"Build Status\"\n     src=\"https://img.shields.io/travis/Simonwep/previous-index-of.svg?style=popout-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/previous-index-of\"\u003e\u003cimg\n     alt=\"Download count\"\n     src=\"https://img.shields.io/npm/dm/previous-index-of.svg?style=popout-square\"\u003e\u003c/a\u003e\n  \u003cimg alt=\"No dependencies\" src=\"https://img.shields.io/badge/dependencies-none-27ae60.svg?style=popout-square\"\u003e\n  \u003cimg alt=\"Current version\"\n       src=\"https://img.shields.io/github/tag/Simonwep/previous-index-of.svg?color=3498DB\u0026label=version\u0026style=flat-square\"\u003e\n  \u003ca href=\"https://www.patreon.com/simonwep\"\u003e\u003cimg\n     alt=\"Support me\"\n     src=\"https://img.shields.io/badge/patreon-support-3498DB.svg?style=popout-square\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nFind the index of a specific char-sequence in a string at a given offset.\n\n### Installation\n##### NPM\n```bash\n$ npm i previous-index-of\n```\n##### Yarn\n```bash\n$ yarn add previous-index-of\n```\n\n### Usage\n```js\nconst previousIndexOf = require('previous-index-of');\n\n// previousIndexOf(sourceString: \u003cstring\u003e, target: \u003cstring\u003e, offset: \u003cnumber|undefined\u003e)\npreviousIndexOf('baz bam boo foo bam', 'bam', 12); // 4\npreviousIndexOf('baz bam boo foo bam', 'bam');     // 16\npreviousIndexOf('baz bam boo foo bam', 'da');      // -1\npreviousIndexOf('baz bam boo foo bam', 'bam', {}); // 16\npreviousIndexOf('baz bam boo foo bam', null);      // -1\npreviousIndexOf(null, 'abc');                      // -1\n```\n\n### Running tests\n```\n$ npm install -d \u0026\u0026 npm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonwep%2Fprevious-index-of","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonwep%2Fprevious-index-of","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonwep%2Fprevious-index-of/lists"}