Last active
December 6, 2018 00:04
-
-
Save BobGneu/1794c443a536cb2c4c4edd69feb864cd to your computer and use it in GitHub Desktop.
Wrangling Input within TS - Example 1
This file contains 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
"use strict"; | |
export class TSWrangle { | |
private name!: string; | |
public get Name() { | |
return this.name; | |
} | |
public set Name(value: string) { | |
if (value.length === 0) { | |
return; | |
} | |
this.name = value; | |
} | |
constructor(name: string) { | |
this.Name = name; | |
} | |
public doSomething() { | |
return `${this.name} ${this.doSomethingElse()}`; | |
} | |
protected doSomethingElse() { | |
return Date.now(); | |
} | |
} |
This file contains 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
"use strict"; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
var TSWrangle = /** @class */ (function () { | |
function TSWrangle(name) { | |
this.Name = name; | |
} | |
Object.defineProperty(TSWrangle.prototype, "Name", { | |
get: function () { | |
return this.name; | |
}, | |
set: function (value) { | |
if (value.length === 0) { | |
return; | |
} | |
this.name = value; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
TSWrangle.prototype.doSomething = function () { | |
return this.name + " " + this.doSomethingElse(); | |
}; | |
TSWrangle.prototype.doSomethingElse = function () { | |
return Date.now(); | |
}; | |
return TSWrangle; | |
}()); | |
exports.TSWrangle = TSWrangle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment