58 lines
1.2 KiB
JavaScript
58 lines
1.2 KiB
JavaScript
|
'use strict';
|
|||
|
|
|||
|
import * as sol from "../../solight/sol.js";
|
|||
|
|
|||
|
|
|||
|
const process_data = (scheduleFile) =>
|
|||
|
sol.processScheduleFile(scheduleFile);
|
|||
|
|
|||
|
|
|||
|
const trackIndexMap = new Map([
|
|||
|
['Main', 0]]);
|
|||
|
|
|||
|
const track_index = (track) =>
|
|||
|
trackIndexMap.get(track);
|
|||
|
|
|||
|
|
|||
|
const typeIndexMap = new Map([
|
|||
|
["Organization", 0],
|
|||
|
["Moderation", 1],
|
|||
|
["Talk", 2]]);
|
|||
|
|
|||
|
const type_index = (type) =>
|
|||
|
typeIndexMap.get(type);
|
|||
|
|
|||
|
|
|||
|
const person_names_concat = (persons) =>
|
|||
|
// persons.map(p => sol.personName(p)).join(', ');
|
|||
|
// persons.map(p => sol.personName(p)).join(' & ');
|
|||
|
persons.map(p => sol.personName(p)).join(' · ');
|
|||
|
|
|||
|
|
|||
|
const ndash_fix_regexp = RegExp('\\s+-\\s+');
|
|||
|
const ndash_fix_replacement = ' – ';
|
|||
|
|
|||
|
const fix_dash = (string) =>
|
|||
|
string.replace(ndash_fix_regexp, ndash_fix_replacement);
|
|||
|
|
|||
|
|
|||
|
const is_soon = (then, now, dt) => {
|
|||
|
const delta = then.toMillis() - now.toMillis();
|
|||
|
return delta >= 0 && delta <= dt * 1000;
|
|||
|
};
|
|||
|
|
|||
|
const is_recent = (then, now, dt) => {
|
|||
|
const delta = now.toMillis() - then.toMillis();
|
|||
|
return delta >= 0 && delta <= dt * 1000;
|
|||
|
};
|
|||
|
|
|||
|
export {
|
|||
|
process_data,
|
|||
|
track_index,
|
|||
|
type_index,
|
|||
|
person_names_concat,
|
|||
|
fix_dash,
|
|||
|
is_soon,
|
|||
|
is_recent
|
|||
|
}
|