mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
1be43911b4
Set Prettier's "trailingComma" setting to "es5" GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
57 lines
1.2 KiB
JavaScript
57 lines
1.2 KiB
JavaScript
// TODO: This file was created by bulk-decaffeinate.
|
|
// Sanity-check the conversion and remove this comment.
|
|
/*
|
|
* decaffeinate suggestions:
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
* DS207: Consider shorter variations of null checks
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
*/
|
|
module.exports = {
|
|
user(user) {
|
|
if (user == null) {
|
|
return null
|
|
}
|
|
if (user._id == null) {
|
|
user = { _id: user }
|
|
}
|
|
return {
|
|
id: user._id,
|
|
email: user.email,
|
|
first_name: user.name,
|
|
last_name: user.name,
|
|
}
|
|
},
|
|
|
|
project(project) {
|
|
if (project == null) {
|
|
return null
|
|
}
|
|
if (project._id == null) {
|
|
project = { _id: project }
|
|
}
|
|
return {
|
|
id: project._id,
|
|
name: project.name,
|
|
}
|
|
},
|
|
|
|
docs(docs) {
|
|
if ((docs != null ? docs.map : undefined) == null) {
|
|
return
|
|
}
|
|
return docs.map(doc => ({
|
|
path: doc.path,
|
|
id: doc.doc,
|
|
}))
|
|
},
|
|
|
|
files(files) {
|
|
if ((files != null ? files.map : undefined) == null) {
|
|
return
|
|
}
|
|
return files.map(file => ({
|
|
path: file.path,
|
|
id: file.file,
|
|
}))
|
|
},
|
|
}
|