UNPKG

frenchify

Version:

A package to apply french punctuation rules (e.g. thin spaces before question marks)

14 lines (13 loc) 479 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function frenchify(str) { return str .replace(/ ([:?!;])/g, '\u202f$1') .replace(/(\w)([:?!;])/g, '$1\u202f$2') .replace(/" ?(.+?) ?"/g, '«\u202f$1\u202f»') .replace(/(\w) ?\/ ?(\w)/g, '$1\u202f/\u202f$2') .replace(/ ?' ?/g, "'") .replace(/([\(\[]) ?(.+?) ?([\)\]])/g, '$1$2$3') .replace(/\.\.\./g, '…'); } exports.frenchify = frenchify;