question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is isCorrect a replacement for isValid?

See original GitHub issue

While updating to ip-address v7 I noticed that isValid is gone.

Is isCorrect a replacement for that?

const address = new Address4(unknownAddress)
address.isCorrect()

You suggest using a try / catch but my problem is that my linter complains both when I do this:

try {
      new Address4(address)
} catch {
      return 'Invalid address'
}

Do not use 'new' for side effects.

and this:

try {
      const ipv4Address = new Address4(address)
} catch {
      return 'Invalid address'
}
'ipv4Address' is declared but its value is never read. ts(6133)
'ipv4Address' is assigned a value but never used. eslint@typescript-eslint/no-unused-vars

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
beaugundersoncommented, Oct 26, 2020

@lekoaf @nrone @jcheng5 I added a static isValid method in the just-released 7.1.0; you can use it like this:

if (Address6.isValid('::')) {
  console.log('valid!');
} else {
  console.log('invalid!');
}
0reactions
jcheng5commented, Oct 26, 2020

Same here, isValid is mostly what I was using this library for.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Check if date is a valid one - Stack Overflow
Was able to find the solution. Since the date I am getting is in ISO format, only providing date to moment will validate...
Read more >
[v2] isValid=true on mount, even though initialValues ... - GitHub
Bug report Current Behavior isValid is true once the form mounts, even though ... during mount, so that isValid's initial value is correct....
Read more >
Differences in @Valid and @Validated Annotations in Spring
In this quick tutorial, we'll focus on the differences between the @Valid and @Validated annotations in Spring.
Read more >
IsValid? Is failing even though setup is correct?
So my issue is I recently had to change some meshes on my main character and delete the old Animation blueprint and make...
Read more >
How to verify that strings are in valid email format
Using a regular expression to validate an email is useful to ensure that the structure of an email is correct. However, it isn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found