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

@lorens/texter

v1.0.5

Published

This tool fixes the text paragraphs by merging the lines, fixing list lines, removing empty lines, and trimming the lines. It also removes white spaces from the text and merges the lines with respect to punctuation marks such as periods (.), colons (:), a

Downloads

16

Readme

texter_cover

texter()

This tool fixes the text paragraphs by merging the lines, fixing list lines, removing empty lines, and trimming the lines. It also removes white spaces from the text and merges the lines with respect to punctuation marks such as periods (.), colons (:), and question marks (?).

What texter do

  • Remove all white spaces from the text. This means combining lines together.
  • If a line starts with a special character like '-', '*', '_', '•', it's considered a list item and won't be merged with the previous line.
  • If a line starts with a number or a number followed by one of these special characters: '-', '*', '•', '.', '_', it's considered a numbered list item and won't merge with the previous line.
  • If a line starts with a '#' symbol, it remains unchanged. You can replace '#' with any prefix you need.
  • The texter() function takes a variable that refers to a special chunk of text you want to keep as is, like a product name or company name.
  • Lines that end with '.', ':',';', or '?' will have a line break added after the ending symbol, preventing them from merging with the next line.
  • Remove every empty line.
  • Remove unnecessary spaces.
  • Trim every line.
  • Detect if the line Starts with Private Use Area Character and replace it with '-'

Install

npm i @lorens/texter

Usage

import { texter } from '@lorens/texter';
const inputText = `Lorem       ipsum        dolor
 sit
      amet          ,                         adipiscing.
- elit, 
sed .`
console.log(texter(inputText));
the output is :
Lorem ipsum dolor sit amet , adipiscing .
- elit, sed .

Try your text

İn this page example we used texter to handle the input text, Copy your text and see see what Texter results.

Who need texter

  • When you're copying text from PDF files.
  • If you're scraping text from a website.
  • If you're translating text from a foreign language...

Texter function

texter() function accept 3 parameters

  • İnput text variable .

  • Line Keeper Symbol, default is ‘#’, If a line starts with a ‘#’ symbol, it remains unchanged.

  • unchangeable Strings parameter ,variable that refers to a special chunk of text you want to keep as is.

texter(inputText, lineKeeperSymbol, unchangeableStringsVariable)

Test

If you've made any changes to the 'texter()' files and want to check if it still works correctly, we have over 50 tests available. After finishing your modifications, you can 'run the tests' to make sure nothing got broken in the process.

run the tests

  • İf you cloned the project from githup, To run the test.
npm run test
  • İf you installed the texter from npm, And want to the run test.
npm explore @lorens/texter -- npm run test
  • Or.
//yourJsFileName.js
import { testResult } from '@lorens/texter';
testResult();

node yourJsFileName.js