Refactor `contains` and `is-num` functions

…for the sake of clarity and LibSass compatibility.