{"id":21058020,"url":"https://github.com/qpssoft/auto-group-strings-array","last_synced_at":"2025-06-26T03:36:44.130Z","repository":{"id":226529996,"uuid":"768959803","full_name":"qpssoft/auto-group-strings-array","owner":"qpssoft","description":"Small JS library to group array of strings by common substring","archived":false,"fork":false,"pushed_at":"2024-03-28T13:18:54.000Z","size":669,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T22:36:22.535Z","etag":null,"topics":["library"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/auto-group-strings-array","language":"TypeScript","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/qpssoft.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}},"created_at":"2024-03-08T03:44:35.000Z","updated_at":"2024-04-06T04:41:22.000Z","dependencies_parsed_at":"2024-03-08T04:25:30.270Z","dependency_job_id":"a6060706-de16-4a73-a3c5-589aa8538081","html_url":"https://github.com/qpssoft/auto-group-strings-array","commit_stats":null,"previous_names":["qpssoft/auto-group-strings-array"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qpssoft%2Fauto-group-strings-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qpssoft%2Fauto-group-strings-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qpssoft%2Fauto-group-strings-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qpssoft%2Fauto-group-strings-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qpssoft","download_url":"https://codeload.github.com/qpssoft/auto-group-strings-array/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243502712,"owners_count":20301110,"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":["library"],"created_at":"2024-11-19T17:06:04.881Z","updated_at":"2025-03-14T00:28:03.707Z","avatar_url":"https://github.com/qpssoft.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# auto-group-strings-array\n\n[![](https://github.com/qpssoft/auto-group-strings-array/workflows/test/badge.svg)](https://github.com/qpssoft/auto-group-strings-array/actions?query=workflow%3Atest) [![](https://img.shields.io/codecov/c/github/qpssoft/auto-group-strings-js/master)](https://codecov.io/github/qpssoft/auto-group-strings-js?branch=master) [![](https://snyk.io/test/github/qpssoft/auto-group-strings-js/badge.svg)](https://snyk.io/test/github/qpssoft/auto-group-strings-js) [![](https://img.shields.io/node/v/auto-group-strings?label=node.js+version)](https://nodejs.org)\n\nSmall JS library to group array of strings by common substring\n\n## Node.js\n\n`npm install auto-group-strings-array`\n\n## Browser\n\nUse `auto-group-strings.min.js` file from [dist/](dist/)\n\n### Function Arguments:\n\n1. inputStrings (type: `Array\u003cstring\u003e`)\n\n2. options, type: `Object` (optional), properties:\n    - **delimiter** (type: `string`, default: `\" \"`)\n    - **delimiterRegExp** (type: `RegExp`, default: `undefined`)\n      - if **delimiterRegExp** is provided, **delimiter** (`string`) will only be used as a fallback when there is no match for **delimiterRegExp**\n    - **direction** (type: `string`, default: `\"rtl\"`)\n      \u003cbr\u003e\n      - Its possible values are `\"ltr\"` for searching left to right or, `\"rtl\"` for right to left.\n    - **caseSensitive** (type: `boolean`, default: `false`)\n    - **includeSingleElementMembers** (type: `boolean`, default: `false`)\n      - this option includes every input string from the first argument as **common** and at least one element (index) in **members** array. \n\n### Return Type:\n\n- `Array\u003cObject\u003e` where\n    - **`common`** property is a `string`\n    - **`members`** property is an `Array\u003cnumber\u003e`\n\n## Usage\n\n```js\nconst autoGroupStrings = require(\"auto-group-strings\");\n\nconst result = autoGroupStrings(\n  [\n    \"hello code\", // 0\n    \"apple and orange\", // 1\n    \"for the happy code\", // 2\n    \"i don't know\", // 3\n    \"is it?\", // 4\n    \"it's a happy code\", // 5\n  ],\n  {\n    delimiter: \" \",\n    direction: \"rtl\",\n  },\n);\n\nconsole.log(result);\n/*\n[\n  { common: 'code', members: [ 0, 2, 5 ] },\n  { common: 'happy code', members: [ 2, 5 ] }\n]\n*/\n```\n\n- For more examples, please check [examples](examples/) directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqpssoft%2Fauto-group-strings-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqpssoft%2Fauto-group-strings-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqpssoft%2Fauto-group-strings-array/lists"}