UNPKG

@aws-lambda-powertools/jmespath

Version:

A type safe and modern jmespath module to parse and extract data from JSON documents using JMESPath

25 lines (24 loc) 665 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Expression = void 0; /** * Apply a JMESPath expression to a JSON value. */ class Expression { #expression; #interpreter; constructor(expression, interpreter) { this.#expression = expression; this.#interpreter = interpreter; } /** * Evaluate the expression against a JSON value. * * @param value - The JSON value to apply the expression to. * @param node - The node to visit. */ visit(value, node) { return this.#interpreter.visit(node ?? this.#expression, value); } } exports.Expression = Expression;