@chumnend/capitalize

This package is used to capitalize the letters of a given string

Usage no npm install needed!

<script type="module">
  import chumnendCapitalize from 'https://cdn.skypack.dev/@chumnend/capitalize';
</script>

README

Capitalize

A package for capitalizing letters. This is my first published npm pacakge, created for me to experiment with the process.

Installation

npm install @chumnend/capitalize

Usage

Import the package into your project,

const capitalize = require('@chumnend/capitalize');

Capitalize all letters

const str = 'hello world'
const res = capitalize(str);
console.log(res); // Outputs: 'HELLO WORLD'

Capitalize only first character

const str = 'hello world'
const res = capitalize(str, 'first');
console.log(res); // Outputs: 'Hello world'

Capitalize first character of each word

const str = 'hello world'
const res = capitalize(str, 'words');
console.log(res); // Outputs: 'Hello World'