@writetome51/get-alphabetical-range
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

getAlphabeticalRange(
      startingLetter,
      endingLetter,
      increment? = 1
): string[]

Returns array of English letters in ascending or descending order, depending on what
startingLetter and endingLetter are, and which comes first in the alphabet.
If startingLetter is uppercase, the returned letters will all be uppercase.

Examples

getAlphabeticalRange('a', 'f');
    // --> ["a", "b", "c", "d", "e", "f"]
    
getAlphabeticalRange('f', 'a');
    // --> ["f", "e", "d", "c", "b", "a"]
    
getAlphabeticalRange('a', 'o', 2);
    // --> [ 'a', 'c', 'e', 'g', 'i', 'k', 'm', 'o' ]
    
getAlphabeticalRange('A', 'o', 2);
    // --> [ 'A', 'C', 'E', 'G', 'I', 'K', 'M', 'O' ]
    
getAlphabeticalRange('z', 'M', 3);
    // --> [ 'z', 'w', 't', 'q', 'n' ]
    
getAlphabeticalRange('M', 'z', 3);
    // --> [ 'M', 'P', 'S', 'V', 'Y' ]

Installation

npm i @writetome51/get-alphabetical-range

Loading

// if using TypeScript:
import {getAlphabeticalRange} from '@writetome51/get-alphabetical-range';
// if using ES5 JavaScript:
var getAlphabeticalRange = 
    require('@writetome51/get-alphabetical-range').getAlphabeticalRange;

License

MIT

Package Sidebar

Install

npm i @writetome51/get-alphabetical-range

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

17.9 kB

Total Files

9

Last publish

Collaborators

  • writetome51