### Prepare and start website server Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/ts-jest/CONTRIBUTING.md Commands to install dependencies, format documentation, and start the local development server for the website. ```sh-session $ cd website # Only needed if you are not already in the website directory $ npm ci $ npm run lint-prettier # Please format markdown files $ npm run start ``` -------------------------------- ### Quickstart Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/micromatch/README.md Basic usage examples for micromatch. ```APIDOC ## Quickstart ```js const micromatch = require('micromatch'); // micromatch(list, patterns[, options]); ``` The [main export](#micromatch) takes a list of strings and one or more glob patterns: ```js console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['f*', 'b*'])) //=> ['foo', 'bar', 'baz'] console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['*', '!b*'])) //=> ['foo', 'qux'] ``` Use [.isMatch()](#ismatch) to for boolean matching: ```js console.log(micromatch.isMatch('foo', 'f*')) //=> true console.log(micromatch.isMatch('foo', ['b*', 'f*'])) //=> true ``` [Switching](#switching-to-micromatch) from minimatch and multimatch is easy! ``` -------------------------------- ### Full Server Example with Router and Middleware Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/router/README.md A comprehensive example showing server setup, middleware usage (compression, body-parser), nested routers, and request handling. ```APIDOC ## Full Server Setup Example ### Description This example demonstrates setting up an HTTP server with the `router` module, including global middleware like `compression`, nested routers for API endpoints, and specific request handlers. ### Server Setup - **HTTP Server**: Listens on port 8080. - **Router**: Main router instance. - **API Router**: Nested router mounted at `/api/`. ### Middleware - **Compression**: Applied globally to all responses. - **Body Parser**: Applied to the `/api/` router for JSON request bodies. ### Endpoints - **GET /**: Returns `Hello World!`. - **GET /message**: Returns a configurable message. - **PATCH /api/set-message**: Updates the message via JSON payload. ### Request Examples #### Get Message ```bash curl http://127.0.0.1:8080 ``` #### Set Message ```bash curl http://127.0.0.1:8080/api/set-message -X PATCH -H "Content-Type: application/json" -d '{"value":"Cats!"}' ``` ### Code Snippet ```js // import our modules var http = require('http') var Router = require('router') var finalhandler = require('finalhandler') var compression = require('compression') var bodyParser = require('body-parser') // store our message to display var message = 'Hello World!' // initialize the router & server and add a final callback. var router = Router() var server = http.createServer(function onRequest (req, res) { router(req, res, finalhandler(req, res)) }) // use some middleware and compress all outgoing responses router.use(compression()) // handle `GET` requests to `/message` router.get('/message', function (req, res) { res.statusCode = 200 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end(message + '\n') }) // create and mount a new router for our API var api = Router() router.use('/api/', api) // add a body parsing middleware to our API api.use(bodyParser.json()) // handle `PATCH` requests to `/api/set-message` api.patch('/set-message', function (req, res) { if (req.body.value) { message = req.body.value res.statusCode = 200 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end(message + '\n') } else { res.statusCode = 400 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Invalid API Syntax\n') } }) // make our http server listen to connections server.listen(8080) ``` ``` -------------------------------- ### Project Setup and Testing Commands Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/ajv-formats/README.md Standard commands for installing dependencies, updating git submodules, and running tests for the project. ```bash npm install git submodule update --init npm test ``` -------------------------------- ### Initialize Hono Server Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/@hono/node-server/README.md Basic setup to start a Hono server on Node.js. ```ts import { serve } from '@hono/node-server' import { Hono } from 'hono' const app = new Hono() app.get('/', (c) => c.text('Hono meets Node.js')) serve(app, (info) => { console.log(`Listening on http://localhost:${info.port}`) // Listening on http://localhost:3000 }) ``` -------------------------------- ### Basic Express.js Server Setup Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/express/Readme.md Sets up a basic Express.js server that listens on port 3000 and responds with 'Hello World' to root requests. Requires Node.js and Express.js installed. ```javascript import express from 'express' const app = express() app.get('/', (req, res) => { res.send('Hello World') }) app.listen(3000, () => { console.log('Server is running on http://localhost:3000') }) ``` -------------------------------- ### Usage Example: Prepending PATH Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/npm-run-path/readme.md Demonstrates how to use npm-run-path to get a PATH string that includes locally installed binaries. This is useful for executing binaries from child processes. ```javascript const childProcess = require('child_process'); const npmRunPath = require('npm-run-path'); console.log(process.env.PATH); //=> '/usr/local/bin' console.log(npmRunPath()); //=> '/Users/sindresorhus/dev/foo/node_modules/.bin:/Users/sindresorhus/dev/node_modules/.bin:/Users/sindresorhus/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/usr/local/bin' // `foo` is a locally installed binary childProcess.execFileSync('foo', { env: npmRunPath() }); ``` -------------------------------- ### Run an Express.js example Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/express/Readme.md Executes a specific example from the cloned Express.js repository. Replace 'content-negotiation' with the desired example name. ```bash node examples/content-negotiation ``` -------------------------------- ### Install nice-try Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/nice-try/README.md Install the package via npm. ```bash npm install nice-try ``` -------------------------------- ### Install run-async Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/run-async/README.md Install the package via npm. ```bash npm install --save run-async ``` -------------------------------- ### Use side-channel-map for data storage Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/side-channel-map/README.md Example demonstrating how to initialize a channel, set, get, check, and delete values associated with a key. ```js const assert = require('assert'); const getSideChannelMap = require('side-channel-map'); const channel = getSideChannelMap(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Install p-try Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/p-try/readme.md Install the package via npm. ```bash $ npm install p-try ``` -------------------------------- ### Install Dependencies and Run Tests Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/send/README.md Install project dependencies using npm install and run the test suite with npm test. ```bash $ npm install $ npm test ``` -------------------------------- ### Install Picomatch Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/jest-util/node_modules/picomatch/README.md Install the library using npm. ```sh npm install --save picomatch ``` -------------------------------- ### Install require-from-string Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/require-from-string/readme.md Install the package using npm. ```bash $ npm install --save require-from-string ``` -------------------------------- ### Installation Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/fast-json-stable-stringify/README.md Command to install the package via npm. ```bash npm install fast-json-stable-stringify ``` -------------------------------- ### Install is-interactive Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/is-interactive/readme.md Install the package using npm. ```bash $ npm install is-interactive ``` -------------------------------- ### Quickstart usage Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/micromatch/README.md Initialize the library and perform basic glob matching on arrays of strings. ```js const micromatch = require('micromatch'); // micromatch(list, patterns[, options]); ``` ```js console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['f*', 'b*'])) //=> ['foo', 'bar', 'baz'] console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['*', '!b*'])) //=> ['foo', 'qux'] ``` -------------------------------- ### Install Package Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/@cspotcode/source-map-support/README.md Install the library via npm. ```bash $ npm install @cspotcode/source-map-support ``` -------------------------------- ### Install is-fullwidth-code-point Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/is-fullwidth-code-point/readme.md Install the package using npm. ```bash $ npm install is-fullwidth-code-point ``` -------------------------------- ### Initialize a full router server Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/router/README.md A complete example showing router initialization, middleware usage, sub-router mounting, and server startup. ```javascript // import our modules var http = require('http') var Router = require('router') var finalhandler = require('finalhandler') var compression = require('compression') var bodyParser = require('body-parser') // store our message to display var message = 'Hello World!' // initialize the router & server and add a final callback. var router = Router() var server = http.createServer(function onRequest (req, res) { router(req, res, finalhandler(req, res)) }) // use some middleware and compress all outgoing responses router.use(compression()) // handle `GET` requests to `/message` router.get('/message', function (req, res) { res.statusCode = 200 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end(message + '\n') }) // create and mount a new router for our API var api = Router() router.use('/api/', api) // add a body parsing middleware to our API api.use(bodyParser.json()) // handle `PATCH` requests to `/api/set-message` api.patch('/set-message', function (req, res) { if (req.body.value) { message = req.body.value res.statusCode = 200 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end(message + '\n') } else { res.statusCode = 400 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Invalid API Syntax\n') } }) // make our http server listen to connections server.listen(8080) ``` -------------------------------- ### Install jest-docblock Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/jest-docblock/README.md Installation commands for yarn and npm. ```sh # with yarn $ yarn add jest-docblock # with npm $ npm install jest-docblock ``` -------------------------------- ### Installation Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/content-disposition/README.md Install the content-disposition package using npm. ```APIDOC ## Installation ```sh $ npm install content-disposition ``` ``` -------------------------------- ### Install and Run Benchmarks Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/micromatch/README.md Commands to set up the environment and execute the performance test suite. ```sh $ cd bench && npm install ``` ```sh $ npm run bench ``` -------------------------------- ### Install figures package Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/figures/readme.md Install the figures package using npm. This is the initial setup step before using the package in your project. ```bash $ npm install figures ``` -------------------------------- ### Quick Start Workflow Source: https://github.com/iamunbounded/devctx/blob/main/README.md Standard initialization and usage flow for capturing and resuming context. ```bash # 1. Initialize in your repo devctx init # 2. Work on your code... then save context devctx save # → Interactive prompts capture: Task, Approaches, Decisions, Next Steps # 3. Resume in ANY editor devctx resume # → Copies a perfectly formatted prompt to your clipboard # → Paste into Cursor, Claude, or ChatGPT to restore full context ``` -------------------------------- ### Install synckit Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/synckit/README.md Install the package using yarn or npm. ```sh # yarn yarn add synckit # npm npm i synckit ``` -------------------------------- ### Install FakeTimers with specific methods Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/@sinonjs/fake-timers/README.md Example of restricting the mocked functions to only setTimeout and nextTick. ```javascript FakeTimers.install({ toFake: ["setTimeout","nextTick"]}) ``` -------------------------------- ### Install call-bind-apply-helpers Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/call-bind-apply-helpers/README.md Install the package via npm. ```sh npm install --save call-bind-apply-helpers ``` -------------------------------- ### Install and Build Documentation Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/jest-util/node_modules/picomatch/README.md This command installs the necessary tools globally and then runs the documentation generator. Note that the readme.md is auto-generated and should not be edited directly. ```sh npm install -g verbose/verb#dev verb-generate-readme && verb ``` -------------------------------- ### Example: Get all .js files using HasteMap Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/jest-haste-map/README.md This example demonstrates how to configure HasteMap to crawl only .js files in a project and retrieve all found files. Ensure necessary imports are present and the root directory is correctly set. ```javascript import HasteMap from 'jest-haste-map'; import os from 'os'; import {dirname} from 'path'; import {fileURLToPath} from 'url'; const root = dirname(fileURLToPath(import.meta.url)); const map = new HasteMap.default({ id: 'myproject', //Used for caching. extensions: ['js'], // Tells jest-haste-map to only crawl .js files. maxWorkers: os.availableParallelism(), //Parallelizes across all available CPUs. platforms: [], // This is only used for React Native, you can leave it empty. roots: [root], // Can be used to only search a subset of files within `rootDir` retainAllFiles: true, rootDir: root, //The project root. }); const {hasteFS} = await map.build(); const files = hasteFS.getAllFiles(); console.log(files); ``` -------------------------------- ### Initialize and Use ArgumentParser Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/argparse/README.md Demonstrates setting up an ArgumentParser instance, defining arguments, and parsing command-line input. ```javascript #!/usr/bin/env node 'use strict'; var ArgumentParser = require('../lib/argparse').ArgumentParser; var parser = new ArgumentParser({ version: '0.0.1', addHelp:true, description: 'Argparse example' }); parser.addArgument( [ '-f', '--foo' ], { help: 'foo bar' } ); parser.addArgument( [ '-b', '--bar' ], { help: 'bar foo' } ); parser.addArgument( '--baz', { help: 'baz bar' } ); var args = parser.parseArgs(); console.dir(args); ``` -------------------------------- ### Usage Example Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/callsites/readme.md Demonstrates how to use the callsites module to get the filename of the current call site. Ensure the module is required before use. ```javascript const callsites = require('callsites'); function unicorn() { console.log(callsites()[0].getFileName()); //=> '/Users/sindresorhus/dev/callsites/test.js' } unicorn(); ``` -------------------------------- ### Create a CLI with subcommands and help Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/commander/Readme.md Shows how to structure a program with subcommands, descriptions, and action handlers. ```javascript const { Command } = require('commander'); const program = new Command(); program .name('string-util') .description('CLI to some JavaScript string utilities') .version('0.8.0'); program.command('split') .description('Split a string into substrings and display as an array') .argument('', 'string to split') .option('--first', 'display just the first substring') .option('-s, --separator ', 'separator character', ',') .action((str, options) => { const limit = options.first ? 1 : undefined; console.log(str.split(options.separator, limit)); }); program.parse(); ``` ```console $ node string-util.js help split Usage: string-util split [options] Split a string into substrings and display as an array. Arguments: string string to split Options: --first display just the first substring -s, --separator separator character (default: ",") -h, --help display help for command $ node string-util.js split --separator=/ a/b/c [ 'a', 'b', 'c' ] ``` -------------------------------- ### Get remote repository URL using simple-git Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/simple-git/readme.md Retrieves the remote URL for the current directory. Requires the simple-git package to be installed and initialized. ```javascript simpleGit().listRemote(['--get-url'], (err, data) => { if (!err) { console.log('Remote url for repository at ' + __dirname + ':'); console.log(data); } }); ``` -------------------------------- ### InstanceType Example Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/type-fest/readme.md Illustrates the use of InstanceType to get the type of an instance from a constructor. This is useful in scenarios where you need to refer to the type of objects created by a class. ```typescript class IdleService { doNothing (): void {} } class News { title: string; content: string; constructor(title: string, content: string) { this.title = title; this.content = content; } } const instanceCounter: Map = new Map(); ``` -------------------------------- ### Install get-proto Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/get-proto/README.md Install the get-proto package using npm. This is the first step before using the library in your project. ```sh npm install --save get-proto ``` -------------------------------- ### Run Inquirer.js Examples Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/inquirer/README.md Execute example scripts from the Inquirer.js package to see different interactive prompt types in action. Navigate to the examples directory to run them. ```shell node packages/inquirer/examples/pizza.js ``` ```shell node packages/inquirer/examples/checkbox.js ``` -------------------------------- ### Get Caller File in a Module Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/get-caller-file/README.md This example demonstrates how to use the get-caller-file utility within a module to retrieve the path of the file that invoked the current function. ```javascript // ./foo.js const getCallerFile = require('get-caller-file'); module.exports = function() { return getCallerFile(); // figures out who called it }; ``` ```javascript // index.js const foo = require('./foo'); foo() // => /full/path/to/this/file/index.js ``` -------------------------------- ### Enable in Browser Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/@cspotcode/source-map-support/README.md Include the bundled script and call the install method. ```html ``` -------------------------------- ### Install on-finished Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/on-finished/README.md Use npm to install the package in your project. ```sh $ npm install on-finished ``` -------------------------------- ### Basic Hono App Setup Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/hono/README.md This is a minimal Hono application that sets up a GET route for the root path and returns plain text. It requires the Hono library to be imported. ```typescript import { Hono } from 'hono' const app = new Hono() app.get('/', (c) => c.text('Hono!')) export default app ``` -------------------------------- ### Usage Example: Modifying Environment for Child Processes Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/npm-run-path/readme.md Shows how to use `npmRunPath.env()` to create a modified environment object for `child_process` functions, ensuring locally installed binaries are available. ```javascript // `foo` is a locally installed binary childProcess.execFileSync('foo', { env: npmRunPath.env() }); ``` -------------------------------- ### Install and use Neo-Async in a browser Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/neo-async/README.md Include the library via a script tag in HTML. ```html ``` -------------------------------- ### Usage Example Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/p-locate/readme.md An example demonstrating how to use p-locate to find the first existing file. ```APIDOC ## Usage Example Here we find the first file that exists on disk, in array order. ```javascript const pathExists = require('path-exists'); const pLocate = require('p-locate'); const files = [ 'unicorn.png', 'rainbow.png', // Only this one actually exists on disk 'pony.png' ]; (async () => { const foundPath = await pLocate(files, file => pathExists(file)); console.log(foundPath); //=> 'rainbow' })(); ``` *Note: Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this functionality in a command-line tool.* ``` -------------------------------- ### Update Repo and Get Tags Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/simple-git/readme.md Pulls the latest changes from the remote repository and retrieves a list of tags. Also shows an example of restarting the app if changes are detected after a pull. ```javascript simpleGit(__dirname + '/some-repo') .pull() .tags((err, tags) => console.log('Latest available tag: %s', tags.latest)); // update repo and when there are changes, restart the app simpleGit().pull((err, update) => { if (update && update.summary.changes) { require('child_process').exec('npm restart'); } }); ``` -------------------------------- ### Ignoring Files with Glob Patterns Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/micromatch/README.md The `ignore` option accepts a string or an array of glob patterns to exclude files from matching. This example shows how to ignore files starting with 'f'. ```javascript const isMatch = micromatch.matcher('*', { ignore: 'f*' }); console.log(isMatch('foo')) //=> false console.log(isMatch('bar')) //=> true console.log(isMatch('baz')) //=> true ``` -------------------------------- ### Install ee-first Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/ee-first/README.md Use npm to install the package in your project. ```sh $ npm install ee-first ``` -------------------------------- ### Run CLI Command Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/napi-postinstall/README.md Execute the postinstall helper via CLI or integrate it into package.json scripts. ```sh napi-postinstall unrs-resolver # ``` ```json { "scripts": { "postinstall": "napi-postinstall unrs-resolver" } } ``` -------------------------------- ### Install serve-static Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/serve-static/README.md Use npm to install the package locally in your project. ```sh $ npm install serve-static ``` -------------------------------- ### Get Object Prototype Examples Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/get-proto/README.md Demonstrates how to use the getProto function to retrieve the prototype of different objects. It covers standard objects, objects with a custom `__proto__`, and objects with a null prototype. ```javascript const assert = require('assert'); const getProto = require('get-proto'); const a = { a: 1, b: 2, [Symbol.toStringTag]: 'foo' }; const b = { c: 3, __proto__: a }; assert.equal(getProto(b), a); assert.equal(getProto(a), Object.prototype); assert.equal(getProto({ __proto__: null }), null); ``` -------------------------------- ### Usage Example for side-channel Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/side-channel/README.md Demonstrates how to use the side-channel package to set, get, assert, and delete information associated with a key. Asserts that the key is not initially present and throws an error when asserting a deleted key. ```js const assert = require('assert'); const getSideChannel = require('side-channel'); const channel = getSideChannel(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Usage Examples Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/cli-width/README.md Examples demonstrating how to use the cli-width package and configure its options. ```APIDOC ## Usage Examples ### Basic Usage ```javascript const cliWidth = require("cli-width"); cliWidth(); // maybe 204 :) ``` ### Setting Environment Variable You can also set the `CLI_WIDTH` environment variable. ### Customizing Options Defining both a default width value and a stream output to try to read from: ```javascript const cliWidth = require("cli-width"); const ttys = require("ttys"); cliWidth({ defaultWidth: 80, output: ttys.output, }); ``` Defines a different tty module to read width from: ```javascript const cliWidth = require("cli-width"); const ttys = require("ttys"); cliWidth({ tty: ttys, }); ``` ``` -------------------------------- ### Usage Example for side-channel-list Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/side-channel-list/README.md Demonstrates how to use the side-channel-list to set, get, assert, and delete keys. Requires importing the library and using Node.js assert module for verification. Note the warning about memory leaks if keys are not deleted. ```js const assert = require('assert'); const getSideChannelList = require('side-channel-list'); const channel = getSideChannelList(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Install fb-watchman Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/fb-watchman/README.md Install the fb-watchman npm package. Ensure Watchman is installed separately. ```bash $ npm install fb-watchman ``` -------------------------------- ### Install Router Package Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/router/README.md Install the router package using npm. This command is used for Node.js module installation. ```bash npm install router ``` -------------------------------- ### Install source-map-support Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/source-map-support/README.md Install the package using npm. This is the first step before using the module. ```bash $ npm install source-map-support ``` -------------------------------- ### Install Acorn using npm Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/acorn/README.md Use this command to install Acorn via npm. Ensure you have Node.js and npm installed. ```sh npm install acorn ``` -------------------------------- ### Browser Installation Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/natural-compare/README.md Include the library in your HTML using a script tag for browser environments. ```html ``` -------------------------------- ### Install base64-js with npm Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/base64-js/README.md Use this command to install the base64-js package via npm. After installation, require the module to use its functions. ```bash npm install base64-js ``` ```javascript var base64js = require('base64-js') ``` -------------------------------- ### Example Usage (Deno/ESM) Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/@isaacs/cliui/README.md Example demonstrating how to use cliui with Deno and ESM. ```APIDOC ## Example (Deno/ESM) ```typescript import cliui from "https://deno.land/x/cliui/deno.ts"; const ui = cliui({}) ui.div('Usage: $0 [command] [options]') ui.div({ text: 'Options:', padding: [2, 0, 1, 0] }) ui.div({ text: "-f, --file", width: 20, padding: [0, 4, 0, 4] }) console.log(ui.toString()) ``` ``` -------------------------------- ### Installation Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/micromatch/README.md Install micromatch using npm. ```APIDOC ## Install Install with [npm](https://www.npmjs.com/): ```sh $ npm install --save micromatch ``` ``` -------------------------------- ### Basic Demo Source Files Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/source-map-support/README.md Example source and compiled files demonstrating stack trace mapping. ```js throw new Error('test'); // This is the original code ``` ```js require('source-map-support').install(); throw new Error('test'); // This is the compiled code // The next line defines the sourceMapping. //# sourceMappingURL=compiled.js.map ``` ```json { "version": 3, "file": "compiled.js", "sources": ["original.js"], "names": [], "mappings": ";;AAAA,MAAM,IAAI" } ``` -------------------------------- ### Install Dependencies and Run Tests Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/fill-range/README.md To run and review unit tests, install dependencies using npm and then execute the test command. ```sh $ npm install && npm test ``` -------------------------------- ### Install yargs-parser Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/yargs-parser/README.md Install the package via npm. ```sh npm i yargs-parser --save ``` -------------------------------- ### Install type-fest Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/ts-jest/node_modules/type-fest/readme.md Install the package via npm. ```shell npm install type-fest ``` -------------------------------- ### Usage Example Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/create-require/README.md Basic implementation showing how to import the module and create a require function for a specific file. ```js const createRequire = require('create-require') const myRequire = createRequire('path/to/test.js') const myModule = myRequire('./test-sibling-module') ``` -------------------------------- ### Installation Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/safe-buffer/README.md Install the safe-buffer package using npm. ```APIDOC ## Installation ```bash npm install safe-buffer ``` ``` -------------------------------- ### Install micromatch Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/micromatch/README.md Install the package via npm. ```sh $ npm install --save micromatch ``` -------------------------------- ### Install and Import js-tokens Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/js-tokens/README.md Installation command and module import patterns. ```bash npm install js-tokens ``` ```js import jsTokens from "js-tokens" // or: var jsTokens = require("js-tokens").default ``` -------------------------------- ### Quick Example: Incremental Hashing Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/imurmurhash/README.md Demonstrates creating an initial hash state, incrementally adding strings, and retrieving the final hash result. Chaining calls is also shown. ```javascript // Create the initial hash var hashState = MurmurHash3('string'); // Incrementally add text hashState.hash('more strings'); hashState.hash('even more strings'); // All calls can be chained if desired hashState.hash('and').hash('some').hash('more'); // Get a result hashState.result(); // returns 0xe4ccfe6b ``` -------------------------------- ### Install restore-cursor Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/restore-cursor/readme.md Install the package via npm. ```bash $ npm install restore-cursor ``` -------------------------------- ### Install pretty-format Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/pretty-format/README.md Add the package to your project using yarn. ```sh $ yarn add pretty-format ``` -------------------------------- ### Install @babel/helper-plugin-utils Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/@babel/helper-plugin-utils/README.md Commands to install the package using common package managers. ```sh npm install --save @babel/helper-plugin-utils ``` ```sh yarn add @babel/helper-plugin-utils ``` -------------------------------- ### Ora Installation Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/ora/readme.md Install Ora using npm. ```APIDOC ## Install ```bash $ npm install ora ``` ``` -------------------------------- ### Install Neo-Async via Bower Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/neo-async/README.md Use Bower package manager for installation. ```bash bower install neo-async ``` -------------------------------- ### Install DevContext Source: https://github.com/iamunbounded/devctx/blob/main/README.md Global installation command for the CLI tool. ```bash npm install -g devctx ``` -------------------------------- ### Install p-finally Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/p-finally/readme.md Install the package via npm. ```bash $ npm install --save p-finally ``` -------------------------------- ### API Usage Example Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/napi-postinstall/README.md Implementation examples for the main package and the fallback module in JavaScript. ```js // index.js const { checkAndPreparePackage, isNpm } = require('napi-postinstall') if (isNpm()) { void checkAndPreparePackage('unrs-resolver' /* */) } // fallback.js module.exports = require('napi-postinstall/fallback')( require.resolve('./package.json') /* */, true /* */, ) ``` -------------------------------- ### Jackspeak Initialization and Parsing Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/jackspeak/README.md Demonstrates how to initialize Jackspeak with options and parse command-line arguments. ```APIDOC ## POST /api/users ### Description This endpoint allows for the creation of a new user in the system. ### Method POST ### Endpoint /api/users ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of users to return. #### Request Body - **username** (string) - Required - The desired username for the new user. - **email** (string) - Required - The email address for the new user. - **password** (string) - Required - The password for the new user. ### Request Example ```json { "username": "johndoe", "email": "john.doe@example.com", "password": "securepassword123" } ``` ### Response #### Success Response (201) - **id** (string) - The unique identifier for the newly created user. - **username** (string) - The username of the created user. - **email** (string) - The email address of the created user. #### Response Example ```json { "id": "user-12345", "username": "johndoe", "email": "john.doe@example.com" } ``` ``` -------------------------------- ### Install Negotiator Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/negotiator/README.md Install the package via npm. ```sh $ npm install negotiator ``` -------------------------------- ### Install Dependencies and Run Tests Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/jest-util/node_modules/picomatch/README.md Use this command to install project dependencies and run unit tests. This is a common step for verifying code integrity and familiarizing with the API. ```sh npm install && npm test ``` -------------------------------- ### Enable Programmatically Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/@cspotcode/source-map-support/README.md Install support by calling the install method or importing the register module. ```javascript require('@cspotcode/source-map-support').install(); ``` ```javascript import '@cspotcode/source-map-support/register' // Instead of: import sourceMapSupport from '@cspotcode/source-map-support' sourceMapSupport.install() ``` -------------------------------- ### Install mime-types Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/mime-types/README.md Install the package via npm. ```sh $ npm install mime-types ``` -------------------------------- ### Installation Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/log-symbols/readme.md Install the log-symbols package using npm. ```bash npm install log-symbols ``` -------------------------------- ### Upgrade Example: Node.js File Reading Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/convert-source-map/README.md Illustrates how to adapt to version 2.0.0 and later by providing a file reading function for `fromMapFileSource` in a Node.js environment. ```diff + var fs = require('fs'); // Import the fs module to read a file + var path = require('path'); // Import the path module to resolve a path against your directory - var conv = convert.fromMapFileSource(css, '../my-dir'); + var conv = convert.fromMapFileSource(css, function (filename) { + return fs.readFileSync(path.resolve('../my-dir', filename), 'utf-8'); + }); ``` -------------------------------- ### Install log-symbols Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/log-symbols/readme.md Install the package via npm. ```bash $ npm install log-symbols ``` -------------------------------- ### Basic Usage Example Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/cliui/README.md Demonstrates how to use cliui to create a simple command-line interface with divisions and options. ```APIDOC ## Basic Usage Example ### Description This example shows how to initialize `cliui` and use `div` to structure content, including text, width, padding, and alignment. ### Method `require('cliui')()` ### Endpoint N/A (Client-side library) ### Request Body N/A ### Request Example ```javascript const ui = require('cliui')() ui.div('Usage: $0 [command] [options]') ui.div({ text: 'Options:', padding: [2, 0, 1, 0] }) ui.div( { text: "-f, --file", width: 20, padding: [0, 4, 0, 4] }, { text: "the file to load." + chalk.green("(if this description is long it wraps).") , width: 20 }, { text: chalk.red("[required]"), align: 'right' } ) console.log(ui.toString()) ``` ### Response #### Success Response (200) - **string**: The rendered UI as a string. #### Response Example ``` Usage: $0 [command] [options] Options: -f, --file the file to load. (if this description is long it wraps). [required] ``` ``` -------------------------------- ### Install pkce-challenge Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/pkce-challenge/README.md Install the pkce-challenge package using npm. ```bash npm install pkce-challenge ``` -------------------------------- ### Installation Source: https://github.com/iamunbounded/devctx/blob/main/devctx/node_modules/json-schema-traverse/README.md Install the json-schema-traverse package using npm. ```APIDOC ## Install ```bash npm install json-schema-traverse ``` ```