{"id":16609738,"url":"https://github.com/nbubna/Case","last_synced_at":"2025-10-29T17:30:30.520Z","repository":{"id":8793397,"uuid":"10485445","full_name":"nbubna/Case","owner":"nbubna","description":"String case utitility: convert, identify, flip, extend","archived":false,"fork":false,"pushed_at":"2023-07-18T21:23:44.000Z","size":492,"stargazers_count":282,"open_issues_count":7,"forks_count":23,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-24T03:35:18.404Z","etag":null,"topics":["camelcase","capital","case","constants","dot","javascript","kebab-case","letters","lowercase","pascal","sentence","snake","string","title","type","uppercase"],"latest_commit_sha":null,"homepage":"http://nbubna.github.io/Case/","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/nbubna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-06-04T18:16:01.000Z","updated_at":"2024-10-13T09:18:53.000Z","dependencies_parsed_at":"2022-08-19T15:20:46.663Z","dependency_job_id":"c771bad3-d172-4472-bf2c-bdbcc6c8909f","html_url":"https://github.com/nbubna/Case","commit_stats":{"total_commits":124,"total_committers":12,"mean_commits":"10.333333333333334","dds":"0.18548387096774188","last_synced_commit":"b61c98d173cf8080b05181e323ef27af8249388b"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbubna%2FCase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbubna%2FCase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbubna%2FCase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbubna%2FCase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nbubna","download_url":"https://codeload.github.com/nbubna/Case/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238362479,"owners_count":19459390,"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":["camelcase","capital","case","constants","dot","javascript","kebab-case","letters","lowercase","pascal","sentence","snake","string","title","type","uppercase"],"created_at":"2024-10-12T01:29:14.189Z","updated_at":"2025-10-29T17:30:25.159Z","avatar_url":"https://github.com/nbubna.png","language":"JavaScript","readme":"### Case: An extensible utility to convert, identify, and flip string case.\n\nDownload: [Case.min.js][min]  or  [Case.js][full]  \n[NPM][npm]: `npm install case`  (little 'c' due to NPM restrictions)  \n[NuGet][]: `Install-Package Case`  \n\n\n[![Build Status](https://img.shields.io/travis/nbubna/Case.svg)](https://travis-ci.org/nbubna/Case)\n[![NPM version](https://img.shields.io/npm/v/case.svg)][npm]\n[![NPM](https://img.shields.io/npm/dm/case.svg)][npm]\n\n[NuGet]: http://nuget.org/packages/Case/\n[min]: https://raw.github.com/nbubna/Case/master/dist/Case.min.js\n[full]: https://raw.github.com/nbubna/Case/master/dist/Case.js\n[npm]: https://npmjs.org/package/case\n\n## Documentation\nEach of the following functions will first \"undo\" previous case manipulations\nbefore applying the desired case to the given string.\n\n### Foundations\n```javascript\nCase.upper('foo_bar')     -\u003e 'FOO BAR'\nCase.lower('fooBar')      -\u003e 'foo bar'\nCase.capital('foo_v_bar') -\u003e 'Foo V Bar'\n```\n\n### Code Helpers\n```javascript\nCase.snake('Foo bar!')   -\u003e 'foo_bar'\nCase.pascal('foo.bar')   -\u003e 'FooBar'\nCase.camel('foo, bar')   -\u003e 'fooBar'\nCase.kebab('Foo? Bar.')  -\u003e 'foo-bar'\nCase.header('fooBar=')   -\u003e 'Foo-Bar'\nCase.constant('Foo-Bar') -\u003e 'FOO_BAR'\n```\n\n\n### UI Helpers\n```javascript\nCase.title('foo v. bar')                    -\u003e 'Foo v. Bar'\nCase.sentence('\"foo!\" said bar', ['Bar'])   -\u003e '\"Foo!\" said Bar'\nCase.sentence('the 12 oz. can', null, ['oz'])   -\u003e 'The 12 oz. can'\n```\n`Case.sentence(str, names, abbreviations)` accepts an array of proper names that should be capitalized,\nregardless of location in the sentence. This function is specialized, but useful\nwhen dealing with input generated with capslock on (i.e. everything my grandma types).\nIt can also accept a list of abbreviations (words that may end in a period but aren't meant\nto end a sentence).\n\n\n### Custom Casing\n```javascript\nCase.lower('FOO-BAR', '.')                  -\u003e 'foo.bar'\nCase.upper('Foo? Bar.', '__')               -\u003e 'FOO__BAR'\nCase.capital('fooBar', ' + ')               -\u003e 'Foo + Bar'\n\nCase.lower(\"Don't keep 'em!\", \"/\", true)    -\u003e 'dont/keep/em'\nCase.capital(\"'ello, world.\", null, true)   -\u003e 'Ello, World.'\n```\n`Case.upper`, `Case.lower`, and `Case.capital` accept an optional \"fill\" value\nthat will replace any characters which are not letters and numbers. All three also accept \na third optional boolean argument indicating if apostrophes are to be stripped out or left in.\nFor example, programmatic case changes (snake, kebab, pascal, camel, constant) are best without\napostrophes, but user-facing ones (title, sentence) do not want \"don't\" turned into \"Dont\".\n\n\n### Extending Case\n```javascript\nCase.type('bang', function(s) {\n    return Case.upper(s, '!')+'!';\n});\nCase.bang('bang')       -\u003e 'BANG!'\nCase.of('TEST!THIS!')   -\u003e 'bang'\n```\n`Case.type(name, fn)`: extends Case, creating a new function on `Case` and adding `Case.of` support automatically.\n\n\n### Utilities\n```javascript\nCase.of('foo')          -\u003e 'lower'\nCase.of('foo_bar')      -\u003e 'snake'\nCase.of('Foo v Bar')    -\u003e 'title'\nCase.of('foo_ Bar')     -\u003e undefined\n\nCase.of('Hello there, Bob!', ['Bob']) -\u003e 'sentence'\n\nCase.flip('FlipMe')     -\u003e 'fLIPmE'\nCase.flip('TEST THIS!') -\u003e 'test this!'\n\nCase.random('Hello!')   -\u003e 'hElLO!'\n```\n* `Case.of(str[, names])`: identifies the case of a string, returns undefined if it doesn't match a known type\n* `Case.flip(str)`: reverses the case of letters, no other changes\n* `Case.random(str)`: randomizes the case of letters, no other changes\n\n\n## Release History\n* 2013-06-10 [v1.0.0][] (public, initial)\n* 2013-06-20 [v1.0.1][] (regex improvements)\n* 2013-08-23 [v1.0.3][] (better support for Node, Component and AMD)\n* 2014-10-24 [v1.1.2][] (regexps used are now extensible and support more latin diacritics)\n* 2015-01-27 [v1.2.0][] (deprecate squish in favor of pascal)\n* 2015-01-28 [v1.2.1][] (fix UMD regression)\n* 2015-10-27 [v1.3.0][] (Case.kebab and Case.random)\n* 2015-12-02 [v1.3.2][] (fix title case when small word is first or last)\n* 2016-02-01 [v1.3.3][] (Case.of('foo') to return lower, not snake)\n* 2016-02-07 [v1.4.0][] (fix apostrophe handling)\n* 2016-02-08 [v1.4.1][] (fix swallowed prefix/suffix on lone words)\n* 2016-11-11 [v1.4.2][] (add typings for TypeScript support)\n* 2017-03-09 [v1.5.2][] (add Header-Case and expose noApostrophes option for upper/lower/capital fns)\n* 2017-07-11 [v1.5.3][] (Case.of and to[Type]Case functions should accept extra arguments, like the rest)\n* 2017-10-23 [v1.5.4][] (Shift order of Case.of tests to prioritize 'capital' over 'header')\n* 2018-05-04 [v1.5.5][] (Fix issue #26, corner case of bad \"decamelizing\" of string w/number after caps)\n* 2018-11-15 [v1.6.0][] (PR #29, support 'abbreviations' argument for Case.sentence to avoid incorrect sentence ends)\n* 2019-01-11 [v1.6.1][] (PR #30, update typings to include 'abbreviations' argument for Case.sentence)\n* 2019-07-26 [v1.6.2][] (PR #31, allow importing as default)\n* 2020-03-24 [v1.6.3][] (PR #33, update license structure in package.json for automated checkers)\n\n[v1.0.0]: https://github.com/nbubna/store/tree/1.0.0\n[v1.0.1]: https://github.com/nbubna/store/tree/1.0.1\n[v1.0.3]: https://github.com/nbubna/store/tree/1.0.3\n[v1.1.2]: https://github.com/nbubna/store/tree/1.1.2\n[v1.2.0]: https://github.com/nbubna/store/tree/1.2.0\n[v1.2.1]: https://github.com/nbubna/store/tree/1.2.1\n[v1.3.0]: https://github.com/nbubna/store/tree/1.3.0\n[v1.3.2]: https://github.com/nbubna/store/tree/1.3.2\n[v1.3.3]: https://github.com/nbubna/store/tree/1.3.3\n[v1.4.0]: https://github.com/nbubna/store/tree/1.4.0\n[v1.4.1]: https://github.com/nbubna/store/tree/1.4.1\n[v1.4.2]: https://github.com/nbubna/store/tree/1.4.2\n[v1.5.2]: https://github.com/nbubna/store/tree/1.5.2\n[v1.5.3]: https://github.com/nbubna/store/tree/1.5.3\n[v1.5.4]: https://github.com/nbubna/store/tree/1.5.4\n[v1.5.5]: https://github.com/nbubna/store/tree/1.5.5\n[v1.6.0]: https://github.com/nbubna/store/tree/1.6.0\n[v1.6.1]: https://github.com/nbubna/store/tree/1.6.1\n[v1.6.2]: https://github.com/nbubna/store/tree/1.6.2\n[v1.6.3]: https://github.com/nbubna/store/tree/1.6.3","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbubna%2FCase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnbubna%2FCase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbubna%2FCase/lists"}