npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@swagger-api/apidom-json-path

v1.0.2

Published

Evaluate JSONPath expressions against ApiDOM.

Readme

@swagger-api/apidom-json-path

apidom-json-path is a package that evaluates JSONPath expressions against ApiDOM.

Installation

You can install this package via npm CLI by running the following command:

 $ npm install @swagger-api/apidom-json-path

Evaluating

Package contains JSONPath evaluation functions for evaluating single or multiple JSONPath expression.

Evaluating single JSONPath expression

Suited for evaluating single JSONPath expression against ApiDOM.

import { ObjectElement } from '@swagger-api/apidom-core';
import { evaluate } from '@swagger-api/apidom-json-path';

const apidom = new ObjectElement({
  a: {
    b: [100, 1, 2],
  },
});
const result = evaluate('$.a.b[?(@ < 10)]', apidom);
// =>
// [
//   NumberElement(1),
//   NumberElement(2),
// ]

Evaluating multiple JSONPath expressions

Suited for evaluating multiple JSONPath expression against the same ApiDOM. Use this function in cases when you have multiple JSONPath expressions that need to be evaluated against single ApiDOM fragment.

import { ObjectElement } from '@swagger-api/apidom-core';
import { evaluateMulti } from '@swagger-api/apidom-json-path';

const apidom = new ObjectElement({
  a: {
    b: [100, 1, 2],
  },
});
const resultMulti = evaluateMulti(['$.a.b[?(@ < 10)]', '$.a.b[?(@ > 10)]'], apidom);
// => returns list of tuples which represents mappings between paths and end point values
// [
//   ['$.a.b[?(@ < 10)]', [NumberElement(1), NumberElement(2)]],
//   ['$.a.b[?(@ > 10)]', [NUmberElement(100)]],
// ]

Invalid JSONPath expression

If either evaluate or evaluateMulti functions are provided with invalid JSONPath expressions, they don't throw errors, but they rather return empty list of end point values.

import { ObjectElement } from '@swagger-api/apidom-core';
import { evaluate, evaluateMulti } from '@swagger-api/apidom-json-path';

const apidom = new ObjectElement({
  a: {
    b: [100, 1, 2],
  },
});
const result = evaluate('%~!@U@IU$@', apidom); // => []
const resultMulti = evaluateMulti(['%~!@U@IU$@', 'd*AS&*)(&YR3R'], apidom); // => []