import { isObject } from "./type-checks/src/is-object.mjs";
import { isString } from "./type-checks/src/is-string.mjs";
import "./type-checks/src/index.mjs";

//#region ../../node_modules/.pnpm/@stryke+convert@0.6.38/node_modules/@stryke/convert/dist/parse-type-definition.mjs
/**
* Parse a type definition parameter into a {@link TypeDefinition} object
*
* @param param - The parameter to parse
* @returns The parsed type definition
*/
const parseTypeDefinition = (param) => {
	if (isString(param)) {
		if (param.includes(":")) {
			const params = param.split(":");
			if (params.length > 1 && params[0]) return {
				file: params[0],
				name: params[1]
			};
		}
		if (param.includes("#")) {
			const params = param.split("#");
			if (params.length > 1 && params[0]) return {
				file: params[0],
				name: params[1]
			};
		}
		return { file: param };
	}
	if (isObject(param)) return {
		file: param.file,
		name: param.name
	};
};

//#endregion
export { parseTypeDefinition };
//# sourceMappingURL=parse-type-definition.mjs.map