clean-quotes
v1.0.6
Published
✍️ Normalize quotes, dashes, and ellipsis in strings.
Maintainers
Readme
clean-quotes
- ✍️ Clean and standardize punctuation in strings — normalize
quotes,single quotes,dashes, andellipsisformulti-languagetext,emojisand consistent formatting. - ♻️ Works seamlessly with
CommonJS,ESMandTypeScript
🚀 Why use this?
- 👍 Good for validating input fields or textareas.
- 👍 Sanitizing data before it's saved to a SQL/NoSQL database.
- 👍 Pre-processing text for Natural Language Processing (NLP) or sentiment analysis, where special characters are often
"noise."
📦 Install via NPM
$ npm i clean-quotes💻 Usage
- See examples below
CommonJS
const cleanQuotes = require('clean-quotes');
const input = `“Hello” — said the cat… ‘Are you okay?’ «Bonjour» ― こんにちは…`;
const cleanedString = cleanQuotes(input);
console.log(cleanedString);
// --| Expected output: "Hello" - said the cat... 'Are you okay?' "Bonjour" - こんにちは...ESM
import cleanQuotes from 'clean-quotes';
const input = `“Hello” — said the cat… ‘Are you okay?’ «Bonjour» ― こんにちは…`;
const cleanedString = cleanQuotes(input);
console.log(cleanedString);
// --| Expected output: "Hello" - said the cat... 'Are you okay?' "Bonjour" - こんにちは...TypeScript
import cleanQuotes from 'clean-quotes';
const input: string = `“Hello” — said the cat… ‘Are you okay?’ «Bonjour» ― こんにちは…`;
const cleanedString: string = cleanQuotes(input);
console.log(cleanedString);
// --| Expected output: "Hello" - said the cat... 'Are you okay?' "Bonjour" - こんにちは...