MCPcopy
hub / github.com/showdownjs/showdown / legacyExtensionLoading

Function legacyExtensionLoading

src/converter.js:160–185  ·  view source on GitHub ↗

* LEGACY_SUPPORT * @param {*} ext * @param {string} name

(ext, name)

Source from the content-addressed store, hash-verified

158 * @param {string} name
159 */
160 function legacyExtensionLoading (ext, name) {
161 if (typeof ext === 'function') {
162 ext = ext(new showdown.Converter());
163 }
164 if (!showdown.helper.isArray(ext)) {
165 ext = [ext];
166 }
167 var valid = validate(ext, name);
168
169 if (!valid.valid) {
170 throw Error(valid.error);
171 }
172
173 for (var i = 0; i < ext.length; ++i) {
174 switch (ext[i].type) {
175 case 'lang':
176 langExtensions.push(ext[i]);
177 break;
178 case 'output':
179 outputModifiers.push(ext[i]);
180 break;
181 default:// should never reach here
182 throw Error('Extension loader error: Type unrecognized!!!');
183 }
184 }
185 }
186
187 /**
188 * Listen to an event

Callers 1

_parseExtensionFunction · 0.85

Calls 1

validateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…