Pass the urls you care about to your javascript:
return {
'urls': js_urls(
'foo', # 'foo' => r'^(?P<slug>[a-z0-9-]+)/'
'bar', # 'bar' => r'^bar/(?P<id>[0-9-]+)/'
),
}
Then in your javascript you can get the url by it's name:
import {reverse} from '.urls';
let url = reverse('foo', {'slug': 'buzz'}); // => /buzz/
let url2 = reverse('bar', {'id': 1}); // => /bar/1/