I see that in looseEqual function you are using JSON.stringify, but JSON.stringify has no quarantines on key order when serializing. See here:
Properties of non-array objects are not guaranteed to be stringified in any particular order. Do not rely on ordering of properties within the same object within the stringification.