dot-path-value
dot-path-value copied to clipboard
hasByPath()
Hi,
Thanks for the library. It would be great if it provided an hasByPath()
method to check the path's availability.
Thanks,
@ozum hi, thanks for feedback :)
Maybe I misunderstood, but why can't you use like this? const hasValue = getByPath(obj, 'a.b.c') !== undefined
Hi @g-makarov,
Below is an example for a use case:
const a = {
name: "Jane"
surname: undefined
}
const hasValue = getByPath(a, 'surname') !== undefined; // false
const hasValue = hasByPath(a, 'surname'); // true