@contentful/rich-text-types
Version:
Type definitions and constants for the Contentful rich text field type.
25 lines (24 loc) • 601 B
JavaScript
import { ObjectAssertion } from './assert.mjs';
export function assertText(text, path) {
var $ = new ObjectAssertion(text, path);
if (!$.object()) {
return $.errors;
}
$.noAdditionalProperties([
'nodeType',
'data',
'value',
'marks'
]);
$.object('data');
$.each('marks', function(mark, path) {
var mark$ = new ObjectAssertion(mark, path);
if (!mark$.object()) {
return mark$.errors;
}
mark$.string('type');
return mark$.errors;
});
$.string('value');
return $.errors;
}