Quote a value.
- What is this?
- When should I use this?
- Install
- Use
- API
- 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. In Node.js (version 14.14+, 16.0+), install with npm:
npm install quotation
In Deno with esm.sh
:
import {quotation} from 'https://esm.sh/quotation@2'
In browsers with esm.sh
:
<script type="module">
import {quotation} from 'https://esm.sh/quotation@2?bundle'
</script>
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.
value
(string
orstring[]
) — value to wrap in quotesopen
(string
, default:"
) — character to add at start ofvalue
close
(string
, default:open
or"
) — character to add at end ofvalue
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.