JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q5494F
  • License MIT

Debug your code, not the Runtime

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cstack) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    CStack

    Debug your code, not the Runtime

    Tested on CommonJS and ESM

    Table of Contents

    Why

    As a developer you'll often need to inspect call stacks to debug your code, not the Runtime. Tools like Error.stack() provide more information than needed, cluttering your call stack with Runtime internals (i.e. node:internals) which you don't care about; you're only concerned with your code.

    Installation

    npm i cstack # includes type definitions for TypeScript support

    Example

    import cstack from "cstack";
    
    function firstCall() {
      console.debug("1");
      secondCall();
    }
    
    function secondCall() {
      console.debug("2");
      thirdCall();
    }
    
    function thirdCall() {
      console.debug("3");
      console.log(cstack.getStack()); // -> StackFrame[]
      console.log(cstack.getParent("secondCall")); // -> "firstCall"
      console.log(cstack.getTrace(true)); // -> reversed stack trace (chronological)
    }
    
    firstCall();

    License

    MIT License