Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
Signed-off-by: Momozor <[email protected]>
  • Loading branch information
Momozor committed May 25, 2021
1 parent b347e18 commit 1cf24d5
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Src/Controllers/Text.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const { reverseString, textToBinary, sarcasticConverter, textToMorse } =
require('../Utilities/functions')
const {
reverseString,
textToBinary,
sarcasticConverter,
textToMorse
} = require('../Utilities/functions')

exports.shuffle = async (req, res, next) => {
try {
Expand All @@ -14,7 +18,12 @@ exports.shuffle = async (req, res, next) => {
return next()
}

const shuffledWord = text.split(/\s\b(?!\s)/).sort(function () { return 0.5 - Math.random() }).join(' ')
const shuffledWord =
text
.split(/\s\b(?!\s)/)
.sort(function () {
return 0.5 - Math.random()
}).join(' ')

res.status(200).json({
'shuffled Word': shuffledWord
Expand All @@ -23,7 +32,7 @@ exports.shuffle = async (req, res, next) => {
res.status(500).json({
error: error
})
}
}
}

exports.reverse = async (req, res, next) => {
Expand All @@ -48,7 +57,7 @@ exports.reverse = async (req, res, next) => {
res.status(500).json({
error: error
})
}
}
}

exports.binary = async (req, res, next) => {
Expand Down Expand Up @@ -124,4 +133,4 @@ exports.morse = async (req, res, next) => {
error: error
})
}
}
}

0 comments on commit 1cf24d5

Please sign in to comment.