Symbol

class
 new Symbol() 

The class that manges symbols.

class Symbol {
  constructor() {}

structure

method
 Symbol.structure() 

Option name Type Description
symbols Array

array of symbols

file String

filename

return Array

Returns the structure of a parsed file

static structure(symbols, file) {
    return _.compact(symbols.map(function(method) {
      if (!method.ctx || !method.ctx.name) {
        return null;
      }
      return {
        targetFile: file,
        name: method.ctx.name,
        type: method.ctx.type
      };
    })) || [];
  }

has

method
 Symbol.has() 

Option name Type Description
val string

value to check against

return function

A function that evaluates the truth when True if tag type is val

Checks if a tag has a specific type

static has(val) {
    return function(tag) {
      return tag.type === val;
    };
  }

compact

method
 Symbol.compact() 

Compacts multi-line expression

static compact(tags) {
    // [{"type":"description",     
    // "string":"Note: if `addClass` is defined at the step level."},    
    //  {"type":"",    
    //  "string": "The two defined `addClass`      
    //  will be taken into account in the popover"},     
    //  {"type":"type","types":["String"]}]     
    var compacted = [];
    tags.forEach(function(tag, i) {
      if (!tag.type) {
        if (i === 0) {
          return;
        }
        // Append to previous         
        var prevTag = compacted[compacted.length - 1];
        if (prevTag.description) {
          prevTag.description += ' ' + tag.string;
        } else {
          prevTag.string += ' ' + tag.string;
        }
        return;
      }
      compacted.push(tag);
    });
    return compacted;
  }