"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _slugid = _interopRequireDefault(require("slugid"));
var _constants = require("../constants");
const headerRule = (element, parseChild) => {
  const {
    nodeName,
    childNodes
  } = element;
  if (nodeName && _constants.HEADER_LIST.includes(nodeName)) {
    return {
      id: _slugid.default.nice(),
      type: _constants.HEADER_TYPE_MAP[nodeName],
      children: parseChild(childNodes)
    };
  }
  return;
};
var _default = exports.default = headerRule;