npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

clean-text-utils

v1.1.17

Published

A Swiss Army Knife of text operations. Great for removing smart quotes, non-ASCII characters, and more.

Downloads

20,304

Readme

clean-text-utils

By Davis E. Ford - daviseford.com

A Swiss Army Knife of text operations. Great for removing smart quotes, non-ASCII characters, emojis, and more.

Usage

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"'

Methods

.get

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.

.is

cleanTextUtils.is.hexCode - Returns true if the given string is a hex code, such as #FFF or #FA5732.

.strip

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.

.replace

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.

Types

TypeScript definitions are automatically installed.

import * as cleanTextUtils from 'clean-text-utils' to use built in types. :)