1.0.5 • Published 5 months ago

multiple-utils v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

Multiple utilities

Small library that implements some methods to handle different types of values in Typescript.

String methods

Methods to help you handle strings.

MethodReturnsDescription
isValidPhoneString(phone: string)booleanChecks if the given string has a phone format that is formed from the next chars: +123456789.0(); its lenght is not greater than 18 characters and have not bad formations
itHasNestedBrackets(pattern: string, openingBracketChar: string, closingBracketChar: string)booleanChecks if a given string has nested brackets
itHasBalancedBrackets(pattern: string, openingBracketChar: string, closingBracketChar: string)booleanChecks if a given string is balanced with the given brackets.
containsTwoConsecutiveCharacters(pattern: string, char: string)booleanChecks if a string contains two consecutive instances of the given char.
truncateString(string: string, length: number)stringTruncates the given string if its length is greater that the length provided.
fillZerosOnTheLeft(number: number, totalLength: number)stringFills the given number with zeroes to the left.
countCharacter(string: string, character: string)stringCounts the specific characters that exist in a given string
generateRandomString(length: number)stringGenerates a string composed by random characters (AZ-az-0-9 only) with the specified lenght.
cleanSpacesInString(text: string)stringCleans the existing multiple spaces that a string could have, in the start, middle or end, leaving the string with single separation spaces in between.
isValidEmailAddress(email: string)booleanEvaluate the given string to define if is a correct email address.

Contributing

Contributions are always welcome!

Pull requests should have tests to cover the new methods, covering a wide range of posible scenarios.

Support

For support, open an new issue in this the repository site.

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago