{"library":"power-assert-context-reducer-ast","title":"power-assert-context-reducer-ast","description":"Appends AST, tokens, and visitorKeys to power-assert context at runtime. Version 1.2.0 is the latest stable release. This package is part of the power-assert-runtime monorepo and is intended for use when the transpiler does not add AST metadata during compilation. It parses the assertion expression to generate the missing AST nodes, enabling power-assert's enhanced assertion messages even without a transpiler step. The package is lightweight and focused on a single responsibility within the power-assert ecosystem.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install power-assert-context-reducer-ast"],"cli":null},"imports":["var appendAst = require('power-assert-context-reducer-ast');","var appendAst = require('power-assert-context-reducer-ast');","const appendAst = require('power-assert-context-reducer-ast');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"var appendAst = require('power-assert-context-reducer-ast');\n\n// Given a powerAssertContext object without ast, tokens, visitorKeys\nvar context = {\n  source: {\n    content: 'assert(foo === bar)',\n    filepath: 'test/some_test.js',\n    line: 1\n  },\n  args: [\n    {\n      value: false,\n      events: [\n        { value: 'FOO', espath: 'arguments/0/left' },\n        { value: 'BAR', espath: 'arguments/0/right' },\n        { value: false, espath: 'arguments/0' }\n      ]\n    }\n  ]\n};\n\nvar appendedContext = appendAst(context);\nconsole.log(appendedContext.source.ast);\n// prints JSON representation of AST nodes","lang":"javascript","description":"Demonstrates how to use appendAst to add AST, tokens, and visitorKeys to a power-assert context object.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}