Module talk:IPAddress: Difference between revisions

Content deleted Content added
Reuse Module:IP: use isIpOrRange
Line 89:
::::::::::I already cleaned the module and there are now no globals (in the sandbox). Some searching showed it is likely the globals are unused but we'll find out when the sandbox eventually goes live. I've been caught up off-wiki and haven't fully thought about the issue but new functions might be best. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 03:03, 1 April 2021 (UTC)
{{Outdent}} {{u|Johnuniq}}: We have two pending issues. One is whether we want a separate set of functions or not. My ''guess'' is that current usages will probably be ok with the change, but I can separate the functionality if we want to be extra safe. The other is the question of strict/lax parsing. [[Module:IPAddress]] is quite strict while [[Module:IP]] accepts many addresses that are invalid (even if they can be parsed with some assumptions). I thought about proposing a bit of stricter parsing at [[Module:IP]], like not accepting two zero compressions (::) in the same address. But I fear that following that road means it will never be done. [[User:MarioGom|MarioGom]] ([[User talk:MarioGom|talk]]) 17:18, 31 May 2021 (UTC)
:It's two months since my last comment and that's too long for me to remember what this is all about. I edited [[Module:IPAddress]] to include my changes in [[Module:IPAddress/sandbox]] relating to style and to remove global functions. That will make a comparison easier.
{{#invoke:convert/tester|compare|IPAddress}}
:<code>isIpOrRange</code> could be used to determine if given text (with the perhaps too lenient checking of [[Module:IP]]) is a valid IP or range. Then, if it contains <code>/</code> it's a range, and if it contains <code>:</code> it's IPv6. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 05:09, 1 June 2021 (UTC)