How to use the phone.required function in phone

To help you get started, we’ve selected a few phone 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 poppinss / indicative / test-old / validator.spec.js View on Github external
}

    const messages = {
      'age.required': 'Age is required',
      'phone.required': function () {
        return 'Phone number is required for validations'
      }
    }

    try {
      const passed = await Validator.validateAll(body, rules, messages)
      assert.notExist(passed)
    } catch (e) {
      assert.isArray(e)
      assert.equal(e[0].message, messages['age.required'])
      assert.equal(e[1].message, messages['phone.required']())
    }
  })

phone

With a given country and phone number, validate and format the phone number to E.164 standard

MIT
Latest version published 24 days ago

Package Health Score

86 / 100
Full package analysis