Skip to content

abranhe/transform-string

Repository files navigation

transform-string Build Status

Transform any string using properties CSS like

Install

$ npm install transform-string

Usage

const transformString = require('transform-string');

transformString('unicorns');
//=> 'Unicorns'

transformString.lowercase('Hello World');
//=> 'hello world'

or

import transformString, { capitalize } from 'transform-string';

transformString('unicorns');
//=> 'Unicorns'

capitalize('hello world');
//=> 'Hello World'

API

transformString(input, [options])

input

Type: string

The input to be transformed

options

Type: object

type

Type: string
Default: title

String transform type.

Types:

  • title
  • capitalize
  • lowercase
  • uppercase

title(input)

input

Type: string

Capitalizes first letter of string

capitalize(input)

input

Type: string

Capitalizes first letter of each word in string

lowercase(input)

input

Type: string

Converts all to lowercase

uppercase(input)

input

Type: string

Converts all to uppercase

Related

License

MIT © Abraham Hernandez