
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
humanize-list
Advanced tools
Comma delimit an array for human readability, the Oxford comma is optional.
The humanize-list npm package is designed to convert arrays into human-readable strings. It is particularly useful for creating natural language lists from array data, making it easier to display lists in a user-friendly format.
Basic List Humanization
This feature converts an array of items into a human-readable string, using commas and the word 'and' before the last item.
const humanizeList = require('humanize-list');
const items = ['apples', 'oranges', 'bananas'];
const humanized = humanizeList(items);
console.log(humanized); // Output: 'apples, oranges, and bananas'
Custom Conjunction
This feature allows you to customize the conjunction used in the list. In this example, the word 'or' is used instead of 'and'.
const humanizeList = require('humanize-list');
const items = ['apples', 'oranges', 'bananas'];
const humanized = humanizeList(items, { conjunction: 'or' });
console.log(humanized); // Output: 'apples, oranges, or bananas'
Serial Comma
This feature allows you to control the use of the serial comma (Oxford comma). Setting `serialComma` to false omits the comma before the conjunction.
const humanizeList = require('humanize-list');
const items = ['apples', 'oranges', 'bananas'];
const humanized = humanizeList(items, { serialComma: false });
console.log(humanized); // Output: 'apples, oranges and bananas'
The oxford-comma package provides similar functionality by converting arrays into human-readable strings with an emphasis on the Oxford comma. It offers customization options for conjunctions and serial commas, similar to humanize-list.
The listify package also converts arrays into human-readable strings. It is highly customizable, allowing for different conjunctions, separators, and formatting options. It is comparable to humanize-list in terms of flexibility and ease of use.
The array-to-sentence package focuses on converting arrays into readable sentences. It provides options for conjunctions and serial commas, making it a good alternative to humanize-list for creating natural language lists.
Comma delimit an array for human readability, the Oxford comma is optional.
npm install --save humanize-list
var humanizeList = require('humanize-list')
humanizeList(['apples', 'tomatoes', 'unicorns']) // => 'apples, tomatoes and unicorns'
humanizeList(['apples', 'tomatoes', 'unicorns'], { oxfordComma: true }) // => 'apples, tomatoes, and unicorns'
humanizeList(['apples', 'tomatoes', 'unicorns'], { conjunction: 'or' }) // => 'apples, tomatoes or unicorns'
humanizeList(['apples', 'tomatoes', 'unicorns'], { skipConjunction: true }) // => 'apples, tomatoes, unicorns'
oxfordComma
Boolean - Specify whether the Oxford comma should be included. Default: false
conjunction
String - Specify a conjunction. Default: 'and'
skipConjunction
Boolean - Skip the conjunction altogether. Default: false
MIT
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Crafted with <3 by John Otander (@4lpine).
This package was initially generated with yeoman and the p generator.
FAQs
Comma delimit an array for human readability, the Oxford comma is optional.
The npm package humanize-list receives a total of 207,659 weekly downloads. As such, humanize-list popularity was classified as popular.
We found that humanize-list demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.