deno_doc
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

deno_doc

A Deno Doc port for Node.js

Features

  • Asynchronous
  • Supports both JavaScript and TypeScript
  • Generates documentation from remote url or file path
  • ESM & CJS supported

Installation

# npm
$ npm install --save deno_doc
# Yarn
$ yarn add deno_doc

Example Usage

// ES Modules
import { doc } from "deno_doc";

const colorsDoc = await doc("https://deno.land/std/fmt/colors.ts");

for (const node of colorsDoc) {
  console.log(`name: ${node.name} kind: ${node.kind}`);
}

// CommonJS
const { doc } = require("deno_doc");

const colorsDoc = await doc("https://deno.land/std/fmt/colors.ts");

for (const node of colorsDoc) {
  console.log(`name: ${node.name} kind: ${node.kind}`);
}

API

doc()

The doc() function takes a string URL module specifier and potentially some options, and asynchronously resolves with an array of documentation nodes, which represent the surface API of the module.

A minimal example of using doc() and printing out some information about a function:

import { doc } from "deno_doc";

const colorsDoc = await doc("https://deno.land/std/fmt/colors.ts");

for (const node of colorsDoc) {
  console.log(`name: ${node.name} kind: ${node.kind}`);
}

The doc() function needs a way to retrieve modules, and by default uses a load() function provided by a partial implementation of deno_graph which uses fetch() for remote modules and fs.readFile() for local modules.

Package Sidebar

Install

npm i deno_doc

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

3.53 MB

Total Files

11

Last publish

Collaborators

  • snowflake7