Replace ${foo.baz} properties in strings
$ npm install --save expr-prop
const exprProp = require('expr-prop')
var obj = {
name: 'expr-prop',
version: '1.0.0',
author:{
email: '[email protected]'
},
dependencies: [
{
module: 'prop-by-string',
version: '^1.0.1'
}
]
}
exprProp.expr('name: ${name}, email: ${author.email}', obj)
// name: expr-prop, email: [email protected]
exprProp.expr('depends: ${dependencies[0].module}', obj)
// depends: prop-by-string
MIT