1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-28 05:12:18 +01:00
metamask-extension/ui/app/components/send_/send-content/send-to-row/send-to-row.utils.js

22 lines
410 B
JavaScript
Raw Normal View History

const {
REQUIRED_ERROR,
INVALID_RECIPIENT_ADDRESS_ERROR,
} = require('../../send.constants')
2018-04-07 00:29:51 +02:00
const { isValidAddress } = require('../../../../util')
function getToErrorObject (to) {
let toError = null
if (!to) {
toError = REQUIRED_ERROR
2018-04-07 00:29:51 +02:00
} else if (!isValidAddress(to)) {
toError = INVALID_RECIPIENT_ADDRESS_ERROR
2018-04-07 00:29:51 +02:00
}
2018-04-07 00:29:51 +02:00
return { to: toError }
}
module.exports = {
getToErrorObject,
2018-04-07 00:29:51 +02:00
}