@tpmjs/text-transformer
v1.0.22
Published
Una herramienta de transformación de texto para TPMJS - convierte mayúsculas/minúsculas, crea slugs, y más
Maintainers
Readme
Text Transformer Tool for TPMJS
A text transformation utility tool for the TPMJS ecosystem. Convert text case, generate slugs, and perform various text operations optimized for AI and LLM consumption.
Installation
npm install @tpmjs/text-transformerUsage
As a Library
import { transform } from '@tpmjs/text-transformer';
// Transform to uppercase
const result = transform({ operation: 'uppercase', text: 'hello world' });
// Result: "HELLO WORLD"
// Generate a URL slug
const slug = transform({ operation: 'slug', text: 'My Blog Post Title!' });
// Result: "my-blog-post-title"
// Convert to camelCase
const camel = transform({ operation: 'camelcase', text: 'hello world example' });
// Result: "helloWorldExample"As a CLI Tool
# Install globally
npm install -g @tpmjs/text-transformer
# Use the CLI
text-transform uppercase "hello world"
# Output: HELLO WORLD
text-transform slug "My Blog Post Title"
# Output: my-blog-post-title
text-transform camelcase "user first name"
# Output: userFirstNameAvailable Operations
| Operation | Description | Example Input | Example Output |
|-----------|-------------|---------------|----------------|
| uppercase | Convert to UPPERCASE | "hello world" | "HELLO WORLD" |
| lowercase | Convert to lowercase | "HELLO WORLD" | "hello world" |
| titlecase | Convert To Title Case | "hello world" | "Hello World" |
| camelcase | convertToCamelCase | "hello world" | "helloWorld" |
| pascalcase | ConvertToPascalCase | "hello world" | "HelloWorld" |
| snakecase | convert_to_snake_case | "hello world" | "hello_world" |
| kebabcase | convert-to-kebab-case | "hello world" | "hello-world" |
| slug | convert-to-url-slug | "My Post!" | "my-post" |
| trim | Remove extra whitespace | " hello world " | "hello world" |
| reverse | Reverse text | "hello" | "olleh" |
API Reference
transform(options: TextTransformOptions): string
Main transformation function.
Parameters:
options.operation: The transformation operation to performoptions.text: The text to transform
Returns: Transformed text string
Individual Functions
You can also import and use individual transformation functions:
import {
toUpperCase,
toLowerCase,
toSlug,
toCamelCase
} from '@tpmjs/text-transformer';
const upper = toUpperCase('hello');
const slug = toSlug('My Blog Post');TPMJS Metadata
This package is designed for the TPMJS ecosystem with the following capabilities:
- Transform text case (uppercase, lowercase, title case, camel case, pascal case, snake case, kebab case)
- Generate URL-friendly slugs
- Remove extra whitespace
- Reverse text
License
MIT
Contributing
This is a tool package for TPMJS. Contributions are welcome!
TPMJS
TPMJS is "The Tool Package Manager for the AI Era" - a centralized registry for tools, skills, and agent capabilities optimized for LLM consumption.
Learn more at: https://github.com/tpmjs
