Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert util TextUtils to TS #16

Merged
merged 2 commits into from
May 20, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TextUtils {
* One, Two, and Three
* @param {String[]} items The items to join in a list
*/
static join(items) {
static join(items: string[]): string {
spasovski marked this conversation as resolved.
Show resolved Hide resolved
if (items == null || items.length === 0) {
return '';
}
Expand All @@ -30,7 +30,7 @@ class TextUtils {
* @param {String} text The text to convert to lower case
* @param {Boolean} isNullAllowed True if a null string should return an empty string from this function. If false an error is thrown if null is passed in.
*/
static toLower(text, isNullAllowed = true) {
static toLower(text: string, isNullAllowed = true): string {
spasovski marked this conversation as resolved.
Show resolved Hide resolved
if (text == null) {
if (isNullAllowed) {
return '';
Expand All @@ -48,7 +48,7 @@ class TextUtils {
* @param {String} b Second string to sort
* @param {boolean} isAscending Whether to sort ascending or descending
*/
static sort(a, b, isAscending = true) {
static sort(a: string, b: string, isAscending = true): number {
if (a < b) {
return isAscending ? -1 : 1;
}
Expand Down