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 | 3x 3x 490x 490x 490x 3x 402x 402x | 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);
};
|