This repository was archived by the owner on Sep 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,4 +29,5 @@ test('isV3Call', () => {
2929 expect ( isV3Call ( '2020Q1' , 'net_sales' ) ) . toBeTruthy ( )
3030 expect ( isV3Call ( 'LYLQ' , 'net_sales' ) ) . toBeTruthy ( )
3131 expect ( isV3Call ( '2020-09-06' , 'market_capital' ) ) . toBeTruthy ( )
32+ expect ( isV3Call ( 'latest' , 'market_capital' ) ) . toBeTruthy ( )
3233} )
Original file line number Diff line number Diff line change @@ -13,12 +13,15 @@ test('parse', () => {
1313 expect ( PeriodParser . parse ( '2020LQ' ) ) . toEqual ( new YearQuarterParam ( 2020 , LQ ) )
1414 expect ( PeriodParser . parse ( 'LYQ3' ) ) . toEqual ( new YearQuarterParam ( LY , 3 ) )
1515 expect ( PeriodParser . parse ( 'LYLQ' ) ) . toEqual ( new YearQuarterParam ( LY , LQ ) )
16+ expect ( PeriodParser . parse ( 'lylq' ) ) . toEqual ( new YearQuarterParam ( LY , LQ ) )
1617 expect ( PeriodParser . parse ( 'LY-1Q4' ) ) . toEqual ( new YearQuarterParam ( new LyWithOffset ( - 1 ) , 4 ) )
1718 expect ( PeriodParser . parse ( '2020LQ-1' ) ) . toEqual ( new YearQuarterParam ( 2020 , new LqWithOffset ( - 1 ) ) )
1819 expect ( PeriodParser . parse ( 'LY-1LQ-1' ) ) . toEqual ( new YearQuarterParam ( new LyWithOffset ( - 1 ) , new LqWithOffset ( - 1 ) ) )
20+ expect ( PeriodParser . parse ( 'ly-1lq-1' ) ) . toEqual ( new YearQuarterParam ( new LyWithOffset ( - 1 ) , new LqWithOffset ( - 1 ) ) )
1921 expect ( PeriodParser . parse ( '2020-09-06' ) ) . toEqual ( new DateParam ( new Date ( '2020-09-06' ) ) )
22+ expect ( PeriodParser . parse ( 'latest' ) ) . toEqual ( new DateParam ( 'latest' ) )
23+ expect ( PeriodParser . parse ( 'Latest' ) ) . toEqual ( new DateParam ( 'latest' ) )
2024 expect ( ( ) => PeriodParser . parse ( 'foo' ) ) . toThrow ( ParseError )
2125 expect ( ( ) => PeriodParser . parse ( '2020/09/06' ) ) . toThrow ( ParseError )
22- expect ( ( ) => PeriodParser . parse ( 'latest' ) ) . toThrow ( ParseError )
2326 expect ( ( ) => PeriodParser . parse ( '0Q1' ) ) . toThrow ( ParseError )
2427} )
Original file line number Diff line number Diff line change @@ -8,19 +8,14 @@ export class PeriodParser {
88 }
99
1010 static parse ( str : string ) : DateParam | YearQuarterParam {
11- str = str . toUpperCase ( )
12-
1311 try {
1412 return YearQuarterParam . parse ( str )
1513 } catch {
1614 // noop
1715 }
1816
1917 try {
20- const date = DateParam . parse ( str )
21- if ( ! date . isLatest ( ) ) {
22- return date
23- }
18+ return DateParam . parse ( str )
2419 } catch {
2520 // noop
2621 }
Original file line number Diff line number Diff line change 1- export const version = 'v12 '
1+ export const version = 'v13 '
You can’t perform that action at this time.
0 commit comments