The javascript version comes from paul miller's reference implementation, it's basically copied over into nostr-tools
Discussion
of course i don't know it because javascript is the most abominable language ever invented, and i curse Griesemer, he only avoids hell by helping build Go