2.0.5 • Published 2 months ago

@zerodep/string-titlecase v2.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@zerodep/string-titlecase

version language types license

CodeFactor Known Vulnerabilities

A utility to convert the first letter of each word to an uppercase value, with special exceptions for English contractions and possessives. Non-string values will cause a ZeroDepError to be thrown.

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

import { stringTitleCase } from '@zerodep/string-titlecase';
// or
const { stringTitleCase } = require('@zerodep/string-titlecase');

Successful Response

stringTitleCase('california'); // "California"
stringTitleCase('New york'); // "New York"
stringTitleCase('sanchez-ferrero'); // "Sanches-Ferrero"
stringTitleCase('this is IMPORANT'); // "This Is IMPORANT"
stringTitleCase("o'neill"); // "O'Neill"
stringTitleCase('3.14 pi'); // "3.14 Pi"
stringTitleCase('éclair'); // "Éclair"
stringTitleCase("john's"); // "John's"
stringTitleCase("i'll be there"); // "I'll Be There"
stringTitleCase(''); // ""

Unsuccessful Response

stringTitleCase({ not: 'a string' }); // throws ZeroDepError: Value is not a string
2.0.5

2 months ago

2.0.4

2 months ago

2.0.3

7 months ago

2.0.1

10 months ago