Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
gustawdaniel
nbp
Commits
fd13a96c
Commit
fd13a96c
authored
Feb 17, 2021
by
gustawdaniel
Browse files
Dropped junk lines
parent
845527b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
app.ts
app.ts
+3
-1
No files found.
app.ts
View file @
fd13a96c
...
...
@@ -36,6 +36,7 @@ const FILES_FILTER = (e: string, i: number) => i < Infinity
const
ROWS_FILTER
=
(
e
:
string
,
i
:
number
)
=>
i
<=
Infinity
const
DROP_SPACES
=
(
l
:
string
):
string
=>
l
.
replace
(
/
\s
+/g
,
''
)
const
DROP_JUNK_LINES
=
(
l
:
string
):
string
=>
l
.
replace
(
/
(
Nr
)
|
(
data
)
|
(
WALUTA
\/
CURRENCY
)
|
(\.
tab
)
/ig
,
''
)
const
DROP_EMPTY_LINES
=
(
e
:
string
)
=>
!
/^,*$/
.
test
(
e
)
const
testYearData
=
(
r
:
YearData
):
void
=>
{
...
...
@@ -66,11 +67,12 @@ const main = () => {
.
toString
()
.
split
(
`\n`
)
.
map
(
DROP_SPACES
)
.
map
(
DROP_JUNK_LINES
)
.
filter
(
DROP_EMPTY_LINES
)
.
filter
(
ROWS_FILTER
)
.
map
(
l
=>
l
.
split
(
'
,
'
));
console
.
table
(
arr
.
map
(
l
=>
l
.
filter
((
e
,
i
)
=>
i
<
3
||
Math
.
abs
(
i
-
27
)
<
5
)
));
console
.
table
(
arr
.
map
(
l
=>
l
));
const
head
=
arr
.
shift
()
if
(
!
head
)
throw
Error
(
'
File do not have header line.
'
)
...
...
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