Skip to content

Commit 97cbdc6

Browse files
committed
- Further type fixes/clarifications
1 parent 9873841 commit 97cbdc6

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
@@ -140,7 +140,7 @@ class NewError extends Error {
140140

141141
/**
142142
* @typedef {PlainObject} ReturnObject
143-
* @property {string} path
143+
* @property {string[]} path
144144
* @property {JSON} value
145145
* @property {PlainObject|GenericArray} parent
146146
* @property {string} parentProperty
@@ -157,7 +157,7 @@ class NewError extends Error {
157157
/**
158158
* @callback OtherTypeCallback
159159
* @param {JSON} val
160-
* @param {string} path
160+
* @param {string[]} path
161161
* @param {PlainObject|GenericArray} parent
162162
* @param {string} parentPropName
163163
* @returns {boolean}
@@ -380,7 +380,7 @@ JSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {
380380
*
381381
* @param {string} expr
382382
* @param {JSON} val
383-
* @param {string} path
383+
* @param {string[]} path
384384
* @param {PlainObject|GenericArray} parent
385385
* @param {string} parentPropName
386386
* @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)