DmnChzl/Stringify

Utilities for string transformation

★ 0Forks 0TypeScriptGitHub ↗Compare

README

Stringify

0.2.0

Utilities for string transformation, published on JSR.

Installation

First of all, you need to install the package:

npx jsr add @dmnchzl/stringify
Equivalent with Yarn
yarn dlx jsr add @dmnchzl/stringify
Equivalent with pNPM
pnpm dlx jsr add @dmnchzl/stringify
Equivalent with Deno
deno add @dmnchzl/stringify
Equivalent with Bun
bunx jsr add @dmnchzl/stringify

Utilities

Below, the list of all available utilities:

toCamelCase

Set case of a string to 'camelCase'

import { toCamelCase } from '@dmnchzl/stringify';

console.log(toCamelCase('Hello World')); // helloWorld

toKebabCase

Set case of a string to 'kebab-case'

import { toKebabCase } from '@dmnchzl/stringify';

console.log(toKebabCase('Hello World')); // hello-world

toPascalCase

Set case of a string to 'PascalCase'

import { toPascalCase } from '@dmnchzl/stringify';

console.log(toPascalCase('Hello World')); // HelloWorld

toSnakeCase

Set case of a string to 'snake_case'

import { toSnakeCase } from '@dmnchzl/stringify';

console.log(toSnakeCase('Hello World')); // hello_world

getWords

Extract words from string

import { getWords } from '@dmnchzl/stringify';

console.log(getWords('Hello World')); // ['Hello', 'World']

countWords

Count words from string

import { countWords } from '@dmnchzl/stringify';

console.log(countWords('Hello World')); // 2

License

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                   Version 2, December 2004

Copyright (C) 2024 Damien Chazoule <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

 0. You just DO WHAT THE FUCK YOU WANT TO.

Contributors

DmnChzl

Issues