function setTMXValue(name, type, value) {
	let match;

	if (typeof value !== "string") {
		// Value is already normalized (e.g. with JSON maps)
		return value;
	}

	switch (type) {
		case "int":
		case "float":
			value = Number(value);
			break;

		case "bool":
			value = value === "true";
			break;

		default:
			// try to parse it anyway
			if (!value || isBoolean(value)) {
				// if value not defined or boolean
				value = value ? value === "true" : true;
			} else if (isNumeric(value)) {
				// check if numeric
				value = Number(value);
			} else if (value.search(/^json:/i) === 0) {
				// try to parse it
				match = value.split(/^json:/i)[1];
				try {
					value = JSON.parse(match);
				} catch {
					throw new Error("Unable to parse JSON: " + match);
				}
			} else if (value.search(/^eval:/i) === 0) {
				// try to evaluate it
				match = value.split(/^eval:/i)[1];
				try {
					// eslint-disable-next-line
					value = Function("'use strict';return (" + match + ")")();
				} catch {
					throw new Error("Unable to evaluate: " + match);
				}
			} else if (
				(match = value.match(/^#([\da-fA-F])([\da-fA-F]{3})$/)) ||
				(match = value.match(/^#([\da-fA-F]{2})([\da-fA-F]{6})$/))
			) {
				value = "#" + match[2] + match[1];
			}

			// normalize values
			if (name.search(/^(ratio|anchorPoint)$/) === 0) {
				// convert number to vector
				if (typeof value === "number") {
					value = {
						x: value,
						y: value,
					};
				}
			}
	}
	// return the interpreted value
	return value;
}
set and interpret a TMX property value
@ignore