Skip to content

Commit

Permalink
Fix code smells and potential precision loss
Browse files Browse the repository at this point in the history
  • Loading branch information
bkimminich committed Dec 25, 2020
1 parent 3bcd023 commit 2a6b6bb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,5 @@ module.exports = {
'app/private/**',
'vagrant/**',
'frontend/**'
],
rules: {
'no-loss-of-precision': 'off',
'array-callback-return': 'off'
}
]
}
2 changes: 1 addition & 1 deletion models/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = (sequelize, { STRING, INTEGER }) => {
validate: {
isInt: true,
min: 1000000000000000,
max: 9999999999999999
max: 9999999999999998
}
},
expMonth: {
Expand Down
6 changes: 3 additions & 3 deletions routes/dataExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function dataExport () {
}

const memories = await models.Memory.findAll({ where: { UserId: req.body.UserId } })
memories.map(memory => {
memories.forEach(memory => {
userData.memories.push({
imageUrl: req.protocol + ':https://' + req.get('host') + '/' + memory.imagePath,
caption: memory.caption
Expand All @@ -34,7 +34,7 @@ module.exports = function dataExport () {

db.orders.find({ email: updatedEmail }).then(orders => {
if (orders.length > 0) {
orders.map(order => {
orders.forEach(order => {
userData.orders.push({
orderId: order.orderId,
totalPrice: order.totalPrice,
Expand All @@ -47,7 +47,7 @@ module.exports = function dataExport () {

db.reviews.find({ author: email }).then(reviews => {
if (reviews.length > 0) {
reviews.map(review => {
reviews.forEach(review => {
userData.reviews.push({
message: review.message,
author: review.author,
Expand Down
2 changes: 1 addition & 1 deletion routes/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const models = require('../models/index')
module.exports.getPaymentMethods = function getPaymentMethods () {
return async (req, res, next) => {
const cards = await models.Card.findAll({ where: { UserId: req.body.UserId } })
cards.map(card => {
cards.forEach(card => {
const cardNumber = String(card.cardNum)
card.cardNum = '*'.repeat(12) + cardNumber.substring(cardNumber.length - 4)
})
Expand Down
2 changes: 1 addition & 1 deletion routes/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function dlpPastebinDataLeakChallenge () {
function dangerousIngredients () {
const ingredients = []
const dangerousProduct = config.get('products').filter(product => product.keywordsForPastebinDataLeakChallenge)[0]
dangerousProduct.keywordsForPastebinDataLeakChallenge.map((keyword) => {
dangerousProduct.keywordsForPastebinDataLeakChallenge.forEach((keyword) => {
ingredients.push({ [Op.like]: `%${keyword}%` })
})
return ingredients
Expand Down

0 comments on commit 2a6b6bb

Please sign in to comment.