MCPcopy Create free account
hub / github.com/developit/microbundle / parseMappingArgument

Function parseMappingArgument

src/lib/option-normalization.js:29–46  ·  view source on GitHub ↗
(globalStrings, processValue)

Source from the content-addressed store, hash-verified

27 * Parses values of the form "$=jQuery,React=react" into key-value object pairs.
28 */
29export 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.

Callers 1

createConfigFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…