README (node-pajsdoc)
Installation
npm install node-pajsdoc
Quick Start
const PaJSDoc = require('node-pajsdoc');
let pajsdoc = null;
let json_obj = null;
pajsdoc = new PaJSDoc('test/sample/dirmodule.c');
json_obj = pajsdoc.searchByFunction('FullPath');
if (item_node && item_node.function) {
console.log(item_node.function);
}
pajsdoc = new PaJSDoc("/**" +
" * @function FullPath" +
" */");
json_obj = jsdoc.searchByTagTypeName('function');
if (item_node && item_node.function) {
console.log(item_node.function);
}
Syntax
@TAG {TYPE} `NAME` DESC
Symbol | Item | Explaination |
---|---|---|
@ | TAG | |
{} | TYPE | |
`` | NAME | |
Text | DESC |
Test - Unit Test
./node_modules/mocha/bin/mocha test
Examples
Example 1
/**
* @module {Composite} `DIR_MODULE` Dir module
* @member {DIR_PUBLIC_FUNC_DECLARATION}
* @namespace RtLib.Dir
* @author dougpuob <dougpuob@gmail.com>
*/
struct _DIR_MODULE {
WRAP_STATIC_PUBLIC_DATA( DIR_PUBLIC_DATA_DECLARATION() );
WRAP_STATIC_PUBLIC_FUNC( DIR_PUBLIC_FUNC_DECLARATION() );
};
Example 2
/**
* @module {Parts} `DIR_MODULE` Dir library
* @namespace RtLib.Dir
* @author dougpuob <dougpuob@gmail.com>
*/
Example 3
/**
* @function `_RtlDir_ReadDir` This is a descrption.
* @summary This is a summary text
* @description This is a summary text
* @parameter {char*} `szPath` This is a descrption.
* @parameter {bool} `bRecursive` This is a descrption.
* @parameter {FILE_ENTRY*} `pFileEntry` This is a descrption.
* @parameter {RECORD_DATA*} `pRecordData` This is a descrption.
* @return {FILE_ENTRY*}
* @author dougpuob <dougpuob@gmail.com>
*/
FILE_ENTRY*
_RtlDir_ReadDir(
IN OUT char* const szPath,
IN bool const bRecursive,
IN FILE_ENTRY* const pFileEntry,
IN OUT RECORD_DATA* const pRecordData
)
Example 4
/**
* @@class {} ``
* @function `_RtlDir_ReadDir` This is a descrption.
* @summary This is a summary text
* @description This is a summary text
* @parameter {char*} `szPath` This is a descrption.
* @parameter {bool} `bRecursive` This is a descrption.
* @parameter {FILE_ENTRY*} `pFileEntry` This is a descrption.
* @parameter {RECORD_DATA*} `pRecordData` This is a descrption.
* @return {FILE_ENTRY*}
* @author dougpuob <dougpuob@gmail.com>
*/
TAG NAME | TAG DESCRIPTION |
---|---|
@class @constructor |
Marks a function as a constructor |
@classdesc | ?? |
@module | Document a JavaScript module. |
@function @method |
Describe a function or method. |
@summary | A shorter version of the full description. |
@desc @description |
Describe a symbol. |
@deprecated | Marks a method as deprecated |
@throws @exception |
Documents an exception thrown by a method |
@exports | Identifies a member that is exported by the module |
@param @parameter |
Documents a method parameter; a datatype indicator can be added between curly |
@private | Signifies that a member is private |
@return @returns |
Documents a return value |
@see | Documents an association to another object |
@todo | Documents something that is missing/open |
@this | Specifies the type of the object to which the keyword "this" refers within a function. |
@version | Provides the version number of a library |
@virtual @abstract |
This member must be implemented (or overridden) by the inheritor. |
@deprecated | Document that this is no longer the preferred way. |
@example | Provide an example of how to use a documented item. |
@member | ??? |
@memberof | This symbol belongs to a parent symbol. |
@namespace | Document a namespace object. |
@see | Refer to some other documentation for more information. |
@static | Document a static member. |
@version | Documents the version number of an item. |
@author | Developer's name |
Test
$ mocha
PaJSDoc class
- Constructor() - single file
√ should return true
- Constructor() - Two files by array
√ should return true
- SearchByTagName()
√ should return true
- SearchByFunction()
√ should return true
- SearchByModule()
√ should return true
- SearchFirst() - @parameter {} {TYPE} `NAME` DESCRIPTION
√ should return true
- SearchFirst() - @parameter `NAME` DESCRIPTION
√ should return true
- SearchFirst() - @function DESCRIPTION
√ should return true
- SearchFirst() - @function `NAME`
√ should return true
- SearchFirst() - @function {TYPE}
√ should return true
- SearchFirst() - @description DESCRIPTION
√ should return true
- SearchFirst() - @summary DESCRIPTION
√ should return true
- SearchFirst() - @return {TYPE}
√ should return true
- SearchFirst() - @return {TYPE} DESCRIPTION
√ should return true
- SearchFirst() - @author DESCRIPTION
√ should return true
15 passing (74ms)
Resource
-
node-pajsdoc
https://github.com/dougpuob/node-pajsdoc.git
License
MIT