Alphabetically groups an array of strings.
Install with npm
:
npm install alphabetical-group
First, require the module:
const alphabeticalGroup = require("alphabetical-group");
Simply input an array of stringable values:
alphabeticalGroup([
"alpha",
"bravo",
"charlie",
"Chestnut",
"yesterday",
]);
This will return an object that will look like this:
{
"c": [
"Chestnut",
"charlie"
],
"a": [
"alpha"
],
"b": [
"bravo"
],
"y": [
"yesterday"
]
}