After creating this Gist I decided that I had either:
- Re-implemented something that already existed, which would not be so helpful, but I did look around a lot before doing so.
- Invented something really cool ( hoping, but not that likely as this seems like an obvious and easy piece of code to write ).
So I posted on StackOverflow to try and find out. It turns out that this approach is not really unique and the term I needed was "UMD" (Universal Module Definition). There is a project for collating these in a GitHub repository. I will go about reading the code from that Repository and will see if it is worth me contributing the code I created to that project.
Either way, I learnt a term, created some pretty good code (even if now not useful) and hopefully helped others by posting on StackOverflow, so in some ways that's pretty successful