budibase/packages/backend-core/node_modules/join-component
Budibase Helm Bot c1e5378350 Helm Release: 1.2.36 2022-08-11 08:17:28 +00:00
..
test Helm Release: 1.2.36 2022-08-11 08:17:28 +00:00
.npmignore Helm Release: 1.2.36 2022-08-11 08:17:28 +00:00
History.md Helm Release: 1.2.36 2022-08-11 08:17:28 +00:00
Makefile Helm Release: 1.2.36 2022-08-11 08:17:28 +00:00
Readme.md Helm Release: 1.2.36 2022-08-11 08:17:28 +00:00
component.json Helm Release: 1.2.36 2022-08-11 08:17:28 +00:00
index.js Helm Release: 1.2.36 2022-08-11 08:17:28 +00:00
package.json Helm Release: 1.2.36 2022-08-11 08:17:28 +00:00

Readme.md

join

Join a list in a nice human friendly way.

Installation

$ component install component/join

API

join(arr)

should default to "and".

join(['foo', 'bar']).should.equal('foo and bar');

join(arr, str)

should join.

join([], 'and').should.equal('');
join(['foo'], 'and').should.equal('foo');
join(['foo', 'bar'], 'and').should.equal('foo and bar');
join(['foo', 'bar', 'baz'], 'or').should.equal('foo, bar or baz');

join(arr, str) with Oxford comma

should remove comma with less than 3 items.

join([], ', or').should.equal('');
join(['foo'], ', or').should.equal('foo');
join(['foo', 'bar'], ', or').should.equal('foo or bar');

should join with 3 or more items.

join(['foo', 'bar', 'baz'], ', and').should.equal('foo, bar, and baz');

License

MIT