{"id":21681754,"url":"https://github.com/cbschuld/ts-multitool","last_synced_at":"2026-04-16T04:02:27.726Z","repository":{"id":43438594,"uuid":"510948980","full_name":"cbschuld/ts-multitool","owner":"cbschuld","description":"A library full of tree-shakable TypeScript functions for application construction in both CommonJS and ESM","archived":false,"fork":false,"pushed_at":"2022-11-17T16:09:21.000Z","size":142,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T07:50:53.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/cbschuld.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-07-06T01:37:27.000Z","updated_at":"2025-07-15T16:25:26.000Z","dependencies_parsed_at":"2022-07-14T20:17:20.109Z","dependency_job_id":null,"html_url":"https://github.com/cbschuld/ts-multitool","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/cbschuld/ts-multitool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbschuld%2Fts-multitool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbschuld%2Fts-multitool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbschuld%2Fts-multitool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbschuld%2Fts-multitool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbschuld","download_url":"https://codeload.github.com/cbschuld/ts-multitool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbschuld%2Fts-multitool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-11-25T15:31:14.040Z","updated_at":"2026-04-16T04:02:27.706Z","avatar_url":"https://github.com/cbschuld.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeScript MultiTool 🛠\n\n\u003cp\u003e\n  \u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dw/ts-multitool?style=flat-square\"/\u003e\u003c!-- downloads --\u003e\n  \u003cimg alt=\"size\" src=\"https://img.shields.io/bundlephobia/min/ts-multitool\"/\u003e\u003c!-- bundle size --\u003e\n  \u003cimg alt=\"build\" src=\"https://img.shields.io/github/workflow/status/cbschuld/ts-multitool/CI\"/\u003e\u003c!-- build --\u003e\n  \u003cimg alt=\"license\" src=\"https://img.shields.io/npm/l/ts-multitool?style=flat-square\"/\u003e\u003c!-- license --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\"/\u003e\u003c!-- PRs welcome --\u003e\n\u003c/p\u003e\n\nOn the journey of building applications in [TypeScript](https://www.typescriptlang.org/) you will need a menagerie of functions. Typically the user's trip down Google lane will bring you to [StackOverflow](https://stackoverflow.com). The code is copied into the editor and the app construction continues. Bad, no chance the testing is added and now problems arise. The TypeScript MultiTool is a tree-shakable pile of functions helpful for building apps with all of the tests included in the library.\n\n## Motivation\n\nBuilding software accurately and quickly tends to yield solutions which are simply missing test coverage for quick and dirty functions plucked from google searches or [StackOverflow](https://stackoverflow.com). This library is my own collection of functions I am using with the included test coverages to manage them.\n\nFurthering, in my experience, I find great solutions and I'll adopt them in a project. Months down the road I'll research the same problem and will stop and realize in the middle of the research \"I have looked for this before\" and I'll search my own solutions for it. I have done a poor job denoting great known-good solutions. This is an attempt to encapsulate the runtime from time spent researching.\n\n## Installation\n\nThe recommended way to install is through `npm` or `Yarn`. The library is exposed as CommonJS and ESM.\n\nnpm:\n\n```sh\nnpm install ts-multitool\n```\n\nyarn:\n\n```sh\nyarn add ts-multitool\n```\n\n## Usage\n\nThe entire point of `ts-multitool` is simplicity with the goal of producing rapid test-able solutions in TypeScript\n\n# Functions\n\n## Text Functions (available at `/text/`)\n\n---\n\n### `commaSeparatedString(string[],useOxfordComma)`\n\nTake a list of strings and create a comma separated string. The `useOxfordComma` will place an [Oxford Comma](https://en.wikipedia.org/wiki/Serial_comma)\n\n```typescript\nimport { commaSeparatedString } from 'ts-multitool'\nconst response = commaSeparatedString(['first', 'second', 'third'])\nassert(response === 'first, second and third')\n```\n\n### `capitalize(string)`\n\nCapitalizes the first letter of a string. It does NOT force lowercase on the remaining letters.\n\n```typescript\nimport { capitalize } from 'ts-multitool'\nconst response = capitalize('thomas')\nassert(response === 'Thomas')\n```\n\n### `truncate(string,length,useWordBoundary,ellipsis)`\n\nTruncates the string at the given length and adds an ellipsis. The `useWordBoundary` will truncate at the nearest word boundary. The `ellipsis` will be added to the end of the string.\n\n```typescript\nimport { truncate } from 'ts-multitool'\nconst line1 = truncate('The quick brown fox jumps over the lazy dog', 20, true, '...')\nconst line2 = truncate('The quick brown fox jumps over the lazy dog', 20)\nassert(line1 === 'The quick brown fox...')\nassert(line2 === 'The quick brown fox\u0026hellip;')\n```\n\n---\n\n## Array Functions (available at `/array/`)\n\n---\n\n### `unique\u003cT\u003e(T[])`\n\nReturns a list of unique values from the given array (supports primitives)\n\n```typescript\nimport { unique } from 'ts-multitool'\nconst list = unique([1, 2, 3, 4, 3, 2, 4, 1])\n// returns [1, 2, 3, 4]\n```\n\n### `uniqueValue(value:string, list:string[]): string`\n\nDetermines and possibly mutates value to ensure it is unique in the list of values\n\n```typescript\nimport { uniqueValue } from 'ts-multitool'\nconst field1 = uniqueValue('a', ['a', 'b', 'c'])\n// returns 'a0'\nconst field2 = uniqueValue('a', ['a', 'a0', 'a1'])\n// returns 'a2'\n```\n\n---\n\n## File Functions (available at `/files/`)\n\n---\n\n### `getExtension(string)`\n\nGet the extension of a file.\n\n```typescript\nimport { getExtension } from 'ts-multitool'\nconst ext = getExtension('somefile.that.you.need.jpg')\nassert(response === 'jpg')\n```\n\n---\n\n## Have something to add (or something is busted)?\n\nSomething to add to the library? Cool, add it and create a PR! If there is something busted in the library? Whoops, file an issue!\n\n## Tests\n\nTests are executed via Jest.\n\n```shell script\nnpm run test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbschuld%2Fts-multitool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbschuld%2Fts-multitool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbschuld%2Fts-multitool/lists"}