{"id":15413508,"url":"https://github.com/wooorm/match-casing","last_synced_at":"2025-10-11T05:35:23.468Z","repository":{"id":57291826,"uuid":"67524680","full_name":"wooorm/match-casing","owner":"wooorm","description":"Match the case of `value` to that of `base`","archived":false,"fork":false,"pushed_at":"2022-11-20T11:49:29.000Z","size":55,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-16T15:18:43.678Z","etag":null,"topics":["case","lower","lowercase","match","sentence","upper","uppercase"],"latest_commit_sha":null,"homepage":"","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/wooorm.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":"funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"wooorm"}},"created_at":"2016-09-06T16:11:23.000Z","updated_at":"2023-08-13T01:15:13.000Z","dependencies_parsed_at":"2023-01-22T01:45:19.653Z","dependency_job_id":null,"html_url":"https://github.com/wooorm/match-casing","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/wooorm/match-casing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fmatch-casing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fmatch-casing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fmatch-casing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fmatch-casing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wooorm","download_url":"https://codeload.github.com/wooorm/match-casing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fmatch-casing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006324,"owners_count":26084085,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"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":["case","lower","lowercase","match","sentence","upper","uppercase"],"created_at":"2024-10-01T16:57:27.402Z","updated_at":"2025-10-11T05:35:23.447Z","avatar_url":"https://github.com/wooorm.png","language":"JavaScript","funding_links":["https://github.com/sponsors/wooorm"],"categories":[],"sub_categories":[],"readme":"# match-casing\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\nMatch the case of `value` to that of `base`.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`matchCasing(value, base)`](#matchcasingvalue-base)\n*   [Algorithm](#algorithm)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package matches the case (lowercase, uppercase, capitalized) of a string to\nthat of another string.\n\n## When should I use this?\n\nThis package is useful if a user wrote some word, and you want to suggest a\nreplacement, and want to make sure that the suggestion matches that of the\noriginal.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 14.14+, 16.0+), install with [npm][]:\n\n```sh\nnpm install match-casing\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {matchCasing} from 'https://esm.sh/match-casing@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {matchCasing} from 'https://esm.sh/match-casing@2?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\n```js\nimport {matchCasing} from 'match-casing'\n\nmatchCasing('foo', 'BAZ') // =\u003e 'FOO'\nmatchCasing('foo', 'Baz') // =\u003e 'Foo'\nmatchCasing('foo', 'baz') // =\u003e 'foo'\nmatchCasing('foo', 'BaZ') // =\u003e 'foo'\n\nmatchCasing('FOO', 'BAZ') // =\u003e 'FOO'\nmatchCasing('FOO', 'Baz') // =\u003e 'Foo'\nmatchCasing('FOO', 'baz') // =\u003e 'foo'\nmatchCasing('FOO', 'BaZ') // =\u003e 'FOO'\n\nmatchCasing('Foo', 'BAZ') // =\u003e 'FOO'\nmatchCasing('Foo', 'Baz') // =\u003e 'Foo'\nmatchCasing('Foo', 'baz') // =\u003e 'foo'\nmatchCasing('Foo', 'BaZ') // =\u003e 'Foo'\n\nmatchCasing('’90S', '’twas') // =\u003e '’90s'\nmatchCasing('’N’', 'a') // =\u003e '’n’'\n```\n\n## API\n\nThis package exports the identifier `matchCasing`.\nThere is no default export.\n\n### `matchCasing(value, base)`\n\nTransform the case in `value` (`string`) to match that of `base` (`string`).\n\n## Algorithm\n\n*   if `base` is uppercase, `value` is uppercased\n*   else, if `base` is lowercase, `value` is lowercased\n*   else, if the first alphabetic character in `base` is uppercase,\n    and the rest of `base` is lowercase, uppercase the first alphabetic\n    character in `value` and lowercase the rest\n*   else, return `value` unmodified\n\nThe third case deals with initial non-alphabetical characters as expected.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Compatibility\n\nThis package is at least compatible with all maintained versions of Node.js.\nAs of now, that is Node.js 14.14+ and 16.0+.\nIt also works in Deno and modern browsers.\n\n## Security\n\nThis package is safe.\n\n## Related\n\n*   [`words/emoji-emotion`](https://github.com/words/emoji-emotion)\n    — list of emoji rated for valence\n*   [`wooorm/emoticon`](https://github.com/wooorm/emoticon)\n    — info on ASCII emoticons\n*   [`wooorm/strip-skin-tone`](https://github.com/wooorm/strip-skin-tone)\n    — strip skin-tones from emoji\n*   [`wooorm.com/checkmoji`](https://wooorm.com/checkmoji/)\n    — check emoji across platforms\n\n## Contribute\n\nYes please!\nSee [How to Contribute to Open Source][contribute].\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/wooorm/match-casing/workflows/main/badge.svg\n\n[build]: https://github.com/wooorm/match-casing/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/match-casing.svg\n\n[coverage]: https://codecov.io/github/wooorm/match-casing\n\n[downloads-badge]: https://img.shields.io/npm/dm/match-casing.svg\n\n[downloads]: https://www.npmjs.com/package/match-casing\n\n[size-badge]: https://img.shields.io/bundlephobia/minzip/match-casing.svg\n\n[size]: https://bundlephobia.com/result?p=match-casing\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esmsh]: https://esm.sh\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[typescript]: https://www.typescriptlang.org\n\n[contribute]: https://opensource.guide/how-to-contribute/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwooorm%2Fmatch-casing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwooorm%2Fmatch-casing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwooorm%2Fmatch-casing/lists"}