Nonsense Placement Mandatory
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

coffeekraken-docblock-parser

1.0.10 • Public • Published

Coffeekraken Docblock Parser

Simple, powerfull and extensible docblock parser that return a JSON representation to work with

Table of content

  1. Install
  2. Get Started
  3. Documentation
  4. Contribute
  5. Who are Coffeekraken?
  6. Licence

Install

npm install coffeekraken-docblock-parser --save-dev

Get Started

First, require the package in your javascript node file like so:

const docblockParser = require('coffeekraken-docblock-parser');
const json = docblockParser(config).parse(myStringToParse);

Documentation

This package mainly expose a parse function that take a String and return a JSON object representing the docblocks found. Around that main function, you will find some functions and configurations that you can hook to extend or modify the parsing process.

API doc

Here's some API references:

  • Config : Configuration file reference
  • parse function : Main package function that parse a String and convert it to JSON
  • Next line analyzer : Each function that analyze the line just after each docblocks
  • Tags : Each tags function that sets the data accordingly

Supported tags

Here's the list of supported docblock tags out of the box. You can register new tags as well.

  • abstract : If is an abstract class, etc...
  • attribute : Specify if is an HTMLElement attribute that we document
  • author : Specify the author
  • body : Specify the body content of the docblock. It's usually taken automatically from the first non tagged content
  • category : Specify a category
  • class : Specify if is a class that we document
  • constructor : Specify if is a constructor that we document
  • const : Specify if is a constant
  • copyright : Specify a copyright
  • default : Specify the default value for a property.
  • deprecated : Specify if is deprecated
  • event : Specify if the docblock document an event or not
    • Usage :
@name 	my-cool-event
@event
etc...
  • example : Specify an example.
    • Usage :
@example    {language}
your code here...
  • extends : Specify the parent class
  • final : Specify if is final implementation
  • global : Specify if is a global variable, etc...
  • implements : Specify some interfaces that the class implement
  • interface : Specify if is an interface
  • name : Specify the name of the item.
  • override : Specify if is an override
  • package : Specify a package
  • param : Specify the parameters for the function
    • Usage :
@param    {String}    myCoolParam    A cool param
@param    {Integer}    [otherParam=2]    Another optional param
  • private : Specify if the function/variable is private
  • property : Specify some properties
    • Usage :
@property    {String}    myCoolProperty    A cool property
@property    {Integer}    [otherProperty=2]    Another cool property
  • protected : Specify if the function/variable is protected
  • public : Specify if the function/variable is public
  • return : Specify the returned value
    • Usage :
@return    {String}    The cool returned value
  • see : Specify a url for more info
    • Usage :
@see    http://google.com    {optionalLabel}
  • static : Specify if the documented property/function is a static one.
  • todo : Specify some things to do
  • type : Specify the type(s) of the documented variable.
    • Usage :
@type    {String|Boolean}
  • values : Specify the possible values for the documented element
    • Usage :
@values    Hello|World

Contribute

This is an open source project and will ever be! You are more that welcomed to contribute to his development and make it more awesome every day. To do so, you have several possibilities:

  1. Share the love ❤️
  2. Declare issues
  3. Fix issues
  4. Add features
  5. Build web component

Who are Coffeekraken

We try to be some cool guys that build some cool tools to make our (and yours hopefully) every day life better.

More on who we are

License

The code is available under the MIT license. This mean that you can use, modify, or do whatever you want with it. This mean also that it is shipped to you for free, so don't be a hater and if you find some issues, etc... feel free to contribute instead of sharing your frustrations on social networks like an asshole...

Install

npm i coffeekraken-docblock-parser

DownloadsWeekly Downloads

0

Version

1.0.10

License

MIT

Unpacked Size

276 kB

Total Files

77

Last publish

Collaborators

  • avatar