@types/jsonquery
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

Installation

npm install --save @types/jsonquery

Summary

This package contains type definitions for jsonquery (https://github.com/eugeneware/jsonquery).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsonquery.

index.d.ts

/// <reference types="node" />

declare function jsonquery<T>(query: jsonquery.Query<T>): NodeJS.ReadWriteStream;

declare namespace jsonquery {
    function match<T>(haystack: T, predicate: Query<T>): boolean;

    type Query<T> = BinaryQueryCondition<T> | QueryValue<T> | PathQuery;

    interface OrQueryCondition<T> {
        $or: ReadonlyArray<Query<T>>;
    }

    interface AndQueryCondition<T> {
        $and: ReadonlyArray<Query<T>>;
    }

    type BinaryQueryCondition<T> = OrQueryCondition<T> | AndQueryCondition<T>;

    interface BaseCondition<P> {
        $lt: P;
        $lte: P;
        $gt: P;
        $gte: P;
        $mod: [number, number];
        $ne: P;
        $in: readonly P[];
        $nin: readonly P[];
        $all: readonly P[];
        $elemMatch: Partial<P>;
    }

    interface PathQuery {
        [path: string]: any;
    }

    type QueryValue<T> = {
        [P in keyof T]?: T[P] | BaseCondition<T[P]>;
    };
}

export = jsonquery;

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: @types/node

Credits

These definitions were written by .

Readme

Keywords

none

Package Sidebar

Install

npm i @types/jsonquery

Weekly Downloads

11

Version

0.1.4

License

MIT

Unpacked Size

4.36 kB

Total Files

5

Last publish

Collaborators

  • types