* 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)
| 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. |
no test coverage detected