This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
/** | |
Truncates the string to the specified length number of characters and appends an optional trailing string if longer. | |
- Parameter length: A `String`. | |
- Parameter trailing: A `String` that will be appended after the truncation. | |
- Returns: A `String` object. | |
*/ | |
func truncate(length: Int, trailing: String = "…") -> String { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The Timer Module makes it easy to analyze how long each | |
of your functions, promises, etc. are taking in Cloud | |
Code. | |
Although NSDate.getTime() isn't as accurate as other modern | |
approaches (e.g console.time, performance.now) it is still | |
quite helpful. |