Files
30-seconds-of-code/node_modules/remark-stringify/lib/macro/one.js
2019-08-20 15:52:05 +02:00

22 lines
415 B
JavaScript

'use strict';
module.exports = one;
function one(node, parent) {
var self = this;
var visitors = self.visitors;
/* Fail on unknown nodes. */
if (typeof visitors[node.type] !== 'function') {
self.file.fail(
new Error(
'Missing compiler for node of type `' +
node.type + '`: `' + node + '`'
),
node
);
}
return visitors[node.type].call(self, node, parent);
}