String

Methods

(static) camelCase(textnon-null) → {strign}

Returns the camelCase text from text
Parameters:
Name Type Description
text string The text
Source:
Example
import { camelCase } from 'main-fns';

const text = 'Hello world';
console.log(camelCase(text)); // 'helloWorld'

(static) capitalize(textnon-null) → {strign}

Returns the capitalized text from text
Parameters:
Name Type Description
text string The text
Source:
Example
import { capitalize } from 'main-fns';

const text = 'hello';
console.log(capitalize(text)); // 'Hello'

(static) firstLetters(textnon-null, numberOfLettersopt) → {strign}

Returns the first letters from text
Parameters:
Name Type Attributes Default Description
text string The text
numberOfLetters number <optional>
1 The number of letters, by default is `1`
Source:
Example
import { firstLetters } from 'main-fns';

const text = 'Hello world';
console.log(firstLetters(text, 3)); // 'Hel'

(static) kebabCase(textnon-null) → {strign}

Returns the kebabCase text from text
Parameters:
Name Type Description
text string The text
Source:
Example
import { kebabCase } from 'main-fns';

const text = 'Hello world';
console.log(kebabCase(text)); // 'hello-world'

(static) lastLetters(textnon-null, numberOfLettersopt) → {strign}

Returns the last letters from text
Parameters:
Name Type Attributes Default Description
text string The text
numberOfLetters number <optional>
1 The number of letters, by default is `1`
Source:
Example
import { lastLetters } from 'main-fns';

const text = 'Hello world';
console.log(lastLetters(text, 3)); // 'rld'

(static) lowerCase(textnon-null) → {strign}

Returns the lowerCase text from text
Parameters:
Name Type Description
text string The text
Source:
Example
import { lowerCase } from 'main-fns';

const text = 'Hello world';
console.log(lowerCase(text)); // 'hello world'

(static) pascalCase(textnon-null) → {strign}

Returns the pascalCase text from text
Parameters:
Name Type Description
text string The text
Source:
Example
import { pascalCase } from 'main-fns';

const text = 'Hello world';
console.log(pascalCase(text)); // 'HelloWorld'

(static) snakeCase(textnon-null) → {strign}

Returns the snakeCase text from text
Parameters:
Name Type Description
text string The text
Source:
Example
import { snakeCase } from 'main-fns';

const text = 'Hello world';
console.log(snakeCase(text)); // 'hello_world'

(static) titleCase(textnon-null) → {strign}

Returns the titleCase text from text
Parameters:
Name Type Description
text string The text
Source:
Example
import { titleCase } from 'main-fns';

const text = 'Hello world';
console.log(titleCase(text)); // 'Hello World'

(static) upperCase(textnon-null) → {strign}

Returns the upperCase text from text
Parameters:
Name Type Description
text string The text
Source:
Example
import { upperCase } from 'main-fns';

const text = 'Hello world';
console.log(upperCase(text)); // 'HELLO WORLD'