respond
A library to test for deeply nested properties of complicated JavaScript objects.
Installation
From within your project directory run:
npm install --save responds
Usage
Responds exposes two functions to test for the existence of properties buried deep within JavaScript objects.
const testable = new Responds(myObject);
testable.has('path.to.my.deeply.nested.property');
testable.hasFunction('path.to.my.deeply.nested.function');
The first of these functions tests that the object responds to any type of property, whilst the second specifically tests that the object responds to a function.
In addition to retrieve a property its path can be used.
const testable = new Responds(myObject);
testable.get('path.to.my.deeply.nested.property');
License
This project is licensed under the MIT License.