/** * Math utilities for demonstrating svelte-docinfo analysis. * @module */ /** * Add two numbers. * @param a - first number * @param b - second number * @returns the sum * @example * ```ts * add(2, 3) // 5 * ``` */ export const add = (a: number, b: number): number => a + b; /** * Multiply two numbers. * @param a - first number * @param b - second number * @returns the product */ export const multiply = (a: number, b: number): number => a * b; /** Configuration for math operations. */ export interface MathConfig { /** Decimal precision. */ precision: number; /** Round results? */ round: boolean; } /** A 2D vector. */ export interface Vector2 { x: number; y: number; } /** * Add vectors in place. * @param target - vector to mutate * @param source - vector to add * @mutates target - modifies x and y fields */ export const add_vector = (target: Vector2, source: Vector2): void => { target.x += source.x; target.y += source.y; };
{ "path": "math.ts", "declarations": [ { "name": "add", "kind": "function", "docComment": "Add two numbers.", "typeSignature": "(a: number, b: number): number", "sourceLine": 16, "examples": [ "```ts\nadd(2, 3) // 5\n```" ], "alsoExportedFrom": [ "index.ts" ], "parameters": [ { "name": "a", "type": "number", "description": "first number" }, { "name": "b", "type": "number", "description": "second number" } ], "returnType": "number", "returnDescription": "the sum" }, { "name": "multiply", "kind": "function", "docComment": "Multiply two numbers.", "typeSignature": "(a: number, b: number): number", "sourceLine": 24, "alsoExportedFrom": [ "index.ts" ], "parameters": [ { "name": "a", "type": "number", "description": "first number" }, { "name": "b", "type": "number", "description": "second number" } ], "returnType": "number", "returnDescription": "the product" }, { "name": "MathConfig", "kind": "interface", "docComment": "Configuration for math operations.", "typeSignature": "MathConfig", "sourceLine": 27, "alsoExportedFrom": [ "index.ts" ], "members": [ { "name": "precision", "kind": "variable", "docComment": "Decimal precision.", "typeSignature": "number" }, { "name": "round", "kind": "variable", "docComment": "Round results?", "typeSignature": "boolean" } ] }, { "name": "Vector2", "kind": "interface", "docComment": "A 2D vector.", "typeSignature": "Vector2", "sourceLine": 35, "members": [ { "name": "x", "kind": "variable", "typeSignature": "number" }, { "name": "y", "kind": "variable", "typeSignature": "number" } ] }, { "name": "add_vector", "kind": "function", "docComment": "Add vectors in place.", "typeSignature": "(target: Vector2, source: Vector2): void", "sourceLine": 46, "mutates": { "target": "modifies x and y fields" }, "parameters": [ { "name": "target", "type": "Vector2", "description": "vector to mutate" }, { "name": "source", "type": "Vector2", "description": "vector to add" } ], "returnType": "void" } ], "moduleComment": "Math utilities for demonstrating svelte-docinfo analysis.", "dependents": [ "Calculator.svelte", "index.ts" ] }