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