one.js 423 B

1234567891011121314151617181920212223
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = void 0;
  4. function one(h, node, parent) {
  5. const type = node && node.type;
  6. const fn = h.handlers[type];
  7. /* Fail on non-nodes. */
  8. if (!type) {
  9. throw new Error(`Expected node, got \`${node}\``);
  10. }
  11. if (!fn) {
  12. throw new Error(`Node of type ${type} is unknown`);
  13. }
  14. return fn(h, node, parent);
  15. }
  16. var _default = one;
  17. exports.default = _default;