{"id":13757603,"url":"https://github.com/unjs/scule","last_synced_at":"2025-06-10T22:41:42.013Z","repository":{"id":41886061,"uuid":"339548309","full_name":"unjs/scule","owner":"unjs","description":"🧵 String Case Utils","archived":false,"fork":false,"pushed_at":"2025-05-05T17:36:10.000Z","size":431,"stargazers_count":425,"open_issues_count":21,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-05T18:51:44.177Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/unjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-16T22:27:40.000Z","updated_at":"2025-04-26T00:56:52.000Z","dependencies_parsed_at":"2024-01-07T17:07:07.203Z","dependency_job_id":"56300385-0086-4299-b71e-7934d4efdee0","html_url":"https://github.com/unjs/scule","commit_stats":{"total_commits":52,"total_committers":7,"mean_commits":7.428571428571429,"dds":0.5576923076923077,"last_synced_commit":"249072ac10d1f441a23eb9df7bcb1bfc1e13d419"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unjs%2Fscule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unjs%2Fscule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unjs%2Fscule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unjs%2Fscule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unjs","download_url":"https://codeload.github.com/unjs/scule/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253371076,"owners_count":21897998,"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":[],"created_at":"2024-08-03T12:00:41.705Z","updated_at":"2025-05-10T05:32:12.737Z","avatar_url":"https://github.com/unjs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript",":books: Libraries"],"sub_categories":["Universal"],"readme":"# 🧵 Scule\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![bundle][bundle-src]][bundle-href]\n[![Codecov][codecov-src]][codecov-href]\n\n\u003c!-- ![](.github/banner.svg) --\u003e\n\n## Install\n\nInstall using npm or yarn:\n\n```bash\nnpm i scule\n```\n\nImport:\n\n```js\n// CommonJS\nconst { pascalCase } = require(\"scule\");\n\n// ESM\nimport { pascalCase } from \"scule\";\n```\n\n**Notice:** You may need to transpile package for legacy environments.\n\n## Utils\n\n### `pascalCase(str, opts?: { normalize })`\n\nSplits string and joins by PascalCase convention:\n\n```ts\npascalCase(\"foo-bar_baz\");\n// FooBarBaz\n```\n\n**Notice:** If an uppercase letter is followed by other uppercase letters (like `FooBAR`), they are preserved. You can use `{ normalize: true }` for strictly following pascalCase convention.\n\n### `camelCase(str, opts?: { normalize })`\n\nSplits string and joins by camelCase convention:\n\n```ts\ncamelCase(\"foo-bar_baz\");\n// fooBarBaz\n```\n\n### `kebabCase(str)`\n\nSplits string and joins by kebab-case convention:\n\n```ts\nkebabCase(\"fooBar_Baz\");\n// foo-bar-baz\n```\n\n**Notice:** It does **not** preserve case.\n\n### `snakeCase`\n\nSplits string and joins by snake_case convention:\n\n```ts\nsnakeCase(\"foo-barBaz\");\n// foo_bar_baz\n```\n\n### `flatCase`\n\nSplits string and joins by flatcase convention:\n\n```ts\nflatCase(\"foo-barBaz\");\n// foobarbaz\n```\n\n### `trainCase(str, opts?: { normalize })`\n\nSplit string and joins by Train-Case (a.k.a. HTTP-Header-Case) convention:\n\n```ts\ntrainCase(\"FooBARb\");\n// Foo-Ba-Rb\n```\n\n**Notice:** If an uppercase letter is followed by other uppercase letters (like `WWWAuthenticate`), they are preserved (=\u003e `WWW-Authenticate`). You can use `{ normalize: true }` for strictly only having the first letter uppercased.\n\n### `titleCase(str, opts?: { normalize })`\n\nWith Title Case all words are capitalized, except for minor words.\nA compact regex of common minor words (such as `a`, `for`, `to`) is used to automatically keep them lower case.\n\n```ts\ntitleCase(\"this-IS-aTitle\");\n// This is a Title\n```\n\n### `upperFirst(str)`\n\nConverts first character to upper case:\n\n```ts\nupperFirst(\"hello world!\");\n// Hello world!\n```\n\n### `lowerFirst(str)`\n\nConverts first character to lower case:\n\n```ts\nlowerFirst(\"Hello world!\");\n// hello world!\n```\n\n### `splitByCase(str, splitters?)`\n\n- Splits string by the splitters provided (default: `['-', '_', '/', '.']`)\n- Splits when case changes from lower to upper or upper to lower\n- Ignores numbers for case changes\n- Case is preserved in returned value\n- Is an irreversible function since splitters are omitted\n\n## Development\n\n- Clone this repository\n- Install latest LTS version of [Node.js](https://nodejs.org/en/)\n- Enable [Corepack](https://github.com/nodejs/corepack) using corepack enable\n- Install dependencies using pnpm install\n- Run interactive tests using pnpm dev\n\n## License\n\n[MIT](./LICENSE)\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/scule?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[npm-version-href]: https://npmjs.com/package/scule\n[npm-downloads-src]: https://img.shields.io/npm/dm/scule?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[npm-downloads-href]: https://npmjs.com/package/scule\n[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/scule/main?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[codecov-href]: https://codecov.io/gh/unjs/scule\n[bundle-src]: https://img.shields.io/bundlephobia/minzip/scule?style=flat\u0026colorA=18181B\u0026colorB=F0DB4F\n[bundle-href]: https://bundlephobia.com/result?p=scule\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funjs%2Fscule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funjs%2Fscule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funjs%2Fscule/lists"}