@proseprep/core
v1.0.3
Published
Pure utility functions and prep modules for ProsePrep
Downloads
274
Maintainers
Readme
@proseprep/core
Pure TypeScript text processing engines powering ProsePrep.io. Zero external dependencies. Works in any browser or Node.js environment.
Install
npm install @proseprep/core
# or
pnpm add @proseprep/coreModules
The library is organized into specialized modules, each focused on a specific text processing domain. All modules are exported from the root @proseprep/core package.
🧹 AI Sanitizer (sanitize)
Cleans and normalizes AI-generated text — removes hidden characters, normalizes smart quotes/dashes/ellipsis, strips markdown/HTML, and collapses whitespace.
import { sanitizeModule, purgeLLMTells, sanitizeMarkdown } from '@proseprep/core';
// Using the Module interface
const result = sanitizeModule.run(text, { removeAsterisks: true });
// Using specialized utilities
purgeLLMTells("Sure! Here's the answer...");
sanitizeMarkdown("**bold*"); // Fixes broken syntax📝 LinkedIn Formatter (linkedin)
Converts text to Unicode mathematical styles (bold, italic, script, monospace, underline, strikethrough) and creates numbered circle lists for social media.
import { applyLinkedInStyle, applyLinkedInList, linkedinModule } from '@proseprep/core';
applyLinkedInStyle('Hello World', 'bold'); // 𝗛𝗲𝗹𝗹𝗼 𝗪𝗼𝗿𝗹𝗱
applyLinkedInList('Item one\nItem two'); // ① Item one\n② Item two🔍 Robotic AI Detector (detector)
Scores text for AI-tell patterns including robotic buzzwords, passive voice ratio, and sentence length uniformity (pacing).
import { scanRoboticHeuristics } from '@proseprep/core';
const scan = scanRoboticHeuristics(text);
// scan.score (0-100), scan.grade ('Human'|'Robotic'), scan.highlightedHtml✨ AI Humanizer (humanizer)
Transforms robotic AI-generated text into natural, human-like copy by replacing buzzwords with context-aware synonyms and rewriting passive voice.
import { humanizeText } from '@proseprep/core';
humanizeText(text, 'casual', 2); // tones: 'casual' | 'professional' | 'creative'👁️ Invisible Character Scanner (invisible)
Detects and reports zero-width spaces (ZWSP), byte-order marks (BOM), and non-breaking spaces (NBSP).
import { scanInvisibleChars, getVisualDebuggerText } from '@proseprep/core';
const scan = scanInvisibleChars(text);
const debug = getVisualDebuggerText(text); // Visual markers for hidden characters␠ Whitespace & Stripping (whitespace, stripper)
Utilities for collapsing excess whitespace, removing YAML/JSON frontmatter, and stripping HTML tags.
import { compressWhitespace, stripFrontmatter, stripHtml } from '@proseprep/core';
compressWhitespace(text, { collapseLines: true, trimTrailing: true });
stripFrontmatter(text); // Removes --- YAML --- blocks
stripHtml(text); // Removes <tags>⇄ Case & CSV Transformer (devcase)
Converts strings between common coding casings and transforms CSV data into Markdown tables.
import { caseTransform, csvToMarkdownTable } from '@proseprep/core';
caseTransform('hello world', 'camel'); // helloWorld
csvToMarkdownTable('Name,Age\nAlice,30'); // Markdown grid📊 Quality Assurance (qa)
Provides live readability assessments, Flesch grade indexes, reading/speaking time estimations, and keyword density analysis.
import { calculateReadability, scanKeywordDensity } from '@proseprep/core';
const stats = calculateReadability(text);
const keywords = scanKeywordDensity(text);✓ Grammar Scanner (grammar)
Detects and auto-fixes spelling mistakes, double words, spacing errors, a/an mismatches, and sentence capitalization.
import { scanGrammar, fixGrammar } from '@proseprep/core';
const issues = scanGrammar(text);
const fixed = fixGrammar(text);✍️ Paraphraser (paraphraser)
Simplifies, expands, or rewrites sentences to change tone while preserving core meaning entirely on the client side.
import { paraphraseText } from '@proseprep/core';
paraphraseText(text, 'simplify'); // 'standard' | 'simplify' | 'expand'👯 Duplicate Remover (duplicate)
Deduplicates list elements or text blocks with alphabetical sorting, whitespace trimming, and frequency analysis.
import { removeDuplicateLines } from '@proseprep/core';
const result = removeDuplicateLines(text, { sortOrder: 'asc' });PrepModule Interface
First-class modules (sanitizeModule, linkedinModule) implement the standard PrepModule interface for uniform integration:
interface PrepModule<Options = any> {
id: string;
name: string;
description: string;
defaultOptions: Options;
run(input: string, options?: Partial<Options>): {
output: string;
applied: boolean;
changes: string[];
};
}License
MIT
