function objectMaker(schema, src) {
return Object.keys(schema).reduce((acc, el) => {
if (src.hasOwnProperty(el)) {
acc[el] = src[el]
}
return acc;
}, {})
}
const mySchema = {
author: 'string',
description: 'string',
}
const source = {
author: 'Vasya',
garbage: 'dfsfsdf',
}
const authorOne = objectMaker(mySchema, source);