Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new Promise((resolve, reject) => {
const contributors = JSON.parse(content).contributors.map(c => {
const avatar = url.parse(c['avatar_url'], true);
avatar.search = undefined; // Override so that we can use `avatar.query`.
if (avatar.hostname.endsWith('githubusercontent.com')) {
// Use 32px avatars, instead of full-size.
avatar.query['s'] = '32';
}
const avatar_url = url.format(avatar);
return Object.assign({}, c, { avatar_url });
});
resolve(yaml.dump({ contributors }));
})
)
get: function(yaml) {
yaml = yaml || false;
if (validate()) {
return (yaml ? YAML.dump(spec,100,2): JSON.stringify(spec, null, 2));
} else {
console.error('Errors found when validating generated Swagger');
return false;
}
}
};