String Utils
toCamel
- description:
convert kebab-case or snake_case to camelCase.
- returns:
camelized string.
ts
import { } from '@vincent-the-gamer/utils'
const = 'pal-world'
const = 'pal_world'
() // palWorld
() // palWorld
toPascal
- description:
convert kebab-case or snake_case to PascalCase.
- returns:
pascalized string.
ts
import { } from '@vincent-the-gamer/utils'
const = 'pal-world'
const = 'pal_world'
() // PalWorld
() // PalWorld
kebab-case -> snake_case
Just look at the code.
Notice
This will lowercase the word.
ts
import { } from '@vincent-the-gamer/utils'
const = 'Git-Hub'
() // git_hub
snake_case -> kebab-case
Just look at the code.
Notice
This will lowercase the word.
ts
import { } from '@vincent-the-gamer/utils'
const = 'bili_bili'
() // bili-bili
First Letter
Capitalize/Uncapitalize
ts
import { , } from '@vincent-the-gamer/utils'
('palworld') // Palworld
('Palworld') // palworld
Bilibili BV <-> AV
AVxxxx or BVxxxx is the number of Bilibili videos. These functions give you a transformer between BV and AV.
ts
import { , } from '@vincent-the-gamer/utils'
// BV must be capital letters.
('BV1Q541167Qg') // AV455017605
// AV can be any case, or omitted.
('882584971') // BV1mK4y1C7Bz
('av498566183') // BV1AK411W7wq
('AV455017605') // BV1Q541167Qg