Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
lib-ical
Commits
398e1a1b
Commit
398e1a1b
authored
Feb 17, 2017
by
Mark Stenglein
Browse files
A few fixes as well as adding the generated js
parent
cda27382
Changes
6
Show whitespace changes
Inline
Side-by-side
dist/ContentLine.js
0 → 100644
View file @
398e1a1b
"
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
;
dist/
src/
main.js
→
dist/main.js
View file @
398e1a1b
"
use strict
"
;
var
greet_1
=
require
(
"
./greet
"
);
const
greet_1
=
require
(
"
./greet
"
);
console
.
log
(
greet_1
.
sayHello
(
"
TypeScript
"
));
dist/src/greet.js
deleted
100644 → 0
View file @
cda27382
"
use strict
"
;
function
sayHello
(
name
)
{
return
"
Hello from
"
+
name
;
}
exports
.
sayHello
=
sayHello
;
dist/util.js
0 → 100644
View file @
398e1a1b
"
use strict
"
;
function
isAlpha
(
input
)
{
return
/^
[
a-zA-Z
]
+$/
.
test
(
input
);
}
exports
.
isAlpha
=
isAlpha
;
src/ContentLine.ts
View file @
398e1a1b
...
...
@@ -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!
"
)
;
}
}
...
...
tsconfig.json
View file @
398e1a1b
{
"files"
:
[
"src/**/*.ts"
"src/ContentLine.ts"
,
"src/util.ts"
,
"src/main.ts"
,
"src/greeter.ts"
],
"compilerOptions"
:
{
"module"
:
"commonjs"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment