asaskevich/govalidator — pull request #17 by attilaolah (2014-11-25 18:16:12+00:00)
Title: Fix Escape

There was a problem with Escape, which was causing test failures sometimes.

It relied on the order of items when `range`ing through a map, which is undefined. Thus, the order in which strings were replaced was undefined. In cases where `&` was not escaped first, it caused test failures because it replaced the `&` in entities like `<`, turning them to `&<`, etc.

This also gets rid of the map to avoid extra allocations, which makes the entire function faster, and avoids keeping track of the original variable since it is not needed.

Closes #9.