@@ -5,7 +5,6 @@ import { UndefinedFactError } from './errors'
5
5
import debug from './debug'
6
6
7
7
import { JSONPath } from 'jsonpath-plus'
8
- import isObjectLike from 'lodash.isobjectlike'
9
8
10
9
function defaultPathResolver ( value , path ) {
11
10
return JSONPath ( { path, json : value , wrap : false } )
@@ -161,7 +160,7 @@ export default class Almanac {
161
160
debug ( `condition::evaluate extracting object property ${ path } ` )
162
161
return factValuePromise
163
162
. then ( factValue => {
164
- if ( isObjectLike ( factValue ) ) {
163
+ if ( factValue != null && typeof factValue === 'object' ) {
165
164
const pathValue = this . pathResolver ( factValue , path )
166
165
debug ( `condition::evaluate extracting object property ${ path } , received: ${ JSON . stringify ( pathValue ) } ` )
167
166
return pathValue
@@ -179,7 +178,7 @@ export default class Almanac {
179
178
* Interprets value as either a primitive, or if a fact, retrieves the fact value
180
179
*/
181
180
getValue ( value ) {
182
- if ( isObjectLike ( value ) && Object . prototype . hasOwnProperty . call ( value , 'fact' ) ) { // value = { fact: 'xyz' }
181
+ if ( value != null && typeof value === 'object' && Object . prototype . hasOwnProperty . call ( value , 'fact' ) ) { // value = { fact: 'xyz' }
183
182
return this . factValue ( value . fact , value . params , value . path )
184
183
}
185
184
return Promise . resolve ( value )
0 commit comments