reachTemplate.js 319 B

12345678910111213141516
  1. 'use strict';
  2. const Reach = require('./reach');
  3. const internals = {};
  4. module.exports = function (obj, template, options) {
  5. return template.replace(/{([^}]+)}/g, ($0, chain) => {
  6. const value = Reach(obj, chain, options);
  7. return (value === undefined || value === null ? '' : value);
  8. });
  9. };