Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unnecessary toDate call in next week day functions (nextMonday, etc) #2599

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/nextFriday/index.ts
@@ -1,6 +1,5 @@
import requiredArgs from '../_lib/requiredArgs/index'
import nextDay from '../nextDay/index'
import toDate from '../toDate/index'
import requiredArgs from '../_lib/requiredArgs/index'

/**
* @name nextFriday
Expand All @@ -21,5 +20,5 @@ import toDate from '../toDate/index'
*/
export default function nextFriday(date: Date | number): Date {
requiredArgs(1, arguments)
return nextDay(toDate(date), 5)
return nextDay(date, 5)
}
5 changes: 2 additions & 3 deletions src/nextMonday/index.ts
@@ -1,6 +1,5 @@
import requiredArgs from '../_lib/requiredArgs/index'
import nextDay from '../nextDay/index'
import toDate from '../toDate/index'
import requiredArgs from '../_lib/requiredArgs/index'

/**
* @name nextMonday
Expand All @@ -21,5 +20,5 @@ import toDate from '../toDate/index'
*/
export default function nextMonday(date: Date | number): Date {
requiredArgs(1, arguments)
return nextDay(toDate(date), 1)
return nextDay(date, 1)
}
5 changes: 2 additions & 3 deletions src/nextSaturday/index.ts
@@ -1,6 +1,5 @@
import requiredArgs from '../_lib/requiredArgs/index'
import nextDay from '../nextDay/index'
import toDate from '../toDate/index'
import requiredArgs from '../_lib/requiredArgs/index'

/**
* @name nextSaturday
Expand All @@ -21,5 +20,5 @@ import toDate from '../toDate/index'
*/
export default function nextSaturday(date: Date | number): Date {
requiredArgs(1, arguments)
return nextDay(toDate(date), 6)
return nextDay(date, 6)
}
5 changes: 2 additions & 3 deletions src/nextSunday/index.ts
@@ -1,6 +1,5 @@
import requiredArgs from '../_lib/requiredArgs/index'
import nextDay from '../nextDay/index'
import toDate from '../toDate/index'
import requiredArgs from '../_lib/requiredArgs/index'

/**
* @name nextSunday
Expand All @@ -21,5 +20,5 @@ import toDate from '../toDate/index'
*/
export default function nextSunday(date: Date | number): Date {
requiredArgs(1, arguments)
return nextDay(toDate(date), 0)
return nextDay(date, 0)
}
5 changes: 2 additions & 3 deletions src/nextThursday/index.ts
@@ -1,6 +1,5 @@
import requiredArgs from '../_lib/requiredArgs/index'
import nextDay from '../nextDay/index'
import toDate from '../toDate/index'
import requiredArgs from '../_lib/requiredArgs/index'

/**
* @name nextThursday
Expand All @@ -21,5 +20,5 @@ import toDate from '../toDate/index'
*/
export default function nextThursday(date: Date | number): Date {
requiredArgs(1, arguments)
return nextDay(toDate(date), 4)
return nextDay(date, 4)
}
5 changes: 2 additions & 3 deletions src/nextTuesday/index.ts
@@ -1,6 +1,5 @@
import requiredArgs from '../_lib/requiredArgs/index'
import nextDay from '../nextDay/index'
import toDate from '../toDate/index'
import requiredArgs from '../_lib/requiredArgs/index'

/**
* @name nextTuesday
Expand All @@ -21,5 +20,5 @@ import toDate from '../toDate/index'
*/
export default function nextTuesday(date: Date | number): Date {
requiredArgs(1, arguments)
return nextDay(toDate(date), 2)
return nextDay(date, 2)
}
5 changes: 2 additions & 3 deletions src/nextWednesday/index.ts
@@ -1,6 +1,5 @@
import requiredArgs from '../_lib/requiredArgs/index'
import nextDay from '../nextDay/index'
import toDate from '../toDate/index'
import requiredArgs from '../_lib/requiredArgs/index'

/**
* @name nextWednesday
Expand All @@ -21,5 +20,5 @@ import toDate from '../toDate/index'
*/
export default function nextWednesday(date: Date | number): Date {
requiredArgs(1, arguments)
return nextDay(toDate(date), 3)
return nextDay(date, 3)
}