-
Notifications
You must be signed in to change notification settings - Fork 1
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
Функции возвращаются #5
Changes from 3 commits
7e5fbd8
e869bc6
aa3520c
33801d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,6 @@ const getPhotoData = () => { | |
]; | ||
|
||
return { DESCRIPTIONS, NAMES, MESSAGES }; | ||
} | ||
}; | ||
|
||
export { getPhotoData }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
// Функция для проверки, является ли строка длиннее заданного числа | ||
|
||
const isStringLonger = (string = '', maxLength = 1) => string.length <= maxLength; | ||
|
||
|
||
// Функция для проверки, является ли строка палиндромом | ||
|
||
const isPalindrom = (string = '') => { | ||
string = string.toLowerCase().replaceAll(' ', ''); | ||
let reverseString = ''; | ||
for (let i = 0; i < string.length; i++) { | ||
|
@@ -16,7 +15,7 @@ | |
|
||
// Функция для извлечения числа из строки | ||
|
||
const extractNumber = (string) => { | ||
string = string.toString(); | ||
let number = ''; | ||
for (let i = 0; i < string.length; i++) { | ||
|
@@ -26,3 +25,25 @@ | |
} | ||
return parseInt(number, 10); | ||
}; | ||
|
||
// Функция, опеределяющая, выходит вреча за рамки рабочего времени или нет | ||
|
||
const isDelayAtWork = (starWorkDayTime, endWorkDayTime, startMeetingTime, meetingTimeInMinute) => { | ||
const toNumber = (string) => { | ||
const number = string.split(':'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Деструктуризируй массив |
||
number[1] /= 60; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Не ошибка, но рекомендация. Лучше приводить к минутам, чтоб не работать с числами с плавающей точкой И здесь можно избежать присваивания, а сразу все делать в return, даже не сохраняя в |
||
const result = Number(number[0]) + number[1]; | ||
return result; | ||
}; | ||
|
||
const startDay = toNumber(starWorkDayTime); | ||
const endDay = toNumber(endWorkDayTime); | ||
const startMeeting = toNumber(startMeetingTime); | ||
const meetingTimeInHour = meetingTimeInMinute / 60; | ||
|
||
if (startDay > startMeeting || endDay <= startMeeting || meetingTimeInHour > (endDay - startMeeting)) { | ||
return false; | ||
} | ||
|
||
return true; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import { getPhotoSettings } from './photo-settings.js'; | ||
import { createPhoto } from './create-photo.js'; | ||
import { createPhoto, PhotosQuantity } from './create-photo.js'; | ||
|
||
const photos = Array.from({length: getPhotoSettings().PhotosQuantity.MAX}, createPhoto); | ||
const photos = Array.from({length: PhotosQuantity.MAX}, createPhoto); | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Убери функцию getPhotoData и экспортируй сразу export { DESCRIPTIONS, NAMES, MESSAGES }. Функция здесь абсолютно лишняя