Install npm install object-path-valueyarn add object-path-value Usage let getValue = require('object-path-value'); console.log(getValue([1, 2, 3], 1) === 2);console.log(getValue({ foo: { bar: 'hello world' } }, 'foo.bar') === 'hello world');console.log(getValue({ foo: { bar: [1, 2, 3] } }, 'foo.bar.0') === 1);