Type check for parsePath variable would be nice to have #1043
Closed
Description
When calling the parsePath function (https://github.com/chaijs/chai/blob/master/chai.js#L10117) type checking can help users identify incorrect usage of API.
Problematic line:
function parsePath(path) {
var str = path.replace(/([^\\])\[/g, '$1.[');
When running this (slightly incorrect) code:
expect(data).to.have.nested.property({'a':'1'})
The following error is thrown:
TypeError: path.replace is not a function
Because path in this case is an object {'a':'1'}
Would be nice to throw a more descriptive error :)