vector-im-hydrogen-web/src/matrix/room/timeline/persistence/common.js

25 lines
559 B
JavaScript
Raw Normal View History

export function createEventEntry(key, roomId, event) {
return {
fragmentId: key.fragmentId,
eventIndex: key.eventIndex,
roomId,
event: event,
};
2019-05-19 20:49:46 +02:00
}
export function directionalAppend(array, value, direction) {
if (direction.isForward) {
array.push(value);
} else {
array.unshift(value);
}
}
export function directionalConcat(array, otherArray, direction) {
if (direction.isForward) {
return array.concat(otherArray);
} else {
return otherArray.concat(array);
}
}