MCPcopy Create free account
hub / github.com/RubyLouvre/anu / loadBuiltin

Function loadBuiltin

test/babel.js:118–129  ·  view source on GitHub ↗

* Loads the given name (or [name, options] pair) from the given table object * holding the available presets or plugins. * * Returns undefined if the preset or plugin is not available; passes through * name unmodified if it (or the first element of the pair) is not a string.

(builtinTable, name)

Source from the content-addressed store, hash-verified

116 * name unmodified if it (or the first element of the pair) is not a string.
117 */
118 function loadBuiltin(builtinTable, name) {
119 if (isArray(name) && typeof name[0] === 'string') {
120 if (builtinTable.hasOwnProperty(name[0])) {
121 return [builtinTable[name[0]]].concat(name.slice(1));
122 }
123 return;
124 } else if (typeof name === 'string') {
125 return builtinTable[name];
126 }
127 // Could be an actual preset/plugin module
128 return name;
129 }
130
131 /**
132 * Parses plugin names and presets from the specified options.

Callers 1

processOptionsFunction · 0.85

Calls 1

isArrayFunction · 0.85

Tested by

no test coverage detected