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

yjsdoc

v0.1.0

Published

create doc from javascript source files

Downloads

3

Readme

jsdoc

Create doc from javascript source files.

We support the regular javascript block comment syntax.

What we changed is you have to indicate the class name instead of parsing it,because javascript syntax is so flexible.

This library just output the base comment object structure instead of some HTML pages.

usage

var jsdoc = require('yjsdoc');
var docs = jsdoc([filecontent1,filecontent2...]);
console.log(docs);

We will get a object:

{
    "classes": {
        "Cat": {
            "_def": {
                "type": "func",
                "descs": [
                    "This is the demo description for Cat class.",
                    ""
                ],
                "attr": {
                    "name": null
                },
                "func": {
                    "name": "Cat",
                    "params": ""
                },
                "clazz": "",
                "zuper": null,
                "tags": {}
            },
            "_methods": {},
            "_attrs": {
                "smile": {
                    "type": "attr",
                    "descs": [
                        "Smail cat",
                        ""
                    ],
                    "attr": {
                        "name": "smile"
                    },
                    "func": {
                        "name": null,
                        "params": null
                    },
                    "clazz": "Cat",
                    "zuper": null,
                    "tags": {}
                }
            }
        },
        "Parser": {
            "_def": null,
            "_methods": {
                "parse": {
                    "type": "func",
                    "descs": [
                    "This is the demo description for the method 'parse'    of class 'Parser'.",
                        ""
                    ],
                    "attr": {
                        "name": null
                    },
                    "func": {
                        "name": "parse",
                        "params": "d, x"
                    },
                    "clazz": "Parser",
                    "zuper": null,
                    "tags": {
                        "param": [
                            "{String} d",
                            "{String} x"
                        ],
                        "throws": [
                            "{Error} If [this condition is met]",
                            "{Error} If [this condition is met]"
                        ],
                        "return": "{String} The out put string parsed.",
                        "since": "0.1.0"
                    }
                },
                "out": {
                    "type": "func",
                    "descs": [
                    "This is the demo description for the method 'out' of   class 'Parser'.",
                        ""
                    ],
                    "attr": {
                        "name": null
                    },
                    "func": {
                        "name": "out",
                        "params": "mark, deep"
                    },
                    "clazz": "Parser",
                    "zuper": null,
                    "tags": {
                        "param": [
                            "{String} mark The marker.",
                            "{Boolean} deep If need deep."
                        ],
                        "return": "{String} The output string."
                    }
                }
            },
            "_attrs": {
                "version": {
                    "type": "attr",
                    "descs": [
                        "Version description.",
                        ""
                    ],
                    "attr": {
                        "name": "version"
                    },
                    "func": {
                        "name": null,
                        "params": null
                    },
                    "clazz": "Parser",
                    "zuper": null,
                    "tags": {}
                },
                "multiple": {
                    "type": "attr",
                    "descs": [
                        "Multiple",
                        ""
                    ],
                    "attr": {
                        "name": "multiple"
                    },
                    "func": {
                        "name": null,
                        "params": null
                    },
                    "clazz": "Parser",
                    "zuper": null,
                    "tags": {}
                }
            }
        }
    },
    "methods": {
        "fly": {
            "type": "func",
            "descs": [
                "This is a demo description for fly function",
                ""
            ],
            "attr": {
                "name": null
            },
            "func": {
                "name": "fly",
                "params": "name"
            },
            "clazz": null,
            "zuper": null,
            "tags": {
                "param": [
                    "{String} name The name of object."
                ],
                "return": "{Boolean} True"
            }
        }
    }
}

classes means the class defination,each has a _methods member and a _attrs member,may has a _def member.

methods means the function that not belongs to any class.

For each function or attr,it has a descs member which is an array,a type member equals func or attr,a func member stores the function infomation if its type equals 'func',an attr member stores the attribute information if its type equals 'attr',a tag member stores the @tags,like "@param","@since" etc,a clazz member indicates the class it belongs to,a zuper indicates its super class if it is a constructor.

syntax

We support multiple comment template:

Functions
/**
 * Parse the source text to Comment structure.
 *
 * @since 0.1.0
 * @class SourceTextParser
 * @return {Undefined}
 */
parse: function() {}

/**
 * Parse the source text to Comment structure.
 *
 * @since 0.1.0
 * @class SourceTextParser
 * @return {Undefined}
 */
var parse = function() {}

/**
 * Parse the source text to Comment structure.
 *
 * @since 0.1.0
 * @return {Undefined}
 */
function parse () {}
Attributes
/**
 * Version description.
 * 
 * @type {Integer}
 * @class Parser
 * @since 0.1.0
 */
version : 0x0810

/**
 * Version description.
 * 
 * @type {Integer}
 * @class Parser
 * @since 0.1.0
 */
Parser.version = 0x0810

Remember tag the class if the function/attribute belongs to a class defination.

tags

The following tags are allowed to show only once: return,copyright,author,since,description,example,version,override,todo,deprecated,type

The following tags are allowd to show twice and more: param,see,throws

we ignore other tags

changelog

  • 2014-08-14:first publish version,better format output;ignore,type supported

contact