File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,28 @@ var propStringTmplRe = /^<%=\s*([a-z0-9_$]+(?:\.[a-z0-9_$]+)*)\s*%>$/i;
4343
4444// Get config data, recursively processing templates.
4545config . get = function ( prop ) {
46- return config . process ( config . getRaw ( prop ) ) ;
46+ var props = getParts ( config . getPropString ( prop ) ) ;
47+ var currentData = config . data ;
48+ // from https://github.com/cowboy/node-getobject/blob/master/lib/getobject.js
49+ // Split strings on dot, but only if dot isn't preceded by a backslash. Since
50+ // JavaScript doesn't support lookbehinds, use a placeholder for "\.", split
51+ // on dot, then replace the placeholder character with a dot.
52+ function getParts ( str ) {
53+ return str . replace ( / \\ \. / g, '\uffff' ) . split ( '.' ) . map ( function ( s ) {
54+ return s . replace ( / \uffff / g, '.' ) ;
55+ } ) ;
56+ }
57+
58+ props . forEach ( function ( item ) {
59+ currentData = currentData [ item ] ;
60+ // if current value is template -- expand it
61+ if ( typeof currentData === 'string' &&
62+ currentData . match ( propStringTmplRe ) ) {
63+ currentData = config . process ( currentData ) ;
64+ }
65+ } ) ;
66+
67+ return config . process ( currentData ) ;
4768} ;
4869
4970// Expand a config value recursively. Used for post-processing raw values
You can’t perform that action at this time.
0 commit comments