
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.
@devdynamo/string-utils
Advanced tools
This repository contains various JavaScript functions for manipulating strings in creative and useful ways.
Each word in the sentence starts with a capital letter.
function titleCase(sentence) {
return sentence
.split(' ')
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.join(' ');
}
Example:
titleCase("hello world from javascript");
// Output: "Hello World From Javascript"
Every alternate character is uppercase.
function alternateCase(str) {
return str.split('')
.map((char, index) => index % 2 === 0 ? char.toUpperCase() : char.toLowerCase())
.join('');
}
Example:
alternateCase("javascript is fun");
// Output: "JaVaScRiPt iS FuN"
Randomly rearranges the characters of the string.
function shuffleString(str) {
return str.split('')
.sort(() => Math.random() - 0.5)
.join('');
}
Example:
shuffleString("hello");
// Output: Random variations like "ollhe", "hlelo"
Removes all vowels (a, e, i, o, u) from the string.
function removeVowels(str) {
return str.replace(/[aeiouAEIOU]/g, '');
}
Example:
removeVowels("beautiful world");
// Output: "btfl wrld"
Finds the character that appears most in a string.
function mostFrequentChar(str) {
let charMap = {};
let maxChar = '';
let maxCount = 0;
for (let char of str) {
charMap[char] = (charMap[char] || 0) + 1;
if (charMap[char] > maxCount) {
maxCount = charMap[char];
maxChar = char;
}
}
return maxChar;
}
Example:
mostFrequentChar("success");
// Output: "s"
Converts each character to its ASCII equivalent.
function encodeASCII(str) {
return str.split('').map(char => char.charCodeAt(0)).join('-');
}
Example:
encodeASCII("hello");
// Output: "104-101-108-108-111"
Expands common abbreviations in a string with an option for custom mappings.
function expandAbbreviations(str, customMap = {}) {
const defaultMap = {
"brb": "be right back",
"gtg": "got to go",
"idk": "I don't know",
"imo": "in my opinion",
"ttyl": "talk to you later"
};
const abbreviationMap = { ...defaultMap, ...customMap };
return str.split(' ').map(word => abbreviationMap[word.toLowerCase()] || word).join(' ');
}
Example:
expandAbbreviations("brb I will ttyl");
// Output: "be right back I will talk to you later"
const customMap = {
"asap": "as soon as possible",
"np": "no problem",
"fyi": "for your information"
};
expandAbbreviations("fyi brb asap", customMap);
// Output: "for your information be right back as soon as possible"
FAQs
A collection of useful string manipulation functions
The npm package @devdynamo/string-utils receives a total of 1 weekly downloads. As such, @devdynamo/string-utils popularity was classified as not popular.
We found that @devdynamo/string-utils 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.