UNPKG

@aws-lambda-powertools/jmespath

Version:

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

22 lines (21 loc) 549 B
/** * 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); } } export { Expression };