UNPKG

js-object-utilities

Version:
16 lines (15 loc) 358 B
"use strict"; module.exports = (object, key) => { const keyParts = key.split("."); let returnValue = object; for (let i = 0; i < keyParts.length; i++) { const part = keyParts[i]; if (returnValue) { returnValue = returnValue[part]; } else { break; } } return returnValue; };