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

arrford

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arrford

Array to human readable list converter

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
increased by26.47%
Maintainers
1
Weekly downloads
 
Created
Source

arrford

npm version Build Status NPM downloads

Array to human readable list converter


Install

Node
npm install --save arrford
Web

arrford is exported for web and usable with the variable arrford

<script src="https://rawgit.com/dawsonbotsford/arrford/master/bundle.js"></script>

Usage

// remove require statement if using the web bundle
const arrford = require('arrford');

arrford(['run', 'climb', 'jump!']);
//=> 'run, climb, and jump!'

Fewer than 3 elements in array
arrford(['run', 'climb!']);
//=> 'run and climb!'

arrford(['run!']);
//=> 'run!'

Abort the Oxford comma
arrford(['run', 'climb', 'jump!'], false);
//=> 'run, climb and jump!'

Replace the word 'and'
arrford(['spring', 'klättra', 'hoppa!'], true, 'och');
//=> 'spring, klättra, och hoppa!'

Replace the word 'and' and abort the Oxford comma
arrford(['spring', 'klättra', 'hoppa!'], false, 'och');
//=> 'spring, klättra och hoppa!'

API

arrford(target [, oxford, join])


target

Type: Array of strings


oxford

optional

Type: boolean

Default: true

Description: whether to use the Oxford comma or not


join

optional

Type: string

Default: 'and'

Description: word used to join the list with the last element


returns

Type: string

Description: Take an array of strings and return a string of these items as a list. Insert "," and "and" in a grammatically correct way. Follow the Oxford comma trend unless false is passed in for the second argument. Use the word 'and' to join the list unless some other "join" word is specified for the third argument.


License

MIT © Dawson Botsford

Keywords

FAQs

Package last updated on 06 Jun 2016

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