https://github.com/Microsoft/TypeScript/issues/5453 Once this issue is resolved (there are open PR) we can do this nicer by making addressOrName default to null for 2 operand calls. :)
192700
function Contract(addressOrName, contractInterface, signerOrProvider) {
        var _this = this;
        errors.checkNew(this, Contract);
        // @TODO: Maybe still check the addressOrName looks like a valid address or name?
        //address = getAddress(address);
        if (interface_1.Interface.isInterface(contractInterface)) {
            properties_1.defineReadOnly(this, 'interface', contractInterface);
        }
        else {
            properties_1.defineReadOnly(this, 'interface', new interface_1.Interface(contractInterface));
        }
        if (abstract_signer_1.Signer.isSigner(signerOrProvider)) {
            properties_1.defineReadOnly(this, 'provider', signerOrProvider.provider);
            properties_1.defineReadOnly(this, 'signer', signerOrProvider);
        }
        else if (abstract_provider_1.Provider.isProvider(signerOrProvider)) {
            properties_1.defineReadOnly(this, 'provider', signerOrProvider);
            properties_1.defineReadOnly(this, 'signer', null);
        }
        else {
            errors.throwError('invalid signer or provider', errors.INVALID_ARGUMENT, { arg: 'signerOrProvider', value: signerOrProvider });
        }
        properties_1.defineReadOnly(this, 'estimate', {});
        properties_1.defineReadOnly(this, 'functions', {});
        properties_1.defineReadOnly(this, 'filters', {});
        Object.keys(this.interface.events).forEach(function (eventName) {
            var event = _this.interface.events[eventName];
            properties_1.defineReadOnly(_this.filters, eventName, function () {
                var args = [];
                for (var _i = 0; _i < arguments.length; _i++) {
                    args[_i] = arguments[_i];
                }
                return {
                    address: _this.address,
                    topics: event.encodeTopics(args)
                };
            });
        });
        this._events = [];
        properties_1.defineReadOnly(this, 'address', addressOrName);
        if (this.provider) {
            properties_1.defineReadOnly(this, 'addressPromise', this.provider.resolveName(addressOrName).then(function (address) {
                if (address == null) {
                    throw new Error('name not found');
                }
                return address;
            }).catch(function (error) {
                throw error;
            }));
        }
        else {
            try {
                properties_1.defineReadOnly(this, 'addressPromise', Promise.resolve(address_1.getAddress(addressOrName)));
            }
            catch (error) {
                // Without a provider, we cannot use ENS names
                errors.throwError('provider is required to use non-address contract address', errors.INVALID_ARGUMENT, { argument: 'addressOrName', value: addressOrName });
            }
        }
        Object.keys(this.interface.functions).forEach(function (name) {
            var run = runMethod(_this, name, false);
            if (_this[name] == null) {
                properties_1.defineReadOnly(_this, name, run);
            }
            else {
                errors.warn('WARNING: Multiple definitions for ' + name);
            }
            if (_this.functions[name] == null) {
                properties_1.defineReadOnly(_this.functions, name, run);
                properties_1.defineReadOnly(_this.estimate, name, runMethod(_this, name, true));
            }
        });
    }
1199510
function(aUrlParams) {

					var aUrlParamsNormalized = [];

					var fnStartsWith = function(sValue) {
						var apostLocation = sValue.indexOf("'");
						var doubleQuotesLocation = sValue.indexOf("\"");
						if (apostLocation === -1 && doubleQuotesLocation === -1) {
							return null;
						} else {
							if (apostLocation > -1 && doubleQuotesLocation === -1) {
								return "appost";
							}
							if (doubleQuotesLocation > -1 && apostLocation === -1) {
								return "doublequotes";
							}
							if (apostLocation > -1 && doubleQuotesLocation > -1 && apostLocation < doubleQuotesLocation) {
								return "appost";
							}
							if (apostLocation > -1 && doubleQuotesLocation > -1 && doubleQuotesLocation < apostLocation) {
								return "doublequotes";
							}
						}

					};

					var fnAmpersandHandler = function(aParams, aParamsNorm, index, apostType) {
						var stringAmpersand = aParams[index];
						var j = index + 1;
						while (j < aParams.length && aParams[j].indexOf(apostType) === -1) {
							stringAmpersand = stringAmpersand + "&" + aParams[j];
							j++;
						}

						stringAmpersand = stringAmpersand + "&" + aParams[j];

						aParamsNorm.push(stringAmpersand);
						index = j;
						return index;
					};

					for (var i = 0; i < aUrlParams.length; i++) {
						// there is no ' and no " in param values
						if (!fnStartsWith(aUrlParams[i])) {
							aUrlParamsNormalized.push(aUrlParams[i]);
						}
						// there is ' in param value
						if (fnStartsWith(aUrlParams[i]) === "appost") {
							var firstLocation = aUrlParams[i].indexOf("'");
							if (aUrlParams[i].indexOf("'", firstLocation + 1) === -1) {
								i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "'");
							} else {
								aUrlParamsNormalized.push(aUrlParams[i]);
							}
						}
						// there is " in param value
						if (fnStartsWith(aUrlParams[i]) === "doublequotes") {
							var firstQuotesLocation = aUrlParams[i].indexOf("\"");
							if (aUrlParams[i].indexOf("\"", firstQuotesLocation + 1) === -1) {
								i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "\"");
							} else {
								aUrlParamsNormalized.push(aUrlParams[i]);
							}
						}
					}

					return aUrlParamsNormalized;
				}
