Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A library that helps manipulate strings in JavaScript, from uppercase to lowercase, via useful features
StringJs is a library that introduces useful and easy functions to manipulate strings in JavaScript
npm install --save stringjs
or
yarn add stringjs
const stringjs = require('stringjs')
or
import stringjs from 'stringjs'
After this import you can use any function provided in the section below with this call structure
stringjs.capitalizeFirst()
Method | Input | Output |
---|---|---|
capitalizeFirst | a string | The string with the first letter capitalized |
capitalizeLast | a string | The string with the last letter capitalized |
capitalizeByIndex | a string and a parameter of type number , array or function | The string with the letter in the index provided (zero-based) capitalized.
|
capitalizeByLetter | a string and a parameter of type number , array or function | Converts in uppercase all the occurencies of the letter provided
|
deCapitalizeFirst | a string | The string with the first letter decapitalized |
deCapitalizeLast | a string | The string with the last letter decapitalized |
deCapitalizeByIndex | a string and a parameter of type number , array or function | The string with the letter in the index provided (zero-based) capitalized.
|
deCapitalizeByLetter | a string and a parameter of type number , array or function | Converts in lowercase all the occurencies of the letter provided
|
stringjs.capitalizeFirst('my cool string')
// OUTPUT: My cool string
stringjs.capitalizeLast('my cool string')
// OUTPUT: my cool strinG
stringjs.capitalizeByIndex('my cool string', 3)
// OUTPUT: my Cool string
stringjs.capitalizeByIndex('my cool string', 50)
// OUTPUT: my cool string
stringjs.capitalizeByIndex('my cool string', [0, 1, 5, 20, 6, 13])
// OUTPUT: MY coOL strinG
stringjs.capitalizeByIndex('my cool string', (i) => { return i === 3 || i === 5 })
// OUTPUT: my CoOl string
stringjs.capitalizeByLetter('test', 't')
// OUTPUT: TesT
stringjs.capitalizeByLetter('test', ['t', 'e'])
// OUTPUT: TEsT
stringjs.capitalizeByLetter('test', (l) => { return l === 'e' || l === 's' })
// OUTPUT: tESt
stringjs.deCapitalizeFirst('TEST')
// OUTPUT: tEST
stringjs.deCapitalizeLast('TEST')
// OUTPUT: TESt
stringjs.deCapitalizeByIndex('MY COOL STRING', 3)
// OUTPUT: MY cOOL STRING
stringjs.deCapitalizeByIndex('MY COOL STRING', 50)
// OUTPUT: MY COOL STRING
stringjs.deCapitalizeByIndex('MY COOL STRING', [0, 1, 5, 20, 6, 13])
// OUTPUT: my COol STRINg
stringjs.deCapitalizeByIndex('MY COOL STRING', (i) => { return i === 3 || i === 5 })
// OUTPUT: MY cOoL STRING
stringjs.deCapitalizeByLetter('TEST', 'T')
// OUTPUT: tESt
stringjs.deCapitalizeByLetter('TEST', ['T', 'E'])
// OUTPUT: teSt
stringjs.deCapitalizeByLetter('TEST', (l) => { return l === 'E' || l === 'S' })
// OUTPUT: TesT
MIT
FAQs
A library that helps manipulate strings in JavaScript, from uppercase to lowercase, via useful features
We found that stringjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.