@yume-chan/scrcpy
Version:
TypeScript implementation of Scrcpy client.
22 lines • 831 B
JavaScript
import { toScrcpyOptionValue } from "../../base/option-value.js";
function toSnakeCase(input) {
return input.replace(/([A-Z])/g, "_$1").toLowerCase();
}
// 1.21 changed the format of arguments
export function serialize(options, defaults) {
const result = [];
for (const [key, value] of Object.entries(options)) {
const serializedValue = toScrcpyOptionValue(value, undefined);
// v3.0 `new_display` option needs to send empty strings to server
if (serializedValue === undefined) {
continue;
}
const defaultValue = toScrcpyOptionValue(defaults[key], undefined);
if (serializedValue === defaultValue) {
continue;
}
result.push(`${toSnakeCase(key)}=${serializedValue}`);
}
return result;
}
//# sourceMappingURL=serialize.js.map