Bugfix. Add javascript implementation

Hi Rasky :)

I've just ported to Javascript your python implementation of GCS.
If you want to give me a feedback or just accept the pull request it would be nice!