
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
string-filters
Advanced tools
Fast native javascript string filters library.
| Browser | Version |
|---|---|
| Chrome | >= 107 |
| Edge | >= 107 |
| Firefox | >= 104 |
| Safari | >= 16 |
npm install string-filters
import { camelCase } from 'string-filters'
let result = ''
result = camelCase('camel 123 case')
// Output: camelCase
console.log(result)
result = camelCase('camel 123 case', { numbers: true })
// Output: camel123Case
console.log(result)
result = camelCase('cameL 123 casE', { lower: true })
// Output: camelCase
console.log(result)
result = camelCase('cameL 123 casE', { numbers: true, lower: true })
// Output: camel123Case
console.log(result)
import { capitalize } from 'string-filters'
let result = ''
result = capitalize('capitalize')
// Output: Capitalize
console.log(result)
result = capitalize('cApitalizE', true)
// Output: Capitalize
console.log(result)
import { flatCase } from 'string-filters'
let result = ''
result = flatCase('Flat 123 Case')
// Output: flatcase
console.log(result)
result = flatCase('Flat 123 Case', true)
// Output: flat123case
console.log(result)
import { kebabCase } from 'string-filters'
let result = ''
result = kebabCase('Kebab 123 Case')
// Output: kebab-case
console.log(result)
result = kebabCase('Kebab 123 Case', true)
// Output: kebab-123-case
console.log(result)
import { pad } from 'string-filters'
let result = ''
result = pad('pad', 10, '_')
// Output: ___pad____
console.log(result)
import { pascalCase } from 'string-filters'
let result = ''
result = pascalCase('pascal 123 case')
// Output: PascalCase
console.log(result)
result = pascalCase('pascal 123 case', { numbers: true })
// Output: Pascal123Case
console.log(result)
result = pascalCase('pascaL 123 casE', { lower: true })
// Output: PascalCase
console.log(result)
result = pascalCase('pascaL 123 casE', { numbers: true, lower: true })
// Output: Pascal123Case
console.log(result)
import { snakeCase } from 'string-filters'
let result = ''
result = snakeCase('Snake 123 Case')
// Output: snake_case
console.log(result)
result = snakeCase('Snake 123 Case', true)
// Output: snake_123_case
console.log(result)
import { titleCase } from 'string-filters'
let result = ''
result = titleCase('title 123 case')
// Output: Title Case
console.log(result)
result = titleCase('title 123 case', { numbers: true })
// Output: Title 123 Case
console.log(result)
result = titleCase('titlE 123 casE', { lower: true })
// Output: Title Case
console.log(result)
result = titleCase('titlE 123 casE', { numbers: true, lower: true })
// Output: Title 123 Case
console.log(result)
import { trainCase } from 'string-filters'
let result = ''
result = trainCase('train 123 case')
// Output: Train-Case
console.log(result)
result = trainCase('train 123 case', { numbers: true })
// Output: Train-123-Case
console.log(result)
result = trainCase('traiN 123 casE', { lower: true })
// Output: Train-Case
console.log(result)
result = trainCase('traiN 123 casE', { numbers: true, lower: true })
// Output: Train-123-Case
console.log(result)
import { truncate } from 'string-filters'
let result = truncate('etcetera', 3, '...')
// Output: etc...
console.log(result)
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Fast native javascript string filters library.
We found that string-filters demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.