@nxtedition/deepstream.io-client-js 24.1.22 → 24.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/deepstream.io-client-js",
3
- "version": "24.1.22",
3
+ "version": "24.2.0",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
@@ -504,7 +504,10 @@ class RecordHandler {
504
504
 
505
505
  if (
506
506
  idx < args.length &&
507
- (args[idx] == null || typeof args[idx] === 'string' || Array.isArray(args[idx]))
507
+ (args[idx] == null ||
508
+ typeof args[idx] === 'string' ||
509
+ Array.isArray(args[idx]) ||
510
+ typeof args[idx] === 'function')
508
511
  ) {
509
512
  path = args[idx++]
510
513
  }
@@ -125,7 +125,15 @@ class Record {
125
125
  }
126
126
 
127
127
  get(path) {
128
- return path ? jsonPath.get(this._data, path) : this._data
128
+ if (!path) {
129
+ return this._data
130
+ } else if (typeof path === 'string' || Array.isArray(path)) {
131
+ return path ? jsonPath.get(this._data, path) : this._data
132
+ } else if (typeof path === 'function') {
133
+ return path(this._data)
134
+ } else {
135
+ throw new Error('invalid argument: path')
136
+ }
129
137
  }
130
138
 
131
139
  set(pathOrData, dataOrNil) {