Socket
Socket
Sign inDemoInstall

case-anything

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

case-anything - npm Package Compare versions

Comparing version 0.3.1 to 1.0.0

66

dist/index.cjs.js

@@ -11,6 +11,18 @@ 'use strict';

*/
function getParts(string) {
function splitOnSpecialChars(string) {
return string.match(/^[a-z]+|[A-Z][a-z]+|[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g);
}
/**
* A string.match function that will return an array of "string parts"
*
* @param {string} string
* @returns {string[]}
*/
function getParts(string, noSpecialChars) {
if (noSpecialChars === void 0) { noSpecialChars = false; }
var target = string.trim();
var parts = target.includes(' ') ? target.split(' ') : splitOnSpecialChars(target);
return noSpecialChars ? parts.map(function (part) { return part.replace(/[^a-zA-Z0-9]/g, ''); }) : parts;
}
/**
* Capitalises a single word

@@ -26,2 +38,3 @@ *

var noSpecialChars = true;
/**

@@ -32,12 +45,7 @@ * converts strings to camelCase

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in camelCase
*/
function camelCase(string, splitFn) {
if (splitFn === void 0) { splitFn = getParts; }
return splitFn(string)
.reduce(function (result, match, index) {
return (index === 0)
? match.toLowerCase()
: result + capitaliseWord(match);
function camelCase(string) {
return getParts(string, noSpecialChars).reduce(function (result, match, index) {
return index === 0 ? match.toLowerCase() : result + capitaliseWord(match);
}, '');

@@ -50,9 +58,6 @@ }

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in PascalCase
*/
function pascalCase(string, splitFn) {
if (splitFn === void 0) { splitFn = getParts; }
return splitFn(string)
.reduce(function (result, match) {
function pascalCase(string) {
return getParts(string, noSpecialChars).reduce(function (result, match) {
return result + capitaliseWord(match);

@@ -69,4 +74,5 @@ }, '');

function kebabCase(string) {
return getParts(string)
.join('-').toLowerCase();
return getParts(string, noSpecialChars)
.join('-')
.toLowerCase();
}

@@ -81,4 +87,5 @@ /**

function snakeCase(string) {
return getParts(string)
.join('_').toLowerCase();
return getParts(string, noSpecialChars)
.join('_')
.toLowerCase();
}

@@ -93,4 +100,5 @@ /**

function constantCase(string) {
return getParts(string)
.join('_').toUpperCase();
return getParts(string, noSpecialChars)
.join('_')
.toUpperCase();
}

@@ -105,4 +113,3 @@ /**

function pathCase(string) {
return getParts(string)
.join('/');
return getParts(string).join('/');
}

@@ -117,4 +124,3 @@ /**

function spaceCase(string) {
return getParts(string)
.join(' ');
return getParts(string).join(' ');
}

@@ -126,8 +132,6 @@ /**

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in Capital Case (with spaces)
*/
function capitalCase(string, splitFn) {
if (splitFn === void 0) { splitFn = getParts; }
return splitFn(string)
function capitalCase(string) {
return getParts(string)
.reduce(function (result, match) {

@@ -147,3 +151,4 @@ return result + " " + capitaliseWord(match);

return getParts(string)
.join(' ').toLowerCase();
.join(' ')
.toLowerCase();
}

@@ -159,3 +164,4 @@ /**

return getParts(string)
.join(' ').toUpperCase();
.join(' ')
.toUpperCase();
}

@@ -162,0 +168,0 @@

@@ -7,6 +7,18 @@ /**

*/
function getParts(string) {
function splitOnSpecialChars(string) {
return string.match(/^[a-z]+|[A-Z][a-z]+|[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g);
}
/**
* A string.match function that will return an array of "string parts"
*
* @param {string} string
* @returns {string[]}
*/
function getParts(string, noSpecialChars) {
if (noSpecialChars === void 0) { noSpecialChars = false; }
var target = string.trim();
var parts = target.includes(' ') ? target.split(' ') : splitOnSpecialChars(target);
return noSpecialChars ? parts.map(function (part) { return part.replace(/[^a-zA-Z0-9]/g, ''); }) : parts;
}
/**
* Capitalises a single word

@@ -22,2 +34,3 @@ *

var noSpecialChars = true;
/**

@@ -28,12 +41,7 @@ * converts strings to camelCase

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in camelCase
*/
function camelCase(string, splitFn) {
if (splitFn === void 0) { splitFn = getParts; }
return splitFn(string)
.reduce(function (result, match, index) {
return (index === 0)
? match.toLowerCase()
: result + capitaliseWord(match);
function camelCase(string) {
return getParts(string, noSpecialChars).reduce(function (result, match, index) {
return index === 0 ? match.toLowerCase() : result + capitaliseWord(match);
}, '');

@@ -46,9 +54,6 @@ }

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in PascalCase
*/
function pascalCase(string, splitFn) {
if (splitFn === void 0) { splitFn = getParts; }
return splitFn(string)
.reduce(function (result, match) {
function pascalCase(string) {
return getParts(string, noSpecialChars).reduce(function (result, match) {
return result + capitaliseWord(match);

@@ -65,4 +70,5 @@ }, '');

function kebabCase(string) {
return getParts(string)
.join('-').toLowerCase();
return getParts(string, noSpecialChars)
.join('-')
.toLowerCase();
}

@@ -77,4 +83,5 @@ /**

function snakeCase(string) {
return getParts(string)
.join('_').toLowerCase();
return getParts(string, noSpecialChars)
.join('_')
.toLowerCase();
}

@@ -89,4 +96,5 @@ /**

function constantCase(string) {
return getParts(string)
.join('_').toUpperCase();
return getParts(string, noSpecialChars)
.join('_')
.toUpperCase();
}

@@ -101,4 +109,3 @@ /**

function pathCase(string) {
return getParts(string)
.join('/');
return getParts(string).join('/');
}

@@ -113,4 +120,3 @@ /**

function spaceCase(string) {
return getParts(string)
.join(' ');
return getParts(string).join(' ');
}

@@ -122,8 +128,6 @@ /**

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in Capital Case (with spaces)
*/
function capitalCase(string, splitFn) {
if (splitFn === void 0) { splitFn = getParts; }
return splitFn(string)
function capitalCase(string) {
return getParts(string)
.reduce(function (result, match) {

@@ -143,3 +147,4 @@ return result + " " + capitaliseWord(match);

return getParts(string)
.join(' ').toLowerCase();
.join(' ')
.toLowerCase();
}

@@ -155,5 +160,6 @@ /**

return getParts(string)
.join(' ').toUpperCase();
.join(' ')
.toUpperCase();
}
export { camelCase, capitalCase, constantCase, kebabCase, lowerCase, pascalCase, pathCase, snakeCase, spaceCase, upperCase };
{
"name": "case-anything",
"version": "0.3.1",
"version": "1.0.0",
"sideEffects": false,

@@ -5,0 +5,0 @@ "description": "camelCase, kebab-case, PascalCase... a simple integration with nano package size. (SMALL footprint!)",

@@ -27,3 +27,3 @@ # Case anything 🐫

case-anything supports tree-shaking.
case-anything supports tree-shaking and is side-effect free!

@@ -36,22 +36,14 @@ ```js

camelCase(testString)
=== 'ponytaVaporeonPoliwrathButterfree'
camelCase(testString) === 'ponytaVaporeonPoliwrathButterfree'
pascalCase(testString)
=== 'PonytaVaporeonPoliwrathButterfree'
pascalCase(testString) === 'PonytaVaporeonPoliwrathButterfree'
kebabCase(testString)
=== 'ponyta-vaporeon-poliwrath-butterfree'
kebabCase(testString) === 'ponyta-vaporeon-poliwrath-butterfree'
snakeCase(testString)
=== 'ponyta_vaporeon_poliwrath_butterfree'
snakeCase(testString) === 'ponyta_vaporeon_poliwrath_butterfree'
constantCase(testString)
=== 'PONYTA_VAPOREON_POLIWRATH_BUTTERFREE'
pathCase(testString)
=== 'Ponyta/Vaporeon/Poliwrath/BUTTERFREE'
constantCase(testString) === 'PONYTA_VAPOREON_POLIWRATH_BUTTERFREE'
```
There is also `spaceCase` and `pathCase`, which does not convert the casing:
There is also `spaceCase` and `pathCase`, which does **not convert the casing**:

@@ -63,7 +55,5 @@ ```js

spaceCase(testString)
=== 'Ponyta Vaporeon poliwrath BUTTERFREE'
spaceCase(testString) === 'Ponyta Vaporeon poliwrath BUTTERFREE'
pathCase(testString)
=== 'Ponyta/Vaporeon/poliwrath/BUTTERFREE'
pathCase(testString) === 'Ponyta/Vaporeon/poliwrath/BUTTERFREE'
```

@@ -78,38 +68,43 @@

upperCase(testString)
=== 'PONYTA VAPOREON POLIWRATH BUTTERFREE'
lowerCase(testString)
=== 'ponyta vaporeon poliwrath butterfree'
capitalCase(testString)
=== 'Ponyta Vaporeon Poliwrath Butterfree'
upperCase(testString) === 'PONYTA VAPOREON POLIWRATH BUTTERFREE'
lowerCase(testString) === 'ponyta vaporeon poliwrath butterfree'
capitalCase(testString) === 'Ponyta Vaporeon Poliwrath Butterfree'
```
### Custom split function
### When spaces are involved
The split function used in case-anything will remove any special characters (besides numbers) as well. If however, you require a different split function, you can provide one yourself as second parameter.
As soon as there is a space in the target string, it will regard the input as a "sentence" and only split each part at the spaces.
This is possible for the `capitalCase`, `pascalCase` or `camelCase`.
See this example to understand each case:
One use case example is when working with sentences. Eg. you want the capital case of this sentence: `listen I'm O.K.!`. Let's see how this can be done:
<!-- prettier-ignore-start -->
```js
const testString = "listen I'M O.K.!"
const testString = "listen I'm O.K.!"
// capitalCase expected behaviour:
capitalCase(testString)
=== 'Listen I M O K'
// splits on spaces & removes special characters
camelCase(listenImOK) === 'listenImOk'
pascalCase(listenImOK) === 'ListenImOk'
kebabCase(listenImOK) === 'listen-im-ok'
snakeCase(listenImOK) === 'listen_im_ok'
constantCase(listenImOK) === 'LISTEN_IM_OK'
// capitalCase with own split function:
capitalCase(testString, s => s.split(' '))
=== "Listen I'm O.k.!"
// splits on spaces & keeps special characters
spaceCase(listenImOK) === "listen I'm O.K.!"
pathCase(listenImOK) === "listen/I'm/O.K.!"
lowerCase(listenImOK) === "listen i'm o.k.!"
upperCase(listenImOK) === "LISTEN I'M O.K.!"
capitalCase(listenImOK) === "Listen I'm O.k.!"
```
<!-- prettier-ignore-end -->
The reason this is only possible for three functions is because the logic behind the other functions is simple enough to implement yourself. Eg.:
### When special alphabet is involved
```js
// snakeCase with own split function:
testString.split(' ').join('_').toLowerCase()
=== "listen_i'm_o.k.!"
```
Currently what keeps the package small is the fact that I use a simple regex to find all the parts in a string:
- `/^[a-z]+|[A-Z][a-z]+|[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g`
That means that alphabet letters like é, ç, ü, ī and many others aren't compatible.
If there is a simple way to include these via unicode ranges in the regex, please feel free to open a PR or issue!
## Package size

@@ -119,35 +114,19 @@

| | case-anything | change-case |
| --- | --- | --- |
| camelCase | 1.1K (572) | 27.2K (6K) |
| pascalCase | 1.1K (561) | 27.4K (6.1K) |
| kebabCase | 1.1K (541) | 26.8K (5.9K) |
| snakeCase | 1.1K (540) | 26.8K (5.9K) |
| constantCase | 1.1K (540) | 27.2K (6K) |
| pathCase | 1K (530) | 26.8K (5.9K) |
| | case-anything | change-case |
| ------------ | ------------- | ------------ |
| camelCase | 1.1K (572) | 27.2K (6K) |
| pascalCase | 1.1K (561) | 27.4K (6.1K) |
| kebabCase | 1.1K (541) | 26.8K (5.9K) |
| snakeCase | 1.1K (540) | 26.8K (5.9K) |
| constantCase | 1.1K (540) | 27.2K (6K) |
| pathCase | 1K (530) | 26.8K (5.9K) |
## Source code
It is literally just this code:
What keeps my package small, is that it's literally just a regex:
```js
function getParts (string) {
return string.match(/^[a-z]+|[A-Z][a-z]+|[A-Z]+|[a-z]+/g)
export function splitOnSpecialChars (string: string): any[] {
return string.match(/^[a-z]+|[A-Z][a-z]+|[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g)
}
export function camelCase (string) {
return getParts(string)
.reduce((result, match, index) => {
return (index === 0)
? match.toLowerCase()
: result + match[0].toUpperCase() + match.slice(1).toLowerCase()
}, '')
}
export function kebabCase (string) {
return getParts(string)
.join('-').toLowerCase()
}
// etc...
```
import { getParts, capitaliseWord } from './utils'
const noSpecialChars = true
/**

@@ -8,12 +10,8 @@ * converts strings to camelCase

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in camelCase
*/
export function camelCase (string: string, splitFn = getParts): string {
return splitFn(string)
.reduce((result, match, index) => {
return (index === 0)
? match.toLowerCase()
: result + capitaliseWord(match)
}, '')
export function camelCase (string: string): string {
return getParts(string, noSpecialChars).reduce((result, match, index) => {
return index === 0 ? match.toLowerCase() : result + capitaliseWord(match)
}, '')
}

@@ -26,10 +24,8 @@

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in PascalCase
*/
export function pascalCase (string: string, splitFn = getParts): string {
return splitFn(string)
.reduce((result, match) => {
return result + capitaliseWord(match)
}, '')
export function pascalCase (string: string): string {
return getParts(string, noSpecialChars).reduce((result, match) => {
return result + capitaliseWord(match)
}, '')
}

@@ -45,4 +41,5 @@

export function kebabCase (string: string): string {
return getParts(string)
.join('-').toLowerCase()
return getParts(string, noSpecialChars)
.join('-')
.toLowerCase()
}

@@ -58,4 +55,5 @@

export function snakeCase (string: string): string {
return getParts(string)
.join('_').toLowerCase()
return getParts(string, noSpecialChars)
.join('_')
.toLowerCase()
}

@@ -71,4 +69,5 @@

export function constantCase (string: string): string {
return getParts(string)
.join('_').toUpperCase()
return getParts(string, noSpecialChars)
.join('_')
.toUpperCase()
}

@@ -84,4 +83,3 @@

export function pathCase (string: string): string {
return getParts(string)
.join('/')
return getParts(string).join('/')
}

@@ -97,4 +95,3 @@

export function spaceCase (string: string): string {
return getParts(string)
.join(' ')
return getParts(string).join(' ')
}

@@ -107,7 +104,6 @@

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in Capital Case (with spaces)
*/
export function capitalCase (string: string, splitFn = getParts): string {
return splitFn(string)
export function capitalCase (string: string): string {
return getParts(string)
.reduce((result, match) => {

@@ -128,3 +124,4 @@ return `${result} ${capitaliseWord(match)}`

return getParts(string)
.join(' ').toLowerCase()
.join(' ')
.toLowerCase()
}

@@ -141,3 +138,4 @@

return getParts(string)
.join(' ').toUpperCase()
.join(' ')
.toUpperCase()
}

@@ -7,3 +7,3 @@ /**

*/
export function getParts (string: string): any[] {
export function splitOnSpecialChars (string: string): any[] {
return string.match(/^[a-z]+|[A-Z][a-z]+|[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g)

@@ -13,2 +13,14 @@ }

/**
* A string.match function that will return an array of "string parts"
*
* @param {string} string
* @returns {string[]}
*/
export function getParts (string: string, noSpecialChars = false): any[] {
const target = string.trim()
const parts = target.includes(' ') ? target.split(' ') : splitOnSpecialChars(target)
return noSpecialChars ? parts.map(part => part.replace(/[^a-zA-Z0-9]/g, '')) : parts
}
/**
* Capitalises a single word

@@ -15,0 +27,0 @@ *

@@ -16,6 +16,6 @@ import test from 'ava'

const tests = [
'ponytaVaporeonPOLIWRATH ButterfreeA',
'PonytaVaporeonPOLIWRATH ButterfreeA',
'ponytaVaporeonPOLIWRATH_ButterfreeA',
'PonytaVaporeonPOLIWRATH_ButterfreeA',
'ponyta-vaporeon-POLIWRATH-ButterfreeA',
'Ponyta vaporeon POLIWRATH ButterfreeA',
'Ponyta~vaporeon~POLIWRATH/ButterfreeA',
'ponyta_vaporeon_POLIWRATH_ButterfreeA',

@@ -93,21 +93,24 @@ 'ponyta_Vaporeon_POLIWRATH_ButterfreeA',

test('spaceCase I\'m a M.I.B. 101 OK?', t => { t.is(spaceCase(ImaMIB101OK), 'I m a M I B 101 OK') }) // prettier-ignore
test('pathCase I\'m a M.I.B. 101 OK?', t => { t.is(pathCase(ImaMIB101OK), 'I/m/a/M/I/B/101/OK') }) // prettier-ignore
test('capitalCase I\'m a M.I.B. 101 OK?', t => { t.is(capitalCase(ImaMIB101OK), 'I M A M I B 101 Ok') }) // prettier-ignore
test('upperCase I\'m a M.I.B. 101 OK?', t => { t.is(upperCase(ImaMIB101OK), 'I M A M I B 101 OK') }) // prettier-ignore
test('lowerCase I\'m a M.I.B. 101 OK?', t => { t.is(lowerCase(ImaMIB101OK), 'i m a m i b 101 ok') }) // prettier-ignore
test('pascalCase I\'m a M.I.B. 101 OK?', t => { t.is(pascalCase(ImaMIB101OK), 'IMAMIB101Ok') }) // prettier-ignore
test('camelCase I\'m a M.I.B. 101 OK?', t => { t.is(camelCase(ImaMIB101OK), 'iMAMIB101Ok') }) // prettier-ignore
test('kebabCase I\'m a M.I.B. 101 OK?', t => { t.is(kebabCase(ImaMIB101OK), 'i-m-a-m-i-b-101-ok') }) // prettier-ignore
test('snakeCase I\'m a M.I.B. 101 OK?', t => { t.is(snakeCase(ImaMIB101OK), 'i_m_a_m_i_b_101_ok') }) // prettier-ignore
test('constantCase I\'m a M.I.B. 101 OK?', t => { t.is(constantCase(ImaMIB101OK), 'I_M_A_M_I_B_101_OK') }) // prettier-ignore
test("camelCase I'm a M.I.B. 101 OK?", t => { t.is(camelCase(ImaMIB101OK), 'imAMib101Ok') }) // prettier-ignore
test("pascalCase I'm a M.I.B. 101 OK?", t => { t.is(pascalCase(ImaMIB101OK), 'ImAMib101Ok') }) // prettier-ignore
test("kebabCase I'm a M.I.B. 101 OK?", t => { t.is(kebabCase(ImaMIB101OK), 'im-a-mib-101-ok') }) // prettier-ignore
test("snakeCase I'm a M.I.B. 101 OK?", t => { t.is(snakeCase(ImaMIB101OK), 'im_a_mib_101_ok') }) // prettier-ignore
test("constantCase I'm a M.I.B. 101 OK?", t => { t.is(constantCase(ImaMIB101OK), 'IM_A_MIB_101_OK') }) // prettier-ignore
test("spaceCase I'm a M.I.B. 101 OK?", t => { t.is(spaceCase(ImaMIB101OK), "I'm a M.I.B. 101 OK?") }) // prettier-ignore
test("pathCase I'm a M.I.B. 101 OK?", t => { t.is(pathCase(ImaMIB101OK), "I'm/a/M.I.B./101/OK?") }) // prettier-ignore
test("lowerCase I'm a M.I.B. 101 OK?", t => { t.is(lowerCase(ImaMIB101OK), "i'm a m.i.b. 101 ok?") }) // prettier-ignore
test("upperCase I'm a M.I.B. 101 OK?", t => { t.is(upperCase(ImaMIB101OK), "I'M A M.I.B. 101 OK?") }) // prettier-ignore
test("capitalCase I'm a M.I.B. 101 OK?", t => { t.is(capitalCase(ImaMIB101OK), "I'm A M.i.b. 101 Ok?") }) // prettier-ignore
test('capitalCase -_-', t => {
t.is(capitalCase(ImaMIB101OK, s => s.split(' ')), "I'm A M.i.b. 101 Ok?") // prettier-ignore
})
test('pascalCase -_-', t => {
t.is(pascalCase(ImaMIB101OK, s => s.split(' ')), "I'mAM.i.b.101Ok?") // prettier-ignore
})
test('camelCase -_-', t => {
t.is(camelCase(ImaMIB101OK, s => s.split(' ')), "i'mAM.i.b.101Ok?") // prettier-ignore
})
const listenImOK = "listen I'm O.K.!"
test("camelCase listen I'm O.K.!", t => { t.is(camelCase(listenImOK), 'listenImOk') }) // prettier-ignore
test("pascalCase listen I'm O.K.!", t => { t.is(pascalCase(listenImOK), 'ListenImOk') }) // prettier-ignore
test("kebabCase listen I'm O.K.!", t => { t.is(kebabCase(listenImOK), 'listen-im-ok') }) // prettier-ignore
test("snakeCase listen I'm O.K.!", t => { t.is(snakeCase(listenImOK), 'listen_im_ok') }) // prettier-ignore
test("constantCase listen I'm O.K.!", t => { t.is(constantCase(listenImOK), 'LISTEN_IM_OK') }) // prettier-ignore
test("spaceCase listen I'm O.K.!", t => { t.is(spaceCase(listenImOK), "listen I'm O.K.!") }) // prettier-ignore
test("pathCase listen I'm O.K.!", t => { t.is(pathCase(listenImOK), "listen/I'm/O.K.!") }) // prettier-ignore
test("lowerCase listen I'm O.K.!", t => { t.is(lowerCase(listenImOK), "listen i'm o.k.!") }) // prettier-ignore
test("upperCase listen I'm O.K.!", t => { t.is(upperCase(listenImOK), "LISTEN I'M O.K.!") }) // prettier-ignore
test("capitalCase listen I'm O.K.!", t => { t.is(capitalCase(listenImOK), "Listen I'm O.k.!") }) // prettier-ignore

@@ -1,2 +0,1 @@

import { getParts } from './utils';
/**

@@ -7,6 +6,5 @@ * converts strings to camelCase

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in camelCase
*/
export declare function camelCase(string: string, splitFn?: typeof getParts): string;
export declare function camelCase(string: string): string;
/**

@@ -17,6 +15,5 @@ * converts strings to PascalCase

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in PascalCase
*/
export declare function pascalCase(string: string, splitFn?: typeof getParts): string;
export declare function pascalCase(string: string): string;
/**

@@ -67,6 +64,5 @@ * converts strings to kebab-case

* @param {string} string
* @param {function} [splitFn=getParts] the function to split the string. Defaults to `getParts`
* @returns {string} in Capital Case (with spaces)
*/
export declare function capitalCase(string: string, splitFn?: typeof getParts): string;
export declare function capitalCase(string: string): string;
/**

@@ -73,0 +69,0 @@ * converts strings to lower case (with spaces)

@@ -7,4 +7,11 @@ /**

*/
export declare function getParts(string: string): any[];
export declare function splitOnSpecialChars(string: string): any[];
/**
* A string.match function that will return an array of "string parts"
*
* @param {string} string
* @returns {string[]}
*/
export declare function getParts(string: string, noSpecialChars?: boolean): any[];
/**
* Capitalises a single word

@@ -11,0 +18,0 @@ *

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc