File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,12 @@ import parse from 'parse-duration'
3
3
parse [ '' ] = parse [ 's' ] !
4
4
parse [ 'mo' ] = parse [ 'M' ] = parse [ 'month' ] !
5
5
6
- const defaultUnitValue = parse [ '' ] !
7
-
8
6
export const parseDuration = ( duration : string , defaultUnit ?: parse . Units ) => {
7
+ const defaultUnitValue = parse [ '' ] !
9
8
if ( defaultUnit ) parse [ '' ] = parse [ defaultUnit ] !
10
- return (
11
- // biome-ignore lint/suspicious/noAssignInExpressions: Expression is ignored
12
- // biome-ignore lint/style/noCommaOperator: The last expression (parse call) is returned, it is not confusing
13
- ( parse [ '' ] = defaultUnitValue ) , parse ( duration , 'ms' ) ?? Number . NaN
14
- )
9
+ const result = parse ( duration , 'ms' ) ?? Number . NaN
10
+ parse [ '' ] = defaultUnitValue
11
+ return result
15
12
}
16
13
17
14
export const durationToString = ( duration : number ) => {
You can’t perform that action at this time.
0 commit comments