interface String {
get trimmed(): string
}
Object.defineProperty(String.prototype, "trimmed", {
get: function trimmed() {
return this.trim()
}
})
let str = " \t word \r\n".trimmed
//str is "word"
console.log(`str is \"${str}\"`)