LoggerSerializers.mjs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // TODO: This file was created by bulk-decaffeinate.
  2. // Sanity-check the conversion and remove this comment.
  3. /*
  4. * decaffeinate suggestions:
  5. * DS102: Remove unnecessary code created because of implicit returns
  6. * DS207: Consider shorter variations of null checks
  7. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  8. */
  9. export default {
  10. user(user) {
  11. if (user == null) {
  12. return null
  13. }
  14. if (user._id == null) {
  15. user = { _id: user }
  16. }
  17. return {
  18. id: user._id,
  19. email: user.email,
  20. first_name: user.name,
  21. last_name: user.name,
  22. }
  23. },
  24. project(project) {
  25. if (project == null) {
  26. return null
  27. }
  28. if (project._id == null) {
  29. project = { _id: project }
  30. }
  31. return {
  32. id: project._id,
  33. name: project.name,
  34. }
  35. },
  36. docs(docs) {
  37. if ((docs != null ? docs.map : undefined) == null) {
  38. return
  39. }
  40. return docs.map(doc => ({
  41. path: doc.path,
  42. id: doc.doc,
  43. }))
  44. },
  45. files(files) {
  46. if ((files != null ? files.map : undefined) == null) {
  47. return
  48. }
  49. return files.map(file => ({
  50. path: file.path,
  51. id: file.file,
  52. }))
  53. },
  54. }