1.1.6 • Published 2 years ago

title-case-edward v1.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Title Case

About

Lets you call a function, titleCase, to transform a sentence into title case with the option of having some protected words.

Installation

npm i title-case-edward

Usage

Transform a sentence

You can pass the function a string which is will transform to tile case with the following rules:

  • The first and last word will always be capitalized,
  • words of three letters or less will not be capitalized,
  • only the first element of a hyphenated compound will be capitalized,
  • spelt-out numbers will be capitalized,
  • both elements of hyphenated, spelt-out numbers will be capitalized.

Example:

const titleCase = require("title-case-edward");

titleCase("i have twenty-two reasons to use this package"); //=> "I Have Twenty-Two Reasons to use This Package"

Include protected words

You can optionally pass the function a second argument of an array. The matching strings in the sentence will always be displayed the same way as in the array.

Example:

const titleCase = require("title-case-edward");

titleCase("how an fMRI is used"); //=> "How an Fmri is Used" ⛔️
titleCase("how an fMRI is used", ["fMRI"]); //=> "How an fMRI is Used" ✅
1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago