@theholocron/utils-string
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

Strings

Convert a string to any case or case to a different data type.

Installation

npm install --save-dev @theholocron/utils-string

Usage

import * as str from "@theholocron/utils-string";

const test = "hello world";

// casing
str.toCamelCase(test); // helloWorld
str.toConstantCase(test); // HELLO_WORLD"
str.toDotCase(test); // hello.world
str.toKebabCase(test); // hello-world
str.toLowerCase(test); // hello world
str.toPascalCase(test); // HelloWorld
str.toPathCase(test); // hello/world
str.toSentenceCase(test); // Hello world
str.toSnakeCase(test); // hello_world
str.toTitleCase(test); // Hello World
str.toUpperCase(test); // HELLO WORLD

// casting
str.toArray(test); // ["hello world"]);
str.toArray([test]); // ["hello world"]);
str.toBoolean("true"); // true;
str.toBoolean(""); // false;

Check out The Holocron Archive for more information.

Readme

Keywords

none

Package Sidebar

Install

npm i @theholocron/utils-string

Weekly Downloads

41

Version

0.2.1

License

GPL-3.0

Unpacked Size

50.1 kB

Total Files

13

Last publish

Collaborators

  • thenewton