function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp) {
  ensureSafeMemberName(key0, fullExp);
  ensureSafeMemberName(key1, fullExp);
  ensureSafeMemberName(key2, fullExp);
  ensureSafeMemberName(key3, fullExp);
  ensureSafeMemberName(key4, fullExp);

  return function cspSafeGetter(scope, locals) {
    var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope;

    if (pathVal == null) return pathVal;
    pathVal = pathVal[key0];

    if (!key1) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = pathVal[key1];

    if (!key2) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = pathVal[key2];

    if (!key3) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = pathVal[key3];

    if (!key4) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = pathVal[key4];

    return pathVal;
  };
}
function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp) {
  ensureSafeMemberName(key0, fullExp);
  ensureSafeMemberName(key1, fullExp);
  ensureSafeMemberName(key2, fullExp);
  ensureSafeMemberName(key3, fullExp);
  ensureSafeMemberName(key4, fullExp);

  return function cspSafeGetter(scope, locals) {
    var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope;

    if (pathVal == null) return pathVal;
    pathVal = pathVal[key0];

    if (!key1) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = pathVal[key1];

    if (!key2) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = pathVal[key2];

    if (!key3) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = pathVal[key3];

    if (!key4) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = pathVal[key4];

    return pathVal;
  };
}
function cspSafeGetterFn ( key0 , key1 , key2 , key3 , key4 , fullExp ) { ensureSafeMemberName ( key0 , fullExp ) ; ensureSafeMemberName ( key1 , fullExp ) ; ensureSafeMemberName ( key2 , fullExp ) ; ensureSafeMemberName ( key3 , fullExp ) ; ensureSafeMemberName ( key4 , fullExp ) ; return function cspSafeGetter ( scope , locals ) { var pathVal = ( locals && locals . hasOwnProperty ( key0 ) ) ? locals : scope ; if ( pathVal == null ) return pathVal ; pathVal = pathVal [ key0 ] ; if ( ! key1 ) return pathVal ; if ( pathVal == null ) return undefined ; pathVal = pathVal [ key1 ] ; if ( ! key2 ) return pathVal ; if ( pathVal == null ) return undefined ; pathVal = pathVal [ key2 ] ; if ( ! key3 ) return pathVal ; if ( pathVal == null ) return undefined ; pathVal = pathVal [ key3 ] ; if ( ! key4 ) return pathVal ; if ( pathVal == null ) return undefined ; pathVal = pathVal [ key4 ] ; return pathVal ; } ; }
Implementation of the "Black Hole" variant from:
- http://jsperf.com/angularjs-parse-getter/4
- http://jsperf.com/path-evaluation-simplified/7
Implementation of the Black Hole variant from : - http : // jsperf . com / angularjs - parse - getter / 4 - http : // jsperf . com / path - evaluation - simplified / 7