@yume-chan/scrcpy
Version:
TypeScript implementation of Scrcpy client.
22 lines • 724 B
JavaScript
export function isScrcpyOptionValue(value) {
return (typeof value === "object" &&
value !== null &&
"toOptionValue" in value &&
typeof value.toOptionValue === "function");
}
export function toScrcpyOptionValue(value, empty) {
if (isScrcpyOptionValue(value)) {
value = value.toOptionValue();
}
// `value` may become `undefined` after `toOptionValue`
if (value === undefined) {
return empty;
}
if (typeof value !== "string" &&
typeof value !== "number" &&
typeof value !== "boolean") {
throw new TypeError(`Invalid option value: ${JSON.stringify(value)}`);
}
return value.toString();
}
//# sourceMappingURL=option-value.js.map