T3060
Per feedback from D13916, adding consume method to new file script.js with unit tests.
Going forward, we may want to abstract this to a library. However there isn't a logical place to put it at the moment, and alias-server will the be first production user. Makes sense to keep it here and reserve the option to abstract to a libary later when additional use cases are known.