
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
clean-text-utils
Advanced tools
A Swiss Army Knife of text operations. Great for removing smart quotes, non-ASCII characters, and more.
A Swiss Army Knife of text operations. Great for removing smart quotes, non-ASCII characters, emojis, and more.
npm i clean-text-utils --save
import * as cleanTextUtils from 'clean-text-utils';
let txt = 'Iлtèrn, get rid of these so-called “💩emoji💩”';
// Let's clean this up
txt = cleanTextUtils.strip.emoji(txt);
txt = cleanTextUtils.replace.diacritics(txt);
txt = cleanTextUtils.replace.smartChars(txt);
console.log(txt)
>>> 'Intern, get rid of these so-called "emoji"'
cleanTextUtils.get.capitalized
- Capitalizes the first character of a given string.
cleanTextUtils.get.checksum
- Given any data, returns a unique checksum. Pass in md5
or sha1
for different algorithms. sha256
is enabled by default.
cleanTextUtils.get.filename
- Given a url or filepath, returns the filename.
cleanTextUtils.get.reversed
- Reverses a string. Unicode aware.
cleanTextUtils.is.hexCode
- Returns true
if the given string is a hex code, such as #FFF
or #FA5732
.
cleanTextUtils.strip.bom
- Remove UTF8 Byte Order Marks from a string.
cleanTextUtils.strip.emoji
- Remove emojii from a string.
cleanTextUtils.strip.extraSpace
- Remove any extra padding from a string.
cleanTextUtils.strip.gutenberg
- Remove Project Gutenberg header/footer watermarks for further processing.
cleanTextUtils.strip.newlines
- Removes newline characters from a string.
cleanTextUtils.strip.nonASCII
- Remove non-ASCII characters from a string.
cleanTextUtils.strip.punctuation
- Removes common punctuation characters from a string.
cleanTextUtils.strip.whitespace
- Removes ALL whitespace characters from a string.
cleanTextUtils.replace.diacritics
- Replace diacritics with their sensible alternatives
cleanTextUtils.replace.exoticChars
- Replace diacritics, remove UTF8 BOM, and replace smart characters from a string.
cleanTextUtils.replace.smartChars
- Replace smart characters.
TypeScript definitions are automatically installed.
import * as cleanTextUtils from 'clean-text-utils'
to use built in types. :)
FAQs
A Swiss Army Knife of text operations. Great for removing smart quotes, non-ASCII characters, and more.
The npm package clean-text-utils receives a total of 4,830 weekly downloads. As such, clean-text-utils popularity was classified as popular.
We found that clean-text-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.