
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
megaorm-text
Advanced tools
This package provides various functions to manipulate and transform strings.
megaorm-text is a utility library that provides various functions to manipulate and transform strings. The package includes functions to convert strings to different cases (camelCase, snake_case, kebab-case, etc.), handle singular/plural transformations, and more.
To install the package, run:
npm install megaorm-text
dictionary(singular: string, plural: string): void: Adds or updates the plural form for a singular word in the dictionary.
dictionary('cat', 'cats');
dictionary('bus', 'buses');
toPlural(singular: string): string: Converts a singular word to its plural form based on registered mappings or rules.
console.log(toPlural('cat')); // "cats"
console.log(toPlural('bus')); // "buses"
toSingular(plural: string): string: Converts a plural word to its singular form based on registered mappings or rules.
console.log(toSingular('cats')); // "cat"
console.log(toSingular('buses')); // "bus"
toRegex(text: string, flags?: string): RegExp: Converts a string pattern into a regular expression.
const regex = toRegex('hello*');
console.log(regex.test('hello world')); // true
toUpper(text: string): string: Converts a string to uppercase.
console.log(toUpper('hello world')); // "HELLO WORLD"
toLower(text: string): string: Converts a string to lowercase.
console.log(toLower('HELLO WORLD')); // "hello world"
toUpperAt(text: string, index: number): string: Converts the character at a specified index of a string to uppercase.
console.log(toUpperAt('hello world', 6)); // "hello World"
toLowerAt(text: string, index: number): string: Converts the character at a specified index of a string to lowercase.
console.log(toLowerAt('HELLO World', 6)); // "HELLO world"
toUpperFrom(text: string, index: number, to?: number): string: Converts all characters from a specified index to uppercase.
index to the end of the string.console.log(toUpperFrom('hello world', 6)); // "hello WORLD"
toLowerFrom(text: string, index: number, to?: number): string: Converts all characters from a specified index to lowercase.
index to the end of the string.console.log(toLowerFrom('HELLO World', 6)); // "HELLO world"
toUpperFirst(text: string): string: Converts the first character of a string to uppercase.
console.log(toUpperFirst('hello world')); // "Hello world"
toKamelCase(text: string): string: Converts a string to camelCase.
console.log(toKamelCase('hello world')); // "helloWorld"
toPascalCase(text: string): string: Converts a string to PascalCase.
console.log(toPascalCase('hello world')); // "HelloWorld"
toSnakeCase(text: string): string: Converts a string to snake_case.
console.log(toSnakeCase('hello world')); // "hello_world"
toKababCase(text: string): string: Converts a string to kebab-case.
console.log(toKababCase('hello world')); // "hello-world"
toTitle(text: string): string: Converts the first character of every word to uppercase.
console.log(toTitle('hello world')); // "Hello World"
toSlug(text: string): string: Converts a string to a slug.
console.log(toSlug('Hello world!')); // "hello-world"
toSnap(text: string, length: number): string: Trims the string to a specified length and appends an ellipsis ("...") if the string is longer than the specified length.
console.log(toSnap('This is a long sentence', 10)); // "This is a..."
toChars(text: string, ...exclude: string[]): string[]: Splits a string into an array of characters, optionally excluding certain characters.
console.log(toChars('hello world', 'o')); // ["h", "e", "l", "l", " ", "w", "r", "l", "d"]
toWords(text: string): string[]: Splits a string into an array of words, based on spaces.
console.log(toWords('hello world')); // ["hello", "world"]
prefix(text: string, portion: string): string: Prefixes a string with a given portion.
console.log(prefix('world', 'hello ')); // "hello world"
suffix(text: string, portion: string): string: Suffixes a string with a given portion.
console.log(suffix('hello', ' world')); // "hello world"
infix(text: string, portion: string, index: number): string: Inserts a portion of text into a string at a specific index.
console.log(infix('helloworld', ' beautiful', 5)); // "hello beautiful world"
countOf(text: string, search: string | RegExp): number: Counts the occurrences of a substring or pattern in a string.
console.log(countOf('hello hello world', 'hello')); // 2
indexOf(text: string, search: string | RegExp, pos: number = 0): number | void: Finds the first index of a substring or pattern in a string, starting from a specified position.
0).console.log(indexOf('hello world', 'world')); // 6
indexesOf(text: string, search: string | RegExp): Indexes | void: Finds all the indexes of a substring or pattern in a string and returns an array of index ranges.
console.log(indexesOf('hello world hello', 'hello')); // [{ start: 0, end: 5 }, { start: 12, end: 17 }]
lastIndexOf(text: string, search: string | RegExp): number | void: Finds the last index of a substring or pattern in a string.
console.log(lastIndexOf('hello world hello', 'hello')); // 12
FAQs
This package provides various functions to manipulate and transform strings.
We found that megaorm-text demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.