0.1.1 • Published 11 years ago

reference v0.1.1

Weekly downloads
7
License
-
Repository
github
Last release
11 years ago

reference.js

Generate a simple API reference from JSON. Made specifically for PeerJS, so it probably won't suit your needs.

Expected style

The name property is required. Everything else is optional. Anchor IDs will correspond to the nesting of the current property (e.g. Some Class -> klass#method -> argument has an ID of some_class-klassmethod-argument).

[
  {
    "name": "TopLevelClass",
    "type": "constructor",
    "description": "This class does some stuff.",
    "snippet": "var klass = new TopLevelClass(arg1, [callback]);",
    "children": [
      {
        "name": "arg1",
        "type": "string",
        "description": "This is an argument for the constructor."
      },
      {
        "name": "callback",
        "type": "function",
        "description": "This is an optional callback.",
        "optional": true,
        "children": {
          "name": "err",
          "type": "error",
          "description": "Will callback with an error if you messed up."
        }
      }
    ]
  },
  {
    "name": "AnotherTopLevelClass",
    "type": "constructor",
    "description": "This class does some other stuff.",
    "snippet": "var klass2 = new AnotherTopLevelClass(options);",
    "children": {
      "name": "options",
      "type": "object",
      "description": "This is a hash of options for AnotherTopLevelClass.",
      "children": [
        {
          "name": "option1",
          "description": "This is anything, really."
        },
        {
          "name": "option2",
          "description": "This is just really another option."
        }
      ]
    }
  }
]

The above should give you something like this:

Generate PeerJS demo

cd demo
npm install
node demo.js
0.1.1

11 years ago

0.1.0

11 years ago

0.0.0

11 years ago