Adaptation of the official [Javascript JMESPath package](https://github.com/jmespath/jmespath.js/) to work along with [RxJS](https://rxjs.dev/).
npm install @platyplus/rx-jmespathAdaptation of the official Javascript JMESPath package to work along with RxJS.
Passes all the original compliance tests.
``bash`
yarn add @platyplus/rx-jmespath
`typescript`
function search$(
expression: string | Observable
options: SearchOptions
): (data$: Observable
Example:
`js
import { search$ } from '@platyplus/rx-jmespath'
import { of } from 'rxjs'
of({ a: { b: { c: 'hello' } } })
.pipe(search$('a.b.c'))
.subscribe((result) => {
console.log(result) // <- returns 'hello'
})
`
Exact same function as in the official package:
`typescript`
search(obj: any, expression: string ) => any
`typescript`
type SearchOptions
getField?: FieldGetter
getIdentity?: IdentityGetter
circularData?: boolean
}
`typescript`
const getField: FieldGetter
obj: any,
property: string | number,
options: SearchOptions
): Observable
return of(obj[key] ?? null)
}
`typescript`
const getIdentity: IdentityGetter
obj: any,
options: SearchOptions
): Observable
return of(obj)
}
Sometimes, objects are mutually referenced, so browsing them entirely would create an infinite loop. You can prevent this in setting this option to true.
When true, the expression * expression raises an error instead of making the processing fail.
The circularData option defaults to false.