fmt-it
v0.4.0
Published
Format string tool.
Downloads
4
Readme
fmt-it
A format string tool.
Types
export type AllowingInput = string | Readonly<string>
export type FmtFn = (input: AllowingInput, ...args: any[]) => string
Utilities
1. camelCase
function camelCase(input: AllowingInput): string
2. pluralize
function pluralize(input: AllowingInput, count?: number): string
3. singularize
function singularize(input: AllowingInput): string
4. addSpace
function addSpace(input: AllowingInput): string
5. pascalCase
function pascalCase(input: AllowingInput): string
helper
1. pipeFmt
function pipeFmt(value: AllowingInput): {
then: (fn: FmtFn) => pipeFmt
get: () => string
}
example
function camelCaseAndPluralize(input: AllowingInput, count: number) {
return pipe(input)
.then(input => camelCase(input))
.then(res => pluralize(res, count))
}
camelCaseAndPluralize(input, 2).get() // => 'twoApples'