Skip to content

Make library able to be used on both browser and CLI environments

Currently this module only attaches itself to window, which works for browser windows, but not for NodeJS or similar CLI environments. If the library ended with:

if (typeof window !== 'undefined') {
  window.LibMoonCat = Fn;
} else if (typeof module != 'undefined') {
  module.exports = Fn;
}

That would allow the library to be polymorphic for both browser and CLI environment