Repository
https://github.com/Ominousness/utopian-beneficiaries
New Project
This JavaScript library is a response to this coding task: https://steemit.com/utopian-io/@utopian.tasks/js-developers-and-regex-experts-wanted-javascript-coding-task
I've used node.js and ES6. This code should work in recent browsers sans the testing part, which I'm not sure will work (I haven't used jest [the testing suite] on the client-side yet.)
I'm using regular expressions for most of the parsing. Exact expressions with the explanation are available here: https://github.com/Ominousness/utopian-beneficiaries/blob/master/beneficiaries.js#L7
Most of the sanity checks happen in the Javascript part, though.
Unit tests are also included to check for regressions that may happen on accident.
// Import the library.
const beneficiaries = require('./beneficiaries');
// Pass the message as the (only) argument.
beneficiaries('@utopian-bot !utopian @mention1:15% @mention2:35% @mention3:25% @mention4:25%');// Im
Roadmap
The project will serve its purpose once it's used in the bot code.
How to contribute?
Submit a new pull request: https://github.com/Ominousness/utopian-beneficiaries/pulls