(globalStrings, processValue)
| 27 | * Parses values of the form "$=jQuery,React=react" into key-value object pairs. |
| 28 | */ |
| 29 | export function parseMappingArgument(globalStrings, processValue) { |
| 30 | const globals = {}; |
| 31 | globalStrings.split(',').forEach(globalString => { |
| 32 | let [key, value] = globalString.split('='); |
| 33 | if (processValue) { |
| 34 | const r = processValue(value, key); |
| 35 | if (r !== undefined) { |
| 36 | if (Array.isArray(r)) { |
| 37 | [value, key] = r; |
| 38 | } else { |
| 39 | value = r; |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | globals[key] = value; |
| 44 | }); |
| 45 | return globals; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Parses values of the form "$=jQuery,React=react" into key-value object pairs. |
no outgoing calls
no test coverage detected
searching dependent graphs…