Skip to content

Commit 9b94dde

Browse files
committed
- Further type fixes/clarifications
1 parent 0f8ff1a commit 9b94dde

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/jsonpath.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ declare module 'jsonpath-plus' {
66
payload: any, payloadType: "value"|"property", fullPayload: any
77
) => void
88

9-
type JSONPathOtherTypeCallback = (...args: any[]) => boolean
9+
type JSONPathOtherTypeCallback = (
10+
val: JSON|any, path: string[], parent: object|array, parentPropName: string
11+
) => boolean
1012

1113
type JSON = null|boolean|number|string|{[key: string]: JSON}|JSON[]
1214

src/jsonpath.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class NewError extends Error {
4848

4949
/**
5050
* @typedef {PlainObject} ReturnObject
51-
* @property {string} path
51+
* @property {string[]} path
5252
* @property {JSON} value
5353
* @property {PlainObject|GenericArray} parent
5454
* @property {string} parentProperty
@@ -65,7 +65,7 @@ class NewError extends Error {
6565
/**
6666
* @callback OtherTypeCallback
6767
* @param {JSON} val
68-
* @param {string} path
68+
* @param {string[]} path
6969
* @param {PlainObject|GenericArray} parent
7070
* @param {string} parentPropName
7171
* @returns {boolean}
@@ -288,7 +288,7 @@ JSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {
288288
*
289289
* @param {string} expr
290290
* @param {JSON} val
291-
* @param {string} path
291+
* @param {string[]} path
292292
* @param {PlainObject|GenericArray} parent
293293
* @param {string} parentPropName
294294
* @param {JSONPathCallback} callback

test/test.type-operators.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('JSONPath - Type Operators', function () {
7070
/**
7171
*
7272
* @param {any} val
73-
* @param {string} path
73+
* @param {string[]} path
7474
* @param {PlainObject|GenericArray} parent
7575
* @param {string} parentPropName
7676
* @returns {boolean}

0 commit comments

Comments
 (0)