How to use the npm-user-validate.email function in npm-user-validate

To help you get started, we’ve selected a few npm-user-validate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bcoe / nodemailer-mock-transport / index.js View on Github external
function validate (addr) {
  try {
    var err = userValidate.email(addr)
    if (err != null) return err
  } catch (_err) {
    return new Error('Error validating address.')
  }
  return null
}
github npm / npm-profile / cmds / util / read.js View on Github external
function readEmail (email, opts) {
  if (email) {
    const error = userValidate.email(email)
    if (error) {
      opts.log && opts.log.warn(error.message)
    } else {
      return email.trim()
    }
  }

  return read({prompt: 'Email (this IS public): ', default: email || ''})
    .then(username => readEmail(username, opts))
}
github graalvm / graaljs / graal-nodejs / deps / npm / lib / utils / read-user-info.js View on Github external
function readEmail (msg, email, opts, isRetry) {
  if (!msg) msg = 'email (this IS public): '
  if (isRetry && email) {
    const error = userValidate.email(email)
    if (error) {
      opts.log && opts.log.warn(error.message)
    } else {
      return email.trim()
    }
  }

  return read({prompt: msg, default: email || ''})
    .then((username) => readEmail(msg, username, opts, true))
}

npm-user-validate

User validations for npm

BSD-2-Clause
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis