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

and

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

and

Join arrays with commas and »and« before the last item

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13K
increased by4.8%
Maintainers
1
Weekly downloads
 
Created
Source

And

Join arrays with commas and »and« before the last item

Build Status Coverage Status Dependency Status Dependency Status

Installation

npm install and

Usage

const and = require('and');

console.log(and(['John', 'Frank', 'Jimmy'])); // = 'John, Frank & Jimmy'

console.log(and(['John', 'Frank'])); // = 'John & Frank'

console.log(and(['Frank'])); // = 'Frank'

console.log(and(['John', 'Frank', 'Jimmy'], 'and')); // = 'John, Frank and Jimmy'

console.log(and(['John', 'Frank', 'Jimmy'], 'or')); // = 'John, Frank or Jimmy'

console.log(and(['John', 'Frank', 'Jimmy'], 'and', true)); // = 'John, Frank, and Jimmy'

API

and accepts the following three parameters.

data

Input data.

Example: ['John', 'Frank', 'Jimmy']

separator

The separator to be used for the last item.

Example: and

Default: & (= language-independent)

oxfordComma

Use oxford comma in front of the last separator?

Example: true (= 'John, Frank, and Jimmy')

Default: false (= 'John, Frank and Jimmy')

Changelog

  • 0.0.3
    • Fix oxford comma for <3 items
  • 0.0.2
    • Fix README
  • 0.0.1
    • Initial version

License

Copyright (c) 2018 Thomas Rasshofer
Licensed under the MIT license.

See LICENSE for more info.

Keywords

FAQs

Package last updated on 13 Jan 2018

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