Skip to content

Commit

Permalink
improve example
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Jul 25, 2024
1 parent ba4851b commit 311f659
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ Returns a generator for individual IPs contained in the networks.
Be aware that passing large networks that contain millions of IPs can result in memory exhaustion and slow execution time. It's recommended to validate the amount of IPs first, for example, like this:

```js
const {start, end} = parseCidr(net);
import {parseCidr} from "cidr-tools";

const {start, end} = parseCidr("1.2.3.4/2");
if (end - start >= 1000000n) {
throw new Error("Too many IPs");
}
Expand Down

0 comments on commit 311f659

Please sign in to comment.