Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

humanize-list

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

humanize-list

Comma delimit an array for human readability, the Oxford comma is optional.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
269K
increased by104.02%
Maintainers
1
Weekly downloads
 
Created

What is humanize-list?

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.

What are humanize-list's main functionalities?

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'

Other packages similar to humanize-list

Keywords

FAQs

Package last updated on 23 Jun 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc