How to use the snapdragon-util.removeType function in snapdragon-util

To help you get started, we’ve selected a few snapdragon-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github breakdance / breakdance / lib / compiler.js View on Github external
if (!this.compilers[node.type] && this.options.knownOnly !== true) {
        this.set(node.type, util.noop);
      }

      var compilerOpts = this.options.compiler || {};
      var visitor = compilerOpts[node.type];
      if (visitor === false) {
        return;
      }

      // run any registered "before" plugins
      node = before.call(this, node) || node;

      // add or remove this node type from `state.types`
      if (util.isOpen(node)) util.addType(this.state, node);
      if (util.isClose(node)) util.removeType(this.state, node);

      if (typeof visitor === 'function') {
        node = visitor.apply(this, arguments) || node;
      } else {
        node = visit.apply(this, arguments) || node;
      }

      // run any registered "after" plugins
      node = after.call(this, node) || node;
      return node;
    };
github here-be / snapdragon / lib / compiler.js View on Github external
}

    this.emitter.emit('node', node);

    var fn = this.compilers[node.type] || this.compilers.unknown;
    if (typeof fn !== 'function') {
      throw this.error('compiler "' + node.type + '" is not registered', node);
    }

    var val = fn.call(this, node) || node;
    if (util.isNode(val)) {
      node = val;
    }

    if (util.isClose(node)) {
      util.removeType(this.state, node);
    }
    return node;
  },