extendutils

0.3.0 • Public • Published

~ extendutils ~

A small library for extended string and array functions

 

npm install extendutils --save

Usage

String

.contains(content, casesensitive)

Tests if the string contains another string or a string of an array.

Parameter Type Optional (Default) Description
content string / string[] no sequence / array which needs to be containing
csasesensitive boolean yes (false) check content case sensitive or not

Returns: boolean Containing state



.replaceAny(oldstring, newstring)

Replace all entered strings with new strings or remove strings when no new string is defined.

Parameter Type Optional (Default) Description
oldstring string no String that should be replaced
newstring string yes ("" remove) Replace with

Returns: string String with replaced string sequences



.padStart(length, char)

Append a string at the beginning with a character until it's length is same as set as minimum length.

Parameter Type Optional (Default) Description
length number yes (2) Minimum length of the result
char string yes (' ') Appendet character

Returns: string Result

.padEnd(length, char)

Append a string at the end with a character until it's length is same as set as minimum length.

Parameter Type Optional (Default) Description
length number yes (2) Minimum length of the result
char string yes (' ') Appendet character

Returns: string Result

Array

.contains(content, casesensitive)

Tests if the array contains a string or a string of another array. Atention: It returns true if the input array contains ANY string of the query, and not the specific sequence of it!

Parameter Type Optional (Default) Description
content string / string[] no sequence / array which needs to be containing
csasesensitive boolean yes (false) check content case sensitive or not

Returns: boolean Containing state

Number

.padStart(length, char)

Append a number at the beginning with a character until it's length is same as set as minimum length.

Parameter Type Optional (Default) Description
length number yes (2) Minimum length of the result
char string yes ('0') Appendet character

Returns: string Result

.padEnd(length, char)

Append a number at the end with a character until it's length is same as set as minimum length.

Parameter Type Optional (Default) Description
length number yes (2) Minimum length of the result
char string yes ('0') Appendet character

Returns: string Result

Package Sidebar

Install

npm i extendutils

Weekly Downloads

2

Version

0.3.0

License

MIT

Last publish

Collaborators

  • zekro