Quote a value
npm install quotation[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Quote a value.
* What is this?
* When should I use this?
* Install
* Use
* API
* [quotation(value[, open[, close]])](#quotationvalue-open-close)
* Types
* Compatibility
* Security
* Contribute
* License
This package makes it quite easy to quote one or more values.
Use this package if you need to quote one or more strings with straight or smart
quotes.
This package is [ESM only][esm].
In Node.js (version 14.14+, 16.0+), install with [npm][]:
``sh`
npm install quotation
In Deno with [esm.sh][esmsh]:
`js`
import {quotation} from 'https://esm.sh/quotation@2'
In browsers with [esm.sh][esmsh]:
`html`
`js
import {quotation} from 'quotation'
quotation('one') // => '"one"'
quotation(['one', 'two']) // => ['"one"', '"two"']
quotation('one', "'") // => "'one'"
quotation('one', '“', '”') // => '“one”'
`
This package exports the identifier quotation.
There is no default export.
Quote a value.
###### Parameters
* value (string or string[])open
— value to wrap in quotes
* (string, default: ")value
— character to add at start of close
* (string, default: open or ")value`
— character to add at end of
This package is fully typed with [TypeScript][].
It exports no additional types.
This package is at least compatible with all maintained versions of Node.js.
As of now, that is Node.js 14.14+ and 16.0+.
It also works in Deno and modern browsers.
This package is safe.
Yes please!
See [How to Contribute to Open Source][contribute].
[MIT][license] © [Titus Wormer][author]
[build-badge]: https://github.com/wooorm/quotation/workflows/main/badge.svg
[build]: https://github.com/wooorm/quotation/actions
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/quotation.svg
[coverage]: https://codecov.io/github/wooorm/quotation
[downloads-badge]: https://img.shields.io/npm/dm/quotation.svg
[downloads]: https://www.npmjs.com/package/quotation
[size-badge]: https://img.shields.io/bundlephobia/minzip/quotation.svg
[size]: https://bundlephobia.com/result?p=quotation
[npm]: https://docs.npmjs.com/cli/install
[esmsh]: https://esm.sh
[license]: license
[author]: https://wooorm.com
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[typescript]: https://www.typescriptlang.org
[contribute]: https://opensource.guide/how-to-contribute/