Global variable "url" mystery

I’ve come across a pretty useful little object in my global space:

url

Its methods are:

> url
{ parse: [Function: urlParse],
  resolve: [Function: urlResolve],
  resolveObject: [Function: urlResolveObject],
  format: [Function: urlFormat],
  Url: [Function: Url] }

Unfortunately, I have no idea where it’s coming from, and it’s only available inside my local meteor shell. It’s nowhere to be found in production ([ReferenceError: url is not defined]) and I’ve been relying on it.

Any idea which package this is coming from? http? the url package provides URL, not url

It comes from the npm url package: https://www.npmjs.com/package/url, which is used in a number of Meteor core packages, although I haven’t found one which exports the url global.

There is a package on atmosphere which wraps the npm url package for the server:

meteor add mrt:url

However, it uses url at version 0.10.1, whereas the current release is 0.11.0.

1 Like

Thanks Rob. I ended up using arunoda’s Npm require package, and just using querystring.

1 Like