@fontoxml/fontoxml-development-tools
Version:
Development tools for Fonto.
20 lines (18 loc) • 506 B
JavaScript
import httpStatusCodeHelpers from './httpStatusCodeHelpers.js';
/**
* Maps the annotation result objects to objects that can be parsed by the client.
*
* @param {Result} result
* @return {object}
*/
export default function mapAnnotationResultToAnnotationToReturn(result) {
return {
status: httpStatusCodeHelpers.mapAnnotationResultStatusToHttpStatusCode(
result.status,
!!result.annotation
),
annotation: result.annotation
? result.annotation
: { id: result.annotationId },
};
}