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 🙏

© 2026 – Pkg Stats / Ryan Hefner

doxyjs

v1.3.2

Published

Converts Javascript into psudo C++ for Doxygen

Readme

doxyjs

A simple CLI tool for converting Javascript into psudo C++ for Doxygen, inspired by doxyqml.

Installation

Install it once globally via npm:

npm install -g doxyjs

Or via yarn:

yarn global add doxyjs

Usage

CLI

You can use doxyjs as standalone CLI tool to generate pseudo C++ code from javascript source files.

Example

Printing pseudo C++ representation of Javascript source to standard output:

doxyjs --encoding utf8 --line-break lf --lang ru file.js

Options

$ doxyjs --help

  Usage: doxyjs [options] [files...]

  Converts Javascript into psudo C++ for Doxygen

  Options:

    -h, --help                     output usage information
    -V, --version                  output the version number
    -e, --encoding <encoding>      source files encoding (utf8 by default)
    -b, --line-break <line break>  line break symbol [lf|crlf] (lf by default)
    -l, --lang <language code>     output language (en by default)

List of supported encodings can be found here.

List of supported languages:

  • de
  • en
  • es
  • it
  • ru

Doxygen Integration

To use doxyjs with Doxygen you must make few changes to your Doxyfile.

  • Add the .js extension to the FILTER_PATTERNS:

    FILTER_PATTERNS = *.js=doxyjs
  • Add the .js extension to FILE_PATTERNS:

    FILE_PATTERNS = *.js
  • Since Doxygen 1.8.8, you must also add the .js extension to EXTENSION_MAPPING:

    EXTENSION_MAPPING = js=C++

Documenting code

Files

It's pretty straightforward:

/*!
 * @file FileName.js
 * @brief File description goes here
 */

will produce:

/*!
 * @file FileName.js
 * @brief File description goes here
 */

Variables

doxyjs will use var as default variable's type, but you can override it with type:<YourTypeHere>.

//! This is variable
var a = 42;
//! type:String This is string variable
var b = 'some string value';

Code above will transform into:

//! This is variable
var a;
//! This is string variable
String b;

However, you can omit any type definitions. Then default type var will be used.

Functions

Type definition for function arguments done the same way as for variables. Also you're able define functions's return type, however, this is still optional.

//! Short function description
function foo(args) {
}

/*!
 *  @brief Test Function
 *  @param type:Object param1 first parameter
 *  @param type:String param2 second parameter
 *  @return type:Date return value description
 */
function global_function_with_args(param1, param2) {
  return new Date();
}

Resulting pseudo C++:

/*!
 * @brief Short function description
 */
void foo(var args);

/*!
 * @brief Test Function
 * @param param1 first parameter
 * @param param2 second parameter
 * @return return value description
 */
Date global_function_with_args(Object param1, String param2);

For functions without return value, just omit @return comment section:

/*!
 *  @brief Test Function
 *  @param type:Date foo parameter description
 */
function global_function_without_arg(var foo) {
}
/*!
 * @brief Test Function
 * @param foo parameter description
 */
void global_function_without_arg(Date foo);

Classes

Next contructions will be interpreted as classes:


/*!
 * @brief Argument Class
 * @param type:Object arg argument description
 */
function Argument(arg) {
}

/*!
 * @brief Get child arguments
 * @param type:String name arguments name
 * @return type:Array child arguments
 */
Argument.prototype.getArguments = function(name) {
}

/*!
 * @brief Get first child argument
 * @param type:String name argument name
 * @return type:Argument child argument
 */
Argument.prototype.getArgument = function(name) {
}

/*!
 * @brief Add child arguments
 * @param type:Argument arg argument
 */
Argument.prototype.addArgument = function(arg) {
}

/*!
 * @brief Command Class
 * @param type:Object cmd command description
 */
function Command(cmd) {
}

Command.prototype = Object.create(Argument.prototype);
Command.prototype.constructor = Command;

/*!
 * @brief Event Class
 * @param type:Object event event description
 */
function Event(event) {
}

Event.prototype = Object.create(Argument.prototype);
Event.prototype.constructor = Event;

Output pseudo code:

//! Argument Class
class Argument {
public:
    /*!
     * @brief Constructor
     * @param arg argument description
     */
    Argument(Object arg);

    /*!
     * @brief Get child arguments
     * @param name arguments name
     * @return child arguments
     */
    Array getArguments(String name);

    /*!
     * @brief Get first child argument
     * @param name argument name
     * @return child argument
     */
    Argument getArgument(String name);

    /*!
     * @brief Add child arguments
     * @param arg argument
     */
    void addArgument(Argument arg);
};

//! Command Class
class Command: public Argument {
public:
    /*!
     * @brief Constructor
     * @param cmd command description
     */
    Command(Object cmd);
};

//! Event Class
class Event: public Argument {
public:
    /*!
     * @brief Constructor
     * @param event event description
     */
    Event(Object event);
};

Here some things to notice:

  • Base class is determined by next code:

    Event.prototype = Object.create(Argument.prototype);

    Here Argument will be used as base class of Event.

  • Class'es brief description and constructor's parameters are extracted from next comment:

    /*!
     * @brief Event Class
     * @param type:Object event event description
     */
     function Event(event) {
     }

    Here @brief is used for class description, and @param is used for constructor's parameters documentation.

  • Docs for class methods done the same way as for global functions.

CHANGELOG

CHANGELOG

License

MIT