quote-quote
Version:
Convert straight quotes to curly quotes — also known as smart quotes.
20 lines (19 loc) • 750 B
TypeScript
import type { ConvertOptions } from './types.js';
/**
* Convert straight quotes to curly quotes.
*
* This includes:
* - Straight single/double quotes to left/right quotation marks,
* - Straight quotes used as primes to proper prime symbols.
* - Contractions and possessives like "don't", "it's", or "John's",
*
* @param {string} text - the text that may contain straight quotes
* @param {Object} [options]
* @param {boolean} [options.ellipsis] - whether to also convert "..." to an ellipsis
* @return {string}
* @throws {TypeError} if `text` is not a `String`
*
* @example
* convert(`"That's a 'magic' shoe."`); // “That’s a ‘magic’ shoe.”
*/
export declare function convert(text: string, options?: ConvertOptions): string;