1.2.0 • Published 3 years ago

strhelper v1.2.0

Weekly downloads
3
License
MIT
Repository
-
Last release
3 years ago

strhelper

Powerful library to manage and interact with strings


Implementation

const STRHelper = require('strhelper');

Now there is 2 ways: 1) Patch String class and add methods into:

STRHelper.patch();

2) Get object with methods to use on strings

let strhelper = STRHeleper.get();

Usage

If patched string class:

let string = 'example';
let newString = string.mixedCase(true);
// newString == 'ExAmPlE'

If using as object with functions:

let string = 'example';
let newString = sthelper.mixedCase(string, false);
// newString == 'eXaMpLe'

Methods

Bit shift (left) - 'string'.shiftLeft(bits: number) 1) Number should be positive

Bit shift (right) - 'string'.shiftRight(bits: number) 1) Number should be positive

Encode/Decode from Base64 - 'string'.toBase64() / 'c3RyaW5n'.fromBase64() Encode/Decode from Hex - 'string'.toHex() / '737472696e67'.fromHex()

Split string every N characters - 'string'.splitEvery(count: number) 1) Count should be more than 0

Make string mixed case - 'string'.mixedCase(startFromFirst: boolean)

Match regex - 'string'.matchR(/test/g) 1) Always returns array, even if no matches (instead of default null)

1.2.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago