Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 5x 5x 521x 521x 521x 5x 435x 435x | import {type ITimestampStruct, Timestamp} from 'json-joy/lib/json-crdt-patch';
import type {PresenceIdShorthand} from './types';
export const toDto = (sid: number, id: ITimestampStruct): PresenceIdShorthand => {
const dto: PresenceIdShorthand = [id.time];
if (id.sid !== sid) dto.push(id.sid);
return dto;
};
export const fromDto = (sid: number, dto: PresenceIdShorthand): ITimestampStruct => {
const [time, dtoSid = sid] = dto;
return new Timestamp(dtoSid, time);
};
|