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 🙏

© 2025 – Pkg Stats / Ryan Hefner

advance-text-parser

v1.0.2

Published

A powerful text parser library for extracting, processing, and manipulating text data in various formats.

Readme

Text Manipulation Package

This JavaScript package provides a collection of functions for manipulating text. It includes utilities for extracting URLs, domains, emails, phone numbers, and more. Additionally, it offers various text transformation and search capabilities, such as converting text case, capitalizing words, counting word occurrences, and performing find and replace operations.

Features

  • Extract URLs: Extracts all URLs from a given text.
  • Extract Domains: Extracts domain names from the URLs in the text.
  • Extract Emails: Extracts all email addresses from the given text.
  • Extract Phone Numbers: Extracts phone numbers from the text.
  • Text Transformations: Convert text to uppercase, lowercase, or capitalize each word.
  • Find and Replace: Find and replace specific text in a string.
  • Whitespace Management: Remove extra whitespaces or trim the text.
  • Text Search: Check if a word exists in the text or count the occurrences of a word.
  • Text Wrapping: Wrap text into a specified number of characters per line.
  • Text Reversal: Reverse the order of characters in the text.
  • Append or Remove Text: Append or remove text at the beginning or end of the string.

Installation

You can install the package using npm:

npm install advance-text-parser

Usage via CDN

You can also use the package via a CDN. Include the following script tag in your HTML file:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/index.js"></script>
<script>
    // Example usage
    const urls = extractURLs("Visit https://example.com and http://test.com");
    console.log(urls); // Output: ['https://example.com', 'http://test.com']
</script>

Functions

extractURLs(text)

Extracts all URLs from the given text.

const { extractURLs } = require('advance-text-parser');
const urls = extractURLs("Visit https://example.com and http://test.com");
console.log(urls);  // Output: ['https://example.com', 'http://test.com']

extractDomains(text)

Extracts domain names from URLs in the text.

const { extractDomains } = require('advance-text-parser');
const domains = extractDomains("Visit https://example.com and http://test.com");
console.log(domains);  // Output: ['example.com', 'test.com']

extractEmails(text)

Extracts all email addresses from the text.

const { extractEmails } = require('advance-text-parser');
const emails = extractEmails("Contact us at [email protected] or [email protected]");
console.log(emails);  // Output: ['[email protected]', '[email protected]']

extractPhoneNumbers(text)

Extracts phone numbers from the text.

const { extractPhoneNumbers } = require('advance-text-parser');
const phones = extractPhoneNumbers("Call us at +1-234-567-890 or (123) 456-7890");
console.log(phones);  // Output: ['+1-234-567-890', '(123) 456-7890']

convertToUpperCase(text)

Converts text to uppercase.

const { convertToUpperCase } = require('advance-text-parser');
const upperText = convertToUpperCase("hello world");
console.log(upperText);  // Output: 'HELLO WORLD'

convertToLowerCase(text)

Converts text to lowercase.

const { convertToLowerCase } = require('advance-text-parser');
const lowerText = convertToLowerCase("HELLO WORLD");
console.log(lowerText);  // Output: 'hello world'

capitalizeText(text)

Capitalizes the first letter of each word in the text.

const { capitalizeText } = require('advance-text-parser');
const capitalizedText = capitalizeText("hello world");
console.log(capitalizedText);  // Output: 'Hello World'

findAndReplaceText(text, findText, replaceText)

Finds and replaces a specific text in the string.

const { findAndReplaceText } = require('advance-text-parser');
const replacedText = findAndReplaceText("Hello world", "world", "there");
console.log(replacedText);  // Output: 'Hello there'

appendText(originalText, textToAdd, position)

Appends text to the original string at the specified position.

const { appendText } = require('advance-text-parser');
const newText = appendText("Hello", " world", "end");
console.log(newText);  // Output: 'Hello world'

removeText(originalText, position, count)

Removes a specified number of characters from the text at a given position.

const { removeText } = require('advance-text-parser');
const newText = removeText("Hello world", "end", 5);
console.log(newText);  // Output: 'Hello'

countWordOccurrences(text, word)

Counts the occurrences of a specific word in the text.

const { countWordOccurrences } = require('advance-text-parser');
const count = countWordOccurrences("The quick brown fox jumps over the lazy dog", "quick");
console.log(count);  // Output: 1

removeExtraWhitespaces(text)

Removes extra whitespaces and trims the text.

const { removeExtraWhitespaces } = require('advance-text-parser');
const cleanedText = removeExtraWhitespaces("   Hello   world   ");
console.log(cleanedText);  // Output: 'Hello world'

reverseText(text)

Reverses the text.

const { reverseText } = require('advance-text-parser');
const reversedText = reverseText("Hello");
console.log(reversedText);  // Output: 'olleH'

wordWrap(text, maxLength)

Wraps the text into a specified number of characters per line.

const { wordWrap } = require('advance-text-parser');
const wrappedText = wordWrap("Lorem ipsum dolor sit amet", 10);
console.log(wrappedText);
/* Output:
Lorem ipsum
dolor sit
amet
*/

containsWord(text, word)

Checks if the text contains a specific word.

const { containsWord } = require('advance-text-parser');
const isContained = containsWord("The quick brown fox", "quick");
console.log(isContained);  // Output: true

License

This package is open-source and available under the MIT License.