Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Get nested object property using dot notation
- * */
- const getProperty = ( propertyName, object ) => {
- let parts = propertyName.split( "." ),
- length = parts.length,
- i,
- property = object || this;
- for ( i = 0; i < length; i++ ) {
- property = property[parts[i]];
- }
- return property;
- };
Add Comment
Please, Sign In to add comment