1.0.2 • Published 5 years ago

@writetome51/get-alphabetical-range v1.0.2

Weekly downloads
10
License
MIT
Repository
-
Last release
5 years ago

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