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
83172958
Commit
83172958
authored
Feb 17, 2017
by
Mark Stenglein
Browse files
Add CI, fix a couple tests, kill .viscode folder
parent
addafff2
Pipeline
#898
failed with stage
in 0 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
.gitignore
View file @
83172958
...
...
@@ -4,3 +4,5 @@ logs
# Dependency Directory
node_modules
.vscode/
.gitlab-ci.yml
0 → 100644
View file @
83172958
image
:
node-latest
cache
:
paths
:
-
node_modules/
types
:
-
test
test_lib-ical
:
type
:
test
before_script
:
-
npm install
-
npm install -g typescript ts-node gulp-cli
script
:
-
npm test
-
gulp
.vscode/settings.json
deleted
100644 → 0
View file @
addafff2
//
Place
your
settings
in
this
file
to
overwrite
default
and
user
settings.
{
}
\ No newline at end of file
dist/ContentLine.js
View file @
83172958
...
...
@@ -13,17 +13,18 @@ const util_1 = require("./util");
* unfilled.
*/
class
ContentLine
{
constructor
(
inName
,
inParam
,
inValue
)
{
constructor
(
inName
,
inParams
,
inValue
)
{
this
.
_params
=
[];
this
.
name
=
inName
;
this
.
param
=
inParam
;
this
.
_
param
s
=
inParam
s
;
this
.
value
=
inValue
;
}
/* Getters */
get
name
()
{
return
this
.
_name
;
}
get
param
()
{
return
this
.
_param
;
get
param
s
()
{
return
this
.
_param
s
;
}
get
value
()
{
return
this
.
_value
;
...
...
@@ -37,13 +38,35 @@ class ContentLine {
throw
new
TypeError
(
"
'name' must be alphabetic!
"
);
}
}
set
param
(
newParam
)
{
this
.
_param
=
newParam
;
}
set
value
(
newValue
)
{
if
(
util_1
.
isAlpha
(
newValue
))
{
this
.
_value
=
newValue
;
}
}
/**
* Folds lines into 74 octet sections
*
* @author Sebastian Pekarek <mail@sebbo.net>
*
* TODO: Make sure that this handles multi-octed UTF-8 segments properly.
*/
static
fold
(
line
)
{
return
line
.
match
(
/
(
.
{1,74})
/g
).
join
(
"
\r\n
"
);
}
/**
* Generates a folded content line to use to create the final file.
*
* @author Mark Stenglein <mark@stengle.in>
*/
generate
()
{
let
outputLine
=
this
.
name
;
this
.
params
.
forEach
((
param
)
=>
{
outputLine
+=
"
;
"
;
outputLine
+=
param
;
});
outputLine
+=
"
:
"
+
this
.
value
+
"
\r\n
"
;
return
ContentLine
.
fold
(
outputLine
);
}
}
exports
.
ContentLine
=
ContentLine
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
default
=
ContentLine
;
src/ContentLine.spec.ts
View file @
83172958
...
...
@@ -6,11 +6,11 @@ describe("ContentLine", () => {
it
(
"
Should exist
"
,
()
=>
{
let
result
=
true
;
if
(
typeof
ContentLine
==
undefined
)
{
if
(
typeof
ContentLine
==
=
undefined
)
{
result
=
false
;
}
expect
(
result
).
to
.
be
.
true
;
})
})
})
;
})
;
src/ContentLine.ts
View file @
83172958
...
...
@@ -62,7 +62,7 @@ export default class ContentLine {
* TODO: Make sure that this handles multi-octed UTF-8 segments properly.
*/
static
fold
(
line
:
string
):
string
{
return
line
.
match
(
/
(
.
{1,74})
/g
).
join
(
'
\r\n
'
);
return
line
.
match
(
/
(
.
{1,74})
/g
).
join
(
"
\r\n
"
);
}
/**
...
...
@@ -74,11 +74,11 @@ export default class ContentLine {
let
outputLine
=
this
.
name
;
this
.
params
.
forEach
((
param
)
=>
{
outputLine
+=
'
;
'
;
outputLine
+=
"
;
"
;
outputLine
+=
param
;
});
outputLine
+=
'
:
'
+
this
.
value
+
'
\r\n
'
;
outputLine
+=
"
:
"
+
this
.
value
+
"
\r\n
"
;
return
ContentLine
.
fold
(
outputLine
);
}
...
...
src/util.spec.ts
View file @
83172958
...
...
@@ -8,12 +8,12 @@ describe("util", () => {
it
(
"
Should exist
"
,
()
=>
{
let
result
=
true
;
if
(
typeof
isAlpha
==
undefined
)
{
if
(
typeof
isAlpha
==
=
undefined
)
{
result
=
false
;
}
expect
(
result
).
to
.
be
.
true
;
})
})
;
it
(
"
Should return false for numbers
"
,
()
=>
{
let
test
=
"
12345
"
;
...
...
@@ -47,7 +47,7 @@ describe("util", () => {
let
test
=
"
ABCDEF
"
;
let
result
=
isAlpha
(
test
);
expect
(
result
).
to
.
be
.
true
expect
(
result
).
to
.
be
.
true
;
});
it
(
"
Should return true for mixed alpha
"
,
()
=>
{
...
...
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