JS Solution (pull request)

Pretty simple JS solution.