vanillajs-helpers

Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS

View the Project on GitHub Tokimon/vanillajs-helpers

vanillajs-helpers > “camelCase”

External module: “camelCase”

Index

Interfaces

Type aliases

Functions

Object literals


Type aliases

CamelCaseFunction

Τ CamelCaseFunction: function

Defined in camelCase.ts:11

Type declaration

►(str: string): string

Parameters:

Param Type Description
str string -

Returns: string


Functions

camelCase

camelCase(input?: CamelCaseSettings): CamelCaseFunction

camelCase(input: string): string

Defined in camelCase.ts:60

Return a function that transforms a string into a camelCased word (eg. ‘camel case’ -> ‘camelCase’).

const caser = camelCase({ abbr: true, numbers: true, upper: true });

caser('data-VALUE2-input'); // -> DataVALUE2Input
caser('XML data input'); // -> XMLDataInput

Parameters:

Param Type Description
input CamelCaseSettings The settings for the returned format method

Returns: CamelCaseFunction

Defined in camelCase.ts:80

Transform a string into a camelCased word (eg. ‘camel case’ -> ‘camelCase’)

camelCase('data-value2-input'); // -> dataValue2input
camelCase('XML data input'); // -> XmlDataInput

The Ruels of the camel casing can be changed by giving it an object

const camelCaseKeepAbbr = camelCase({ abbr: true });
camelCaseKeepAbbr('XML data input'); // -> XMLDataInput

Parameters:

Param Type Description
input string The string to format

Returns: string


caser

caser(settings: CamelCaseSettings, str: string): string

Defined in camelCase.ts:33

Transform a string into a camelCased word (eg. ‘camel case’ -> ‘camelCase’)

caser('data-value2-input'); // -> dataValue2input

Parameters:

Param Type Description
settings CamelCaseSettings The settings for the string formatting
str string The string to format

Returns: string


Object literal: defaultSettings

abbr

● abbr: false = false

Defined in camelCase.ts:17


numbers

● numbers: true = true

Defined in camelCase.ts:18


upper

● upper: false = false

Defined in camelCase.ts:16