@contentful/rich-text-types
Version:
Type definitions and constants for the Contentful rich text field type.
26 lines • 891 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertText = assertText;
var assert_1 = require("./assert");
function assertText(text, path) {
var $ = new assert_1.ObjectAssertion(text, path);
if (!$.object()) {
return $.errors;
}
$.noAdditionalProperties(['nodeType', 'data', 'value', 'marks']);
$.object('data');
$.each('marks', function (mark, path) {
var mark$ = new assert_1.ObjectAssertion(mark, path);
if (!mark$.object()) {
return mark$.errors;
}
// For historical reasons, we don't explicitly check for supported marks
// e.g. bold, italic ..etc. This makes it possible for a customer to add
// custom marks
mark$.string('type');
return mark$.errors;
});
$.string('value');
return $.errors;
}
//# sourceMappingURL=text.js.map
;