Giter VIP home page Giter VIP logo

json-p3's People

Contributors

jg-rp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

json-p3's Issues

Keys filter selector

To solve a problem with node locations generated when using the non-standard keys selector (~), we need a way to conditionally select an object's keys, which could also be useful aside from creating valid node locations.

Whereas the standard filter selector ([? <expression>]) selects values from an array or object when the expression evaluates to true, the keys filter selector would select keys instead of values. Syntax for this could be [?~ <expression>] or [~? <expression>].

Alternatively (or additionally), we could implement a key selector ("key" singular), which selects the key if it exists. Syntax could be $.obj.~name or $.obj[~'name'] or $.obj[~"name"]. Without this we could use the proposed keys filter selector like this:

[~? # == 'name']

But that would not be a singular query and the key selector would.

Slice generator function

The *lazyResolve method of SliceSelector uses the non-lazy private slice method. We should add a generator version of slice, which should be more memory efficient when used on large arrays with large slice ranges.

private slice(
arr: JSONValue[],
start?: number,
stop?: number,
step?: number,
): Array<[number, JSONValue]> {

Model JSONPath segments explicitly

Considering our abstract class JSONPathSelector, and the absence of a JSONPathSegment class, we are currently blurring the lines between segments and selectors.

We should refactor to follow the JSONPath model described in RFC 9535 by implementing a JSONPathSegment class, where all JSONPathSelector instances belong to a segment, even shorthand selectors. In turn, a JSONPath expression (currently JSONPath and should be JSONPathQuery or JSONPathExpression to match terminology from RFC 9535) should be made up of segments only.

This diagram illustrates what we want.

Blank diagram

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.