Commit 398e1a1b authored by Mark Stenglein's avatar Mark Stenglein

A few fixes as well as adding the generated js

parent cda27382
"use strict";
const util_1 = require("./util");
/**
* Implementation of a Content Line from RFC 5545
*
* @author Mark Stenglein <mark@stengle.in>
*
* Chapter 3.1 defines the content line. This implementation will use it as an
* abstract class which can be extended later by the specific content types.
*
* This class defines all of the general features specified by the chapter,
* while leaving the specific features required by individual component objects
* unfilled.
*/
class ContentLine {
constructor(inName, inParam, inValue) {
this.name = inName;
this.param = inParam;
this.value = inValue;
}
/* Getters */
get name() {
return this._name;
}
get param() {
return this._param;
}
get value() {
return this._value;
}
/* Setters */
set name(newName) {
if (util_1.isAlpha(newName)) {
this._name = newName;
}
else {
throw new TypeError("'name' must be alphabetic!");
}
}
set param(newParam) {
this._param = newParam;
}
set value(newValue) {
if (util_1.isAlpha(newValue)) {
this._value = newValue;
}
}
}
exports.ContentLine = ContentLine;
"use strict";
var greet_1 = require("./greet");
const greet_1 = require("./greet");
console.log(greet_1.sayHello("TypeScript"));
"use strict";
function sayHello(name) {
return "Hello from " + name;
}
exports.sayHello = sayHello;
"use strict";
function isAlpha(input) {
return /^[a-zA-Z]+$/.test(input);
}
exports.isAlpha = isAlpha;
......@@ -44,7 +44,7 @@ export class ContentLine {
this._name = newName;
}
else {
throw new TypeError("'name' must be alphabetic!")
throw new TypeError("'name' must be alphabetic!");
}
}
......@@ -57,4 +57,4 @@ export class ContentLine {
this._value = newValue;
}
}
}
\ No newline at end of file
}
{
"files": [
"src/**/*.ts"
"src/ContentLine.ts",
"src/util.ts",
"src/main.ts",
"src/greeter.ts"
],
"compilerOptions": {
"module": "commonjs",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment