npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coddoc

v0.0.3

Published

Documentation generator

Downloads

29

Readme

.subnav-inner { width: 100%; height: 36px; background-color: #EEE; background-repeat: repeat-x; background-image: -moz-linear-gradient(top, whiteSmoke 0%, #EEE 100%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, whiteSmoke), color-stop(100%, #EEE)); background-image: -webkit-linear-gradient(top, whiteSmoke 0%, #EEE 100%); background-image: -ms-linear-gradient(top, whiteSmoke 0%, #EEE 100%); background-image: -o-linear-gradient(top, whiteSmoke 0%, #EEE 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#f5f5f5', endColorstr = '#eeeeee', GradientType = 0); background-image: linear-gradient(top, whiteSmoke 0%, #EEE 100%); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; }

.subnav .nav > li > a:hover { color: black !important; }

.subnav .nav li.dropdown .dropdown-toggle .caret, .subnav .nav li.dropdown.open .caret { border-top-color: #999 !important; border-bottom-color: #999 !important; }

.subnav-fixed { position: fixed; width : 90%; margin-right: auto; margin-left: auto; top: 40px; left: 0; right: 0; z-index: 1020; border-color: #D5D5D5; border-width: 0 0 1px; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1); -moz-box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1); box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); }

.navbar .nav .dropdown-menu { max-height: 500px; overflow: auto; }​

    </style>
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
    </style>
 <script type="text/javascript">
     var init = (function () {
         "use strict";

         var processScroll = (function () {
             var curr = null, prev = null;
             return function (nav) {
                 var $win = $(window);
                 $('.subnav').each(function () {
                     var nav = $(this);
                     var navTop = nav.offset().top - 40;
                     var scrollTop = $win.scrollTop();
                     if (scrollTop >= navTop && curr != nav) {
                         if(curr){
                             curr.removeClass('subnav-fixed')
                             prev = curr;
                         }
                         curr = nav;
                         curr.addClass('subnav-fixed')
                     } else if (curr == nav && scrollTop <= navTop) {
                         curr.removeClass('subnav-fixed');
                         prev.addClass('subnav-fixed');
                         curr = prev;
                     }else{
                         nav.removeClass('subnav-fixed');
                     }
                 });
             };
         })();

         return function () {
             window.prettyPrint && prettyPrint();
             $(".collapse").collapse();
             // fix sub nav on scroll
             processScroll();
             $(window).on('scroll', processScroll)
         }
     })();
 </script>
      <a href="./index.html" class="brand">coddoc</a>
  
  <div class="nav-collapse">
  <ul class="nav nav-pills">
  
    <li class="dropdown">
       <a href="#" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a>
       <ul class="dropdown-menu">
         
                     <li><a href="#coddoc">coddoc</a></li>
           
       </ul>
       </li>
    
    
       <li class="dropdown">
       <a href="#" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
       <ul class="dropdown-menu">
         
                     <li><a href="#coddoc_Context">coddoc.Context</a></li>
           
                     <li><a href="#coddoc_Symbol">coddoc.Symbol</a></li>
           
                     <li><a href="#coddoc_Tree">coddoc.Tree</a></li>
           
       </ul>
    </li>
   
  </ul>
  
  <ul class="nav pull-right">
              <li><a href="https://github.com/doug-martin/coddoc" target="#github" class="pull-right">github</a></li>
    </ul>
    
  </div>
</div>
<div class="container-fluid">
    <a name="top"></a>
    <div class="container">
    
     <li>header : allows you to document a header that should appear before
     generated documentation</li>
     <li>footer : allows you to document a footer that should come after the generated documentation</li>
     <li>protected : allows you to document a field as protected</li>
</ul>

Command line options

Examples

JSON output

To use the markdown formatter

To use the HTML formatter

To use pragmatically

<a name="coddoc"></a>
<div class="navbar subnav">
<div class="navbar-inner  subnav-inner">
              <div class="container">
                <a href="#" class="brand">
                            coddoc
                            
                            <span class="label label-label">Function</span>
                            
                            
                                    
                             <span class="label label-success">Public</span>
                                    
                            
                </a>
               <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                          <span class="icon-bar"></span>
                          <span class="icon-bar"></span>
                          <span class="icon-bar"></span>
                        </a>

                        <div class="nav-collapse">
        
        <ul class="nav pull-right">
        <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Methods<b class="caret"></b></a>
            <ul class="dropdown-menu">
                
                <li><a href="#coddoc_addCodeHandler">
                            
                            <span class="label label-info">S</span>
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                    addCodeHandler
                 </a></li>
                
                <li><a href="#coddoc_addTagHandler">
                            
                            <span class="label label-info">S</span>
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                    addTagHandler
                 </a></li>
                
                <li><a href="#coddoc_getTagRegexp">
                            
                            <span class="label label-info">S</span>
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-warning">P</span>
                                    
                            
                    getTagRegexp
                 </a></li>
                
                <li><a href="#coddoc_parse">
                            
                            <span class="label label-info">S</span>
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-warning">P</span>
                                    
                            
                    parse
                 </a></li>
                
                <li><a href="#coddoc_parseCode">
                            
                            <span class="label label-info">S</span>
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-warning">P</span>
                                    
                            
                    parseCode
                 </a></li>
                
                <li><a href="#coddoc_parseTag">
                            
                            <span class="label label-info">S</span>
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-warning">P</span>
                                    
                            
                    parseTag
                 </a></li>
                
            </ul>
        </li>
        </ul>
        
        </div>
        </div>
 </div>
<em>Example</em>
    <pre class="prettyprint linenums lang-js">

var tree = coddoc({directory : path.resolve(__dirname + "lib")});

//To use markdown formatter var doc = coddoc({directory : path.resolve(__dirname + "lib"), formatter : coddoc.formatters.markdown});

//To use html formatter var doc = coddoc({directory : path.resolve(__dirname + "lib"), formatter : coddoc.formatters.html});

//To use custom file pattern var doc = coddoc({directory : path.resolve(__dirname + "lib"), patter : /.+.test.js$/i, formatter : coddoc.html});

<em>Arguments</em>
<ul>

    <li> <em>options</em>  : options object.</li>

    <li> <em>options.dir</em> <code>String</code> : the directory of code to parse.</li>

    <li> <em>[options.pattern= <code>/.+\.js$/i</code>]</em> <code>RegExp</code> : a regular expression to test files agains</li>

    <li> <em>options.formatter?</em> <code>Object</code> : And optional formatter to format the tree. The object must contain

a generate method. See coddoc.formatters.html

 </ul>





<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (options){ options = options || {}; var baseDir = options.dir, filePattern = options.pattern || FILE_PATTERN; if (!baseDir) { console.log("directory required"); } var fileMap = {}; (function findFiles(dir) { var files = fs.readdirSync(dir); files.forEach(function (file) { var filePath = path.resolve(dir, file); var stat = fs.statSync(filePath); if (stat.isDirectory()) { findFiles(filePath); } else if (stat.isFile() && filePattern.test(file)) { fileMap[filePath] = fs.readFileSync(filePath, "utf8"); } }); }(baseDir)); var context = new Context(), tree = new Tree(); Object.keys(fileMap).forEach(function (i, j) { emitter.emit("file", i); context.activateScope("global"); parser.parse(fileMap[i], path.relative(baseDir, i), tree, context, emitter); }); return tree;

}

    <a name="coddoc_addCodeHandler"></a>
<h3>
    addCodeHandler
    
    <span class="label label-info">Static</span>
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    

By Default code blocks of the following form are parsed.

<em>Example</em>
    <pre class="prettyprint linenums lang-js">

var util = require("coddoc").util; //parse code in the format of var myLocal = name.space.myFunction = function(){}; //give it a high priority to allow it to override current handlers. addHandler(/^var *\w+ = * (\w+(?:.\w+)) = *function/, 20, function (str, symbol, context) { var splitName = util.splitName(RegExp.$1), name = splitName.name, activeScope = splitName.memberof, params = util.getParamList(str); return { type:'function', isFunction:true, memberof:activeScope, isStatic:activeScope ? !activeScope.match(".prototype") : false, isPrivate:name.match(/^_/) != null, name:name, params:params, code:['function (', params.map( function (n) { return n.name.name; }).join(","), '){\n ', util.getCode(str, "{").split("\n").join("\n "), "\n}"].join("") }; });

<em>Arguments</em>
<ul>

    <li> <em>regexp</em>  : the regular expression used to match code blocks.</li>

    <li> <em>[priority= <code>0</code>]</em>  : the priority to give this code handler if not provided

it is defaulted to 0.

    <li> <em>parse</em>  : a function that returns an object. The object will be set as the <code>codeObject</code> on the <a href='#coddoc_Symbol'> coddoc.Symbol</a>. The properties of the object will be added to the <a href='#coddoc_Symbol'> coddoc.Symbol</a> for processing later.</li>

 </ul>





<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (regexp,priority,parse){ if (util.isFunction(priority)) { parse = priority; priority = 0; } handlers.push({ priority:priority, match:function (str) { return regexp.exec(str); }, parse:parse }); handlers.sort(sortHandlers);

}

    <a name="coddoc_addTagHandler"></a>
<h3>
    addTagHandler
    
    <span class="label label-info">Static</span>
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Example</em>
    <pre class="prettyprint linenums lang-js">

//if a tag is contains a '|' character then each variation will resolve the the same parser function. coddoc.addTagHandler("void|VOID|Void", function(comment, symbol, context){ //do something with the tag or add properties to the symbol. symbol.isVoid = true; symbol.tags.push({tag : "void", props : {}}); }); //in the template you can add functionality to handle the new tag. For example: //in the html symbol.tmpl you could add a new label to the name header <h3> {{name}} {{#if isStatic}} <span class="label label-info">Static</span> {{/if}} {{#if isFunction}} <span class="label label-label">Function</span> {{/if}} {{#if isPrivate}} <span class="label label-important">Private</span> {{else}} {{#if isProtected}} <span class="label label-warning">Protected</span> {{else}} <span class="label label-success">Public</span> {{/if}} {{/if}} {{#if isVoid}} <span class="label label-label">Void</span> {{/if}} </h3>

<em>Arguments</em>
<ul>

    <li> <em>tag</em>  : the tag to parse, if a tag is contains a '|' character then the string will be split and each variation will resolve to the same parse function. If the tag already exists then the old implementation will be replaced by the new one.</li>

    <li> <em>parse</em>  : a parser function to invoke when a tag that matches the name is encountered.</li>

 </ul>





<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (tag,parse){ tag.split("|").forEach(function (tag) { tags[tag] = { parse:parse || function () { return {tag:tag, props:{}}; }}; });

}

    <a name="coddoc_getTagRegexp"></a>
<h3>
    getTagRegexp
    
    <span class="label label-info">Static</span>
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-warning">Protected</span>
            
    
<em>Returns</em>
<ul>

    <li> <code>RegExp</code> a regular expression to parse valid tags.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (){ return new RegExp("@(" + Object.keys(tags).join("|") + ")");

}

    <a name="coddoc_parse"></a>
<h3>
    parse
    
    <span class="label label-info">Static</span>
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-warning">Protected</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>str</em>  : the source code to parse</li>

    <li> <em>filepath</em>  : the relative filepath where the source is located. This is set on the symbol during parsing.</li>

    <li> <em>tree</em>  : the tree which contains all symbols.</li>

    <li> <em>context</em>  : the context which holds information about the current parsing job.</li>

    <li> <em>emitter</em>  : </li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Object</code> </li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (str,filepath,tree,context,emitter){ var l = str.length; var symbols = []; for (var i = 0; i < l; i++) { var tags = []; var comment = "", c = str[i], startIndex = i, endIndex, ret = []; var startCIndex = str.indexOf("/**", i); if (startCIndex !== -1) { i = startCIndex + 2; var endCIndex = str.indexOf("*/", i); if (endCIndex !== -1) { comment = str.substr(startCIndex + 2, endCIndex - (startCIndex + 2)).split("\n").map(joinAndReplace).join("\n"); emitter.emit("comment", comment); i = endCIndex + 1; //console.log(str.substr(startCIndex, endCIndex - startCIndex)); //console.log(comment); var res = parseTags({comment:comment, start:startCIndex, end:endCIndex + 2}, str, filepath, context), sym = res.symbol; symbols.push(sym); emitter.emit("symbol", sym); var memberof = sym.memberof; if (!sym.ignore && !sym.lends) { tree.addSymbol(sym); } } } else { i++; } } return {symbols:symbols, code:str};

}

    <a name="coddoc_parseCode"></a>
<h3>
    parseCode
    
    <span class="label label-info">Static</span>
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-warning">Protected</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>str</em>  : the source string to parse</li>

    <li> <em>symbol</em>  : the symbol to add parsed properties from.</li>

    <li> <em>context</em>  : the current context</li>

 </ul>





<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (str,symbol,context){ var l = handlers.length, ret = {}; for (var i = 0; i < l; i++) { var h = handlers[i]; if (h.match(str)) { ret = h.parse(str, symbol, context); break; } } if (ret) { symbol.codeObject = ret; Object.keys(ret).forEach(function (i) { symbol[i] = ret[i]; }); }

}

    <a name="coddoc_parseTag"></a>
<h3>
    parseTag
    
    <span class="label label-info">Static</span>
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-warning">Protected</span>
            
    
<em>Example</em>
    <pre class="prettyprint linenums lang-js">

coddoc.parseTag("someTag", "@someTag props...", sym, src, index, context); //would add a new tag to the symbols property { tag : "tagname", props : {...} }

//the props value would also be added to the symbols params array.

<em>Arguments</em>
<ul>

    <li> <em>comment</em>  : the comment fragment being parsed</li>

    <li> <em>sym</em>  : the symbol that the comment corresponds to. The code object and values will have already been set.</li>

    <li> <em>context</em>  : the currect context object. The context allows tags to set new scopes and namespaces.</li>

    <li> <em>tag</em> <code>String</code> : the tag name being parsed from the comment</li>

 </ul>





<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (comment,sym,context){ var tag = comment.match(TAG_REGEXP), ret = {}; if (tag && tag.length === 2) { var t = tags[tag[1]]; if (t) { t.parse(comment, sym, context); } else { throw new Error("Invalid tag " + tag); } }

}

<a name="coddoc_Context"></a>
<div class="navbar subnav">
<div class="navbar-inner  subnav-inner">
      <div class="container">
        <a href="#" class="brand">
        coddoc.Context
        
                
         <span class="label label-success">Public</span>
                
        
        </a>
       <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                </a>
                <div class="nav-collapse">

        <ul class="nav pull-right">
         <li><a href="#coddoc_Context_constructor">Constructor</a></li>
                    
                    
                    
                    
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Instance Methods<b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            
                            <li><a href="#coddoc_Context_prototype_activateScope">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            activateScope

                            </a></li>
                            
                            <li><a href="#coddoc_Context_prototype_addNamespace">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            addNamespace

                            </a></li>
                            
                            <li><a href="#coddoc_Context_prototype_addScope">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            addScope

                            </a></li>
                            
                            <li><a href="#coddoc_Context_prototype_getActiveScope">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            getActiveScope

                            </a></li>
                            
                            <li><a href="#coddoc_Context_prototype_getActiveScopeName">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            getActiveScopeName

                            </a></li>
                            
                            <li><a href="#coddoc_Context_prototype_getNamespace">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            getNamespace

                            </a></li>
                            
                            <li><a href="#coddoc_Context_prototype_getScope">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            getScope

                            </a></li>
                            
                        </ul>
                    </li>
                    
        </ul>
        </div>
        </div>
 </div>
<p>

A Context object used to keep state when parsing symbols. The context should not be used directly by user code.

<a name="coddoc_Context_constructor"></a>
<h3>Constructor</h3>

<em>Defined context.js</em>



    
        <em>Source</em>
        <pre class="prettyprint linenums lang-js">

function (){ this.scopes = {}; this.nameSpaces = {global:[]}; this.aliases = {}; this.activateScope("global");

}

<a name="coddoc_Context_prototype_activateScope"></a>
<h3>
    activateScope
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>name</em>  : the name of the scope.</li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Object</code> the activated scope object.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (name){ this.activeScope = name; return this.addScope(name);

}

<a name="coddoc_Context_prototype_addNamespace"></a>
<h3>
    addNamespace
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>name</em>  : the name of the namespace</li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Object</code> the object for the namespace.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (name){ if ("undefined" === typeof this.nameSpaces[name]) { this.nameSpaces[name] = {}; } return this.nameSpaces[name];

}

<a name="coddoc_Context_prototype_addScope"></a>
<h3>
    addScope
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>name</em>  : the name of the scope to add,</li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Object</code> the object for the namespace.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (name){ if ("undefined" === typeof this.scopes[name]) { this.scopes[name] = {}; } return this.scopes[name];

}

<a name="coddoc_Context_prototype_getActiveScope"></a>
<h3>
    getActiveScope
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Returns</em>
<ul>

    <li> <code>Object</code> the scope object</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (){ return this.getScope(this.activeScope);

}

<a name="coddoc_Context_prototype_getActiveScopeName"></a>
<h3>
    getActiveScopeName
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Returns</em>
<ul>

    <li> <code>String</code> the active scope name.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (){ return this.activeScope;

}

<a name="coddoc_Context_prototype_getNamespace"></a>
<h3>
    getNamespace
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>name</em>  : the name of the context</li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Object</code> the object for the namespace.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (name){ return this.addNamespace(name);

}

<a name="coddoc_Context_prototype_getScope"></a>
<h3>
    getScope
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>name</em>  : the name of the scope to get,</li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Object</code> the object for the namespace.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (name){ return this.addScope(name);

}

<a name="coddoc_Symbol"></a>
<div class="navbar subnav">
<div class="navbar-inner  subnav-inner">
      <div class="container">
        <a href="#" class="brand">
        coddoc.Symbol
        
        <span class="label label-important">Private</span>
        
        </a>
       <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                </a>
                <div class="nav-collapse">

        <ul class="nav pull-right">
         <li><a href="#coddoc_Symbol_constructor">Constructor</a></li>
                    
                    <li><a href="#coddoc_Symbol_instanceProperties">Instance Properties</a></li>
                    
                    
                    
                    
        </ul>
        </div>
        </div>
 </div>
<p>

A Symbol represents a comment and code pair. Each code handler added through coddoc.addCodeHandler and tag handler added through coddoc.addTagHandler adds/removes properties from a the symbol. Each symbol is added to the coddoc.Tree which is either returned from coddoc or passed into a template handler.

NOTE: This object should not be instantiated by user code

    <a name="coddoc_Symbol_instanceProperties"></a>
    <em>Instance Properties</em>
    <table class='table table-bordered table-striped'><tr><td>Property</td><td>Type</td><td>Default Value</td><td>Description</td></tr><tr><td>augments</td><td>{Array}</td><td><code>

[] Any symbols this symbol augments

<a name="coddoc_Symbol_constructor"></a>
<h3>Constructor</h3>

<em>Defined symbol.js</em>

    <em>Arguments</em>
    <ul>
    
        <li> <em>options</em>  : an object or symbol whos properties will be added to this symbol. Note a deep copy of paraemeters will not be made, so if you pass an array the array will not be cloned.</li>
    
    </ul>
 


    
        <em>Source</em>
        <pre class="prettyprint linenums lang-js">

function (options){ this.tags = []; this.params = []; this.properties = []; this.examples = []; this.borrows = []; this.augments = []; this.includedDocs = []; this.see = []; this.throws = []; this.returns = []; options = options || {}; for (var i in options) { if (i in this) { this[i] = options[i]; } }

}

<a name="coddoc_Tree"></a>
<div class="navbar subnav">
<div class="navbar-inner  subnav-inner">
      <div class="container">
        <a href="#" class="brand">
        coddoc.Tree
        
        <span class="label label-important">Private</span>
        
        </a>
       <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                </a>
                <div class="nav-collapse">

        <ul class="nav pull-right">
         <li><a href="#coddoc_Tree_constructor">Constructor</a></li>
                    
                    
                    
                    
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Instance Methods<b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            
                            <li><a href="#coddoc_Tree_prototype__addSymbol">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                            <span class="label label-important">P</span>
                            
                            _addSymbol

                            </a></li>
                            
                            <li><a href="#coddoc_Tree_prototype_addSymbol">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            addSymbol

                            </a></li>
                            
                            <li><a href="#coddoc_Tree_prototype_getClasses">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            getClasses

                            </a></li>
                            
                            <li><a href="#coddoc_Tree_prototype_getMembers">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            getMembers

                            </a></li>
                            
                            <li><a href="#coddoc_Tree_prototype_getNamespaces">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            getNamespaces

                            </a></li>
                            
                            <li><a href="#coddoc_Tree_prototype_getSymbol">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            getSymbol

                            </a></li>
                            
                            <li><a href="#coddoc_Tree_prototype_hasSymbol">
                            
                            
                            <span class="label label-label">F</span>
                            
                            
                                    
                             <span class="label label-success">P</span>
                                    
                            
                            hasSymbol

                            </a></li>
                            
                        </ul>
                    </li>
                    
        </ul>
        </div>
        </div>
 </div>
<p>

A Tree object which contains symbols.

<a name="coddoc_Tree_constructor"></a>
<h3>Constructor</h3>

<em>Defined tree.js</em>



    
        <em>Source</em>
        <pre class="prettyprint linenums lang-js">

function (){ this.symbols = {global:[]};

}

<a name="coddoc_Tree_prototype__addSymbol"></a>
<h3>
    _addSymbol
    
    
    <span class="label label-label">Function</span>
    
    
    <span class="label label-important">Private</span>
    
<em>Arguments</em>
<ul>

    <li> <em>name</em>  : the name of the symbol to add.</li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Array</code> </li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (name){ var ret = this.symbols[name]; if (!ret) { ret = this.symbols[name] = []; } return ret;

}

<a name="coddoc_Tree_prototype_addSymbol"></a>
<h3>
    addSymbol
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>symbol</em>  : </li>

    <li> <em>path</em> <code>String</code> : the path of the symbol. i.e the memberof property of a symbol</li>

    <li> <em>name</em>  : </li>

    <li> <em>obj</em>  : </li>

 </ul>





<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (symbol){ var nameParts = utils.splitName(symbol.fullName); var path = nameParts.memberof, name = nameParts.name; if (path === "global") { path = name; } var sym = this.getSymbol(path); sym.push(symbol);

}

<a name="coddoc_Tree_prototype_getClasses"></a>
<h3>
    getClasses
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Returns</em>
<ul>

    <li> <code>Array</code> </li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (){ var symbols = this.symbols, objects = [], keys = Object.keys(this.symbols); keys.forEach(function (k) { objects = objects.concat(symbols[k].filter(function (s) { return s.isConstructor; })); }); return objects.map(function (s) { var name = s.fullName; var statics = symbols[name] || []; var instance = symbols[name + ".prototype"] || []; var borrowedMethods = [], borrowedProperties = [], staticBorrowedMethods = [], staticBorrowedProperties = []; s.borrows.map(function (b) { var borrows = b.borrows; var symbol = symbols[borrows.memberof || "global"].filter(function (s) { return s.name === borrows.name; }); if (symbol.length) { symbol = symbol[0]; var memberof = b.isStatic ? name : name + ".prototype"; var newSymb = new Symbol(utils.merge({}, symbol, {name:b.as, isStatic:b.isStatic, fullName:memberof + "." + b.as, memberof:memberof})); if (b.isStatic) { if (s.isFunction) { staticBorrowedMethods.push(newSymb); } else { staticBorrowedProperties.push(newSymb); } } else { if (s.isFunction) { borrowedMethods.push(newSymb); } else { borrowedProperties.push(newSymb); } } } }); s.name = name; s.staticMethods = statics.filter( function (s) { return s.isFunction && !s.isConstructor; }).concat(staticBorrowedMethods); s.staticProperties = statics.filter( function (s) { return !s.isFunction && !s.isNamespace; }).concat(staticBorrowedProperties); s.instanceMethods = instance.filter( function (s) { return s.isFunction && !s.isConstructor; }).concat(borrowedMethods); s.instanceProperties = instance.filter( function (s) { return !s.isFunction && !s.isNamespace; }).concat(s.properties || []).concat(borrowedProperties); return s; });

}

<a name="coddoc_Tree_prototype_getMembers"></a>
<h3>
    getMembers
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>path</em>  : the path to look up.</li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Array</code> and array of symbols.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (path){ var symbols = this.symbols, namespaces = [], keys = Object.keys(this.symbols); keys.forEach(function (k) { namespaces = namespaces.concat(symbols[k].filter(function (s) { return !s.isNamespace && !s.isConstructor && s.memberof === path; })); }); return namespaces;

}

<a name="coddoc_Tree_prototype_getNamespaces"></a>
<h3>
    getNamespaces
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Returns</em>
<ul>

    <li> <code>Array</code> array of namespaces</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (){ var symbols = this.symbols, namespaces = [], keys = Object.keys(this.symbols); keys.forEach(function (k) { namespaces = namespaces.concat(symbols[k].filter(function (s) { return s.isNamespace; })); }); return namespaces.map(function (s) { var realName = s.memberof && s.memberof !== "global" ? [s.memberof, s.name].join(".") : s.name; var members = this.getMembers(realName); s.name = realName; s.properties = s.properties.concat(members.filter(function (m) { return !m.isFunction; })); s.methods = members.filter(function (m) { return m.isFunction; }); return s; }, this);

}

<a name="coddoc_Tree_prototype_getSymbol"></a>
<h3>
    getSymbol
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>name</em>  : the name of the symbol to get</li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Array</code> the array for the symbol.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (name){ return this._addSymbol(name);

}

<a name="coddoc_Tree_prototype_hasSymbol"></a>
<h3>
    hasSymbol
    
    
    <span class="label label-label">Function</span>
    
    
            
     <span class="label label-success">Public</span>
            
    
<em>Arguments</em>
<ul>

    <li> <em>name</em>  : the name to test if the tree contains the symbol</li>

 </ul>


<em>Returns</em>
<ul>

    <li> <code>Boolean</code> true if the tree contains the symbol.</li>

</ul>




<em>Source</em>
<pre class="prettyprint linenums lang-js">

function (name){ var parts = name.split("."); return !!this.symbols[name];

}

    </div>
</div>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/jquery.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-transition.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-tab.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-tooltip.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-popover.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-button.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-collapse.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-carousel.js"></script>
<script type="text/javascript"
        src="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.js"></script>