This package contains a few helper classes and functions created while attending the Launch Academy Boston 35 bootcamp.
So ... beware ... zero promises.
Returns a random integer number between of min lower
and max upper
For a given string e.g. "hello world" returns "Hello world".
A class
that contains various methods that help working with strings.
stringSortPredicate(isAsc: {Boolean} = true)
- Returns a predicate for use in anArray.sort
method.sortStrings(arr: {arr[]}, isAsc:{Boolean} = true, inPlace: {Boolean} = true)
- Sorts string arrays either ascending or descending either in place or returning a shallow copy.pluralizeNoun(noun: {string})
- has a bit of a go at converting a noun into its plural form using some (but by no means all) of the rules from Grammerly.
A class
for asking questions via window.prompt()
.
question: {string}
- The text to display in the prompt.'answerType: '{string}
- The type of answer required - "string", "number", or "boolean". Default is "string".pattern: {RegExp}
- The regular expression literal that a "string" answer must match to be valid. Default is/./
matching all characters.min: {number}
- Either the minium value for "number", orlength
for a string. Default is zero.max: {number}
- Either the maximum value for "number", orlength
for a string. Default is Infinity.
ask()
- Ask a question viaprompt
and return the validated answer based on theQuestion
's validation critera.
deduplicate({any[]})
- Returns a shallow copy of only the unique items in an provided array.