Skip to content

Instantly share code, notes, and snippets.

@BobGneu
Last active December 6, 2018 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BobGneu/1794c443a536cb2c4c4edd69feb864cd to your computer and use it in GitHub Desktop.
Save BobGneu/1794c443a536cb2c4c4edd69feb864cd to your computer and use it in GitHub Desktop.
Wrangling Input within TS - Example 1
"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();
}
}
"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