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

Функция, которая создает событие #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions Event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Возвращает объект Event
*
* @param {String} [name = "Событие"] Имя события
* @param {String} [address = ""] Адресс события
* @param {Object} time Дата события
* @param {Array} member Участники
* @param {Number} [raiting=3] Важность события (по шкале от 0 до 5)
*
* @example
* Event(
* "Совещание", "Екатеринбург, ул. Тургенева, д. 4, ауд. 150",
* EventTime(new Date(2011, 10, 10, 14, 48, 00), 60),
* ["Жигалов Сергей Алексеевич"], 5)
*
* @return {Object}
* @see EventTime
*/

function Event(name, address, time, member, raiting) {
"use strict";
return {
"name": name || "Событие",
"address": address.toString(),
"time": time,
"member": member || [],
"raiting": +raiting || 3
};
}


/**
* Возвращает объект EventTime
*
* @private
* @param {Number|Date} start Начало события
* @param {Number} [length=0] Длительность события в минутрах
*
* @example
* EventTime(new Date(2011, 10, 10, 14, 48, 00), 60)
*
* @return {Object}
*/
function EventTime(start, length) {
"use strict";
return {
"start": +start,
"length": +length || 0
};
}