fukkem
v1.0.0
Published
Clean up em and en dashes in text with configurable replacements
Maintainers
Readme
fuckem
Clean up em and en dashes in text with configurable replacements.
Installation
npm install fuckemUsage
const fuckem = require('fuckem');
// Basic usage with defaults
fuckem('Hello—world'); // 'Hello - world'
fuckem('Pages 10–20'); // 'Pages 10-20'
// Custom replacements
fuckem('Hello—world', { emDash: '--' }); // 'Hello--world'
fuckem('Pages 10–20', { enDash: ' to ' }); // 'Pages 10 to 20'
// Remove dashes (replace with empty string)
fuckem('Test—thing', { emDash: '' }); // 'Test thing' (space normalized)
// Disable space normalization
fuckem('Test — thing', { emDash: '', normalizeSpaces: false }); // 'Test thing'API
fuckem(text, options)
Parameters:
text(string): The text to clean upoptions(object, optional):emDash(string, default:' - '): Replacement for em dashes (—)enDash(string, default:'-'): Replacement for en dashes (–)normalizeSpaces(boolean, default:true): Collapse multiple spaces into one
Returns: The cleaned text (string)
What are Em and En Dashes?
- Em dash (—): A long dash used for breaks in thought, similar to parentheses
- En dash (–): A shorter dash used for ranges (e.g., "10–20") or connections
License
ISC
