0.4.0 • Published 1 year ago

fmt-it v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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'
0.3.0

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago