Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

capitalize-ts

everdimension327MIT1.0.0TypeScript support: included

A typed capitalize helper which utilizes the Capitalize generic

capitalize, capitalise, first letter, typescript, helper

readme

Capitalize

A helper in typescript for capitalizing first letter in a string, leaving rest letter untouched

Usage

import { capitalize } from 'capitalize-ts';

capitalize('hello'); // 'Hello'
capitalize('hello, World'); // 'Hello World'

Install

npm install capitalize-ts

Strict Typing

Leverage the built-in Capitalize generic for more precise typing

const result = capitalize('hello');
// type of `result` is Hello instead of string