INNER CODE UNIT · JavaScript
decorate
cyrus-and/chrome-remote-interface · lib/api.js:13
function decorate(to, category, object) {
to.category = category;
Object.keys(object).forEach((field) => {
// skip the 'name' field as it is part of the function prototype
if (field === 'name') {
return;
}
// commands and events have parameters whereas types have properties
if (category === 'type' && field === 'properties' ||
field === 'parameters') {
to[field] = arrayToObject(object[field]);
} else {
to[field] = object[field];
}
});
}
function addCommand(chrome, domainName, command) {