How to use is-valid-domain - 3 common examples

To help you get started, we’ve selected a few is-valid-domain 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 AdChain / AdChainRegistryDapp / src / components / mobile_nav / MobileApplication.js View on Github external
async onFormSubmit(event) {
        event.preventDefault()
        
        const { domain, reason } = this.state
        const minDeposit = (this.state.minDeposit | 0) // coerce

        if (domain.startsWith('www.') || domain.startsWith('http') || domain.startsWith('ww.')) {
            toastr.error('Please enter a domain with the following format: domain.com')
            return
        }

        if (!isValidDomain(domain)) {
            toastr.error('Please enter a valid domain')
            return false
        }

        try {
            const adtBalance = await token.getBalance()
            if (adtBalance < minDeposit) {
                toastr.error('You do not have enough ADT to apply this domain')
                return
            }

            const appExists = await registry.applicationExists(domain)
            if (appExists) {
                toastr.error('This domain cannot be applied because it already exists within the registry')
                return
            }
github AdChain / AdChainRegistryDapp / src / components / sidebar / SideBarApplicationContainer.js View on Github external
async onFormSubmit (event) {
    event.preventDefault()

    let {domain} = this.state
    const minDeposit = (this.state.minDeposit | 0) // coerce

    if (domain.startsWith('www.') || domain.startsWith('http') || domain.startsWith('ww.')) {
      toastr.error('Please enter a domain with the following format: domain.com')
      return
    }

    if (!isValidDomain(domain)) {
      toastr.error('Please enter a valid domain')
      return false
    }

    try {
      const adtBalance = await token.getBalance()
      if (adtBalance < minDeposit) {
        toastr.error('You do not have enough ADT to apply this domain')
        return
      }

      const appExists = await registry.applicationExists(domain)
      if (appExists) {
        toastr.error('This domain cannot be applied because it already exists within the registry')
        return
      }
github AdChain / AdChainRegistryDapp / src / components / PublisherApplicationForm.js View on Github external
async onFormSubmit (event) {
    event.preventDefault()

    const {target} = event

    const domain = target.domain.value
    const siteName = target.siteName.value
    const country = target.country.value
    const firstName = target.firstName.value
    const lastName = target.lastName.value
    const email = target.email.value
    const stake = parseInt(target.stake.value.replace(/[^\d]/, ''), 10)
    const minDeposit = (this.state.minDeposit | 0) // coerce

    if (!isValidDomain(domain)) {
      toastr.error('Invalid domain')
      return false
    }

    if (email && !isValidEmail(email)) {
      toastr.error('Invalid email')
      return false
    }

    if (!(stake && stake >= minDeposit)) {
      toastr.error('Deposit must be equal or greater than the minimum required')
      return false
    }

    if (this._isMounted) {
      this.setState({

is-valid-domain

Validate domain name

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular is-valid-domain functions