UNPKG

1.26 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.mapSymbolsToNotifications = void 0;
4function mapSymbolsToNotifications(marbles, messagesArg) {
5 var messages = messagesArg.slice();
6 var result = {};
7 for (var i = 0; i < marbles.length; i++) {
8 var symbol = marbles[i];
9 switch (symbol) {
10 case ' ':
11 case '-':
12 case '^':
13 case '(':
14 case ')':
15 break;
16 case '#':
17 case '|': {
18 messages.shift();
19 break;
20 }
21 default: {
22 if ((symbol.match(/^[0-9]$/) && i === 0) || marbles[i - 1] === ' ') {
23 var buffer = marbles.slice(i);
24 var match = buffer.match(/^([0-9]+(?:\.[0-9]+)?)(ms|s|m) /);
25 if (match) {
26 i += match[0].length - 1;
27 }
28 break;
29 }
30 var message = messages.shift();
31 result[symbol] = message.notification;
32 }
33 }
34 }
35 return result;
36}
37exports.mapSymbolsToNotifications = mapSymbolsToNotifications;
38//# sourceMappingURL=map-symbols-to-notifications.js.map
\No newline at end of file