MCPcopy Create free account
hub / github.com/DHTMLX/gantt / getMode

Function getMode

samples/common/codehighlight/codemirror.js:747–766  ·  view source on GitHub ↗
(options, spec)

Source from the content-addressed store, hash-verified

745 // Given a mode spec (anything that resolveMode accepts), find and
746 // initialize an actual mode object.
747 function getMode(options, spec) {
748 spec = resolveMode(spec);
749 var mfactory = modes[spec.name];
750 if (!mfactory) { return getMode(options, "text/plain") }
751 var modeObj = mfactory(options, spec);
752 if (modeExtensions.hasOwnProperty(spec.name)) {
753 var exts = modeExtensions[spec.name];
754 for (var prop in exts) {
755 if (!exts.hasOwnProperty(prop)) { continue }
756 if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
757 modeObj[prop] = exts[prop];
758 }
759 }
760 modeObj.name = spec.name;
761 if (spec.helperType) { modeObj.helperType = spec.helperType; }
762 if (spec.modeProps) { for (var prop$1 in spec.modeProps)
763 { modeObj[prop$1] = spec.modeProps[prop$1]; } }
764
765 return modeObj
766 }
767
768 // This can be used to attach properties to mode objects from
769 // outside the actual mode definition.

Callers 1

loadModeFunction · 0.85

Calls 1

resolveModeFunction · 0.85

Tested by

no test coverage detected