Skip to content

Commit f32d228

Browse files
authored
refactor: implement suggestion from #2019 review
1 parent 71102d4 commit f32d228

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/lib/isAfter.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,9 @@ import toDate from './toDate';
44
export default function isAfter(str, options) {
55
assertString(str);
66

7-
let date;
8-
9-
if (typeof (options) === 'object') {
10-
date = options.date;
11-
} else { // backwards compatibility: isAfter(str [, date])
12-
// eslint-disable-next-line prefer-rest-params
13-
date = arguments[1];
14-
}
15-
16-
if (!date) {
17-
date = String(new Date());
18-
}
7+
// accessing 'arguments' for backwards compatibility: isAfter(str [, date])
8+
// eslint-disable-next-line prefer-rest-params
9+
const date = (typeof options === 'object' ? options.date : arguments[1]) || String(new Date());
1910

2011
const comparison = toDate(date);
2112
const original = toDate(str);

0 commit comments

Comments
 (0)