File tree 3 files changed +12
-7
lines changed
3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " twinte-parser" ,
3
- "version" : " 1.3.1 " ,
3
+ "version" : " 1.3.2 " ,
4
4
"description" : " Twinte内部で使用するために開発されたKdBパーサ" ,
5
5
"private" : false ,
6
6
"main" : " dist/index.js" ,
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import parse from './parser'
4
4
import * as colors from 'colors'
5
5
import * as commandLineArgs from 'command-line-args'
6
6
7
- console . log ( 'twinte-parser v0.0.1 ' . green . bold )
7
+ console . log ( 'twinte-parser v1.3.2 ' . green . bold )
8
8
9
9
const ops = commandLineArgs ( [
10
10
{ name : 'year' , alias : 'y' , defaultValue : undefined }
Original file line number Diff line number Diff line change @@ -61,11 +61,7 @@ const analyzeDayAndPeriod = (str: string): { day: Day; period: number }[] => {
61
61
const analyzeModule = ( str : string ) : Module [ ] => {
62
62
const result : Module [ ] = [ ]
63
63
64
- // 特殊系のマッチング(通年、夏季休業中、春季休業中)
65
- if ( str . includes ( Module . Annual ) ) result . push ( Module . Annual )
66
- if ( str . includes ( Module . SpringVacation ) ) result . push ( Module . SpringVacation )
67
- if ( str . includes ( Module . SummerVacation ) ) result . push ( Module . SummerVacation )
68
-
64
+
69
65
/*
70
66
/春[ABC]*A/は春A 春AB 春ABCに
71
67
/春[ABC]*B/は春B 春AB 春BCに
@@ -74,10 +70,19 @@ const analyzeModule = (str: string): Module[] => {
74
70
if ( / 春 [ A B C ] * A / gm. test ( str ) ) result . push ( Module . SpringA )
75
71
if ( / 春 [ A B C ] * B / gm. test ( str ) ) result . push ( Module . SpringB )
76
72
if ( / 春 [ A B C ] * C / gm. test ( str ) ) result . push ( Module . SpringC )
73
+
74
+ // 夏季休業中、通年のマッチング
75
+ if ( str . includes ( Module . SummerVacation ) ) result . push ( Module . SummerVacation )
77
76
78
77
if ( / 秋 [ A B C ] * A / gm. test ( str ) ) result . push ( Module . FallA )
79
78
if ( / 秋 [ A B C ] * B / gm. test ( str ) ) result . push ( Module . FallB )
80
79
if ( / 秋 [ A B C ] * C / gm. test ( str ) ) result . push ( Module . FallC )
80
+
81
+ // 春季休業中のマッチング
82
+ if ( str . includes ( Module . SpringVacation ) ) result . push ( Module . SpringVacation )
83
+
84
+ // 通年のマッチング
85
+ if ( str . includes ( Module . Annual ) ) result . push ( Module . Annual )
81
86
82
87
//どのモジュールにも判定されなかったが空文字ではない場合、仮にunknownとする
83
88
if ( str !== '' && result . length === 0 ) result . push ( Module . Unknown )
You can’t perform that action at this time.
0 commit comments