Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.01 KB

README.md

File metadata and controls

53 lines (41 loc) · 1.01 KB

Alphabetical Group

GitHub release npm Travis (.com)

Alphabetically groups an array of strings.

Installation

Install with npm:

npm install alphabetical-group

Usage

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"
	]
}