3 ms·
Common example I’ve seen is checking if an IP is in a range. Most (JS) libs I’ve seen do something like regex or, more commonly, split on periods and then have
by Dachande663 4y ago
Common example I’ve seen is checking if an IP is in a range. Most (JS) libs I’ve seen do something like regex or, more commonly, split on periods and then have a set of nested ifs. Versus if you have a proper IP type, you check if its long value is between ranges. (Not saying you can’t do this, but because so many times an IP is stored as its string representation, that seems to be the default.