Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/voltrexkeyva/string-toolkit
Just a package containing tools to manipulate a string.
https://github.com/voltrexkeyva/string-toolkit
string-manipulation
Last synced: 2 months ago
JSON representation
Just a package containing tools to manipulate a string.
- Host: GitHub
- URL: https://github.com/voltrexkeyva/string-toolkit
- Owner: VoltrexKeyva
- License: mit
- Created: 2020-08-12T06:33:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-14T04:16:43.000Z (over 2 years ago)
- Last Synced: 2024-11-09T14:18:55.882Z (2 months ago)
- Topics: string-manipulation
- Language: C++
- Homepage: https://npmjs.com/package/string-toolkit
- Size: 116 KB
- Stars: 16
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Just a package containing tools to manipulate a string.
[![npm](https://img.shields.io/npm/dm/string-toolkit.svg)](https://www.npmjs.com/package/string-toolkit)
## Installation
```bash
npm i string-toolkit
```## Usage
```js
// Creating a new instance.
const stringTools = new (require('string-toolkit'))();// Can also be used without a new instance.
const stringTools = require('string-toolkit');
```## Example
```js
const stringTools = require('string-toolkit');console.log(stringTools.toProperCase('hey there!'));
```# Available functions
### `toProperCase(string[, boolean])`
```js
const output = stringTools.toProperCase('hey there!', true);console.log(output); // 'Hey There!'
```### `toChunks(string, number)`
```js
const output = stringTools.toChunks('hey there!', 3);console.log(output); // [ 'hey', ' th', 'ere', '!' ]
```### `scramble(string)`
```js
const output = stringTools.scramble('hey there!');console.log(output); // 'rte! ehyhe'
```### `mock(string)`
```js
const output = stringTools.mock('hey there!');console.log(output); // 'HeY ThErE!'
```### `emojify(string)`
```js
const output = stringTools.emojify('hey there!');console.log(output);
// '🇭🇪🇾 🇹🇭🇪🇷🇪❗'
```### `hasCustomEmoji(string)`
```js
const output = stringTools.hasCustomEmoji('hey there!');console.log(output); // false
```### `createProgressBar(number, number[, object])`
```js
const output = stringTools.createProgressBar(57, 100, {
elapsedChar: '+',
progressChar: '@',
emptyChar: '~',
barLength: 10
});console.log(output); // '+++++@~~~~'
```### `toAbbreviation(string)`
```js
const output = stringTools.toAbbreviation('hey there!');console.log(output); // 'ht'
```### `fakeToken()`
```js
const output = stringTools.fakeToken();console.log(output);
// 'NDI0NTYyNzY1NTMzNzQ0MjY3MA==.Cz0j0.Zf6Tfo17wN27N8tnkoG164Q9'
```### `decancer(string)`
```js
const output = stringTools.decancer('𝓱𝓮𝔂 𝓽𝓱𝓮𝓻𝓮!');console.log(output); // 'hey there!'
```### `shorten(string, number[, string])`
```js
const output = stringTools.shorten('bruh moment', 4, 'end');console.log(output); // 'bruhend'
```### `parseOptions(string[])`
```js
const str = 'bruh --moment what bro --search --big bruh moment';const output = stringTools.parseOptions(str.split(' '));
console.log(output);
/*
{
options: {
moment: 'what bro',
big: 'bruh moment'
},
flags: [ 'search' ],
contentNoOptions: 'bruh',
contentNoFlags: 'bruh what bro bruh moment'
}
*/
```