1260619
function process(payload) {
  var addressType = parseInt(payload.substr(0,1),16);
  var typeCode = payload.substr(1,1);
  var length = parseInt(payload.substr(2,2),16) % 64;
  var rxAdd = "public";
  var txAdd = "public";
  if(addressType & 0x8) {
    rxAdd = "random";
  }
  if(addressType & 0x4) {
    txAdd = "random";
  }   
  var type;
  switch(typeCode) {
    case("0"):
      type = TYPE0_NAME;
      break;
    case("1"):
      type = TYPE1_NAME;
      break;
    case("2"):
      type = TYPE2_NAME;
      break;
    case("3"):
      type = TYPE3_NAME;
      break;
    case("4"):
      type = TYPE4_NAME;
      break;
    case("5"):
      type = TYPE5_NAME;
      break;
    case("6"):
      type = TYPE6_NAME;
      break;
    default: 
      type = TYPE_UNDEFINED_NAME;
  }
  return { type: type,
           length: length,
           txAdd: txAdd,
           rxAdd: rxAdd
  };
}
746885
function Form(domElement) {
		this.addresses = [];
		this.dom = domElement;

		this.activeAddressesNotAccepted = function () {
			var addrs = [];
			for (var i = 0; i < this.addresses.length; i++) {
				var addr = this.addresses[i];
				if (addr.status() != "accepted" && addr.active)
					addrs.push(addr);
			}
			return addrs;
		};

		this.allActiveAddressesAccepted = function () {
			return this.activeAddressesNotAccepted().length == 0;
		};
	}
803910
private static String formatAddress6(int[] hexRepresentation){
       if(hexRepresentation == null){
           throw new NullPointerException();
       }
       if(hexRepresentation.length != IPV6_LEN){
           throw new IllegalArgumentException();
       }
       StringBuilder stringBuilder = new StringBuilder();
       boolean inCompressedSection = false;
       for(int i = 0;i<hexRepresentation.length;i++){
           if(hexRepresentation[i] == -1){
               if(!inCompressedSection){
                   inCompressedSection = true;
                   if(i == 0){
                       stringBuilder.append("::");
                   } else {
                       stringBuilder.append(':');
                   }
               }
           } else {
               inCompressedSection = false;
               stringBuilder.append(Integer.toHexString(hexRepresentation[i]));
               if(i+1<hexRepresentation.length){
                   stringBuilder.append(":");
               }
           }
       }
       return stringBuilder.toString();
    }
538198
private static void checkAddress(String address, AddressFamily addrFamily) {
        if (addrFamily == null) {
            throw new NullPointerException("addrFamily");
        }

        switch (addrFamily) {
            case AF_UNSPEC:
                if (address != null) {
                    throw new HAProxyProtocolException("unable to validate an AF_UNSPEC address: " + address);
                }
                return;
            case AF_UNIX:
                return;
        }

        if (address == null) {
            throw new NullPointerException("address");
        }

        switch (addrFamily) {
            case AF_IPv4:
                if (!NetUtil.isValidIpV4Address(address)) {
                    throw new HAProxyProtocolException("invalid IPv4 address: " + address);
                }
                break;
            case AF_IPv6:
                if (!NetUtil.isValidIpV6Address(address)) {
                    throw new HAProxyProtocolException("invalid IPv6 address: " + address);
                }
                break;
            default:
                throw new Error();
        }
    }
752006
private AddressComponent copy(final AddressComponent in) {
        final AddressComponent out = new AddressComponent();
        out.longName = in.longName;
        out.shortName = in.shortName;
        out.types = Arrays.copyOf(in.types, in.types.length);
        return out;
    }
992712
function (scope, iAttrs, newValue) {
    'use strict';
    var ngModelArr = iAttrs.ngModel.split('.');
    // console.log(JSON.stringify(ngModelArr, null, 2));


    switch (ngModelArr.length) {
    case 1:
        scope.$apply(function () {scope[ngModelArr[0]] = newValue;});
        break;
    case 2:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]] = newValue;});
        break;
    case 3:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]] = newValue;});
        break;
    case 4:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]] = newValue;});
        break;
    case 5:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]][ngModelArr[4]] = newValue;});
        break;
    default:
        scope.$apply(function () {scope[iAttrs.ngModel] = newValue;});
    }

}
1197151
function getSingleCallSignature(type) {
            if (type.flags & 2588672 /* ObjectType */) {
                var resolved = resolveStructuredTypeMembers(type);
                if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&
                    resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
                    return resolved.callSignatures[0];
                }
            }
            return undefined;
        }
