UNPKG

@independo/capacitor-voice-recorder

Version:
15 lines 735 B
/** Normalizes recording payloads into a stable contract shape. */ export const normalizeRecordingData = (data) => { const { recordDataBase64, uri, msDuration, mimeType, fileExtension } = data.value; const normalizedValue = { msDuration, mimeType, fileExtension }; const trimmedUri = typeof uri === 'string' && uri.length > 0 ? uri : undefined; const trimmedBase64 = typeof recordDataBase64 === 'string' && recordDataBase64.length > 0 ? recordDataBase64 : undefined; if (trimmedUri) { normalizedValue.uri = trimmedUri; } else if (trimmedBase64) { normalizedValue.recordDataBase64 = trimmedBase64; } return { value: normalizedValue }; }; //# sourceMappingURL=recording-contract.js.map