@mnrendra/util-readable-list
v1.0.0
Published
A utility to convert an array into readable text.
Downloads
3
Maintainers
Readme
@mnrendra/util-readable-list
A utility to convert an array into readable text.
Install
npm i @mnrendra/util-readable-list
Usage
import { readableList } from '@mnrendra/util-readable-list'
console.log(readableList(['a'])) // Will print: a
console.log(readableList(['a'], { quote: '"' })) // Will print: "a"
console.log(readableList(['a', 'b'])) // Will print: a and b
console.log(readableList(['a', 'b'], { conj: 'or' })) // Will print: a or b
console.log(readableList(['a', 'b'], { quote: '`' })) // Will print: `a` and `b`
console.log(readableList(['a', 'b'], { quote: '\'', conj: 'or' })) // Will print: 'a' or 'b'
console.log(readableList(['a', 'b', 'c'], { quote: '"', conj: 'or' })) // Will print: "a", "b", or "c"
console.log(readableList(['a', 'b', 'c'], { quote: '"', conj: 'or', comma: ';' })) // Will print: "a"; "b"; or "c"
console.log(readableList(['a', 'b', 'c']. { comma: ';' })) // Will print: a; b; and c
Types
import type {
Options
} from '@mnrendra/util-readable-list'