I figure there's two main ways you could do this...
Add a third argument to has. This argument accepts a reference to an array. If there is an error then this array is populated with a path that shows where it failed. The last item in the path is what property was undefined. So like....
object-path.has = function (object,path,error){
if (there was some error) error.length=0; error=[...invalid path];
}
var lastError=[];
var has=oe.has(object, 'some,where', lastError);
if (!has) have a look at lastError to see where it failed
The other way is to introduce a new property to object-path called something like lastError that will contain details about the last error it encounters. Every time a command on o-p is executed the prop is cleared and repopulated if an error occurs. This way is nice coz you can apply it to every function and put as much info as you want into the prop. I used this way in my EmitterObject (still working on it, dont judge me ;P )....
https://gist.github.com/PAEz/b6fc1687e4e963796f189d539d8d9d0c
I figure there's two main ways you could do this...
Add a third argument to has. This argument accepts a reference to an array. If there is an error then this array is populated with a path that shows where it failed. The last item in the path is what property was undefined. So like.... object-path.has = function (object,path,error){ if (there was some error) error.length=0; error=[...invalid path]; } var lastError=[]; var has=oe.has(object, 'some,where', lastError); if (!has) have a look at lastError to see where it failed
The other way is to introduce a new property to object-path called something like lastError that will contain details about the last error it encounters. Every time a command on o-p is executed the prop is cleared and repopulated if an error occurs. This way is nice coz you can apply it to every function and put as much info as you want into the prop. I used this way in my EmitterObject (still working on it, dont judge me ;P ).... https://gist.github.com/PAEz/b6fc1687e4e963796f189d539d8d9d0c