Skip to content

This is a simple Node.js package that allows you to create strings that alternate in case.

License

Notifications You must be signed in to change notification settings

haykam821/Alternating-Case

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alternating Case

GitHub release npm GitHub Workflow Status

This is a simple Node.js package that allows you to create strings that alternate in case.

Installation

To start using this package, simply install from NPM:

npm install alternating-case --save

Usage

After installation, you can just require the package to use it:

const altCase = require("alternating-case");

This package exports a single function:

altCase(input, capsOnOdds);

The first argument, input is the string you are trying to manipulate. While by default capital letters will be on odd characters, you can make it capitalize even characters instead by changing the second argument, capsOnOdds, to false.

Examples

altCase("hello"); // "HeLlO"

altCase("should we capitalize odd characters?"); // "ShOuLd wE CaPiTaLiZe oDd cHaRaCtErS?"
altCase("should we capitalize odd characters?", true); // "ShOuLd wE CaPiTaLiZe oDd cHaRaCtErS?"
altCase("should we capitalize odd characters?", false); // "sHoUlD We cApItAlIzE OdD ChArAcTeRs?"

altCase("The quick, brown fox jumps over the lazy dog."); // "ThE QuIcK, bRoWn fOx jUmPs oVeR ThE LaZy dOg."

altCase("No need to worry; áccents are preserved."); // "No nEeD To wOrRy; ÁcCeNtS ArE PrEsErVeD."

Have fun!

About

This is a simple Node.js package that allows you to create strings that alternate in case.

Resources

License

Stars

Watchers

Forks

Packages