https://github.com/zekth/deno_case_style
A string validator and formater for case Style
https://github.com/zekth/deno_case_style
camelcase deno kebabcase pascalcase snakecase string-manipulation
Last synced: 1 day ago
JSON representation
A string validator and formater for case Style
- Host: GitHub
- URL: https://github.com/zekth/deno_case_style
- Owner: zekth
- License: mit
- Created: 2019-04-30T15:51:54.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-13T19:49:12.000Z (almost 6 years ago)
- Last Synced: 2025-03-27T21:11:35.764Z (19 days ago)
- Topics: camelcase, deno, kebabcase, pascalcase, snakecase, string-manipulation
- Language: TypeScript
- Size: 5.86 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deno - deno_case_style - 不同大小写样式的字符串验证器和格式化程序。 例如:camelCase等。 (Uncategorized / Uncategorized)
- awesome-deno-cn - @zekth/deno_case_style
- awesome-deno - deno_case_style - String validator and formater for different case style. eg: camelCase etc.  (Modules / Online Playgrounds)
- awesome-deno - deno_case_style - String validator and formater for different case style. eg: camelCase etc. (Modules / String utils)
README
# Deno Case Style [](https://travis-ci.org/zekth/deno_case_style)
A string validator and formater for case Style
## Validate
Returns a boolean if the string is validated by the style Case:
```ts
import { validate } from "./mod.ts";validate("SALADE-TOMATE-OIGNONS", caseStyle.screamingKebabCase); // true
validate("DIZ_IZ_DA_GLOBAL_VAL", caseStyle.screamingSnakeCase); // true
validate("SmokingIsBad", caseStyle.camelCase); // false
validate("imNotPascal", caseStyle.pascalCase); // false
```## Format
Format the input string to the wanted style case
```ts
import { format } from "./mod.ts";format("FOO Bar", caseStyle.kebabCase); // output: foo-bar
format("FOO Bar", caseStyle.snakeCase); // output: foo_bar
format("FOO Bar", caseStyle.camelCase); // output: fooBar
format("FOO Bar", caseStyle.pascalCase); // output: FooBar
format("FOO Bar", caseStyle.kebabCase); // output: foo-bar
format("FOO Bar", caseStyle.screamingKebabCase); // output: FOO-BAR
format("FOO Bar", caseStyle.screamingSnakeCase); // output: FOO_BAR```