Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Check if two values are loosely equal that is, if they are plain objects, do they have the same shape?
function looseEqual (a, b) { if (a === b) { return true } var isObjectA = isObject(a); var isObjectB = isObject(b); if (isObjectA && isObjectB) { try { var isArrayA = Array.isArray(a); var isArrayB = Array.isArray(b); if (isArrayA && isArrayB) { return a.length === b.length && a.every(function (e, i) { return looseEqual(e, b[i]) }) } else if (a instanceof Date && b instanceof Date) { return a.getTime() === b.getTime() } else if (!isArrayA && !isArrayB) { var keysA = Object.keys(a); var keysB = Object.keys(b); return keysA.length === keysB.length && keysA.every(function (key) { return looseEqual(a[key], b[key]) }) } else { /* istanbul ignore next */ return false } } catch (e) { /* istanbul ignore next */ return false } } else if (!isObjectA && !isObjectB) { return String(a) === String(b) } else { return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sameExactShape(a, b) {\n\treturn JSON.stringify(a) === JSON.stringify(b)\n}", "function sameShape(a, b) {\n return JSON.stringify(a) === JSON.stringify(b)\n}", "function looseEqual(a,b){var isObjectA=isObject(a);var isObjectB=isObject(b);if(isObjectA&&isObjectB){return JSON.stringify(a)===JSON.string...
[ "0.8020216", "0.77488726", "0.73203313", "0.7272047", "0.7229446", "0.7223356", "0.7223356", "0.72070426", "0.72070426", "0.72070426", "0.72070426", "0.72070426", "0.719375", "0.7149837", "0.7149837", "0.7114921", "0.7092365", "0.7092365", "0.7092365", "0.7092365", "0.7092365...
0.0
-1
Return the first index at which a loosely equal value can be found in the array (if value is a plain object, the array must contain an object of the same shape), or 1 if it is not present.
function looseIndexOf (arr, val) { for (var i = 0; i < arr.length; i++) { if (looseEqual(arr[i], val)) { return i } } return -1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function looseIndexOf (arr, val) {\n for (var i = 0; i < arr.length; i++) {\n if (looseEqual(arr[i], val)) { return i }\n }\n return -1\n }", "function looseIndexOf(arr, val) {\n for (var i = 0; i < arr.length; i++) {\n if (looseEqual(arr[i]))\n return i;\n ...
[ "0.7281383", "0.72737753", "0.7273547", "0.7273547", "0.7273547", "0.7273547", "0.7247776", "0.7226055", "0.72179335", "0.719063", "0.71881723", "0.71881723", "0.71881723", "0.71881723", "0.6862148", "0.6846513" ]
0.721711
72
Ensure a function is called only once.
function once (fn) { var called = false; return function () { if (!called) { called = true; fn.apply(this, arguments); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function once(fn){var called=false;return function(){var args=[],len=arguments.length;while(len--){args[len]=arguments[len];}if(called){return;}called=true;return fn.apply(this,args);};}", "function once(fn){var called=false;return function(){if(!called){called=true;fn.apply(this,arguments);}};}", "function on...
[ "0.7813865", "0.7792654", "0.7792654", "0.77814144", "0.7509986", "0.74846625", "0.74533653", "0.74533653", "0.74333113", "0.7429154", "0.7429154", "0.7429154", "0.74233675", "0.74233675", "0.7406151", "0.7406151", "0.7406151", "0.7406151" ]
0.0
-1
Check if a string starts with $ or _
function isReserved (str) { var c = (str + '').charCodeAt(0); return c === 0x24 || c === 0x5F }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "startsWith(c){ return c=='_' || Character.isLetter(c) }", "function beginsWithCharacter(username){\n return /^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/.test(username);\n}", "function starts_with(str, prefix) {\n\t\treturn str.lastIndexOf(prefix, 0) === 0;\n\t}", "function is_alphaDashUnderscore(str)\n{\n ...
[ "0.6809397", "0.64830947", "0.6418743", "0.63947165", "0.6364793", "0.6174454", "0.61610985", "0.6136182", "0.61189294", "0.6094362", "0.6089015", "0.6088359", "0.60722625", "0.60722625", "0.6068401", "0.60577387", "0.60526854", "0.60371375", "0.6011135", "0.59893996", "0.598...
0.0
-1
optimized shallow clone used for static nodes and slot nodes because they may be reused across multiple renders, cloning them avoids errors when DOM manipulations rely on their elm reference.
function cloneVNode (vnode) { var cloned = new VNode( vnode.tag, vnode.data, // #7975 // clone children array to avoid mutating original in case of cloning // a child. vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory ); cloned.ns = vnode.ns; cloned.isStatic = vnode.isStatic; cloned.key = vnode.key; cloned.isComment = vnode.isComment; cloned.fnContext = vnode.fnContext; cloned.fnOptions = vnode.fnOptions; cloned.fnScopeId = vnode.fnScopeId; cloned.asyncMeta = vnode.asyncMeta; cloned.isCloned = true; return cloned }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cloneVNode(vnode,deep){var componentOptions=vnode.componentOptions;var cloned=new VNode(vnode.tag,vnode.data,vnode.children,vnode.text,vnode.elm,vnode.context,componentOptions,vnode.asyncFactory);cloned.ns=vnode.ns;cloned.isStatic=vnode.isStatic;cloned.key=vnode.key;cloned.isComment=vnode.isComment;cloned...
[ "0.7215416", "0.7215016", "0.72046924", "0.6923098", "0.6819354", "0.6819354", "0.6819354", "0.68118244", "0.68118244", "0.67948467", "0.6790519", "0.67770493", "0.67770493", "0.67770493", "0.67770493", "0.67770493", "0.6744016", "0.673486", "0.67249876", "0.67249876", "0.672...
0.0
-1
helpers Augment a target Object or Array by intercepting the prototype chain using __proto__
function protoAugment (target, src) { /* eslint-disable no-proto */ target.__proto__ = src; /* eslint-enable no-proto */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function protoAugment(target,src){/* eslint-disable no-proto */target.__proto__=src;/* eslint-enable no-proto */}", "function protoAugment(target, src) {\n target.__proto__ = src\n}", "function protoAugment(target, src) {\n\t /* eslint-disable no-proto */\n\t target.__proto__ = src;\n\t /* eslint-enable ...
[ "0.76513964", "0.7578844", "0.75163007", "0.75073874", "0.75073874", "0.75073874", "0.75073874", "0.75073874", "0.75073874", "0.75073874", "0.750716", "0.75059545", "0.75059545", "0.75001055", "0.75001055", "0.75001055", "0.75001055", "0.74970436", "0.74963814", "0.74963814", ...
0.0
-1
Augment a target Object or Array by defining hidden properties. / istanbul ignore next
function copyAugment (target, src, keys) { for (var i = 0, l = keys.length; i < l; i++) { var key = keys[i]; def(target, key, src[key]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function borderLayoutvue_type_script_lang_js_objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Ob...
[ "0.62766355", "0.6051237", "0.58810043", "0.5739268", "0.5739268", "0.56967473", "0.5693495", "0.5693272", "0.56831604", "0.56805646", "0.56805646", "0.5673533", "0.5673533", "0.5673533", "0.5610508", "0.5610508", "0.5610508", "0.5610508", "0.5610508", "0.5610508", "0.5610508...
0.0
-1
Attempt to create an observer instance for a value, returns the new observer if successfully observed, or the existing observer if the value already has one.
function observe (value, asRootData) { if (!isObject(value) || value instanceof VNode) { return } var ob; if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { ob = value.__ob__; } else if ( shouldObserve && !isServerRendering() && (Array.isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue ) { ob = new Observer(value); } if (asRootData && ob) { ob.vmCount++; } return ob }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function observer(value) {\n let ob = null;\n if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n ob = value.__ob__;\n } else if (Array.isArray(value) || isObject(value)) {\n ob = new Observer(value);\n }\n return ob;\n }", "function ob...
[ "0.74129635", "0.652159", "0.6444194", "0.6442786", "0.6413996", "0.64086866", "0.64086866", "0.6364294", "0.5903606", "0.5883659", "0.57971364", "0.57971364", "0.57971364", "0.57971364", "0.57971364", "0.57971364", "0.57971364", "0.57971364", "0.57971364", "0.57971364", "0.5...
0.0
-1
Define a reactive property on an Object.
function defineReactive$$1 ( obj, key, val, customSetter, shallow ) { var dep = new Dep(); var property = Object.getOwnPropertyDescriptor(obj, key); if (property && property.configurable === false) { return } // cater for pre-defined getter/setters var getter = property && property.get; var setter = property && property.set; if ((!getter || setter) && arguments.length === 2) { val = obj[key]; } var childOb = !shallow && observe(val); Object.defineProperty(obj, key, { enumerable: true, configurable: true, get: function reactiveGetter () { var value = getter ? getter.call(obj) : val; if (Dep.target) { dep.depend(); if (childOb) { childOb.dep.depend(); if (Array.isArray(value)) { dependArray(value); } } } return value }, set: function reactiveSetter (newVal) { var value = getter ? getter.call(obj) : val; /* eslint-disable no-self-compare */ if (newVal === value || (newVal !== newVal && value !== value)) { return } /* eslint-enable no-self-compare */ if (false) {} // #7981: for accessor properties without setter if (getter && !setter) { return } if (setter) { setter.call(obj, newVal); } else { val = newVal; } childOb = !shallow && observe(newVal); dep.notify(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function defineReactive(obj,key,val,customSetter,shallow){var dep=new Dep();var property=Object.getOwnPropertyDescriptor(obj,key);if(property&&property.configurable===false){return;}// cater for pre-defined getter/setters\nvar getter=property&&property.get;var setter=property&&property.set;var childOb=!shallow&&ob...
[ "0.72791314", "0.72791314", "0.727433", "0.7127494", "0.7061651", "0.7045527", "0.6923424", "0.6918172", "0.69101816", "0.68589103", "0.6853851", "0.6853851", "0.685129", "0.68401927", "0.6833513", "0.6816881", "0.68088764", "0.68023205", "0.6798727", "0.6794959", "0.6792586"...
0.0
-1
Set a property on an object. Adds the new property and triggers change notification if the property doesn't already exist.
function set (target, key, val) { if (false ) {} if (Array.isArray(target) && isValidArrayIndex(key)) { target.length = Math.max(target.length, key); target.splice(key, 1, val); return val } if (key in target && !(key in Object.prototype)) { target[key] = val; return val } var ob = (target).__ob__; if (target._isVue || (ob && ob.vmCount)) { false && false; return val } if (!ob) { target[key] = val; return val } defineReactive$$1(ob.value, key, val); ob.dep.notify(); return val }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@action\n setProp(property, newVal) {\n this.set(property, newVal);\n }", "set property(){}", "function patchProperty(obj, prop, value) {\n obj[prop] = value;\n}", "function patchProperty(obj, prop, value) {\n obj[prop] = value;\n}", "function patchProperty(obj, prop, value) {\n obj[prop] = v...
[ "0.75906134", "0.7324178", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.7164509", "0.71371394", "0.71371394", "0.71371394",...
0.0
-1
Delete a property and trigger change if necessary.
function del (target, key) { if (false ) {} if (Array.isArray(target) && isValidArrayIndex(key)) { target.splice(key, 1); return } var ob = (target).__ob__; if (target._isVue || (ob && ob.vmCount)) { false && false; return } if (!hasOwn(target, key)) { return } delete target[key]; if (!ob) { return } ob.dep.notify(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeProperty(aProperty){\n let propIndex = this._indexOfProperty(aProperty);\n if(propIndex >= 0){\n this._properties.splice(propIndex, 1);\n\n }\n }", "deleteProperty(group, propertyIndex) {\n group.properties.splice(propertyIndex, 1);\n }", "function DeleteProperty(ta...
[ "0.7100229", "0.69204336", "0.6754852", "0.66636324", "0.65777886", "0.65464354", "0.65464354", "0.65464354", "0.6531929", "0.6495098", "0.6456183", "0.64530337", "0.64501435", "0.64452565", "0.64452565", "0.64452565", "0.64452565", "0.64452565", "0.64452565", "0.64452565", "...
0.0
-1
Collect dependencies on array elements when the array is touched, since we cannot intercept array element access like property getters.
function dependArray (value) { for (var e = (void 0), i = 0, l = value.length; i < l; i++) { e = value[i]; e && e.__ob__ && e.__ob__.dep.depend(); if (Array.isArray(e)) { dependArray(e); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dependArray (value) {\n for (var e = (void 0), i = 0, l = value.length; i < l; i++) {\n e = value[i];\n e && e.__ob__ && e.__ob__.dep.depend();\n if (Array.isArray(e)) {\n dependArray(e);\n }\n }\n }", "function dependArray (value) {\n for (var e = (void 0), i = 0, l...
[ "0.6504594", "0.6504594", "0.6504594", "0.6504594", "0.64865226", "0.6479281", "0.64195865", "0.64195865", "0.64195865", "0.64195865", "0.64195865", "0.64195865", "0.6416323", "0.64133656", "0.6411051", "0.63963705", "0.63963705", "0.63921195", "0.6370724", "0.6370724", "0.63...
0.0
-1
Helper that recursively merges two data objects together.
function mergeData (to, from) { if (!from) { return to } var key, toVal, fromVal; var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from); for (var i = 0; i < keys.length; i++) { key = keys[i]; // in case the object is already observed... if (key === '__ob__') { continue } toVal = to[key]; fromVal = from[key]; if (!hasOwn(to, key)) { set(to, key, fromVal); } else if ( toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal) ) { mergeData(toVal, fromVal); } } return to }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeData(to,from){if(!from){return to;}var key,toVal,fromVal;var keys=Object.keys(from);for(var i=0;i<keys.length;i++){key=keys[i];toVal=to[key];fromVal=from[key];if(!hasOwn(to,key)){set(to,key,fromVal);}else if(isPlainObject(toVal)&&isPlainObject(fromVal)){mergeData(toVal,fromVal);}}return to;}", "fun...
[ "0.72979534", "0.72979534", "0.7292702", "0.7285061", "0.7261572", "0.72569245", "0.72569245", "0.7234436", "0.7123602", "0.7123602", "0.71093124", "0.7063697", "0.7063697", "0.7063697", "0.7060833", "0.705406", "0.705406", "0.7036377", "0.7035759", "0.7035759", "0.7035759", ...
0.0
-1
Hooks and props are merged as arrays.
function mergeHook ( parentVal, childVal ) { var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal; return res ? dedupeHooks(res) : res }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $merge(){\r\n var mix = {};\r\n for (var i = 0; i < arguments.length; i++) {\r\n for (var property in arguments[i]) {\r\n var ap = arguments[i][property];\r\n var mp = mix[property];\r\n if (mp && $type(ap) == 'object' && $type(mp) == '...
[ "0.5942144", "0.59220487", "0.581958", "0.577723", "0.56988394", "0.5694502", "0.5694502", "0.55787134", "0.5573753", "0.5573753", "0.5573753", "0.5573753", "0.5573753", "0.55637807", "0.555034", "0.555034", "0.555034", "0.5546893", "0.5546893", "0.55361134", "0.5495715", "...
0.0
-1
Assets When a vm is present (instance creation), we need to do a threeway merge between constructor options, instance options and parent options.
function mergeAssets ( parentVal, childVal, vm, key ) { var res = Object.create(parentVal || null); if (childVal) { false && false; return extend(res, childVal) } else { return res } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeAssets(parentVal,childVal,vm,key){var res=Object.create(parentVal||null);if(childVal){\"development\"!=='production'&&assertObjectType(key,childVal,vm);return extend(res,childVal);}else{return res;}}", "function mergeAssets(parentVal,childVal,vm,key){var res=Object.create(parentVal||null);if(childV...
[ "0.6300831", "0.6300831", "0.6089327", "0.6089327", "0.6089327", "0.6089327", "0.60666543", "0.60659266", "0.60659266", "0.60654974", "0.60507345", "0.6047087", "0.6047087", "0.6047087", "0.6047087", "0.6047087", "0.6047087", "0.6047087", "0.6047087", "0.6047087", "0.6047087"...
0.0
-1
Ensure all props option syntax are normalized into the Objectbased format.
function normalizeProps (options, vm) { var props = options.props; if (!props) { return } var res = {}; var i, val, name; if (Array.isArray(props)) { i = props.length; while (i--) { val = props[i]; if (typeof val === 'string') { name = camelize(val); res[name] = { type: null }; } else if (false) {} } } else if (isPlainObject(props)) { for (var key in props) { val = props[key]; name = camelize(key); res[name] = isPlainObject(val) ? val : { type: val }; } } else if (false) {} options.props = res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeProps (options, vm) {\n var props = options.props;\n if (!props) { return }\n var res = {};\n var i, val, name;\n if (Array.isArray(props)) {\n i = props.length;\n while (i--) {\n val = props[i];\n if (typeof val === 'string') {\n ...
[ "0.7324989", "0.7296385", "0.7291816", "0.7291816", "0.7291816", "0.7291816", "0.7290848", "0.72862524", "0.72693557", "0.72679484", "0.72679484", "0.72540116", "0.7219422", "0.7185131", "0.7185131", "0.7185131", "0.7185131", "0.7185131", "0.7185131", "0.7185131", "0.7185131"...
0.0
-1
Normalize all injections into Objectbased format
function normalizeInject (options, vm) { var inject = options.inject; if (!inject) { return } var normalized = options.inject = {}; if (Array.isArray(inject)) { for (var i = 0; i < inject.length; i++) { normalized[inject[i]] = { from: inject[i] }; } } else if (isPlainObject(inject)) { for (var key in inject) { var val = inject[key]; normalized[key] = isPlainObject(val) ? extend({ from: key }, val) : { from: val }; } } else if (false) {} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeInject(options) {\n\t var inject = options.inject;\n\t if (Array.isArray(inject)) {\n\t var normalized = options.inject = {};\n\t for (var i = 0; i < inject.length; i++) {\n\t normalized[inject[i]] = inject[i];\n\t }\n\t }\n\t}", "function normalizeInject(options) {\n\t var in...
[ "0.6662807", "0.6662807", "0.6650511", "0.6650511", "0.6650511", "0.6650511", "0.6650511", "0.6650511", "0.6650511", "0.6650511", "0.6650511", "0.6635942", "0.6635942", "0.66333044", "0.66333044", "0.65843964", "0.65843964", "0.65843964", "0.65843964", "0.65576065", "0.654783...
0.67549723
5
Normalize raw function directives into object format.
function normalizeDirectives (options) { var dirs = options.directives; if (dirs) { for (var key in dirs) { var def$$1 = dirs[key]; if (typeof def$$1 === 'function') { dirs[key] = { bind: def$$1, update: def$$1 }; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unwrapFunctions(obj){\n\t\tvar res = {};\n\t\tfor(var p in obj){\n\t\t\tvar tp = typeof(obj[p]); \n\t\t\tif(tp == 'function'){\n\t\t\t\tres[p] = obj[p]();\n\t\t\t}else if(tp == 'object'){\n\t\t\t\tvar un = obj[p]; \n\t\t\t\tif(obj[p] && obj[p]['toJSON']){\n\t\t\t\t\tun = obj[p]['toJSON']();\n\t\t\t\t}\n\t...
[ "0.5401093", "0.53510606", "0.53299874", "0.53299874", "0.53299874", "0.53299874", "0.5324845", "0.5320331", "0.5291464", "0.529108", "0.529108", "0.529108", "0.52876604", "0.5284644", "0.5282147", "0.5263787", "0.5254361", "0.5254361", "0.5254361", "0.52353954", "0.52353954"...
0.0
-1
Merge two option objects into a new one. Core utility used in both instantiation and inheritance.
function mergeOptions ( parent, child, vm ) { if (false) {} if (typeof child === 'function') { child = child.options; } normalizeProps(child, vm); normalizeInject(child, vm); normalizeDirectives(child); // Apply extends and mixins on the child options, // but only if it is a raw options object that isn't // the result of another mergeOptions call. // Only merged options has the _base property. if (!child._base) { if (child.extends) { parent = mergeOptions(parent, child.extends, vm); } if (child.mixins) { for (var i = 0, l = child.mixins.length; i < l; i++) { parent = mergeOptions(parent, child.mixins[i], vm); } } } var options = {}; var key; for (key in parent) { mergeField(key); } for (key in child) { if (!hasOwn(parent, key)) { mergeField(key); } } function mergeField (key) { var strat = strats[key] || defaultStrat; options[key] = strat(parent[key], child[key], vm, key); } return options }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeOptions(obj1,obj2){var obj3={};var attrname;for(attrname in obj1){obj3[attrname]=obj1[attrname];}for(attrname in obj2){obj3[attrname]=obj2[attrname];}return obj3;}", "function _mergeOptions(obj1,obj2) {\n\t var obj3 = {};\n\t for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }\n\t...
[ "0.76743364", "0.7325371", "0.72791517", "0.7276775", "0.72505414", "0.722436", "0.72167486", "0.72167486", "0.72167486", "0.72167486", "0.72167486", "0.72121763", "0.7198333", "0.71668035", "0.71602327", "0.71375287", "0.71375287", "0.71375287", "0.71051395", "0.7093834", "0...
0.0
-1
Resolve an asset. This function is used because child instances need access to assets defined in its ancestor chain.
function resolveAsset ( options, type, id, warnMissing ) { /* istanbul ignore if */ if (typeof id !== 'string') { return } var assets = options[type]; // check local registration variations first if (hasOwn(assets, id)) { return assets[id] } var camelizedId = camelize(id); if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } var PascalCaseId = capitalize(camelizedId); if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } // fallback to prototype chain var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; if (false) {} return res }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resolveAsset(options,type,id,warnMissing){/* istanbul ignore if */if(typeof id!=='string'){return;}var assets=options[type];// check local registration variations first\nif(hasOwn(assets,id)){return assets[id];}var camelizedId=camelize(id);if(hasOwn(assets,camelizedId)){return assets[camelizedId];}var Pas...
[ "0.62818235", "0.62818235", "0.62603885", "0.61542135", "0.61542135", "0.61542135", "0.6125455", "0.6125455", "0.6125455", "0.6125455", "0.6125455", "0.6111469", "0.60809875", "0.60809875", "0.6080285", "0.60571265", "0.6020012", "0.59978414", "0.5971991", "0.5971991", "0.597...
0.0
-1
Get the default value of a prop.
function getPropDefaultValue (vm, prop, key) { // no default, return undefined if (!hasOwn(prop, 'default')) { return undefined } var def = prop.default; // warn against non-factory defaults for Object & Array if (false) {} // the raw prop value was also undefined from previous render, // return previous default value to avoid unnecessary watcher trigger if (vm && vm.$options.propsData && vm.$options.propsData[key] === undefined && vm._props[key] !== undefined ) { return vm._props[key] } // call factory function for non-Function types // a value is Function if its prototype is function even across different execution context return typeof def === 'function' && getType(prop.type) !== 'Function' ? def.call(vm) : def }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPropDefaultValue (vm, prop, key) {\n // no default, return undefined\n if (!hasOwn(prop, 'default')) {\n return undefined\n }\n var def = prop.default;\n // warn against non-factory defaults for Object & Array\n if (isObject(def)) {\n warn(\n 'Invalid default value fo...
[ "0.7784161", "0.7784161", "0.7784161", "0.77839553", "0.7770856", "0.7740233", "0.7732649", "0.7714429", "0.7713042", "0.7703943", "0.7703943", "0.7695614", "0.7695614", "0.7695614", "0.7695614", "0.7695614", "0.7695614", "0.7695614", "0.7695614", "0.7695614", "0.7695614", ...
0.77379143
11
Assert whether a prop is valid.
function assertProp ( prop, name, value, vm, absent ) { if (prop.required && absent) { warn( 'Missing required prop: "' + name + '"', vm ); return } if (value == null && !prop.required) { return } var type = prop.type; var valid = !type || type === true; var expectedTypes = []; if (type) { if (!Array.isArray(type)) { type = [type]; } for (var i = 0; i < type.length && !valid; i++) { var assertedType = assertType(value, type[i]); expectedTypes.push(assertedType.expectedType || ''); valid = assertedType.valid; } } if (!valid) { warn( getInvalidTypeMessage(name, value, expectedTypes), vm ); return } var validator = prop.validator; if (validator) { if (!validator(value)) { warn( 'Invalid prop: custom validator check failed for prop "' + name + '".', vm ); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertProp(prop,name,value,vm,absent){if(prop.required&&absent){warn('Missing required prop: \"'+name+'\"',vm);return;}if(value==null&&!prop.required){return;}var type=prop.type;var valid=!type||type===true;var expectedTypes=[];if(type){if(!Array.isArray(type)){type=[type];}for(var i=0;i<type.length&&!val...
[ "0.7921342", "0.78770363", "0.78770363", "0.7842237", "0.779355", "0.7789149", "0.7789149", "0.7789149", "0.77335036", "0.77335036", "0.77275956", "0.76917607", "0.76917607", "0.76917607", "0.76917607", "0.76917607", "0.76917607", "0.7668891", "0.7639332", "0.76153845", "0.76...
0.0
-1
Use function string name to check builtin types, because a simple equality check will fail when running across different vms / iframes.
function getType (fn) { var match = fn && fn.toString().match(/^\s*function (\w+)/); return match ? match[1] : '' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isBuiltinType(fn) {\n return (\n // scalars\n fn === Number ||\n fn === Boolean ||\n fn === String ||\n // objects\n fn === Object ||\n fn === Array ||\n fn === Date ||\n fn === RegExp ||\n fn === Buffer ||\n fn === Null ||\n /...
[ "0.70350987", "0.63953584", "0.6314871", "0.6307279", "0.6161832", "0.6148997", "0.61396724", "0.61396724", "0.6138711", "0.61248386", "0.60916066", "0.60802835", "0.60668826", "0.60643834", "0.60479796", "0.6047623", "0.5982038", "0.5961509", "0.5950394", "0.59033835", "0.59...
0.0
-1
Recursively traverse an object to evoke all converted getters, so that every nested property inside the object is collected as a "deep" dependency.
function traverse (val) { _traverse(val, seenObjects); seenObjects.clear(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function traverse(obj) {\n _lodash2.default.each(obj, function (val, indexOrProp) {\n // Move deeper into the object\n var next = obj[indexOrProp];\n\n // If we can go no further, then quit\n if (MongoObject.isBasicObject(next)) {\n traverse(next);\n }...
[ "0.62905097", "0.6121575", "0.5950286", "0.5849156", "0.57901883", "0.57893395", "0.57820684", "0.577268", "0.5767362", "0.57612413", "0.57531846", "0.57531846", "0.57363987", "0.5696382", "0.565734", "0.56491715", "0.5594592", "0.5580324", "0.5577302", "0.5566833", "0.556036...
0.0
-1
The template compiler attempts to minimize the need for normalization by statically analyzing the template at compile time. For plain HTML markup, normalization can be completely skipped because the generated render function is guaranteed to return Array. There are two cases where extra normalization is needed: 1. When the children contains components because a functional component may return an Array instead of a single root. In this case, just a simple normalization is needed if any child is an Array, we flatten the whole thing with Array.prototype.concat. It is guaranteed to be only 1level deep because functional components already normalize their own children.
function simpleNormalizeChildren (children) { for (var i = 0; i < children.length; i++) { if (Array.isArray(children[i])) { return Array.prototype.concat.apply([], children) } } return children }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function simpleNormalizeChildren(children){for(var i=0;i<children.length;i++){if(Array.isArray(children[i])){return Array.prototype.concat.apply([],children);}}return children;}// 2. When the children contains constructs that always generated nested Arrays,", "function simpleNormalizeChildren(children){for(var i...
[ "0.69195116", "0.69195116", "0.67767596", "0.6734535", "0.6734535", "0.6734535", "0.6734535", "0.6734535", "0.66989434", "0.64314777", "0.6424479", "0.6424479", "0.6424479", "0.63202715", "0.630732", "0.630732", "0.630732", "0.630732", "0.630627", "0.6302493", "0.6302493", ...
0.0
-1
2. When the children contains constructs that always generated nested Arrays, e.g. , , vfor, or when the children is provided by user with handwritten render functions / JSX. In such cases a full normalization is needed to cater to all possible types of children values.
function normalizeChildren (children) { return isPrimitive(children) ? [createTextVNode(children)] : Array.isArray(children) ? normalizeArrayChildren(children) : undefined }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function simpleNormalizeChildren(children){for(var i=0;i<children.length;i++){if(Array.isArray(children[i])){return Array.prototype.concat.apply([],children);}}return children;}// 2. When the children contains constructs that always generated nested Arrays,", "function simpleNormalizeChildren(children){for(var i...
[ "0.81383675", "0.81383675", "0.8134532", "0.7862443", "0.7862443", "0.7862443", "0.7846073", "0.7846073", "0.7846073", "0.7846073", "0.7846073", "0.7834197", "0.78136206", "0.78136206", "0.78136206", "0.78136206", "0.78136206", "0.78136206", "0.77821416", "0.7776711" ]
0.0
-1
Runtime helper for resolving raw children VNodes into a slot object.
function resolveSlots ( children, context ) { if (!children || !children.length) { return {} } var slots = {}; for (var i = 0, l = children.length; i < l; i++) { var child = children[i]; var data = child.data; // remove slot attribute if the node is resolved as a Vue slot node if (data && data.attrs && data.attrs.slot) { delete data.attrs.slot; } // named slots should only be respected if the vnode was rendered in the // same context. if ((child.context === context || child.fnContext === context) && data && data.slot != null ) { var name = data.slot; var slot = (slots[name] || (slots[name] = [])); if (child.tag === 'template') { slot.push.apply(slot, child.children || []); } else { slot.push(child); } } else { (slots.default || (slots.default = [])).push(child); } } // ignore slots that contains only whitespace for (var name$1 in slots) { if (slots[name$1].every(isWhitespace)) { delete slots[name$1]; } } return slots }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resolveSlots(children,context){var slots={};if(!children){return slots;}for(var i=0,l=children.length;i<l;i++){var child=children[i];var data=child.data;// remove slot attribute if the node is resolved as a Vue slot node\nif(data&&data.attrs&&data.attrs.slot){delete data.attrs.slot;}// named slots should ...
[ "0.71123827", "0.70876837", "0.6743867", "0.67305523", "0.67168945", "0.67168945", "0.67168945", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018", "0.6715018...
0.0
-1
Runtime helper for rendering vfor lists.
function renderList ( val, render ) { var ret, i, l, keys, key; if (Array.isArray(val) || typeof val === 'string') { ret = new Array(val.length); for (i = 0, l = val.length; i < l; i++) { ret[i] = render(val[i], i); } } else if (typeof val === 'number') { ret = new Array(val); for (i = 0; i < val; i++) { ret[i] = render(i + 1, i); } } else if (isObject(val)) { if (hasSymbol && val[Symbol.iterator]) { ret = []; var iterator = val[Symbol.iterator](); var result = iterator.next(); while (!result.done) { ret.push(render(result.value, ret.length)); result = iterator.next(); } } else { keys = Object.keys(val); ret = new Array(keys.length); for (i = 0, l = keys.length; i < l; i++) { key = keys[i]; ret[i] = render(val[key], key, i); } } } if (!isDef(ret)) { ret = []; } (ret)._isVList = true; return ret }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderList(val,render){var ret,i,l,keys,key;if(Array.isArray(val)||typeof val==='string'){ret=new Array(val.length);for(i=0,l=val.length;i<l;i++){ret[i]=render(val[i],i);}}else if(typeof val==='number'){ret=new Array(val);for(i=0;i<val;i++){ret[i]=render(i+1,i);}}else if(isObject(val)){keys=Object.keys(va...
[ "0.69482017", "0.69482017", "0.6754226", "0.6730061", "0.6730061", "0.6683929", "0.6683929", "0.6683929", "0.6683929", "0.6683929", "0.6683929", "0.6683929", "0.6683929", "0.66441935", "0.6616919", "0.6566886", "0.6566886", "0.6562391", "0.6562391", "0.6562391", "0.6562391", ...
0.0
-1
Runtime helper for rendering
function renderSlot ( name, fallback, props, bindObject ) { var scopedSlotFn = this.$scopedSlots[name]; var nodes; if (scopedSlotFn) { // scoped slot props = props || {}; if (bindObject) { if (false) {} props = extend(extend({}, bindObject), props); } nodes = scopedSlotFn(props) || fallback; } else { nodes = this.$slots[name] || fallback; } var target = props && props.slot; if (target) { return this.$createElement('template', { slot: target }, nodes) } else { return nodes } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_render() {}", "render() {}", "render() {}", "render() {}", "static rendered () {}", "static rendered () {}", "render(){}", "render(){}", "function render() {\n\n\t\t\t}", "render() { }", "function render() {\n\t\t\n\t}", "function render() {\n\t\t\t}", "function render() {\n\t}", "render...
[ "0.81951976", "0.797086", "0.797086", "0.797086", "0.79466", "0.79466", "0.7533175", "0.7533175", "0.74335504", "0.7409195", "0.7390453", "0.7383342", "0.7373111", "0.7324088", "0.7324088", "0.7256009", "0.7256009", "0.7075014", "0.70568293", "0.7052554", "0.7010985", "0.70...
0.0
-1
Runtime helper for resolving filters
function resolveFilter (id) { return resolveAsset(this.$options, 'filters', id, true) || identity }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "applyFindFilters(filters) { throw 'Not Implemented' }", "function resolveFilter(id){return resolveAsset(this.$options,'filters',id,true)||identity;}", "function resolveFilter(id){return resolveAsset(this.$options,'filters',id,true)||identity;}", "function executeOnFilters(fn) {\n\t var appState = getApp...
[ "0.69978595", "0.6792624", "0.6792624", "0.6602312", "0.6572347", "0.6572347", "0.6572347", "0.6572347", "0.6572347", "0.6559325", "0.6551497", "0.6551497", "0.6546134", "0.6533371", "0.64145756", "0.63767576", "0.6374046", "0.6374046", "0.6374046", "0.6374046", "0.63544434",...
0.0
-1
Runtime helper for checking keyCodes from config. exposed as Vue.prototype._k passing in eventKeyName as last argument separately for backwards compat
function checkKeyCodes ( eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName ) { var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { return isKeyNotMatch(builtInKeyName, eventKeyName) } else if (mappedKeyCode) { return isKeyNotMatch(mappedKeyCode, eventKeyCode) } else if (eventKeyName) { return hyphenate(eventKeyName) !== key } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkKeyCodes(eventKeyCode,key,builtInAlias,eventKeyName){var keyCodes=config.keyCodes[key]||builtInAlias;if(keyCodes){if(Array.isArray(keyCodes)){return keyCodes.indexOf(eventKeyCode)===-1;}else{return keyCodes!==eventKeyCode;}}else if(eventKeyName){return hyphenate(eventKeyName)!==key;}}", "function c...
[ "0.7394007", "0.7394007", "0.71686095", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.69838387", "0.6928423", "0.69021493", "0.6880145", "0.6880145", "...
0.0
-1
Runtime helper for merging vbind="object" into a VNode's data.
function bindObjectProps ( data, tag, value, asProp, isSync ) { if (value) { if (!isObject(value)) { false && false; } else { if (Array.isArray(value)) { value = toObject(value); } var hash; var loop = function ( key ) { if ( key === 'class' || key === 'style' || isReservedAttribute(key) ) { hash = data; } else { var type = data.attrs && data.attrs.type; hash = asProp || config.mustUseProp(tag, type, key) ? data.domProps || (data.domProps = {}) : data.attrs || (data.attrs = {}); } var camelizedKey = camelize(key); var hyphenatedKey = hyphenate(key); if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) { hash[key] = value[key]; if (isSync) { var on = data.on || (data.on = {}); on[("update:" + key)] = function ($event) { value[key] = $event; }; } } }; for (var key in value) loop( key ); } } return data }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bindObjectProps(data,tag,value,asProp,isSync){if(value){if(!isObject(value)){\"development\"!=='production'&&warn('v-bind without argument expects an Object or Array value',this);}else{if(Array.isArray(value)){value=toObject(value);}var hash;var loop=function loop(key){if(key==='class'||key==='style'||isR...
[ "0.5750111", "0.5750111", "0.5574623", "0.5570438", "0.55449307", "0.5451092", "0.544886", "0.543797", "0.54336005", "0.5427807", "0.5426836", "0.5420182", "0.54180074", "0.54180074", "0.54180074", "0.5417664", "0.5417664", "0.53927517", "0.53875333", "0.53802675", "0.5369361...
0.0
-1
Runtime helper for rendering static trees.
function renderStatic ( index, isInFor ) { var cached = this._staticTrees || (this._staticTrees = []); var tree = cached[index]; // if has already-rendered static tree and not inside v-for, // we can reuse the same tree. if (tree && !isInFor) { return tree } // otherwise, render a fresh tree. tree = cached[index] = this.$options.staticRenderFns[index].call( this._renderProxy, null, this // for render fns generated for functional component templates ); markStatic(tree, ("__static__" + index), false); return tree }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderStatic(index, isInFor) {\n // static trees can be rendered once and cached on the contructor options\n // so every instance shares the same cached trees\n var options = this.$options;\n var cached = options.cached || (options.cached = []);\n var tree = cached[index];\n // if has already-render...
[ "0.70392305", "0.7030688", "0.7030688", "0.7001824", "0.69432634", "0.6933784", "0.6933784", "0.6933784", "0.6933784", "0.69145143", "0.6898034", "0.6898034", "0.6897683", "0.6897683", "0.6897683", "0.6893906", "0.6892661", "0.6892661", "0.6889333", "0.6887244", "0.6866389", ...
0.0
-1
Runtime helper for vonce. Effectively it means marking the node as static with a unique key.
function markOnce ( tree, index, key ) { markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); return tree }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function markOnce(tree, index, key) {\n markStatic(tree, \"__once__\" + index + (key ? \"_\" + key : \"\"), true);\n return tree;\n }", "function markOnce(tree, index, key) {\n\t markStatic(tree, \"__once__\" + index + (key ? \"_\" + key : \"\"), true);\n\t return tree;\n\t}", "function markOnce(t...
[ "0.7307867", "0.72644734", "0.72644734", "0.72334355", "0.72334355", "0.7207664", "0.7207664", "0.7207664", "0.7207664", "0.7207664", "0.7207664", "0.7207664", "0.7207664", "0.7207664", "0.7207664", "0.7207664", "0.7207664", "0.71539545", "0.71056765", "0.71056765", "0.708450...
0.0
-1
helper to dynamically append modifier runtime markers to event names. ensure only append when value is already string, otherwise it will be cast to string and cause the type check to miss.
function prependModifier (value, symbol) { return typeof value === 'string' ? symbol + value : value }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prependModifier (value, symbol) {\n return typeof value === 'string' ? symbol + value : value\n }", "function prependModifier (value, symbol) {\n return typeof value === 'string' ? symbol + value : value\n }", "function prependModifier (value, symbol) {\n return typeof value === 'string' ? ...
[ "0.5749372", "0.5749372", "0.5749372", "0.57420117", "0.5670296", "0.5670296", "0.5670296", "0.5670296", "0.5670296", "0.5659303", "0.5654612", "0.5258461", "0.51142997", "0.51061094", "0.50927186", "0.50927186", "0.5085455", "0.50337696", "0.50337696", "0.50337696", "0.50337...
0.5724932
71
transform component vmodel info (value and callback) into prop and event handler respectively.
function transformModel (options, data) { var prop = (options.model && options.model.prop) || 'value'; var event = (options.model && options.model.event) || 'input' ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; var on = data.on || (data.on = {}); var existing = on[event]; var callback = data.model.callback; if (isDef(existing)) { if ( Array.isArray(existing) ? existing.indexOf(callback) === -1 : existing !== callback ) { on[event] = [callback].concat(existing); } } else { on[event] = callback; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function transformModel (options, data) {\n\t var prop = (options.model && options.model.prop) || 'value';\n\t var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;\n\t var on = data.on || (data.on = {});\n\t if (isDef(on[event])) {\n\t on[...
[ "0.67385936", "0.67385936", "0.673094", "0.673094", "0.673094", "0.6685295", "0.6651494", "0.6651494", "0.6646578", "0.66293675", "0.66081053", "0.66081053", "0.66081053", "0.66081053", "0.66081053", "0.66081053", "0.66081053", "0.66081053", "0.66081053", "0.66081053", "0.660...
0.0
-1
wrapper function for providing a more flexible interface without getting yelled at by flow
function createElement ( context, tag, data, children, normalizationType, alwaysNormalize ) { if (Array.isArray(data) || isPrimitive(data)) { normalizationType = children; children = data; data = undefined; } if (isTrue(alwaysNormalize)) { normalizationType = ALWAYS_NORMALIZE; } return _createElement(context, tag, data, children, normalizationType) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PipeDecorator(){}// WARNING: interface has both a type and a value, skipping emit", "function PipeDecorator() {} // WARNING: interface has both a type and a value, skipping emit", "function PipeDecorator() {} // WARNING: interface has both a type and a value, skipping emit", "function PipeDecorator(...
[ "0.600452", "0.5736569", "0.5736569", "0.5736569", "0.5734356", "0.56715864", "0.5587215", "0.55719346", "0.5557246", "0.55180275", "0.54874575", "0.5399787", "0.5294553", "0.52819973", "0.5254858", "0.5233107", "0.5231385", "0.5231385", "0.5231385", "0.52263063", "0.5190922"...
0.0
-1
ref 5318 necessary to ensure parent rerender when deep bindings like :style and :class are used on slot nodes
function registerDeepBindings (data) { if (isObject(data.style)) { traverse(data.style); } if (isObject(data.class)) { traverse(data.class); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "slotchange() {\n let call = 0;\n for (const child of this.slotted.assignedNodes()) {\n if (child && child.nodeType === 1) {\n child.style.zIndex = 99 - call;\n if (this.isEvenNumber(call++)) {\n child.classList.add('animate-down');\n } else {\n child.classList.add(...
[ "0.6036943", "0.6036943", "0.59391546", "0.5817875", "0.57814604", "0.572591", "0.57103086", "0.560922", "0.56005704", "0.5576743", "0.5556157", "0.55253136", "0.5524546", "0.5522381", "0.5513708", "0.54611915", "0.5453313", "0.5452324", "0.5452324", "0.5452324", "0.5452324",...
0.0
-1
Reset the scheduler's state.
function resetSchedulerState () { index = queue.length = activatedChildren.length = 0; has = {}; if (false) {} waiting = flushing = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetSchedule() {\n this._scheduler.resetSchedule();\n }", "function resetSchedulerState () {\n queue.length = 0;\n has$1 = {};\n {\n circular = {};\n }\n waiting = flushing = false;\n}", "function resetSchedulerState () {\n queue.length = 0;\n has$1 = {};\n {\n circular = {};\n }\n waiting...
[ "0.8267329", "0.8216394", "0.8216394", "0.8216394", "0.8214579", "0.8156713", "0.813883", "0.813883", "0.8137888", "0.8137888", "0.81248444", "0.8112753", "0.8112753", "0.8109016", "0.8075108", "0.80690277", "0.80690277", "0.8026076", "0.80160606", "0.80009717", "0.7975701", ...
0.0
-1
Flush both queues and run the watchers.
function flushSchedulerQueue () { currentFlushTimestamp = getNow(); flushing = true; var watcher, id; // Sort queue before flush. // This ensures that: // 1. Components are updated from parent to child. (because parent is always // created before the child) // 2. A component's user watchers are run before its render watcher (because // user watchers are created before the render watcher) // 3. If a component is destroyed during a parent component's watcher run, // its watchers can be skipped. queue.sort(function (a, b) { return a.id - b.id; }); // do not cache length because more watchers might be pushed // as we run existing watchers for (index = 0; index < queue.length; index++) { watcher = queue[index]; if (watcher.before) { watcher.before(); } id = watcher.id; has[id] = null; watcher.run(); // in dev build, check and stop circular updates. if (false) {} } // keep copies of post queues before resetting state var activatedQueue = activatedChildren.slice(); var updatedQueue = queue.slice(); resetSchedulerState(); // call component updated and activated hooks callActivatedHooks(activatedQueue); callUpdatedHooks(updatedQueue); // devtool hook /* istanbul ignore if */ if (devtools && config.devtools) { devtools.emit('flush'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function flushSchedulerQueue() {\n\t\t runSchedulerQueue(queue.sort(queueSorter));\n\t\t runSchedulerQueue(userQueue);\n\t\t // user watchers triggered more watchers,\n\t\t // keep flushing until it depletes\n\t\t if (queue.length) {\n\t\t return flushSchedulerQueue();\n\t\t }\n\t\t // devtool hook\n\t\t...
[ "0.7189843", "0.7172169", "0.7172169", "0.7172169", "0.70486706", "0.70444006", "0.70444006", "0.70444006", "0.7044293", "0.7044293", "0.7044293", "0.7044293", "0.7044293", "0.7037875", "0.7037875", "0.7037875", "0.6825811", "0.6820496", "0.6792773", "0.67876095", "0.6771715"...
0.6656157
26
Queue a keptalive component that was activated during patch. The queue will be processed after the entire tree has been patched.
function queueActivatedComponent (vm) { // setting _inactive to false here so that a render function can // rely on checking whether it's in an inactive tree (e.g. router-view) vm._inactive = false; activatedChildren.push(vm); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function queueActivatedComponent(gm) {\n // setting _inactive to false here so that a render function can\n // rely on checking whether it's in an inactive tree (e.g. router-view)\n gm._inactive = false;\n activatedChildren.push(gm);\n}", "function queueActivatedComponent (vm) {\n\t // setting _inactive to ...
[ "0.67577285", "0.6707664", "0.6707664", "0.6704469", "0.6704469", "0.6704469", "0.6704469", "0.6699409", "0.6698489", "0.6698489", "0.6695783", "0.6695783" ]
0.0
-1
Push a watcher into the watcher queue. Jobs with duplicate IDs will be skipped unless it's pushed when the queue is being flushed.
function queueWatcher (watcher) { var id = watcher.id; if (has[id] == null) { has[id] = true; if (!flushing) { queue.push(watcher); } else { // if already flushing, splice the watcher based on its id // if already past its id, it will be run next immediately. var i = queue.length - 1; while (i > index && queue[i].id > watcher.id) { i--; } queue.splice(i + 1, 0, watcher); } // queue the flush if (!waiting) { waiting = true; if (false) {} nextTick(flushSchedulerQueue); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function queueWatcher (watcher) {\n var id = watcher.id;\n if (has$1[id] == null) {\n has$1[id] = true;\n if (!flushing) {\n queue.push(watcher);\n } else {\n // if already flushing, splice the watcher based on its id\n // if already past its id, it will be run next immediately.\n va...
[ "0.77372956", "0.77372956", "0.77372956", "0.77372956", "0.77372956", "0.772855", "0.7705405", "0.7705405", "0.7705405", "0.7700171", "0.7689657", "0.7689657", "0.7689657", "0.7689657", "0.7689657", "0.7683655", "0.7683433", "0.7683433", "0.7683069", "0.7683069", "0.7683069",...
0.0
-1
Query an element selector if it's not an element already.
function query (el) { if (typeof el === 'string') { var selected = document.querySelector(el); if (!selected) { false && false; return document.createElement('div') } return selected } else { return el } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function query (el) {\n\t if (typeof el === 'string') {\n\t var selector = el\n\t el = document.querySelector(el)\n\t if (!el) {\n\t process.env.NODE_ENV !== 'production' && warn(\n\t 'Cannot find element: ' + selector\n\t )\n\t return document.createElement('div')\n\t }\n\t }\n...
[ "0.6955811", "0.6931722", "0.6931722", "0.6875168", "0.6875168", "0.6865981", "0.6857312", "0.6857312", "0.6857312", "0.6856364", "0.6819468", "0.67957026", "0.67957026", "0.67957026", "0.67957026", "0.67957026", "0.67957026", "0.67957026", "0.67957026", "0.67957026", "0.6795...
0.0
-1
set scope id attribute for scoped CSS. this is implemented as a special case to avoid the overhead of going through the normal attribute patching process.
function setScope (vnode) { var i; if (isDef(i = vnode.fnScopeId)) { nodeOps.setStyleScope(vnode.elm, i); } else { var ancestor = vnode; while (ancestor) { if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) { nodeOps.setStyleScope(vnode.elm, i); } ancestor = ancestor.parent; } } // for slot content they should also get the scopeId from the host instance. if (isDef(i = activeInstance) && i !== vnode.context && i !== vnode.fnContext && isDef(i = i.$options._scopeId) ) { nodeOps.setStyleScope(vnode.elm, i); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pushScopeId(id) {\r\n currentScopeId = id;\r\n}", "function pushScopeId(id) {\r\n currentScopeId = id;\r\n}", "function setScope(vnode) {\n var i;\n if (isDef(i = vnode.fnScopeId)) {\n nodeOps.setAttribute(vnode.elm, i, '');\n } else {\n var ancestor = vnode;\n ...
[ "0.6507561", "0.6507561", "0.645189", "0.6445727", "0.6445727", "0.6445727", "0.6445727", "0.6445727", "0.6445727", "0.6445727", "0.64229226", "0.64229226", "0.64229226", "0.64229226", "0.64210314" ]
0.0
-1
Note: this is a browseronly function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) { var i; var tag = vnode.tag; var data = vnode.data; var children = vnode.children; inVPre = inVPre || (data && data.pre); vnode.elm = elm; if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) { vnode.isAsyncPlaceholder = true; return true } // assert node match if (false) {} if (isDef(data)) { if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); } if (isDef(i = vnode.componentInstance)) { // child component. it should have hydrated its own tree. initComponent(vnode, insertedVnodeQueue); return true } } if (isDef(tag)) { if (isDef(children)) { // empty element, allow client to pick up and populate children if (!elm.hasChildNodes()) { createChildren(vnode, children, insertedVnodeQueue); } else { // v-html and domProps: innerHTML if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) { if (i !== elm.innerHTML) { /* istanbul ignore if */ if (false ) {} return false } } else { // iterate and compare children lists var childrenMatch = true; var childNode = elm.firstChild; for (var i$1 = 0; i$1 < children.length; i$1++) { if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) { childrenMatch = false; break } childNode = childNode.nextSibling; } // if childNode is not null, it means the actual childNodes list is // longer than the virtual children list. if (!childrenMatch || childNode) { /* istanbul ignore if */ if (false ) {} return false } } } } if (isDef(data)) { var fullInvoke = false; for (var key in data) { if (!isRenderedModule(key)) { fullInvoke = true; invokeCreateHooks(vnode, insertedVnodeQueue); break } } if (!fullInvoke && data['class']) { // ensure collecting deps for deep class bindings for future updates traverse(data['class']); } } } else if (elm.data !== vnode.text) { elm.data = vnode.text; } return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkNodeEl(el) {\n return el.nodeType === 1;\n }", "domRemoveChildren(el) {\n if (!el) return;\n while (el.firstChild) {\n el.firstChild.remove();\n };\n }", "function getOuterHTML(el){if(el.outerHTML){return el.outerHTML;}else{var container=document.createElement(...
[ "0.63703173", "0.6075972", "0.603426", "0.603426", "0.603426", "0.59734106", "0.59734106", "0.59734106", "0.59734106", "0.5931207", "0.59173113", "0.58157057", "0.58110684", "0.58097315", "0.57934564", "0.57934564", "0.5774249", "0.57502735", "0.5745852", "0.573527", "0.57082...
0.0
-1
normalize vmodel event tokens that can only be determined at runtime. it's important to place the event as the first in the array because the whole point is ensuring the vmodel callback gets called before userattached handlers.
function normalizeEvents (on) { /* istanbul ignore if */ if (isDef(on[RANGE_TOKEN])) { // IE input[type=range] only supports `change` event var event = isIE ? 'change' : 'input'; on[event] = [].concat(on[RANGE_TOKEN], on[event] || []); delete on[RANGE_TOKEN]; } // This was originally intended to fix #4521 but no longer necessary // after 2.5. Keeping it for backwards compat with generated code from < 2.4 /* istanbul ignore if */ if (isDef(on[CHECKBOX_RADIO_TOKEN])) { on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []); delete on[CHECKBOX_RADIO_TOKEN]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeEvents (on) {\n\t var event;\n\t /* istanbul ignore if */\n\t if (on[RANGE_TOKEN]) {\n\t // IE input[type=range] only supports `change` event\n\t event = isIE ? 'change' : 'input';\n\t on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);\n\t delete on[RANGE_TOKEN];\n\t }\n\t ...
[ "0.61190027", "0.61190027", "0.61190027", "0.6032805", "0.6014792", "0.6014792", "0.60098845", "0.60098845", "0.60098845", "0.60092515", "0.600608", "0.6004231", "0.5989151", "0.5989151", "0.5989151", "0.5989151", "0.59634006", "0.59447026", "0.5942347", "0.5942347", "0.59423...
0.0
-1
merge static and dynamic style data on the same vnode
function normalizeStyleData (data) { var style = normalizeStyleBinding(data.style); // static style is pre-processed into an object during compilation // and is always a fresh object, so it's safe to merge into it return data.staticStyle ? extend(data.staticStyle, style) : style }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeStyleData (data) {\n var style = normalizeStyleBinding(data.style);\n // static style is pre-processed into an object during compilation\n // and is always a fresh object, so it's safe to merge into it\n return data.staticStyle\n ? extend(data.staticStyle, style)\n ...
[ "0.6218191", "0.62023467", "0.619667", "0.61707824", "0.61707824", "0.61707824", "0.61707824", "0.6123679", "0.6123679", "0.61214113", "0.61214113", "0.61214113", "0.61205626", "0.61205626", "0.61205626", "0.61205626", "0.61205626", "0.61205626", "0.6106735" ]
0.0
-1
normalize possible array / string values into Object
function normalizeStyleBinding (bindingStyle) { if (Array.isArray(bindingStyle)) { return toObject(bindingStyle) } if (typeof bindingStyle === 'string') { return parseStyleText(bindingStyle) } return bindingStyle }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeIdentificationValues(ids) {\n const normalized = {};\n Object.entries(ids).forEach(([marker, value]) => {\n if (value === null) {\n normalized[marker] = null;\n }\n else if (Array.isArray(value)) {\n normalized[marker] = value.map((v) => v.toString...
[ "0.61348504", "0.60356313", "0.58325696", "0.58279186", "0.58279186", "0.58279186", "0.568786", "0.568786", "0.5687816", "0.56414163", "0.5611286", "0.5611286", "0.5611286", "0.5611286", "0.5611286", "0.5611286", "0.5611286", "0.55655813", "0.55638725", "0.5559283", "0.555898...
0.0
-1
parent component style should be after child's so that parent component's style could override it
function getStyle (vnode, checkChild) { var res = {}; var styleData; if (checkChild) { var childNode = vnode; while (childNode.componentInstance) { childNode = childNode.componentInstance._vnode; if ( childNode && childNode.data && (styleData = normalizeStyleData(childNode.data)) ) { extend(res, styleData); } } } if ((styleData = normalizeStyleData(vnode.data))) { extend(res, styleData); } var parentNode = vnode; while ((parentNode = parentNode.parent)) { if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) { extend(res, styleData); } } return res }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getChildStyle() {\n\t\treturn {\n\t\t\tposition: 'relative'\n\t\t};\n\t}", "function inheirtInlineStyles(parent, el){\n\t\tvar style = parent.getProperty('style');\n\t\t\n\t\t// Put parent styles before child styles.\n\t\tstyle && el.setProperty('style', style.replace(/([^;])$/, '$1;') + (el.getProperty('style')...
[ "0.65146637", "0.6496358", "0.61068493", "0.6060124", "0.58075565", "0.55838454", "0.5581019", "0.5567864", "0.5567864", "0.5567864", "0.55646735", "0.55375344", "0.55291593", "0.55291593", "0.5525414", "0.5505463", "0.5496729", "0.54747343", "0.546608", "0.5452551", "0.53919...
0.0
-1
Add class with compatibility for SVG since classList is not supported on SVG elements in IE
function addClass (el, cls) { /* istanbul ignore if */ if (!cls || !(cls = cls.trim())) { return } /* istanbul ignore else */ if (el.classList) { if (cls.indexOf(' ') > -1) { cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); }); } else { el.classList.add(cls); } } else { var cur = " " + (el.getAttribute('class') || '') + " "; if (cur.indexOf(' ' + cls + ' ') < 0) { el.setAttribute('class', (cur + cls).trim()); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hackSVG() {\n\tif (SVGElement && SVGElement.prototype) {\n\n\t\tSVGElement.prototype.hasClass = function(className) {\n\t\t\treturn new RegExp('(\\\\s|^)' + className + '(\\\\s|$)').test(this\n\t\t\t\t\t.getAttribute('class'));\n\t\t};\n\n\t\tSVGElement.prototype.addClass = function(className) {\n\t\t\tif...
[ "0.7646955", "0.7538302", "0.715277", "0.715277", "0.7131344", "0.7131344", "0.71100616", "0.71061164", "0.71061164", "0.70534873", "0.7012893", "0.6931945", "0.6931945", "0.6931945", "0.6931945", "0.6931945", "0.6927917", "0.6918403", "0.6347607", "0.62825215", "0.6246344", ...
0.0
-1
Remove class with compatibility for SVG since classList is not supported on SVG elements in IE
function removeClass (el, cls) { /* istanbul ignore if */ if (!cls || !(cls = cls.trim())) { return } /* istanbul ignore else */ if (el.classList) { if (cls.indexOf(' ') > -1) { cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); }); } else { el.classList.remove(cls); } if (!el.classList.length) { el.removeAttribute('class'); } } else { var cur = " " + (el.getAttribute('class') || '') + " "; var tar = ' ' + cls + ' '; while (cur.indexOf(tar) >= 0) { cur = cur.replace(tar, ' '); } cur = cur.trim(); if (cur) { el.setAttribute('class', cur); } else { el.removeAttribute('class'); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hackSVG() {\n\tif (SVGElement && SVGElement.prototype) {\n\n\t\tSVGElement.prototype.hasClass = function(className) {\n\t\t\treturn new RegExp('(\\\\s|^)' + className + '(\\\\s|$)').test(this\n\t\t\t\t\t.getAttribute('class'));\n\t\t};\n\n\t\tSVGElement.prototype.addClass = function(className) {\n\t\t\tif...
[ "0.78212637", "0.70082444", "0.66950405", "0.6686834", "0.6601462", "0.6501605", "0.64928", "0.64598966", "0.6440813", "0.6439091", "0.6416516", "0.639915", "0.639915", "0.639915", "0.639915", "0.639915", "0.6377093", "0.6373922", "0.6355365", "0.6355365", "0.6350961", "0.6...
0.0
-1
Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers in a localedependent way, using a comma instead of a dot. If comma is not replaced with a dot, the input will be rounded down (i.e. acting as a floor function) causing unexpected behaviors
function toMs (s) { return Number(s.slice(0, -1).replace(',', '.')) * 1000 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function floatFmt(value) { //# str(float)\r\n\tvar precision = 1; //#\r\n\tvar power = Math.pow(10, precision || 0); //#\r\n\treturn String(Math.round(value * power) / power); //#\r\n} //#", "function decimalComma2Dot(ivalue){\n return ivalue.replace(/^([^,]*),/, '$1.');\n}", "toFloat(value){\n return pars...
[ "0.6597131", "0.6470943", "0.6449249", "0.6426498", "0.6417687", "0.6262479", "0.6242373", "0.623794", "0.6237522", "0.62252074", "0.62252074", "0.62139016", "0.61919457", "0.6179374", "0.6178386", "0.61721474", "0.61590827", "0.6158602", "0.61562145", "0.6144109", "0.6144041...
0.0
-1
only used in dev mode
function checkDuration (val, name, vnode) { if (typeof val !== 'number') { warn( "<transition> explicit " + name + " duration is not a valid number - " + "got " + (JSON.stringify(val)) + ".", vnode.context ); } else if (isNaN(val)) { warn( "<transition> explicit " + name + " duration is NaN - " + 'the duration expression might be incorrect.', vnode.context ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isDevMode(){_runModeLocked=true;return _devMode;}", "function isDevMode(){_runModeLocked=true;return _devMode}", "function devDebug(){\n\n}", "function initDevMode() {\n if(!document.getElementById(\"devModeCheckbox\").checked) {\n // If not in dev mode, hide the devModeContainer.\n document....
[ "0.689489", "0.6842149", "0.6738177", "0.64978427", "0.6495801", "0.64551413", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.6330048", "0.63274556", ...
0.0
-1
Normalize a transition hook's argument length. The hook may be: a merged hook (invoker) with the original in .fns a wrapped component method (check ._length) a plain function (.length)
function getHookArgumentsLength (fn) { if (isUndef(fn)) { return false } var invokerFns = fn.fns; if (isDef(invokerFns)) { // invoker return getHookArgumentsLength( Array.isArray(invokerFns) ? invokerFns[0] : invokerFns ) } else { return (fn._length || fn.length) > 1 } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getHookArgumentsLength(fn){if(isUndef(fn)){return false;}var invokerFns=fn.fns;if(isDef(invokerFns)){// invoker\nreturn getHookArgumentsLength(Array.isArray(invokerFns)?invokerFns[0]:invokerFns);}else{return(fn._length||fn.length)>1;}}", "function getHookArgumentsLength(fn){if(isUndef(fn)){return false;...
[ "0.62618375", "0.62618375", "0.59820837", "0.5928923", "0.5928923", "0.5928923", "0.5928923", "0.58920735", "0.58920735", "0.5888032", "0.58659106", "0.58659106", "0.58558553", "0.58558553", "0.5846772", "0.583989" ]
0.0
-1
recursively search for possible transition defined inside the component root
function locateNode (vnode) { return vnode.componentInstance && (!vnode.data || !vnode.data.transition) ? locateNode(vnode.componentInstance._vnode) : vnode }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "calculateTransition(transition) {\n // Start in true state so adding transition can make to uncraftable\n const depth = new Depth({value: 0, craftable: true});\n depth.addTransition(transition);\n transition.depth = depth;\n\n if (transition.newActor) {\n this.setObjectDepth(transition.newActor...
[ "0.55722684", "0.5496103", "0.54526746", "0.5379765", "0.5289822", "0.52707857", "0.5268357", "0.52586865", "0.5094728", "0.5027448", "0.500278", "0.50016326", "0.49774256", "0.49774256", "0.49745646", "0.49745646", "0.49745646", "0.49745646", "0.4963759", "0.4952616", "0.494...
0.0
-1
in case the child is also an abstract component, e.g. we want to recursively retrieve the real component to be rendered
function getRealChild (vnode) { var compOptions = vnode && vnode.componentOptions; if (compOptions && compOptions.Ctor.options.abstract) { return getRealChild(getFirstComponentChild(compOptions.children)) } else { return vnode } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRealChild(vnode){var compOptions=vnode&&vnode.componentOptions;if(compOptions&&compOptions.Ctor.options.abstract){return getRealChild(getFirstComponentChild(compOptions.children));}else{return vnode;}}", "function getRealChild(vnode){var compOptions=vnode&&vnode.componentOptions;if(compOptions&&compO...
[ "0.7714982", "0.7714982", "0.7714982", "0.7405274", "0.7405274", "0.7405274", "0.7405274", "0.7385101", "0.7339899", "0.7311697", "0.7305101", "0.73004496", "0.72857636", "0.72857636", "0.72857636", "0.72857636", "0.72857636", "0.72857636", "0.72857636", "0.72857636", "0.7268...
0.0
-1
wrapper for elt, which removes the elt from the accessibility tree
function eltP(tag, content, className, style) { var e = elt(tag, content, className, style); e.setAttribute("role", "presentation"); return e }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeElement() {\n this.el.parentNode.removeChild(this.el);\n }", "function removeElement(elem){ if (elem) elem.parentNode.removeChild(elem) }", "function removeElement(elem){ if (elem) elem.parentNode.removeChild(elem) }", "@chained\n\tremove() {\n\t\tlet parent = this.element.parentNode;\n\t\tpa...
[ "0.66243064", "0.66047394", "0.66047394", "0.65733343", "0.6453954", "0.6365628", "0.630967", "0.6300336", "0.62783736", "0.6265986", "0.6222522", "0.621535", "0.6156153", "0.61448133", "0.61276156", "0.61124647", "0.60432553", "0.60168844", "0.60155696", "0.6015051", "0.6008...
0.0
-1
Counts the column offset in a string, taking tabs into account. Used mostly to find indentation.
function countColumn(string, end, tabSize, startIndex, startValue) { if (end == null) { end = string.search(/[^\s\u00a0]/); if (end == -1) { end = string.length; } } for (var i = startIndex || 0, n = startValue || 0;;) { var nextTab = string.indexOf("\t", i); if (nextTab < 0 || nextTab >= end) { return n + (end - i) } n += nextTab - i; n += tabSize - (n % tabSize); i = nextTab + 1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countColumn(string, end, tabSize) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1) end = string.length;\n }\n for (var i = 0, n = 0; i < end; ++i) {\n if (string.charAt(i) == \"\\t\") n += tabSize - (n % tabSize);\n else ++n;\n }\n return n...
[ "0.78502226", "0.78502226", "0.78502226", "0.78502226", "0.78502226", "0.78502226", "0.7831976", "0.7831976", "0.7831976", "0.7729814", "0.7729814", "0.7729814", "0.7729814", "0.7565417", "0.754758", "0.754758", "0.754189", "0.7519787", "0.7494672", "0.7494672", "0.7494672", ...
0.7578319
24
The inverse of countColumn find the offset that corresponds to a particular column.
function findColumn(string, goal, tabSize) { for (var pos = 0, col = 0;;) { var nextTab = string.indexOf("\t", pos); if (nextTab == -1) { nextTab = string.length; } var skipped = nextTab - pos; if (nextTab == string.length || col + skipped >= goal) { return pos + Math.min(skipped, goal - col) } col += nextTab - pos; col += tabSize - (col % tabSize); pos = nextTab + 1; if (col >= goal) { return pos } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function firstInColumnLocation(col) {\r\n\t\tvar sets = $['mapsettings'];\r\n\t\tvar point = new Point(sets.columns[col],0);\r\n\t\tvar offset = getRelativePoint(point);\r\n\t\treturn offset.x;\r\n\t}", "function getRelativeColStart(col) {\r\n\t\tvar loc = new Point(sets.columns[col],0);\r\n\t\tvar offset = getR...
[ "0.70205384", "0.67743564", "0.65456825", "0.6530709", "0.65124434", "0.6411066", "0.6409894", "0.6358597", "0.6343458", "0.62936705", "0.6244902", "0.62293106", "0.62137413", "0.6201901", "0.6193824", "0.6193824", "0.6193824", "0.6193824", "0.6193824", "0.6193824", "0.615704...
0.6172094
33
Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
function skipExtendingChars(str, pos, dir) { while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; } return pos }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStart (pos, len) {\n if (pos == null) return 0;\n return pos < 0 ? (len + (pos % len)) : Math.min(len, pos);\n}", "function getPosAsInt(str) {\n\treturn parseInt(str.substr(0, str.length - 2));\n}", "function collectDigits(input, pos) {\n\t\t'use strict';\n\t\twhile (pos < input.length && inp...
[ "0.6599332", "0.65338004", "0.615744", "0.5992839", "0.5762691", "0.5724029", "0.5645194", "0.56270653", "0.54611194", "0.5430243", "0.54005027", "0.5377729", "0.5373956", "0.5371918", "0.5371918", "0.5348312", "0.53179735", "0.53129", "0.52632344", "0.5260393", "0.5196242", ...
0.49218094
82
Returns the value from the range [`from`; `to`] that satisfies `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`. Supports `from` being greater than `to`.
function findFirst(pred, from, to) { // At any point we are certain `to` satisfies `pred`, don't know // whether `from` does. var dir = from > to ? -1 : 1; for (;;) { if (from == to) { return from } var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF); if (mid == from) { return pred(mid) ? from : to } if (pred(mid)) { to = mid; } else { from = mid + dir; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findFirst(pred, from, to) {\n // At any point we are certain `to` satisfies `pred`, don't know\n // whether `from` does.\n var dir = from > to ? -1 : 1;\n for (;;) {\n if (from == to) { return from }\n var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);\n if (mid =...
[ "0.7216477", "0.7216477", "0.7216477", "0.7216477", "0.7216477", "0.7216477", "0.7216477", "0.7216477", "0.7216477", "0.7216477", "0.7190594", "0.71828854", "0.71514124", "0.7010212", "0.65170527", "0.6057039", "0.6018446", "0.6018446", "0.6018446", "0.6018446", "0.6018446", ...
0.7149773
25
Get the bidi ordering for the given line (and cache it). Returns false for lines that are fully lefttoright, and an array of BidiSpan objects otherwise.
function getOrder(line, direction) { var order = line.order; if (order == null) { order = line.order = bidiOrdering(line.text, direction); } return order }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOrder(line) {\n\t\t var order = line.order;\n\t\t if (order == null) order = line.order = bidiOrdering(line.text);\n\t\t return order;\n\t\t }", "function getOrder(line) {\n\t var order = line.order;\n\t if (order == null) order = line.order = bidiOrdering(line.text);\n\t return or...
[ "0.76190144", "0.75846356", "0.75846356", "0.75846356", "0.757759", "0.757759", "0.757759", "0.757759", "0.757759", "0.757759", "0.757759", "0.75555116", "0.7471128", "0.72241294", "0.70990753", "0.7073878", "0.7073878", "0.7073878", "0.7073878", "0.7073878", "0.7073878", "...
0.7135159
25
The DOM events that CodeMirror handles can be overridden by registering a (nonDOM) handler on the editor for the event name, and preventDefaulting the event in that handler.
function signalDOMEvent(cm, e, override) { if (typeof e == "string") { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; } signal(cm, override || e.type, cm, e); return e_defaultPrevented(e) || e.codemirrorIgnore }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function signalDOMEvent(cm, e, override) {\n\t\t if (typeof e == \"string\")\n\t\t { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }\n\t\t signal(cm, override || e.type, cm, e);\n\t\t return e_defaultPrevented(e) || e.codemirrorIgnore\n\t\t }", "function signalDOMEve...
[ "0.7128738", "0.71111244", "0.6913718", "0.6913718", "0.6910328", "0.6910328", "0.6910328", "0.6901468", "0.68783", "0.68783", "0.68783", "0.68783", "0.68783", "0.68783", "0.68783", "0.68783", "0.68783", "0.68783", "0.68783", "0.68238217", "0.68238217", "0.68238217", "0.6...
0.68800914
20
Add on and off methods to a constructor's prototype, to make registering events on such objects more convenient.
function eventMixin(ctor) { ctor.prototype.on = function(type, f) {on(this, type, f);}; ctor.prototype.off = function(type, f) {off(this, type, f);}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static mixin(constr) {\n // instance._events = {};\n [\"on\", \"once\", \"off\", \"emit\"].forEach(name => {\n const property = Object.getOwnPropertyDescriptor(Emitter.prototype, name);\n Object.defineProperty(constr.prototype, name, property);\n });\n }", "function ...
[ "0.68008655", "0.6739639", "0.6739639", "0.6707064", "0.6707064", "0.6707064", "0.66955423", "0.66900265", "0.66089475", "0.6582923", "0.6582923", "0.6582923", "0.6582923", "0.6582923", "0.6582923", "0.6582923", "0.6582923", "0.6582923", "0.6582923", "0.6582923", "0.6528967",...
0.66600436
26
Due to the fact that we still support jurassic IE versions, some compatibility wrappers are needed.
function e_preventDefault(e) { if (e.preventDefault) { e.preventDefault(); } else { e.returnValue = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compIE(){\r\n\tvar agent = navigator.userAgent;\r\n\tif(agent.indexOf(\"MSIE 7.0\") > -1 || agent.indexOf(\"MSIE 8.0\") > - 1 || agent.indexOf(\"Trident 4.0\") > -1 || document.documentMode && document.documentMode <= 5)\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function IEcompatibility() {\n\t// O...
[ "0.71469176", "0.69299966", "0.6810428", "0.67629546", "0.67008024", "0.66899574", "0.6618859", "0.6581652", "0.65160435", "0.64810544", "0.64810544", "0.6473725", "0.6473725", "0.64484614", "0.6369455", "0.6367731", "0.63634837", "0.63515633", "0.6347283", "0.6333643", "0.63...
0.0
-1
Extra arguments are stored as the mode's dependencies, which is used by (legacy) mechanisms like loadmode.js to automatically load a mode. (Preferred mechanism is the require/define calls.)
function defineMode(name, mode) { if (arguments.length > 2) { mode.dependencies = Array.prototype.slice.call(arguments, 2); } modes[name] = mode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function defineMode(name, mode) {\n\t\t if (arguments.length > 2)\n\t\t { mode.dependencies = Array.prototype.slice.call(arguments, 2); }\n\t\t modes[name] = mode;\n\t\t }", "function defineMode(name, mode) {\n if (arguments.length > 2)\n { mode.dependencies = Array.prototype.slice.call(arguments...
[ "0.8086951", "0.7878944", "0.7878944", "0.77991426", "0.7784908", "0.7784908", "0.7784908", "0.7784908", "0.7784908", "0.7784908", "0.7784908", "0.7784908", "0.7784908", "0.7784908", "0.7784908", "0.77408165", "0.58079785", "0.5612584", "0.544827", "0.5402135", "0.5336659", ...
0.7837288
17
Given a mode spec (anything that resolveMode accepts), find and initialize an actual mode object.
function getMode(options, spec) { spec = resolveMode(spec); var mfactory = modes[spec.name]; if (!mfactory) { return getMode(options, "text/plain") } var modeObj = mfactory(options, spec); if (modeExtensions.hasOwnProperty(spec.name)) { var exts = modeExtensions[spec.name]; for (var prop in exts) { if (!exts.hasOwnProperty(prop)) { continue } if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; } modeObj[prop] = exts[prop]; } } modeObj.name = spec.name; if (spec.helperType) { modeObj.helperType = spec.helperType; } if (spec.modeProps) { for (var prop$1 in spec.modeProps) { modeObj[prop$1] = spec.modeProps[prop$1]; } } return modeObj }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resolveMode(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n\n if (typeof found == \"string\") {\n ...
[ "0.7575302", "0.72716063", "0.7203816", "0.7203816", "0.7195392", "0.7165974", "0.7165974", "0.7165974", "0.7165974", "0.7165974", "0.7165974", "0.7165974", "0.7165974", "0.7165974", "0.7165974", "0.7165974", "0.71526504", "0.60369533", "0.603071", "0.603071", "0.603071", "...
0.7215773
16
Given a mode and a state (for that mode), find the inner mode and state at the position that the state refers to.
function innerMode(mode, state) { var info; while (mode.innerMode) { info = mode.innerMode(state); if (!info || info.mode == mode) { break } state = info.state; mode = info.mode; } return info || {mode: mode, state: state} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function innerMode(mode, state) {\n var info\n while (mode.innerMode) {\n info = mode.innerMode(state)\n if (!info || info.mode == mode) { break }\n state = info.state\n mode = info.mode\n }\n return info || {mode: mode, state: state}\n}", "function innerMode(mode, state) {\n var info\n while (...
[ "0.7568635", "0.7568635", "0.7557315", "0.7557315", "0.7557315", "0.7557315", "0.7557315", "0.7557315", "0.7557315", "0.7557315", "0.7557315", "0.7557315", "0.7557315", "0.75532556", "0.7467847", "0.74235874", "0.59452957", "0.5686343", "0.5346445", "0.525255", "0.49554074", ...
0.7568082
16
Find the line object corresponding to the given line number.
function getLine(doc, n) { n -= doc.first; if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") } var chunk = doc; while (!chunk.lines) { for (var i = 0;; ++i) { var child = chunk.children[i], sz = child.chunkSize(); if (n < sz) { chunk = child; break } n -= sz; } } return chunk.lines[n] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function code_line(code, line) {\n return code.findIndex(l => l.line === line)\n}", "function getSourceLine(lineNo) {\n\t\tif ((lineNo >= 1) && (lineNo <= sourceList.length)) {\n\t\t\treturn sourceList[lineNo - 1];\n\t\t}\n\t\telse {\n\t\t\treturn null;\n\t\t}\n\t}", "getLine(x, y) {\n var cell = this.getC...
[ "0.6923067", "0.6493435", "0.6369398", "0.63622373", "0.63431793", "0.62240064", "0.6219294", "0.62174237", "0.62174237", "0.62164", "0.62164", "0.62164", "0.62164", "0.62164", "0.62164", "0.62164", "0.62164", "0.62164", "0.62164", "0.62164", "0.6188852", "0.6188852", "0....
0.59771055
77
Get the part of a document between two positions, as an array of strings.
function getBetween(doc, start, end) { var out = [], n = start.line; doc.iter(start.line, end.line + 1, function (line) { var text = line.text; if (n == end.line) { text = text.slice(0, end.ch); } if (n == start.line) { text = text.slice(start.ch); } out.push(text); ++n; }); return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBetween(doc, start, end) {\n\t var out = [], n = start.line;\n\t doc.iter(start.line, end.line + 1, function(line) {\n\t var text = line.text;\n\t if (n == end.line) text = text.slice(0, end.ch);\n\t if (n == start.line) text = text.slice(start.ch);\n\t out.push(text);\n\t ...
[ "0.7319094", "0.7319094", "0.7319094", "0.7309015", "0.7309015", "0.7307082", "0.7307082", "0.7307082", "0.7307082", "0.7307082", "0.7307082", "0.7307082", "0.7296952", "0.7296952", "0.7296952", "0.7296952", "0.7296952", "0.7296952", "0.7296952", "0.7296952", "0.7296952", "...
0.73343515
16
Get the lines between from and to, as array of strings.
function getLines(doc, from, to) { var out = []; doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function(line) { out.push(line.text); });\n return out;\n }", "function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function(line) { out.push(line.text); });\n return out;\n }", "function getLines(doc...
[ "0.7890253", "0.7890253", "0.7890253", "0.7890253", "0.7890253", "0.7890253", "0.78511894", "0.7843739", "0.7843739", "0.7843739", "0.7803353", "0.7778218", "0.7767461", "0.7767461", "0.7767461", "0.7767461", "0.7767461", "0.7767461", "0.7767461", "0.7767461", "0.7767461", ...
0.78499365
20
Update the height of a line, propagating the height change upwards to parent nodes.
function updateLineHeight(line, height) { var diff = height - line.height; if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n\t\t }", "function updateLineHeight(line, height) {\n\t\t var diff = height - line.height;\n\t\t if (diff) for (var n = line; n; n = n.paren...
[ "0.8321819", "0.8306112", "0.82823384", "0.82823384", "0.82823384", "0.82823384", "0.82823384", "0.82823384", "0.82823384", "0.8276702", "0.8276702", "0.8276702", "0.82609373", "0.82104254", "0.81633735", "0.8157468", "0.8157468", "0.8111964", "0.8111964", "0.8111964", "0.811...
0.82784945
23
Given a line object, find its line number by walking up through its parent links.
function lineNo(line) { if (line.parent == null) { return null } var cur = line.parent, no = indexOf(cur.lines, line); for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { for (var i = 0;; ++i) { if (chunk.children[i] == cur) { break } no += chunk.children[i].chunkSize(); } } return no + cur.first }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineNo(line) {\n\t\t if (line.parent == null) { return null }\n\t\t var cur = line.parent, no = indexOf(cur.lines, line);\n\t\t for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n\t\t for (var i = 0;; ++i) {\n\t\t if (chunk.children[i] == cur) { break }\n\t\t ...
[ "0.7643142", "0.76322407", "0.7603572", "0.759263", "0.759263", "0.759263", "0.7586977", "0.7570517", "0.7570517", "0.7570517", "0.7570517", "0.7570517", "0.7570517", "0.7570517", "0.75112087", "0.75112087", "0.75112087", "0.75112087", "0.75112087", "0.75112087", "0.75112087"...
0.7586683
21
Find the line at the given vertical position, using the height information in the document tree.
function lineAtHeight(chunk, h) { var n = chunk.first; outer: do { for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) { var child = chunk.children[i$1], ch = child.height; if (h < ch) { chunk = child; continue outer } h -= ch; n += child.chunkSize(); } return n } while (!chunk.lines) var i = 0; for (; i < chunk.lines.length; ++i) { var line = chunk.lines[i], lh = line.height; if (h < lh) { break } h -= lh; } return n + i }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLineHeight(line, height) {\n var diff = height - line.height;\n\n if (diff) {\n for (var n = line; n; n = n.parent) {\n n.height += diff;\n }\n }\n } // Given a line object, find its line number by walking up through", "lineBlockAtHeight(height) {\n this.readMeasu...
[ "0.6573439", "0.6411567", "0.63364756", "0.63364756", "0.63364756", "0.63168085", "0.62935245", "0.62645507", "0.62553746", "0.6222597", "0.62026316", "0.62026316", "0.62026316", "0.62026316", "0.62026316", "0.62026316", "0.62026316", "0.6181615", "0.6169785", "0.6169785", "0...
0.6221541
23
A Pos instance represents a position within the text.
function Pos(line, ch, sticky) { if ( sticky === void 0 ) sticky = null; if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) } this.line = line; this.ch = ch; this.sticky = sticky; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Pos (line, ch) {\n if (!(this instanceof Pos)) { return new Pos(line, ch) }\n this.line = line; this.ch = ch\n}", "function Pos(x, y) {\n this.x = x; this.y = y;\n}", "function Pos(line, ch, sticky) {\n\t\t if ( sticky === void 0 ) sticky = null;\n\n\t\t if (!(this instanceof Pos)) { return n...
[ "0.7743738", "0.73251367", "0.73067117", "0.72285366", "0.71545565", "0.7152565", "0.7152565", "0.7152565", "0.7152565", "0.7152565", "0.7152565", "0.7152565", "0.7152565", "0.7152565", "0.7152565", "0.7152565", "0.71458405", "0.71267843", "0.7100741", "0.684175", "0.66544276...
0.7239422
17
Compare two positions, return 0 if they are the same, a negative number when a is less, and a positive number otherwise.
function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function posCompare(a, b) {\n const yDiff = a[1] - b[1];\n if (yDiff !== 0) return yDiff;\n return a[0] - b[0];\n}", "function compare(a,b) {\n if (a.x < b.x)\n return -1;\n if (a.x > b.x)\n return 1;\n return 0;\n }", "function compare (a, b) {\n return a > b ?...
[ "0.7987589", "0.7315597", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7279519", "0.7238396", "0.7220961", "0.7220961", "0.7220961", "0.7220961", "...
0.0
-1
Most of the external API clips given positions to make sure they actually exist within the document.
function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_pos(){\n\t//Write our checking of all positions\n\n\tif (blob_pos_x > c_canvas.width - 20){\n\tblob_pos_x = blob_pos_x - 4;\n\t}\n\tif (blob_pos_x < 0){\n\tblob_pos_x = blob_pos_x + 4;\n\t}\n\tif (blob_pos_y > c_canvas.height - 20){\n\tblob_pos_y = blob_pos_y - 4;\n\t}\n\tif (blob_pos_y < 0){\n\tblo...
[ "0.58655846", "0.5677319", "0.55963266", "0.55354923", "0.55068874", "0.5477934", "0.5437027", "0.5401844", "0.5392482", "0.539082", "0.53700304", "0.5357655", "0.5323163", "0.53189015", "0.53059256", "0.53028315", "0.52992606", "0.5290811", "0.52904624", "0.5288167", "0.5287...
0.0
-1
Compute a style array (an array starting with a mode generation for invalidation followed by pairs of end positions and style strings), which is used to highlight the tokens on the line.
function highlightLine(cm, line, context, forceToEnd) { // A styles array always starts with a number identifying the // mode/overlays that it is based on (for easy invalidation). var st = [cm.state.modeGen], lineClasses = {}; // Compute the base array of styles runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); }, lineClasses, forceToEnd); var state = context.state; // Run overlays, adjust style array. var loop = function ( o ) { context.baseTokens = st; var overlay = cm.state.overlays[o], i = 1, at = 0; context.state = true; runMode(cm, line.text, overlay.mode, context, function (end, style) { var start = i; // Ensure there's a token end at the current position, and that i points at it while (at < end) { var i_end = st[i]; if (i_end > end) { st.splice(i, 1, end, st[i+1], i_end); } i += 2; at = Math.min(end, i_end); } if (!style) { return } if (overlay.opaque) { st.splice(start, i - start, end, "overlay " + style); i = start + 2; } else { for (; start < i; start += 2) { var cur = st[start+1]; st[start+1] = (cur ? cur + " " : "") + "overlay " + style; } } }, lineClasses); context.state = state; context.baseTokens = null; context.baseTokenPos = 1; }; for (var o = 0; o < cm.state.overlays.length; ++o) loop( o ); return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStyleArrayForBlock(block) {\n var text = block.text,\n inlineStyleRanges = block.inlineStyleRanges;\n\n var inlineStyles = {\n BOLD: new Array(text.length),\n ITALIC: new Array(text.length),\n UNDERLINE: new Array(text.length),\n STRIKETHROUGH: new Array(text.length),\n CODE: new ...
[ "0.6524877", "0.64424765", "0.61398196", "0.59578437", "0.58346134", "0.577891", "0.5777643", "0.5777643", "0.56957585", "0.56957585", "0.56957585", "0.56957585", "0.56957585", "0.56957585", "0.56957585", "0.56654114", "0.56654114", "0.5658727", "0.56117076", "0.56117076", "0...
0.5612999
32
Lightweight form of highlight proceed over this line and update state, but don't save a style array. Used for lines that aren't currently visible.
function processLine(cm, text, context, startAt) { var mode = cm.doc.mode; var stream = new StringStream(text, cm.options.tabSize, context); stream.start = stream.pos = startAt || 0; if (text == "") { callBlankLine(mode, context.state); } while (!stream.eol()) { readToken(mode, stream, context.state); stream.start = stream.pos; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "highlightLine(line_num)\n{\n this.highlightSet = line_num;\n}", "function highlightLine(cm, line, state, forceToEnd) {\n\t\t // A styles array always starts with a number identifying the\n\t\t // mode/overlays that it is based on (for easy invalidation).\n\t\t var st = [cm.state.modeGen], lineClasses ...
[ "0.684628", "0.6801102", "0.6746067", "0.6697349", "0.6686436", "0.66719717", "0.6644046", "0.6644046", "0.6644046", "0.6644046", "0.6644046", "0.6644046", "0.6644046", "0.664124", "0.664124", "0.66303146", "0.6629034", "0.66056436", "0.66056436", "0.6593987", "0.6515894", ...
0.0
-1
Utility for getTokenAt and getLineTokens
function takeToken(cm, pos, precise, asArray) { var doc = cm.doc, mode = doc.mode, style; pos = clipPos(doc, pos); var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise); var stream = new StringStream(line.text, cm.options.tabSize, context), tokens; if (asArray) { tokens = []; } while ((asArray || stream.pos < pos.ch) && !stream.eol()) { stream.start = stream.pos; style = readToken(mode, stream, context.state); if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); } } return asArray ? tokens : new Token(stream, style, context.state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function takeToken(cm, pos, precise, asArray) {\n\t\t var doc = cm.doc, mode = doc.mode, style;\n\t\t pos = clipPos(doc, pos);\n\t\t var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);\n\t\t var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;...
[ "0.67839366", "0.66377556", "0.66228", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65925443", "0.65721285", "0.65721285", "0.65721285", "0.65721285", "0.65721285", "0.65526426", ...
0.6679065
17
Run the given mode's parser over a line, calling f for each token.
function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) { var flattenSpans = mode.flattenSpans; if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; } var curStart = 0, curStyle = null; var stream = new StringStream(text, cm.options.tabSize, context), style; var inner = cm.options.addModeClass && [null]; if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); } while (!stream.eol()) { if (stream.pos > cm.options.maxHighlightLength) { flattenSpans = false; if (forceToEnd) { processLine(cm, text, context, stream.pos); } stream.pos = text.length; style = null; } else { style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses); } if (inner) { var mName = inner[0].name; if (mName) { style = "m-" + (style ? mName + " " + style : mName); } } if (!flattenSpans || curStyle != style) { while (curStart < stream.start) { curStart = Math.min(stream.start, curStart + 5000); f(curStart, curStyle); } curStyle = style; } stream.start = stream.pos; } while (curStart < stream.pos) { // Webkit seems to refuse to render text nodes longer than 57444 // characters, and returns inaccurate measurements in nodes // starting around 5000 chars. var pos = Math.min(stream.pos, curStart + 5000); f(pos, curStyle); curStart = pos; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runMode(cm, text, mode, state, f) {\n var flattenSpans = cm.options.flattenSpans;\n var curText = \"\", curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize);\n if (text == \"\" && mode.blankLine) mode.blankLine(state);\n while (!stream.eol()) {\n var style = mode....
[ "0.6838197", "0.6827097", "0.6827097", "0.67748964", "0.66096807", "0.64827806", "0.6438834", "0.63332313", "0.63332313", "0.6289509", "0.6289127", "0.6215229", "0.6215229", "0.6215229", "0.6215229", "0.6215229", "0.6215229", "0.6215229", "0.6215229", "0.6215229", "0.6215229"...
0.6225963
25
Finds the line to start with when starting a parse. Tries to find a line with a stateAfter, so that it can start with a valid state. If that fails, it returns the line with the smallest indentation, which tends to need the least context to parse correctly.
function findStartLine(cm, n, precise) { var minindent, minline, doc = cm.doc; var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100); for (var search = n; search > lim; --search) { if (search <= doc.first) { return doc.first } var line = getLine(doc, search - 1), after = line.stateAfter; if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier)) { return search } var indented = countColumn(line.text, null, cm.options.tabSize); if (minline == null || minindent > indented) { minline = search - 1; minindent = indented; } } return minline }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findStartLine(n) {\n var minindent, minline;\n for (var search = n, lim = n - 40; search > lim; --search) {\n if (search == 0) return 0;\n var line = lines[search-1];\n if (line.stateAfter) return search;\n var indented = line.indentation();\n if (minline == nu...
[ "0.69607425", "0.69534135", "0.69534135", "0.6898711", "0.6818646", "0.6818646", "0.6818646", "0.68133503", "0.67161345", "0.66479206", "0.66479206", "0.66479206", "0.66240996", "0.66035306", "0.66035306", "0.66035306", "0.66035306", "0.66035306", "0.66035306", "0.66035306", ...
0.6713184
25
Search an array of spans for a span matching the given marker.
function getMarkedSpanFor(spans, marker) { if (spans) { for (var i = 0; i < spans.length; ++i) { var span = spans[i]; if (span.marker == marker) { return span } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans...
[ "0.7196434", "0.7196434", "0.7196434", "0.7196434", "0.7196434", "0.7196434", "0.7196434", "0.71662706", "0.7142382", "0.7124794", "0.71201074", "0.71201074", "0.71201074", "0.7105415", "0.7105415", "0.71047986", "0.7089332", "0.7089332", "0.7089332", "0.7089332", "0.7089332"...
0.7183609
20
Remove a span from an array, returning undefined if no spans are left (we don't store arrays for lines without spans).
function removeMarkedSpan(spans, span) { var r; for (var i = 0; i < spans.length; ++i) { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } } return r }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeMarkedSpan(spans, span) {\n\t\t for (var r, i = 0; i < spans.length; ++i)\n\t\t if (spans[i] != span) (r || (r = [])).push(spans[i]);\n\t\t return r;\n\t\t }", "function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r...
[ "0.74046427", "0.7398266", "0.7398266", "0.7398266", "0.7398266", "0.7398266", "0.7398266", "0.7398266", "0.73859435", "0.73859435", "0.73859435", "0.736235", "0.7315828", "0.7315045", "0.7235346", "0.7223111", "0.7223111", "0.72049785", "0.72049785", "0.72049785", "0.7204978...
0.72939557
30
Add a span to a line.
function addMarkedSpan(line, span) { line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; span.marker.attachLine(line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMarkedSpan(line, span) {\r\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\r\n span.marker.attachLine(line);\r\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]\n span.marker.attachLi...
[ "0.7691716", "0.7679906", "0.7679906", "0.7669774", "0.7664771", "0.7664771", "0.7664771", "0.7664771", "0.7664771", "0.7664771", "0.7664771", "0.7664771", "0.7664771", "0.7664771", "0.7664771", "0.7613698", "0.7613698", "0.7613698", "0.7580196", "0.708091", "0.7062368", "0...
0.76913285
16
Used for the algorithm that adjusts markers for a change in the document. These functions cut an array of spans at a given character position, returning an array of remaining chunks (or undefined if nothing remains).
function markedSpansBefore(old, startCh, isInsert) { var nw; if (old) { for (var i = 0; i < old.length; ++i) { var span = old[i], marker = span.marker; var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) { var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh) ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to)); } } } return nw }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n\t\t var found = change[\"spans_\" + doc.id];\n\t\t if (!found) return null;\n\t\t for (var i = 0, nw = []; i < change.text.length; ++i)\n\t\t nw.push(removeClearedSpans(found[i]));\n\t\t return nw;\n\t\t }", "function removeClearedSpans(spans) {\n if (!s...
[ "0.54900527", "0.54873455", "0.54783535", "0.5464072", "0.5464072", "0.5464072", "0.54564095", "0.54564095", "0.54564095", "0.54564095", "0.54564095", "0.54564095", "0.54564095", "0.5442161", "0.5439783", "0.54207414", "0.54207414", "0.54207414", "0.54207414", "0.54207414", "...
0.0
-1
Given a change object, compute the new set of marker spans that cover the line in which the change took place. Removes spans entirely within the change, reconnects spans belonging to the same marker that appear on both sides of the change, and cuts off spans partially within the change. Returns an array of span arrays with one element for each line in (after) the change.
function stretchSpansOverChange(doc, change) { if (change.full) { return null } var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans; var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans; if (!oldFirst && !oldLast) { return null } var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0; // Get the spans that 'stick out' on both sides var first = markedSpansBefore(oldFirst, startCh, isInsert); var last = markedSpansAfter(oldLast, endCh, isInsert); // Next, merge those two ends var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0); if (first) { // Fix up .to properties of first for (var i = 0; i < first.length; ++i) { var span = first[i]; if (span.to == null) { var found = getMarkedSpanFor(last, span.marker); if (!found) { span.to = startCh; } else if (sameLine) { span.to = found.to == null ? null : found.to + offset; } } } } if (last) { // Fix up .from in last (or move them into first in case of sameLine) for (var i$1 = 0; i$1 < last.length; ++i$1) { var span$1 = last[i$1]; if (span$1.to != null) { span$1.to += offset; } if (span$1.from == null) { var found$1 = getMarkedSpanFor(first, span$1.marker); if (!found$1) { span$1.from = offset; if (sameLine) { (first || (first = [])).push(span$1); } } } else { span$1.from += offset; if (sameLine) { (first || (first = [])).push(span$1); } } } } // Make sure we didn't create any zero-length spans if (first) { first = clearEmptySpans(first); } if (last && last != first) { last = clearEmptySpans(last); } var newMarkers = [first]; if (!sameLine) { // Fill gap with whole-line-spans var gap = change.text.length - 2, gapMarkers; if (gap > 0 && first) { for (var i$2 = 0; i$2 < first.length; ++i$2) { if (first[i$2].to == null) { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } } for (var i$3 = 0; i$3 < gap; ++i$3) { newMarkers.push(gapMarkers); } newMarkers.push(last); } return newMarkers }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }", "function getOldSpans(doc, change) {\n var found = change[\"spans_\" +...
[ "0.6803287", "0.6803287", "0.6803287", "0.6803287", "0.6803287", "0.6803287", "0.6803287", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "0.679656", "...
0.66396093
75
Remove spans that are empty and don't have a clearWhenEmpty option of false.
function clearEmptySpans(spans) { for (var i = 0; i < spans.length; ++i) { var span = spans[i]; if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) { spans.splice(i--, 1); } } if (!spans.length) { return null } return spans }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearEmptySpans(spans) {\n\t\t for (var i = 0; i < spans.length; ++i) {\n\t\t var span = spans[i];\n\t\t if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n\t\t spans.splice(i--, 1);\n\t\t }\n\t\t if (!spans.length) return null;\n\t\t retur...
[ "0.7583394", "0.75742966", "0.75742966", "0.75742966", "0.75742966", "0.75742966", "0.75742966", "0.75742966", "0.7569507", "0.7569052", "0.7549425", "0.7549425", "0.7549425", "0.7535491", "0.7530014", "0.7530014", "0.75171536", "0.75171536", "0.75171536", "0.75171536", "0.75...
0.758082
16
Used to 'clip' out readOnly ranges when making a change.
function removeReadOnlyRanges(doc, from, to) { var markers = null; doc.iter(from.line, to.line + 1, function (line) { if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { var mark = line.markedSpans[i].marker; if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) { (markers || (markers = [])).push(mark); } } } }); if (!markers) { return null } var parts = [{from: from, to: to}]; for (var i = 0; i < markers.length; ++i) { var mk = markers[i], m = mk.find(0); for (var j = 0; j < parts.length; ++j) { var p = parts[j]; if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue } var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to); if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) { newParts.push({from: p.from, to: m.from}); } if (dto > 0 || !mk.inclusiveRight && !dto) { newParts.push({from: m.to, to: p.to}); } parts.splice.apply(parts, newParts); j += newParts.length - 3; } } return parts }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clipRange(range, min, max) {\n return range\n .filter(segment => segment[1] >= min && segment[0] <= max)\n .map(segment => [Math.max(segment[0], min), Math.min(segment[1], max)]);\n}", "function removeReadOnlyRanges(doc, from, to) {\n\t\t var markers = null;\n\t\t doc.iter(from.line, to.lin...
[ "0.65469515", "0.64165866", "0.64008033", "0.6282006", "0.6282006", "0.6282006", "0.61560845", "0.61560845", "0.61560845", "0.61560845", "0.61560845", "0.61560845", "0.61560845", "0.6142585", "0.6129644", "0.6123883", "0.6104581", "0.6104581", "0.6104581", "0.6104581", "0.610...
0.615654
19
Connect or disconnect spans from a line.
function detachMarkedSpans(line) { var spans = line.markedSpans; if (!spans) { return } for (var i = 0; i < spans.length; ++i) { spans[i].marker.detachLine(line); } line.markedSpans = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLin...
[ "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "0.5948326", "...
0.0
-1
Helpers used when computing which overlapping collapsed span counts as the larger one.
function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n\n if (lenDiff != 0) {\n return lenDiff;\n }\n\n var aPos = a.find(),\n bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n\n if (fromCmp) {\n retur...
[ "0.61587644", "0.5893051", "0.58752155", "0.58752155", "0.58752155", "0.5844405", "0.5844405", "0.5844405", "0.5844405", "0.5844405", "0.5844405", "0.5844405", "0.5819931", "0.58143693", "0.57663435", "0.57663435", "0.57663435", "0.57663435", "0.57663435", "0.57663435", "0.57...
0.0
-1
Returns a number indicating which of two overlapping collapsed spans is larger (and thus includes the other). Falls back to comparing ids when the spans cover exactly the same range.
function compareCollapsedMarkers(a, b) { var lenDiff = a.lines.length - b.lines.length; if (lenDiff != 0) { return lenDiff } var aPos = a.find(), bPos = b.find(); var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b); if (fromCmp) { return -fromCmp } var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b); if (toCmp) { return toCmp } return b.id - a.id }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n\n if (lenDiff != 0) {\n return lenDiff;\n }\n\n var aPos = a.find(),\n bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n\n if (fromCmp) {\n retur...
[ "0.7142195", "0.693498", "0.693498", "0.693498", "0.693498", "0.693498", "0.693498", "0.693498", "0.691132", "0.691132", "0.691132", "0.6910217", "0.6895199", "0.68564695", "0.6827457", "0.6819273", "0.6819273", "0.68139935", "0.68139935", "0.68139935", "0.68139935", "0.681...
0.6881761
29
Find out whether a line ends or starts in a collapsed span. If so, return the marker for that span.
function collapsedSpanAtSide(line, start) { var sps = sawCollapsedSpans && line.markedSpans, found; if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { sp = sps[i]; if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; } } } return found }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collapsedSpanAtSide(line, start) {\n\t\t var sps = sawCollapsedSpans && line.markedSpans, found;\n\t\t if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n\t\t sp = sps[i];\n\t\t if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n\t\t (!found || compare...
[ "0.77824205", "0.77296805", "0.77296805", "0.77296805", "0.77296805", "0.77296805", "0.77296805", "0.77296805", "0.77273697", "0.77246094", "0.76923454", "0.76923454", "0.76923454", "0.765709", "0.765314", "0.765314", "0.76409036", "0.76277256", "0.76277256", "0.76277256", "0...
0.77477694
16
Test whether there exists a collapsed span that partially overlaps (covers the start or end, but not both) of a new span. Such overlap is not allowed.
function conflictingCollapsedRange(doc, lineNo, from, to, marker) { var line = getLine(doc, lineNo); var sps = sawCollapsedSpans && line.markedSpans; if (sps) { for (var i = 0; i < sps.length; ++i) { var sp = sps[i]; if (!sp.marker.collapsed) { continue } var found = sp.marker.find(0); var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker); var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker); if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue } if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) || fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0)) { return true } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) continue;\n var found = sp.marker.find(0...
[ "0.6864755", "0.6864755", "0.6864755", "0.6864755", "0.6864755", "0.6864755", "0.685666", "0.6841365", "0.68317807", "0.68317807", "0.682337", "0.6810524", "0.6806325", "0.6797459", "0.67893624", "0.67893624", "0.67893624", "0.67893624", "0.67893624", "0.67893624", "0.6789362...
0.68406713
15
A visual line is a line as drawn on the screen. Folding, for example, can cause multiple logical lines to appear on the same visual line. This finds the start of the visual line that the given line is part of (usually that is the line itself).
function visualLine(line) { var merged; while (merged = collapsedSpanAtStart(line)) { line = merged.find(-1, true).line; } return line }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t line = merged.find(-1, true).line;\n\t\t return line;\n\t\t }", "function visualLine(line) {\n\t\t var merged;\n\t\t while (merged = collapsedSpanAtStart(line))\n\t\t { line = merged.fi...
[ "0.8249708", "0.82403517", "0.82310456", "0.82310456", "0.82310456", "0.8211458", "0.81782895", "0.81782895", "0.81782895", "0.81782895", "0.81782895", "0.81782895", "0.81782895", "0.8173139", "0.8154529", "0.8154529", "0.8154529", "0.8154529", "0.8154529", "0.8154529", "0.81...
0.81785846
20
Returns an array of logical lines that continue the visual line started by the argument, or undefined if there are no such lines.
function visualLineContinued(line) { var merged, lines; while (merged = collapsedSpanAtEnd(line)) { line = merged.find(1, true).line ;(lines || (lines = [])).push(line); } return lines }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLineContinued(line) {\n var merged, lines;\n\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n (lines || (lines = [])).push(line);\n }\n\n return lines;\n } // Get the line number of the start of the visual line that the", "function visualLi...
[ "0.6936979", "0.6631404", "0.65844053", "0.65823203", "0.65823203", "0.65823203", "0.65823203", "0.65823203", "0.65823203", "0.65823203", "0.6580827", "0.6580827", "0.6580827", "0.6562891", "0.65574646", "0.6548238", "0.6548238", "0.6512879", "0.6512879", "0.6512879", "0.6512...
0.6574651
25
Get the line number of the start of the visual line that the given line number is part of.
function visualLineNo(doc, lineN) { var line = getLine(doc, lineN), vis = visualLine(line); if (line == vis) { return lineN } return lineNo(vis) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN),\n vis = visualLine(line);\n\n if (line == vis) {\n return lineN;\n }\n\n return lineNo(vis);\n } // Get the line number of the start of the next visual line after", "function visualLineNo(doc, lineN) {\n\t\t var lin...
[ "0.7972053", "0.74883324", "0.7423042", "0.74064523", "0.74064523", "0.74064523", "0.7404007", "0.7404007", "0.7404007", "0.7404007", "0.7404007", "0.7404007", "0.7404007", "0.7374401", "0.7374401", "0.7371742", "0.73660076", "0.7365024", "0.7365024", "0.7365024", "0.7365024"...
0.74559826
18
Get the line number of the start of the next visual line after the given line.
function visualLineEndNo(doc, lineN) { if (lineN > doc.lastLine()) { return lineN } var line = getLine(doc, lineN), merged; if (!lineIsHidden(doc, line)) { return lineN } while (merged = collapsedSpanAtEnd(line)) { line = merged.find(1, true).line; } return lineNo(line) + 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN),\n vis = visualLine(line);\n\n if (line == vis) {\n return lineN;\n }\n\n return lineNo(vis);\n } // Get the line number of the start of the next visual line after", "function nextLine() {\n\t\t_this._compConst('LINE', ...
[ "0.79053533", "0.73212373", "0.70655745", "0.7048663", "0.70483404", "0.704656", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", "0.70358926", ...
0.70266366
45
Compute whether a line is hidden. Lines count as hidden when they are part of a visual line that starts with another line, or when they are entirely covered by collapsed, nonwidget span.
function lineIsHidden(doc, line) { var sps = sawCollapsedSpans && line.markedSpans; if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { sp = sps[i]; if (!sp.marker.collapsed) { continue } if (sp.from == null) { return true } if (sp.marker.widgetNode) { continue } if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) { return true } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var sp, i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) continue;\n if (sp.from == null) return true;\n if (sp.marker.widgetNode) continue;\n if (sp.from == ...
[ "0.85059273", "0.85059273", "0.85059273", "0.85059273", "0.85059273", "0.85059273", "0.85059273", "0.84759015", "0.84702784", "0.8453746", "0.8453746", "0.8453746", "0.844043", "0.8434365", "0.8428665", "0.8419037", "0.8419037", "0.8419037", "0.8419037", "0.8419037", "0.84190...
0.85021085
21
Find the height above the given line.
function heightAtLine(lineObj) { lineObj = visualLine(lineObj); var h = 0, chunk = lineObj.parent; for (var i = 0; i < chunk.lines.length; ++i) { var line = chunk.lines[i]; if (line == lineObj) { break } else { h += line.height; } } for (var p = chunk.parent; p; chunk = p, p = chunk.parent) { for (var i$1 = 0; i$1 < p.children.length; ++i$1) { var cur = p.children[i$1]; if (cur == chunk) { break } else { h += cur.height; } } } return h }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function heightAtLine(lineObj) {\n\t\t lineObj = visualLine(lineObj);\n\t\t\n\t\t var h = 0, chunk = lineObj.parent;\n\t\t for (var i = 0; i < chunk.lines.length; ++i) {\n\t\t var line = chunk.lines[i];\n\t\t if (line == lineObj) break;\n\t\t else h += line.height;\n\t\t }\n\t\t for (...
[ "0.7672805", "0.7669036", "0.7598157", "0.7598157", "0.759206", "0.7560561", "0.7560561", "0.7560561", "0.7560561", "0.7560561", "0.7560561", "0.7560561", "0.75525343", "0.7474777", "0.746032", "0.746032", "0.746032", "0.746032", "0.746032", "0.746032", "0.746032", "0.74603...
0.7555887
27