lib/templateUtils.js
function(prefix, f) {
    var retF = function(env) {
        Object.keys(env)
            .forEach(function(x) {
                var val = env[x];
                if ((typeof val === 'string') &&
                    (val.indexOf(prefix) === 0)) {
                    var propName = val.substring(prefix.length,
                                                 val.length);
                    env[x] = f(propName);
                } else if (Array.isArray(val)) {
                    retF(val);
                } else if (val && (typeof val === 'object')) {
                    retF(val);
                }
            });
    };
    return retF;
}
function(prefix, f) {
    var retF = function(env) {
        Object.keys(env)
            .forEach(function(x) {
                var val = env[x];
                if ((typeof val === 'string') &&
                    (val.indexOf(prefix) === 0)) {
                    var propName = val.substring(prefix.length,
                                                 val.length);
                    env[x] = f(propName);
                } else if (Array.isArray(val)) {
                    retF(val);
                } else if (val && (typeof val === 'object')) {
                    retF(val);
                }
            });
    };
    return retF;
}
function ( prefix , f ) { var retF = function ( env ) { Object . keys ( env ) . forEach ( function ( x ) { var val = env [ x ] ; if ( ( typeof val === 'string' ) && ( val . indexOf ( prefix ) === 0 ) ) { var propName = val . substring ( prefix . length , val . length ) ; env [ x ] = f ( propName ) ; } else if ( Array . isArray ( val ) ) { retF ( val ) ; } else if ( val && ( typeof val === 'object' ) ) { retF ( val ) ; } } ) ; } ; return retF ; }
Returns a function that filters relevant values in an environment and
applies a transform to them.

@param {string} prefix A matching prefix for selected values.
@param {function(string): Object} f A function that transforms matching
values.
Returns a function that filters relevant values in an environment and applies a transform to them .