13160
function(name, property, value, types) {
  if (!(types instanceof Array)) {
    types = [types];
  }
  if (types.indexOf(typeof value) === -1) {
    debug('%s \'%s\' expected %j got: %j', name, property, types, value);
    throw new Error(name + ' \'' + property + '\' expected one of type(s): \'' +
                    types.join(',') + '\' got type: \'' + typeof value + '\'');
  }
}
1301531
function sendSharedAddressToPeer(device_address, shared_address, handle){
	var arrDefinition;
	var assocSignersByPath={};
	async.series([
		function(cb){
			db.query("SELECT definition FROM shared_addresses WHERE shared_address=?", [shared_address], function(rows){
				if (!rows[0])
					return cb("Definition not found for " + shared_address);
				arrDefinition = JSON.parse(rows[0].definition);
				return cb(null);
			});
		},
		function(cb){
			db.query("SELECT signing_path,address,member_signing_path,device_address FROM shared_address_signing_paths WHERE shared_address=?", [shared_address], function(rows){
				if (rows.length<2)
					return cb("Less than 2 signing paths found for " + shared_address);
				rows.forEach(function(row){
					assocSignersByPath[row.signing_path] = {address: row.address, member_signing_path: row.member_signing_path, device_address: row.device_address};
				});
				return cb(null);
			});
		}
	],
	function(err){
		if (err)
			return handle(err);
		sendNewSharedAddress(device_address, shared_address, arrDefinition, assocSignersByPath);
		return handle(null);
	});
}
1094617
int getType(InternetAddress address) {
        int type = NOT_FOUND;
        debug("Looking for: %s", address);
        debug("\tstarting at: %d", idx);
        int firstFoundIdx = findFirst(address);
        debug("\tfirstFoundIdx: %d", firstFoundIdx);
        if (firstFoundIdx != Integer.MAX_VALUE) {
            debug("\tfirstFoundIdx-substring: %s", recipients.substring(firstFoundIdx));
            type = getType(firstFoundIdx);
            debug("\t=> found type: %d", type);
            idx = firstFoundIdx + lengthOfTypePrefix(type) + address.toString().length()
                    + adaptLengthForOptionalPersonal(address) + 1;
        } else {
            debug("\t=> type not found");
        }
        return type;
    }
328849
public static Address parse(String addressStr) {
        Address address = root();

        if (addressStr == null) {
            return address;
        }

        addressStr = addressStr.trim();
        if (addressStr.isEmpty()) {
            return address;
        }

        String[] resources = addressStr.split("/");
        for (String resource : resources) {
            resource = resource.trim();
            if (resource.isEmpty()) {
                continue; // skip empty string - its usually due to first char in address being "/"
            }
            String[] typeAndName = resource.split("=");
            String type = typeAndName[0].trim();
            String name = (typeAndName.length == 2) ? typeAndName[1].trim() : "";
            address.add(type, name);
        }

        return address;
    }
1316307
private void setAddress(Address address, RolodexContract rolodex) {
        if (rolodex != null) {
            address.setStreet1(rolodex.getAddressLine1());
            address.setStreet2(rolodex.getAddressLine2());
            address.setCity(checkNull(rolodex.getCity()));
            address.setCounty(rolodex.getCounty());
            address.setState(rolodex.getState());
            address.setZipCode(rolodex.getPostalCode());
            if (rolodex.getCountryCode() != null) {
                CountryCodeType.Enum country = CountryCodeType.Enum.forString(rolodex.getCountryCode());
                address.setCountry(country);
            }
        }else {
            address.setStreet1("");
            address.setCity("");
        }
    }
279512
private static void insertAddressUsingCallable(AddressClient client, String newAddressName)
      throws InterruptedException, ExecutionException {
    // Begin samplegen code for insertAddress().
    ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION);
    Address address = Address.newBuilder().build();
    InsertAddressHttpRequest request =
        InsertAddressHttpRequest.newBuilder()
            .setRegion(region.toString())
            .setAddressResource(address)
            .build();
    ApiFuture<Operation> future = client.insertAddressCallable().futureCall(request);
    // Do something
    Operation response = future.get();

    // End samplegen code for insertAddress().
    System.out.format("Result of insert: %s\n", response.toString());
  }
1094634
function arrset(arr, type) {
      if (arr == null) return null;
      if (typeof arr == 'string') {
        var f = umecob[type](arr);
        if (!f || typeof f != 'function') return null;
        return [f];
      }
      if (arr instanceof Array) {
        var l = arr.length;
        if (l == 0) return [];
        var ret = [];
        for (var i=0; i < l; i++) {
          var f = umecob[type]( arr[i] );
          if (f && typeof f == 'function') ret.push(f);
        }
        return ret;
      }
      return null;
    }
1299928
@VisibleForTesting
  static String makeTargetStringForDirectAddress(SocketAddress address) {
    try {
      return new URI(DIRECT_ADDRESS_SCHEME, "", "/" + address, null).toString();
    } catch (URISyntaxException e) {
      // It should not happen.
      throw new RuntimeException(e);
    }
  }