2.0.9 • Published 2 months ago

@zerodep/case-camel v2.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@zerodep/case-camel

version language types license

CodeFactor Known Vulnerabilities

A utility to convert a string to camelCase that also strips out non-alphanumeric characters and any leading numeric characters.

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

import { caseCamel } from '@zerodep/case-camel';
// or
const { caseCamel } = require('@zerodep/case-camel');

Use Cases

caseCamel('From sentence case'); // "fromSentenceCase"
caseCamel('from.dot.case'); // "fromDotCase"
caseCamel('from-kebab-case'); // "fromKebabCase"
caseCamel('from_snake_case'); // "fromSnakeCase"
caseCamel('FromPascalCase'); // "fromPascalCase"
caseCamel(''); // ""

// with non-alphanumeric characters
caseCamel('A string with some !@#$%^& characters'); // "aStringWithSomeCharacters"
caseCamel('A #22 character long string'); // "a22CharacterLongString"
caseCamel("I'm a sp3c!al $741ng"); // "iMASp3cAl741ng"

// with accented characters
caseCamel('àëîóüý Žøñç'); // "aeiouyZonc"

// with leading special characters and numbers
caseCamel('__with    many --- spaces'); // "withManySpaces"
caseCamel('12 monkeys see 6 bananas'); // "monkeysSee6Bananas"

// non-string values
caseCamel({ not: 'a string' }); // throws ZeroDepError: Value is not a string
2.0.9

2 months ago

2.0.8

2 months ago

2.0.7

2 months ago

2.0.6

7 months ago

2.0.5

7 months ago

2.0.3

10 months ago

2.0.2

10 months ago

2.0.1

10 months ago