lib/x10.js
function HouseCode(houseCode) {
	this.raw = null;

	switch (typeof houseCode) {
	case "string":
		if (houseCode !== "" && houseCode.length === 1) {
			var index = houseCode.charCodeAt(0) - 65;
			if ((index >= 0) && (index <= (deviceCodes.length - 1))) {
				this.raw = deviceCodes[index];
			} else {
				throw new Error("House code string out of range.");
			}
		} else {
			throw new Error("Invalid house code.");
		}
		break;
	default:
		if (deviceCodes.indexOf(houseCode) !== -1) {
			this.raw = houseCode;
		} else {
			throw new Error("House code number out of range.");
		}
		break;
	}
	return this.raw;
}
function HouseCode(houseCode) {
	this.raw = null;

	switch (typeof houseCode) {
	case "string":
		if (houseCode !== "" && houseCode.length === 1) {
			var index = houseCode.charCodeAt(0) - 65;
			if ((index >= 0) && (index <= (deviceCodes.length - 1))) {
				this.raw = deviceCodes[index];
			} else {
				throw new Error("House code string out of range.");
			}
		} else {
			throw new Error("Invalid house code.");
		}
		break;
	default:
		if (deviceCodes.indexOf(houseCode) !== -1) {
			this.raw = houseCode;
		} else {
			throw new Error("House code number out of range.");
		}
		break;
	}
	return this.raw;
}
function HouseCode ( houseCode ) { this . raw = null ; switch ( typeof houseCode ) { case "string" : if ( houseCode !== "" && houseCode . length === 1 ) { var index = houseCode . charCodeAt ( 0 ) - 65 ; if ( ( index >= 0 ) && ( index <= ( deviceCodes . length - 1 ) ) ) { this . raw = deviceCodes [ index ] ; } else { throw new Error ( "House code string out of range." ) ; } } else { throw new Error ( "Invalid house code." ) ; } break ; default : if ( deviceCodes . indexOf ( houseCode ) !== - 1 ) { this . raw = houseCode ; } else { throw new Error ( "House code number out of range." ) ; } break ; } return this . raw ; }
object to convert X-10 house codes from numbers to strings and back
object to convert X - 10 house codes from numbers to strings and back