src/utilities/cmd.js
function variables(root, config, done) {
  var expression = /\$v\[(.+?)\]/g;
  each(Object.keys(root), function(key, next) {
    var value = root[key];
    if (typeof value === 'object') return variables(value, config, next);
    if (typeof value !== 'string') return next();
    root[key] = value.replace(expression, function(match, matchKey) {
      return config[matchKey] || match;
    });
    next();
  }, done);
}
function variables(root, config, done) {
  var expression = /\$v\[(.+?)\]/g;
  each(Object.keys(root), function(key, next) {
    var value = root[key];
    if (typeof value === 'object') return variables(value, config, next);
    if (typeof value !== 'string') return next();
    root[key] = value.replace(expression, function(match, matchKey) {
      return config[matchKey] || match;
    });
    next();
  }, done);
}
function variables ( root , config , done ) { var expression = / \$v\[(.+?)\] / g ; each ( Object . keys ( root ) , function ( key , next ) { var value = root [ key ] ; if ( typeof value === 'object' ) return variables ( value , config , next ) ; if ( typeof value !== 'string' ) return next ( ) ; root [ key ] = value . replace ( expression , function ( match , matchKey ) { return config [ matchKey ] || match ; } ) ; next ( ) ; } , done ) ; }
Expands each variable.
@param {Object} root
@param {Object.<string, string>} config
@param {function()} done
Expands each variable .