luxon.fromFormat argument text must really be text so if the d variable
is not do not call luxon.fromFormat as then we will get the dreaded
TypeError: input.match is not a function. When the variable is not text
it will not match anyway so return null in that case.
The original method of extracting the IP address from an IP:PORT pair never re-applied the PORT number to the sorting algorithm.
This commit has added the functionality for the port number to be included in the sorting for IPv4 if it existed in the original value by appending it to the final zero-filled IPv4 address string.
This commit also reduces the number of if/else chains to perform the zerofill by using a substr of a zeroed pattern matching the desired size of the field. "000" for IPv4 octets, "0000" for IPv6, and "00000" for port numbers.
When a table contains empty values, sorting by IP addresses using the `ip-address.js` sorting plugin
caused erratic sorting behaviour. The empty lines are not sorted correctly and remain scattered about
the rest of the rows.
This seems to be due to a type issue: The ip-address sorting plugin has a guard-clause if-statement
that checks if the value that is to be sorted is false-y. In that case, the integer `0` is returned.
The function seems to usually normalise ip addresses to a lexicographically sortable format, and
values like `"86b4b93fbbf0418144b55bc45057b720"` and `"173040030054"` are returned.
The resulting comparison between strings and integers seems to cause misplaced empty rows and all-over
weird sorting behaviour.
This commit changes the value returned by the guard-clause to the string value `"000000000000"`, which
is simliar to the normalized IPv4 format already used by the plugin.
IP addresses can easily be hidden in HTML formed cells. For example an
IP that links to the IP via an href.
As such, add the naive and basic, but fast html tag stripper from the
core code.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
@Datatables, you are right, it should be better to use !a, then empty string case is covered as well.
And yes, I'm happy for this to be included under MIT licence.