UNPKG

slate-prop-types

Version:

A set of React prop type checkers for Slate editors.

2 lines (1 loc) 1.98 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("slate")):"function"==typeof define&&define.amd?define(["exports","slate"],n):n(e.SlatePropTypes={},e.Slate)}(this,function(e,n){"use strict";function t(e,n){function t(t,i,r,u,o){var a=i[r];return null!=a||t?null==a&&t?new Error("The "+o+" `"+r+"` is marked as required in `"+u+"`, but it was not supplied."):n(a)?null:new Error("Invalid "+o+" `"+r+"` supplied to `"+u+"`, expected a Slate `"+e+"` but received: "+a):null}function i(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.apply(void 0,[!1].concat(n))}return i.isRequired=function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.apply(void 0,[!0].concat(n))},i}var i={block:t("Block",function(e){return n.Block.isBlock(e)}),blocks:t("List<Block>",function(e){return n.Block.isBlockList(e)}),change:t("Change",function(e){return n.Change.isChange(e)}),data:t("Data",function(e){return n.Data.isData(e)}),document:t("Document",function(e){return n.Document.isDocument(e)}),inline:t("Inline",function(e){return n.Inline.isInline(e)}),inlines:t("Inline",function(e){return n.Inline.isInlineList(e)}),leaf:t("Leaf",function(e){return n.Leaf.isLeaf(e)}),leaves:t("List<Leaf>",function(e){return n.Leaf.isLeafList(e)}),mark:t("Mark",function(e){return n.Mark.isMark(e)}),marks:t("Set<Mark>",function(e){return n.Mark.isMarkSet(e)}),node:t("Node",function(e){return n.Node.isNode(e)}),nodes:t("List<Node>",function(e){return n.Node.isNodeList(e)}),range:t("Range",function(e){return n.Range.isRange(e)}),ranges:t("List<Range>",function(e){return n.Range.isRangeList(e)}),selection:t("Selection",function(e){return n.Selection.isSelection(e)}),value:t("Value",function(e){return n.Value.isValue(e)}),text:t("Text",function(e){return n.Text.isText(e)}),texts:t("List<Text>",function(e){return n.Text.isTextList(e)})};e.default=i,Object.defineProperty(e,"__esModule",{value:!0})});