1-2and3
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

1, 2, and 3


GitHub Workflow Status (with event) Codecov npm NPM

NPM

This utility joins array elements with , and last element with and

Suppose if you want to join all elements of string array, but not just with the , .

This utility is here to just solve that tiny problem.

Let's see how to use.

import join from '1-2and3'

join(['1', '2', '3', '4']) // 1, 2, 3 and 4
join(['1', '2']) // 1 and 2
join(['1']) // 1
join([]) //
join(['1', '2', '3', '4'], ', ', '&') // 1, 2, 3 & 4

Element separator can be customized by passing second parameter to function.

Last element separator also can be customized by passing third argument to function

License

MIT

Package Sidebar

Install

npm i 1-2and3

Weekly Downloads

11

Version

1.1.0

License

MIT

Unpacked Size

4.75 kB

Total Files

5

Last publish

Collaborators

  • ninad