[alias-server] add consume function in new script parsing file
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.
Test Plan: npm test
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D13960