repo stringclasses 195 values | path stringlengths 4 99 | func_name stringlengths 0 41 | original_string stringlengths 72 56.1k | language stringclasses 1 value | code stringlengths 72 56.1k | code_tokens listlengths 25 8.12k | docstring stringlengths 2 12.5k | docstring_tokens listlengths 1 449 | sha stringclasses 197 values | url stringlengths 88 186 | partition stringclasses 1 value | summary stringlengths 8 338 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/incubator-echarts | src/component/dataZoom/roams.js | mergeControllerParams | function mergeControllerParams(dataZoomInfos) {
var controlType;
// DO NOT use reserved word (true, false, undefined) as key literally. Even if encapsulated
// as string, it is probably revert to reserved word by compress tool. See #7411.
var prefix = 'type_';
var typePriority = {
'type_true': 2,
'type_move': 1,
'type_false': 0,
'type_undefined': -1
};
var preventDefaultMouseMove = true;
zrUtil.each(dataZoomInfos, function (dataZoomInfo) {
var dataZoomModel = dataZoomInfo.dataZoomModel;
var oneType = dataZoomModel.get('disabled', true)
? false
: dataZoomModel.get('zoomLock', true)
? 'move'
: true;
if (typePriority[prefix + oneType] > typePriority[prefix + controlType]) {
controlType = oneType;
}
// Prevent default move event by default. If one false, do not prevent. Otherwise
// users may be confused why it does not work when multiple insideZooms exist.
preventDefaultMouseMove &= dataZoomModel.get('preventDefaultMouseMove', true);
});
return {
controlType: controlType,
opt: {
// RoamController will enable all of these functionalities,
// and the final behavior is determined by its event listener
// provided by each inside zoom.
zoomOnMouseWheel: true,
moveOnMouseMove: true,
moveOnMouseWheel: true,
preventDefaultMouseMove: !!preventDefaultMouseMove
}
};
} | javascript | function mergeControllerParams(dataZoomInfos) {
var controlType;
// DO NOT use reserved word (true, false, undefined) as key literally. Even if encapsulated
// as string, it is probably revert to reserved word by compress tool. See #7411.
var prefix = 'type_';
var typePriority = {
'type_true': 2,
'type_move': 1,
'type_false': 0,
'type_undefined': -1
};
var preventDefaultMouseMove = true;
zrUtil.each(dataZoomInfos, function (dataZoomInfo) {
var dataZoomModel = dataZoomInfo.dataZoomModel;
var oneType = dataZoomModel.get('disabled', true)
? false
: dataZoomModel.get('zoomLock', true)
? 'move'
: true;
if (typePriority[prefix + oneType] > typePriority[prefix + controlType]) {
controlType = oneType;
}
// Prevent default move event by default. If one false, do not prevent. Otherwise
// users may be confused why it does not work when multiple insideZooms exist.
preventDefaultMouseMove &= dataZoomModel.get('preventDefaultMouseMove', true);
});
return {
controlType: controlType,
opt: {
// RoamController will enable all of these functionalities,
// and the final behavior is determined by its event listener
// provided by each inside zoom.
zoomOnMouseWheel: true,
moveOnMouseMove: true,
moveOnMouseWheel: true,
preventDefaultMouseMove: !!preventDefaultMouseMove
}
};
} | [
"function",
"mergeControllerParams",
"(",
"dataZoomInfos",
")",
"{",
"var",
"controlType",
";",
"// DO NOT use reserved word (true, false, undefined) as key literally. Even if encapsulated",
"// as string, it is probably revert to reserved word by compress tool. See #7411.",
"var",
"prefix",... | Merge roamController settings when multiple dataZooms share one roamController. | [
"Merge",
"roamController",
"settings",
"when",
"multiple",
"dataZooms",
"share",
"one",
"roamController",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/dataZoom/roams.js#L189-L230 | train | Merge controller parameters | [
30522,
3853,
13590,
8663,
13181,
10820,
28689,
5244,
1006,
2951,
23221,
10020,
14876,
2015,
1007,
1063,
13075,
2491,
13874,
1025,
1013,
1013,
2079,
2025,
2224,
9235,
2773,
1006,
2995,
1010,
6270,
1010,
6151,
28344,
1007,
2004,
3145,
6719,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/curly.js | prepareIfChecks | function prepareIfChecks(node) {
const preparedChecks = [];
for (let currentNode = node; currentNode; currentNode = currentNode.alternate) {
preparedChecks.push(prepareCheck(currentNode, currentNode.consequent, "if", { condition: true }));
if (currentNode.alternate && currentNode.alternate.type !== "IfStatement") {
preparedChecks.push(prepareCheck(currentNode, currentNode.alternate, "else"));
break;
}
}
if (consistent) {
/*
* If any node should have or already have braces, make sure they
* all have braces.
* If all nodes shouldn't have braces, make sure they don't.
*/
const expected = preparedChecks.some(preparedCheck => {
if (preparedCheck.expected !== null) {
return preparedCheck.expected;
}
return preparedCheck.actual;
});
preparedChecks.forEach(preparedCheck => {
preparedCheck.expected = expected;
});
}
return preparedChecks;
} | javascript | function prepareIfChecks(node) {
const preparedChecks = [];
for (let currentNode = node; currentNode; currentNode = currentNode.alternate) {
preparedChecks.push(prepareCheck(currentNode, currentNode.consequent, "if", { condition: true }));
if (currentNode.alternate && currentNode.alternate.type !== "IfStatement") {
preparedChecks.push(prepareCheck(currentNode, currentNode.alternate, "else"));
break;
}
}
if (consistent) {
/*
* If any node should have or already have braces, make sure they
* all have braces.
* If all nodes shouldn't have braces, make sure they don't.
*/
const expected = preparedChecks.some(preparedCheck => {
if (preparedCheck.expected !== null) {
return preparedCheck.expected;
}
return preparedCheck.actual;
});
preparedChecks.forEach(preparedCheck => {
preparedCheck.expected = expected;
});
}
return preparedChecks;
} | [
"function",
"prepareIfChecks",
"(",
"node",
")",
"{",
"const",
"preparedChecks",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"currentNode",
"=",
"node",
";",
"currentNode",
";",
"currentNode",
"=",
"currentNode",
".",
"alternate",
")",
"{",
"preparedChecks",
".",... | Prepares to check the bodies of a "if", "else if" and "else" chain.
@param {ASTNode} node The first IfStatement node of the chain.
@returns {Object[]} prepared checks for each body of the chain. See `prepareCheck` for more
information. | [
"Prepares",
"to",
"check",
"the",
"bodies",
"of",
"a",
"if",
"else",
"if",
"and",
"else",
"chain",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/curly.js#L315-L346 | train | Prepares if checks for a node | [
30522,
3853,
7374,
10128,
5403,
10603,
1006,
13045,
1007,
1063,
9530,
3367,
4810,
5403,
10603,
1027,
1031,
1033,
1025,
2005,
1006,
2292,
2783,
3630,
3207,
1027,
13045,
1025,
2783,
3630,
3207,
1025,
2783,
3630,
3207,
1027,
2783,
3630,
3207,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/editor/EditorManager.js | _restoreEditorViewState | function _restoreEditorViewState(editor) {
// We want to ignore the current state of the editor, so don't call __getViewState()
var viewState = ViewStateManager.getViewState(editor.document.file);
if (viewState) {
editor.restoreViewState(viewState);
}
} | javascript | function _restoreEditorViewState(editor) {
// We want to ignore the current state of the editor, so don't call __getViewState()
var viewState = ViewStateManager.getViewState(editor.document.file);
if (viewState) {
editor.restoreViewState(viewState);
}
} | [
"function",
"_restoreEditorViewState",
"(",
"editor",
")",
"{",
"// We want to ignore the current state of the editor, so don't call __getViewState()",
"var",
"viewState",
"=",
"ViewStateManager",
".",
"getViewState",
"(",
"editor",
".",
"document",
".",
"file",
")",
";",
"... | Updates _viewStateCache from the given editor's actual current state
@param {!Editor} editor - editor restore cached data
@private | [
"Updates",
"_viewStateCache",
"from",
"the",
"given",
"editor",
"s",
"actual",
"current",
"state"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorManager.js#L129-L135 | train | Restores the current state of the editor | [
30522,
3853,
1035,
9239,
2098,
15660,
8584,
9153,
2618,
1006,
3559,
1007,
1063,
1013,
1013,
2057,
2215,
2000,
8568,
1996,
2783,
2110,
1997,
1996,
3559,
1010,
2061,
2123,
1005,
1056,
2655,
1035,
1035,
2131,
8584,
9153,
2618,
1006,
1007,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | bits/40_harb.js | dbf_to_aoa | function dbf_to_aoa(buf, opts)/*:AOA*/ {
var out/*:AOA*/ = [];
/* TODO: browser based */
var d/*:Block*/ = (new_raw_buf(1)/*:any*/);
switch(opts.type) {
case 'base64': d = s2a(Base64.decode(buf)); break;
case 'binary': d = s2a(buf); break;
case 'buffer':
case 'array': d = buf; break;
}
prep_blob(d, 0);
/* header */
var ft = d.read_shift(1);
var memo = false;
var vfp = false, l7 = false;
switch(ft) {
case 0x02: case 0x03: break;
case 0x30: vfp = true; memo = true; break;
case 0x31: vfp = true; break;
case 0x83: memo = true; break;
case 0x8B: memo = true; break;
case 0x8C: memo = true; l7 = true; break;
case 0xF5: memo = true; break;
default: throw new Error("DBF Unsupported Version: " + ft.toString(16));
}
var /*filedate = new Date(),*/ nrow = 0, fpos = 0;
if(ft == 0x02) nrow = d.read_shift(2);
/*filedate = new Date(d.read_shift(1) + 1900, d.read_shift(1) - 1, d.read_shift(1));*/d.l += 3;
if(ft != 0x02) nrow = d.read_shift(4);
if(ft != 0x02) fpos = d.read_shift(2);
var rlen = d.read_shift(2);
var /*flags = 0,*/ current_cp = 1252;
if(ft != 0x02) {
d.l+=16;
/*flags = */d.read_shift(1);
//if(memo && ((flags & 0x02) === 0)) throw new Error("DBF Flags " + flags.toString(16) + " ft " + ft.toString(16));
/* codepage present in FoxPro */
if(d[d.l] !== 0) current_cp = dbf_codepage_map[d[d.l]];
d.l+=1;
d.l+=2;
}
if(l7) d.l += 36;
/*:: type DBFField = { name:string; len:number; type:string; } */
var fields/*:Array<DBFField>*/ = [], field/*:DBFField*/ = ({}/*:any*/);
var hend = fpos - 10 - (vfp ? 264 : 0), ww = l7 ? 32 : 11;
while(ft == 0x02 ? d.l < d.length && d[d.l] != 0x0d: d.l < hend) {
field = ({}/*:any*/);
field.name = cptable.utils.decode(current_cp, d.slice(d.l, d.l+ww)).replace(/[\u0000\r\n].*$/g,"");
d.l += ww;
field.type = String.fromCharCode(d.read_shift(1));
if(ft != 0x02 && !l7) field.offset = d.read_shift(4);
field.len = d.read_shift(1);
if(ft == 0x02) field.offset = d.read_shift(2);
field.dec = d.read_shift(1);
if(field.name.length) fields.push(field);
if(ft != 0x02) d.l += l7 ? 13 : 14;
switch(field.type) {
case 'B': // VFP Double
if((!vfp || field.len != 8) && opts.WTF) console.log('Skipping ' + field.name + ':' + field.type);
break;
case 'G': // General
case 'P': // Picture
if(opts.WTF) console.log('Skipping ' + field.name + ':' + field.type);
break;
case 'C': // character
case 'D': // date
case 'F': // floating point
case 'I': // long
case 'L': // boolean
case 'M': // memo
case 'N': // number
case 'O': // double
case 'T': // datetime
case 'Y': // currency
case '0': // VFP _NullFlags
case '@': // timestamp
case '+': // autoincrement
break;
default: throw new Error('Unknown Field Type: ' + field.type);
}
}
if(d[d.l] !== 0x0D) d.l = fpos-1;
else if(ft == 0x02) d.l = 0x209;
if(ft != 0x02) {
if(d.read_shift(1) !== 0x0D) throw new Error("DBF Terminator not found " + d.l + " " + d[d.l]);
d.l = fpos;
}
/* data */
var R = 0, C = 0;
out[0] = [];
for(C = 0; C != fields.length; ++C) out[0][C] = fields[C].name;
while(nrow-- > 0) {
if(d[d.l] === 0x2A) { d.l+=rlen; continue; }
++d.l;
out[++R] = []; C = 0;
for(C = 0; C != fields.length; ++C) {
var dd = d.slice(d.l, d.l+fields[C].len); d.l+=fields[C].len;
prep_blob(dd, 0);
var s = cptable.utils.decode(current_cp, dd);
switch(fields[C].type) {
case 'C':
out[R][C] = cptable.utils.decode(current_cp, dd);
out[R][C] = out[R][C].trim();
break;
case 'D':
if(s.length === 8) out[R][C] = new Date(+s.slice(0,4), +s.slice(4,6)-1, +s.slice(6,8));
else out[R][C] = s;
break;
case 'F': out[R][C] = parseFloat(s.trim()); break;
case '+': case 'I': out[R][C] = l7 ? dd.read_shift(-4, 'i') ^ 0x80000000 : dd.read_shift(4, 'i'); break;
case 'L': switch(s.toUpperCase()) {
case 'Y': case 'T': out[R][C] = true; break;
case 'N': case 'F': out[R][C] = false; break;
case ' ': case '?': out[R][C] = false; break; /* NOTE: technically uninitialized */
default: throw new Error("DBF Unrecognized L:|" + s + "|");
} break;
case 'M': /* TODO: handle memo files */
if(!memo) throw new Error("DBF Unexpected MEMO for type " + ft.toString(16));
out[R][C] = "##MEMO##" + (l7 ? parseInt(s.trim(), 10): dd.read_shift(4));
break;
case 'N': out[R][C] = +s.replace(/\u0000/g,"").trim(); break;
case '@': out[R][C] = new Date(dd.read_shift(-8, 'f') - 0x388317533400); break;
case 'T': out[R][C] = new Date((dd.read_shift(4) - 0x253D8C) * 0x5265C00 + dd.read_shift(4)); break;
case 'Y': out[R][C] = dd.read_shift(4,'i')/1e4; break;
case 'O': out[R][C] = -dd.read_shift(-8, 'f'); break;
case 'B': if(vfp && fields[C].len == 8) { out[R][C] = dd.read_shift(8,'f'); break; }
/* falls through */
case 'G': case 'P': dd.l += fields[C].len; break;
case '0':
if(fields[C].name === '_NullFlags') break;
/* falls through */
default: throw new Error("DBF Unsupported data type " + fields[C].type);
}
}
}
if(ft != 0x02) if(d.l < d.length && d[d.l++] != 0x1A) throw new Error("DBF EOF Marker missing " + (d.l-1) + " of " + d.length + " " + d[d.l-1].toString(16));
if(opts && opts.sheetRows) out = out.slice(0, opts.sheetRows);
return out;
} | javascript | function dbf_to_aoa(buf, opts)/*:AOA*/ {
var out/*:AOA*/ = [];
/* TODO: browser based */
var d/*:Block*/ = (new_raw_buf(1)/*:any*/);
switch(opts.type) {
case 'base64': d = s2a(Base64.decode(buf)); break;
case 'binary': d = s2a(buf); break;
case 'buffer':
case 'array': d = buf; break;
}
prep_blob(d, 0);
/* header */
var ft = d.read_shift(1);
var memo = false;
var vfp = false, l7 = false;
switch(ft) {
case 0x02: case 0x03: break;
case 0x30: vfp = true; memo = true; break;
case 0x31: vfp = true; break;
case 0x83: memo = true; break;
case 0x8B: memo = true; break;
case 0x8C: memo = true; l7 = true; break;
case 0xF5: memo = true; break;
default: throw new Error("DBF Unsupported Version: " + ft.toString(16));
}
var /*filedate = new Date(),*/ nrow = 0, fpos = 0;
if(ft == 0x02) nrow = d.read_shift(2);
/*filedate = new Date(d.read_shift(1) + 1900, d.read_shift(1) - 1, d.read_shift(1));*/d.l += 3;
if(ft != 0x02) nrow = d.read_shift(4);
if(ft != 0x02) fpos = d.read_shift(2);
var rlen = d.read_shift(2);
var /*flags = 0,*/ current_cp = 1252;
if(ft != 0x02) {
d.l+=16;
/*flags = */d.read_shift(1);
//if(memo && ((flags & 0x02) === 0)) throw new Error("DBF Flags " + flags.toString(16) + " ft " + ft.toString(16));
/* codepage present in FoxPro */
if(d[d.l] !== 0) current_cp = dbf_codepage_map[d[d.l]];
d.l+=1;
d.l+=2;
}
if(l7) d.l += 36;
/*:: type DBFField = { name:string; len:number; type:string; } */
var fields/*:Array<DBFField>*/ = [], field/*:DBFField*/ = ({}/*:any*/);
var hend = fpos - 10 - (vfp ? 264 : 0), ww = l7 ? 32 : 11;
while(ft == 0x02 ? d.l < d.length && d[d.l] != 0x0d: d.l < hend) {
field = ({}/*:any*/);
field.name = cptable.utils.decode(current_cp, d.slice(d.l, d.l+ww)).replace(/[\u0000\r\n].*$/g,"");
d.l += ww;
field.type = String.fromCharCode(d.read_shift(1));
if(ft != 0x02 && !l7) field.offset = d.read_shift(4);
field.len = d.read_shift(1);
if(ft == 0x02) field.offset = d.read_shift(2);
field.dec = d.read_shift(1);
if(field.name.length) fields.push(field);
if(ft != 0x02) d.l += l7 ? 13 : 14;
switch(field.type) {
case 'B': // VFP Double
if((!vfp || field.len != 8) && opts.WTF) console.log('Skipping ' + field.name + ':' + field.type);
break;
case 'G': // General
case 'P': // Picture
if(opts.WTF) console.log('Skipping ' + field.name + ':' + field.type);
break;
case 'C': // character
case 'D': // date
case 'F': // floating point
case 'I': // long
case 'L': // boolean
case 'M': // memo
case 'N': // number
case 'O': // double
case 'T': // datetime
case 'Y': // currency
case '0': // VFP _NullFlags
case '@': // timestamp
case '+': // autoincrement
break;
default: throw new Error('Unknown Field Type: ' + field.type);
}
}
if(d[d.l] !== 0x0D) d.l = fpos-1;
else if(ft == 0x02) d.l = 0x209;
if(ft != 0x02) {
if(d.read_shift(1) !== 0x0D) throw new Error("DBF Terminator not found " + d.l + " " + d[d.l]);
d.l = fpos;
}
/* data */
var R = 0, C = 0;
out[0] = [];
for(C = 0; C != fields.length; ++C) out[0][C] = fields[C].name;
while(nrow-- > 0) {
if(d[d.l] === 0x2A) { d.l+=rlen; continue; }
++d.l;
out[++R] = []; C = 0;
for(C = 0; C != fields.length; ++C) {
var dd = d.slice(d.l, d.l+fields[C].len); d.l+=fields[C].len;
prep_blob(dd, 0);
var s = cptable.utils.decode(current_cp, dd);
switch(fields[C].type) {
case 'C':
out[R][C] = cptable.utils.decode(current_cp, dd);
out[R][C] = out[R][C].trim();
break;
case 'D':
if(s.length === 8) out[R][C] = new Date(+s.slice(0,4), +s.slice(4,6)-1, +s.slice(6,8));
else out[R][C] = s;
break;
case 'F': out[R][C] = parseFloat(s.trim()); break;
case '+': case 'I': out[R][C] = l7 ? dd.read_shift(-4, 'i') ^ 0x80000000 : dd.read_shift(4, 'i'); break;
case 'L': switch(s.toUpperCase()) {
case 'Y': case 'T': out[R][C] = true; break;
case 'N': case 'F': out[R][C] = false; break;
case ' ': case '?': out[R][C] = false; break; /* NOTE: technically uninitialized */
default: throw new Error("DBF Unrecognized L:|" + s + "|");
} break;
case 'M': /* TODO: handle memo files */
if(!memo) throw new Error("DBF Unexpected MEMO for type " + ft.toString(16));
out[R][C] = "##MEMO##" + (l7 ? parseInt(s.trim(), 10): dd.read_shift(4));
break;
case 'N': out[R][C] = +s.replace(/\u0000/g,"").trim(); break;
case '@': out[R][C] = new Date(dd.read_shift(-8, 'f') - 0x388317533400); break;
case 'T': out[R][C] = new Date((dd.read_shift(4) - 0x253D8C) * 0x5265C00 + dd.read_shift(4)); break;
case 'Y': out[R][C] = dd.read_shift(4,'i')/1e4; break;
case 'O': out[R][C] = -dd.read_shift(-8, 'f'); break;
case 'B': if(vfp && fields[C].len == 8) { out[R][C] = dd.read_shift(8,'f'); break; }
/* falls through */
case 'G': case 'P': dd.l += fields[C].len; break;
case '0':
if(fields[C].name === '_NullFlags') break;
/* falls through */
default: throw new Error("DBF Unsupported data type " + fields[C].type);
}
}
}
if(ft != 0x02) if(d.l < d.length && d[d.l++] != 0x1A) throw new Error("DBF EOF Marker missing " + (d.l-1) + " of " + d.length + " " + d[d.l-1].toString(16));
if(opts && opts.sheetRows) out = out.slice(0, opts.sheetRows);
return out;
} | [
"function",
"dbf_to_aoa",
"(",
"buf",
",",
"opts",
")",
"/*:AOA*/",
"{",
"var",
"out",
"/*:AOA*/",
"=",
"[",
"]",
";",
"/* TODO: browser based */",
"var",
"d",
"/*:Block*/",
"=",
"(",
"new_raw_buf",
"(",
"1",
")",
"/*:any*/",
")",
";",
"switch",
"(",
"op... | /* TODO: find an actual specification | [
"/",
"*",
"TODO",
":",
"find",
"an",
"actual",
"specification"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/40_harb.js#L44-L185 | train | Convert a DBF buffer to AOA | [
30522,
3853,
16962,
2546,
1035,
2000,
1035,
20118,
2050,
1006,
20934,
2546,
1010,
23569,
2015,
1007,
1013,
1008,
1024,
20118,
2050,
1008,
1013,
1063,
13075,
2041,
1013,
1008,
1024,
20118,
2050,
1008,
1013,
1027,
1031,
1033,
1025,
1013,
1008... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/prefer-object-spread.js | getEndWithSpaces | function getEndWithSpaces(token, sourceCode) {
const text = sourceCode.text;
let end = token.range[1];
// Detect spaces after the token.
while (ANY_SPACE.test(text[end] || "")) {
end += 1;
}
return end;
} | javascript | function getEndWithSpaces(token, sourceCode) {
const text = sourceCode.text;
let end = token.range[1];
// Detect spaces after the token.
while (ANY_SPACE.test(text[end] || "")) {
end += 1;
}
return end;
} | [
"function",
"getEndWithSpaces",
"(",
"token",
",",
"sourceCode",
")",
"{",
"const",
"text",
"=",
"sourceCode",
".",
"text",
";",
"let",
"end",
"=",
"token",
".",
"range",
"[",
"1",
"]",
";",
"// Detect spaces after the token.",
"while",
"(",
"ANY_SPACE",
"."... | Get the range of a given token and around whitespaces.
@param {Token} token The token to get range.
@param {SourceCode} sourceCode The source code object to get tokens.
@returns {number} The start of the range of the token and around whitespaces. | [
"Get",
"the",
"range",
"of",
"a",
"given",
"token",
"and",
"around",
"whitespaces",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-object-spread.js#L131-L141 | train | Get the end of the token | [
30522,
3853,
2131,
10497,
24415,
23058,
2015,
1006,
19204,
1010,
3120,
16044,
1007,
1063,
9530,
3367,
3793,
1027,
3120,
16044,
1012,
3793,
1025,
2292,
2203,
1027,
19204,
1012,
2846,
1031,
1015,
1033,
1025,
1013,
1013,
11487,
7258,
2044,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/json/encodeBook.js | encodeBookToJson | function encodeBookToJson(book) {
var config = book.getConfig();
var language = book.getLanguage();
var variables = config.getValue('variables', {});
return {
summary: encodeSummary(book.getSummary()),
glossary: encodeGlossary(book.getGlossary()),
readme: encodeReadme(book.getReadme()),
config: book.getConfig().getValues().toJS(),
languages: book.isMultilingual()? encodeLanguages(book.getLanguages()) : undefined,
gitbook: {
version: gitbook.version,
time: gitbook.START_TIME
},
book: extend({
language: language? language : undefined
}, variables.toJS())
};
} | javascript | function encodeBookToJson(book) {
var config = book.getConfig();
var language = book.getLanguage();
var variables = config.getValue('variables', {});
return {
summary: encodeSummary(book.getSummary()),
glossary: encodeGlossary(book.getGlossary()),
readme: encodeReadme(book.getReadme()),
config: book.getConfig().getValues().toJS(),
languages: book.isMultilingual()? encodeLanguages(book.getLanguages()) : undefined,
gitbook: {
version: gitbook.version,
time: gitbook.START_TIME
},
book: extend({
language: language? language : undefined
}, variables.toJS())
};
} | [
"function",
"encodeBookToJson",
"(",
"book",
")",
"{",
"var",
"config",
"=",
"book",
".",
"getConfig",
"(",
")",
";",
"var",
"language",
"=",
"book",
".",
"getLanguage",
"(",
")",
";",
"var",
"variables",
"=",
"config",
".",
"getValue",
"(",
"'variables'... | Encode a book to JSON
@param {Book}
@return {Object} | [
"Encode",
"a",
"book",
"to",
"JSON"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/json/encodeBook.js#L15-L37 | train | Encode a book to JSON | [
30522,
3853,
4372,
16044,
8654,
3406,
22578,
2239,
1006,
2338,
1007,
1063,
13075,
9530,
8873,
2290,
1027,
2338,
1012,
2131,
8663,
8873,
2290,
1006,
1007,
1025,
13075,
2653,
1027,
2338,
1012,
2131,
25023,
6692,
3351,
1006,
1007,
1025,
13075,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/BarInPageEnabler.js | function(oRM, oControl) {
var sTag = oControl.getHTMLTag().toLowerCase();
oRM.write("<" + sTag);
oRM.addClass(IBAR_CSS_CLASS);
if (this.shouldAddIBarContext(oControl)) {
oRM.addClass(IBAR_CSS_CLASS + "-CTX");
}
oRM.writeControlData(oControl);
// call the hooks
BarInPageEnabler.renderTooltip(oRM, oControl);
this.decorateRootElement(oRM, oControl);
oRM.writeClasses();
oRM.writeStyles();
oRM.write(">");
this.renderBarContent(oRM, oControl);
oRM.write("</" + sTag + ">");
} | javascript | function(oRM, oControl) {
var sTag = oControl.getHTMLTag().toLowerCase();
oRM.write("<" + sTag);
oRM.addClass(IBAR_CSS_CLASS);
if (this.shouldAddIBarContext(oControl)) {
oRM.addClass(IBAR_CSS_CLASS + "-CTX");
}
oRM.writeControlData(oControl);
// call the hooks
BarInPageEnabler.renderTooltip(oRM, oControl);
this.decorateRootElement(oRM, oControl);
oRM.writeClasses();
oRM.writeStyles();
oRM.write(">");
this.renderBarContent(oRM, oControl);
oRM.write("</" + sTag + ">");
} | [
"function",
"(",
"oRM",
",",
"oControl",
")",
"{",
"var",
"sTag",
"=",
"oControl",
".",
"getHTMLTag",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"oRM",
".",
"write",
"(",
"\"<\"",
"+",
"sTag",
")",
";",
"oRM",
".",
"addClass",
"(",
"IBAR_CSS_CLASS"... | Rendering
Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
@protected
@param {sap.ui.core.RenderManager} oRM the RenderManager that can be used for writing to the render output buffer.
@param {sap.ui.core.Control} oControl an object representation of the control that should be rendered. | [
"Rendering",
"Renders",
"the",
"HTML",
"for",
"the",
"given",
"control",
"using",
"the",
"provided",
"{"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/BarInPageEnabler.js#L223-L246 | train | Renders the HTML for the given control. | [
30522,
3853,
1006,
2030,
2213,
1010,
1051,
8663,
13181,
2140,
1007,
1063,
13075,
2358,
8490,
1027,
1051,
8663,
13181,
2140,
1012,
2131,
11039,
19968,
15900,
1006,
1007,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1025,
2030,
2213,
1012,
433... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/enablement/report/QUnitReport.js | function(oData) {
if (oData) {
var aChildren = oData.children;
aChildren.forEach(function(oGroup) {
this._createModule(oGroup);
}, this);
}
this.setProperty("data", oData);
} | javascript | function(oData) {
if (oData) {
var aChildren = oData.children;
aChildren.forEach(function(oGroup) {
this._createModule(oGroup);
}, this);
}
this.setProperty("data", oData);
} | [
"function",
"(",
"oData",
")",
"{",
"if",
"(",
"oData",
")",
"{",
"var",
"aChildren",
"=",
"oData",
".",
"children",
";",
"aChildren",
".",
"forEach",
"(",
"function",
"(",
"oGroup",
")",
"{",
"this",
".",
"_createModule",
"(",
"oGroup",
")",
";",
"}... | Sets the data to use as a base for the QUnit tests.
@param {object} oData the data to display
@public | [
"Sets",
"the",
"data",
"to",
"use",
"as",
"a",
"base",
"for",
"the",
"QUnit",
"tests",
".",
"@param",
"{",
"object",
"}",
"oData",
"the",
"data",
"to",
"display"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/enablement/report/QUnitReport.js#L63-L71 | train | Creates the modules from the given data object. | [
30522,
3853,
1006,
1051,
2850,
2696,
1007,
1063,
2065,
1006,
1051,
2850,
2696,
1007,
1063,
13075,
9353,
19466,
16200,
2078,
1027,
1051,
2850,
2696,
1012,
2336,
1025,
9353,
19466,
16200,
2078,
1012,
18921,
6776,
1006,
3853,
1006,
13958,
2210... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
benweet/stackedit | src/services/timeSvc.js | isDayFirst | function isDayFirst() {
if (dayFirst !== null) {
return dayFirst;
}
if (!('Intl' in window)) {
return false;
}
const options = { day: 'numeric', month: 'short' };
const formatter = new window.Intl.DateTimeFormat(undefined, options);
const output = formatter.format(new Date(0));
dayFirst = !!output.match(/^\d/);
return dayFirst;
} | javascript | function isDayFirst() {
if (dayFirst !== null) {
return dayFirst;
}
if (!('Intl' in window)) {
return false;
}
const options = { day: 'numeric', month: 'short' };
const formatter = new window.Intl.DateTimeFormat(undefined, options);
const output = formatter.format(new Date(0));
dayFirst = !!output.match(/^\d/);
return dayFirst;
} | [
"function",
"isDayFirst",
"(",
")",
"{",
"if",
"(",
"dayFirst",
"!==",
"null",
")",
"{",
"return",
"dayFirst",
";",
"}",
"if",
"(",
"!",
"(",
"'Intl'",
"in",
"window",
")",
")",
"{",
"return",
"false",
";",
"}",
"const",
"options",
"=",
"{",
"day",... | Private: Determine if the day should be formatted before the month name in the user's current locale. For example, `9 Jun` for en-GB and `Jun 9` for en-US. Returns true if the day appears before the month. | [
"Private",
":",
"Determine",
"if",
"the",
"day",
"should",
"be",
"formatted",
"before",
"the",
"month",
"name",
"in",
"the",
"user",
"s",
"current",
"locale",
".",
"For",
"example",
"9",
"Jun",
"for",
"en",
"-",
"GB",
"and",
"Jun",
"9",
"for",
"en",
... | 91f8cf3c10b75df65b69f9181cee8151d65a788d | https://github.com/benweet/stackedit/blob/91f8cf3c10b75df65b69f9181cee8151d65a788d/src/services/timeSvc.js#L76-L91 | train | Check if the current date is the first day of the week | [
30522,
3853,
2003,
10259,
8873,
12096,
1006,
1007,
1063,
2065,
1006,
2154,
8873,
12096,
999,
1027,
1027,
19701,
1007,
1063,
2709,
2154,
8873,
12096,
1025,
1065,
2065,
1006,
999,
1006,
1005,
20014,
2140,
1005,
1999,
3332,
1007,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
juliangarnier/anime | lib/anime.js | elastic | function elastic(amplitude, period) {
if ( amplitude === void 0 ) amplitude = 1;
if ( period === void 0 ) period = .5;
var a = minMax(amplitude, 1, 10);
var p = minMax(period, .1, 2);
return function (t) {
return (t === 0 || t === 1) ? t :
-a * Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2) * Math.asin(1 / a))) * (Math.PI * 2)) / p);
}
} | javascript | function elastic(amplitude, period) {
if ( amplitude === void 0 ) amplitude = 1;
if ( period === void 0 ) period = .5;
var a = minMax(amplitude, 1, 10);
var p = minMax(period, .1, 2);
return function (t) {
return (t === 0 || t === 1) ? t :
-a * Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2) * Math.asin(1 / a))) * (Math.PI * 2)) / p);
}
} | [
"function",
"elastic",
"(",
"amplitude",
",",
"period",
")",
"{",
"if",
"(",
"amplitude",
"===",
"void",
"0",
")",
"amplitude",
"=",
"1",
";",
"if",
"(",
"period",
"===",
"void",
"0",
")",
"period",
"=",
".5",
";",
"var",
"a",
"=",
"minMax",
"(",
... | Elastic easing adapted from jQueryUI http://api.jqueryui.com/easings/ | [
"Elastic",
"easing",
"adapted",
"from",
"jQueryUI",
"http",
":",
"//",
"api",
".",
"jqueryui",
".",
"com",
"/",
"easings",
"/"
] | 875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a | https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/lib/anime.js#L134-L144 | train | elastic function | [
30522,
3853,
21274,
1006,
22261,
1010,
2558,
1007,
1063,
2065,
1006,
22261,
1027,
1027,
1027,
11675,
1014,
1007,
22261,
1027,
1015,
1025,
2065,
1006,
2558,
1027,
1027,
1027,
11675,
1014,
1007,
2558,
1027,
1012,
1019,
1025,
13075,
1037,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | safegetzipfile | function safegetzipfile(zip, file) {
var k = keys(zip.files);
var f = file.toLowerCase(), g = f.replace(/\//g,'\\');
for(var i=0; i<k.length; ++i) {
var n = k[i].toLowerCase();
if(f == n || g == n) return zip.files[k[i]];
}
return null;
} | javascript | function safegetzipfile(zip, file) {
var k = keys(zip.files);
var f = file.toLowerCase(), g = f.replace(/\//g,'\\');
for(var i=0; i<k.length; ++i) {
var n = k[i].toLowerCase();
if(f == n || g == n) return zip.files[k[i]];
}
return null;
} | [
"function",
"safegetzipfile",
"(",
"zip",
",",
"file",
")",
"{",
"var",
"k",
"=",
"keys",
"(",
"zip",
".",
"files",
")",
";",
"var",
"f",
"=",
"file",
".",
"toLowerCase",
"(",
")",
",",
"g",
"=",
"f",
".",
"replace",
"(",
"/",
"\\/",
"/",
"g",
... | /* Part 2 Section 10.1.2 "Mapping Content Types" Names are case-insensitive /* OASIS does not comment on filename case sensitivity | [
"/",
"*",
"Part",
"2",
"Section",
"10",
".",
"1",
".",
"2",
"Mapping",
"Content",
"Types",
"Names",
"are",
"case",
"-",
"insensitive",
"/",
"*",
"OASIS",
"does",
"not",
"comment",
"on",
"filename",
"case",
"sensitivity"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L2801-L2809 | train | Get a file from a zip object | [
30522,
3853,
3647,
18150,
5831,
14376,
9463,
1006,
14101,
1010,
5371,
1007,
1063,
13075,
1047,
1027,
6309,
1006,
14101,
1012,
6764,
1007,
1025,
13075,
1042,
1027,
5371,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1010,
1043,
1027,
1042,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/components/tracked-controls-webvr.js | function () {
var data = this.data;
var controller = controllerUtils.findMatchingControllerWebVR(
this.system.controllers,
data.id,
data.idPrefix,
data.hand,
data.controller
);
this.controller = controller;
// Legacy handle to the controller for old components.
this.el.components['tracked-controls'].controller = controller;
if (this.data.autoHide) { this.el.object3D.visible = !!this.controller; }
} | javascript | function () {
var data = this.data;
var controller = controllerUtils.findMatchingControllerWebVR(
this.system.controllers,
data.id,
data.idPrefix,
data.hand,
data.controller
);
this.controller = controller;
// Legacy handle to the controller for old components.
this.el.components['tracked-controls'].controller = controller;
if (this.data.autoHide) { this.el.object3D.visible = !!this.controller; }
} | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
";",
"var",
"controller",
"=",
"controllerUtils",
".",
"findMatchingControllerWebVR",
"(",
"this",
".",
"system",
".",
"controllers",
",",
"data",
".",
"id",
",",
"data",
".",
"idPrefix",
... | Handle update controller match criteria (such as `id`, `idPrefix`, `hand`, `controller`) | [
"Handle",
"update",
"controller",
"match",
"criteria",
"(",
"such",
"as",
"id",
"idPrefix",
"hand",
"controller",
")"
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/tracked-controls-webvr.js#L93-L108 | train | Find the controller for the current card | [
30522,
3853,
1006,
1007,
1063,
13075,
2951,
1027,
2023,
1012,
2951,
1025,
13075,
11486,
1027,
11486,
21823,
4877,
1012,
2424,
18900,
8450,
8663,
13181,
10820,
8545,
2497,
19716,
1006,
2023,
1012,
2291,
1012,
21257,
1010,
2951,
1012,
8909,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
muaz-khan/RTCMultiConnection | dev/MediaStreamRecorder.js | StereoAudioRecorder | function StereoAudioRecorder(mediaStream) {
// void start(optional long timeSlice)
// timestamp to fire "ondataavailable"
this.start = function(timeSlice) {
timeSlice = timeSlice || 1000;
mediaRecorder = new StereoAudioRecorderHelper(mediaStream, this);
mediaRecorder.record();
timeout = setInterval(function() {
mediaRecorder.requestData();
}, timeSlice);
};
this.stop = function() {
if (mediaRecorder) {
mediaRecorder.stop();
clearTimeout(timeout);
this.onstop();
}
};
this.pause = function() {
if (!mediaRecorder) {
return;
}
mediaRecorder.pause();
};
this.resume = function() {
if (!mediaRecorder) {
return;
}
mediaRecorder.resume();
};
this.ondataavailable = function() {};
this.onstop = function() {};
// Reference to "StereoAudioRecorder" object
var mediaRecorder;
var timeout;
} | javascript | function StereoAudioRecorder(mediaStream) {
// void start(optional long timeSlice)
// timestamp to fire "ondataavailable"
this.start = function(timeSlice) {
timeSlice = timeSlice || 1000;
mediaRecorder = new StereoAudioRecorderHelper(mediaStream, this);
mediaRecorder.record();
timeout = setInterval(function() {
mediaRecorder.requestData();
}, timeSlice);
};
this.stop = function() {
if (mediaRecorder) {
mediaRecorder.stop();
clearTimeout(timeout);
this.onstop();
}
};
this.pause = function() {
if (!mediaRecorder) {
return;
}
mediaRecorder.pause();
};
this.resume = function() {
if (!mediaRecorder) {
return;
}
mediaRecorder.resume();
};
this.ondataavailable = function() {};
this.onstop = function() {};
// Reference to "StereoAudioRecorder" object
var mediaRecorder;
var timeout;
} | [
"function",
"StereoAudioRecorder",
"(",
"mediaStream",
")",
"{",
"// void start(optional long timeSlice)",
"// timestamp to fire \"ondataavailable\"",
"this",
".",
"start",
"=",
"function",
"(",
"timeSlice",
")",
"{",
"timeSlice",
"=",
"timeSlice",
"||",
"1000",
";",
"m... | ====================== StereoAudioRecorder.js | [
"======================",
"StereoAudioRecorder",
".",
"js"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/MediaStreamRecorder.js#L1375-L1420 | train | StereoAudioRecorder constructor. | [
30522,
3853,
12991,
19513,
25346,
8586,
8551,
2121,
1006,
2865,
21422,
1007,
1063,
1013,
1013,
11675,
2707,
1006,
11887,
2146,
2335,
13231,
1007,
1013,
1013,
2335,
15464,
2361,
2000,
2543,
1000,
2006,
2850,
2696,
12462,
11733,
3468,
1000,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/command/CommandManager.js | register | function register(name, id, commandFn) {
if (_commands[id]) {
console.log("Attempting to register an already-registered command: " + id);
return null;
}
if (!name || !id || !commandFn) {
console.error("Attempting to register a command with a missing name, id, or command function:" + name + " " + id);
return null;
}
var command = new Command(name, id, commandFn);
_commands[id] = command;
exports.trigger("commandRegistered", command);
return command;
} | javascript | function register(name, id, commandFn) {
if (_commands[id]) {
console.log("Attempting to register an already-registered command: " + id);
return null;
}
if (!name || !id || !commandFn) {
console.error("Attempting to register a command with a missing name, id, or command function:" + name + " " + id);
return null;
}
var command = new Command(name, id, commandFn);
_commands[id] = command;
exports.trigger("commandRegistered", command);
return command;
} | [
"function",
"register",
"(",
"name",
",",
"id",
",",
"commandFn",
")",
"{",
"if",
"(",
"_commands",
"[",
"id",
"]",
")",
"{",
"console",
".",
"log",
"(",
"\"Attempting to register an already-registered command: \"",
"+",
"id",
")",
";",
"return",
"null",
";"... | Registers a global command.
@param {string} name - text that will be displayed in the UI to represent command
@param {string} id - unique identifier for command.
Core commands in Brackets use a simple command title as an id, for example "open.file".
Extensions should use the following format: "author.myextension.mycommandname".
For example, "lschmitt.csswizard.format.css".
@param {function(...)} commandFn - the function to call when the command is executed. Any arguments passed to
execute() (after the id) are passed as arguments to the function. If the function is asynchronous,
it must return a jQuery promise that is resolved when the command completes. Otherwise, the
CommandManager will assume it is synchronous, and return a promise that is already resolved.
@return {?Command} | [
"Registers",
"a",
"global",
"command",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/CommandManager.js#L189-L205 | train | Registers a command with the kernel. | [
30522,
3853,
4236,
1006,
2171,
1010,
8909,
1010,
3094,
2546,
2078,
1007,
1063,
2065,
1006,
1035,
10954,
1031,
8909,
1033,
1007,
1063,
10122,
1012,
8833,
1006,
1000,
7161,
2000,
4236,
2019,
2525,
1011,
5068,
3094,
1024,
1000,
1009,
8909,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | mxEdgeHandler | function mxEdgeHandler(state)
{
if (state != null)
{
this.state = state;
this.init();
// Handles escape keystrokes
this.escapeHandler = mxUtils.bind(this, function(sender, evt)
{
var dirty = this.index != null;
this.reset();
if (dirty)
{
this.graph.cellRenderer.redraw(this.state, false, state.view.isRendering());
}
});
this.state.view.graph.addListener(mxEvent.ESCAPE, this.escapeHandler);
}
} | javascript | function mxEdgeHandler(state)
{
if (state != null)
{
this.state = state;
this.init();
// Handles escape keystrokes
this.escapeHandler = mxUtils.bind(this, function(sender, evt)
{
var dirty = this.index != null;
this.reset();
if (dirty)
{
this.graph.cellRenderer.redraw(this.state, false, state.view.isRendering());
}
});
this.state.view.graph.addListener(mxEvent.ESCAPE, this.escapeHandler);
}
} | [
"function",
"mxEdgeHandler",
"(",
"state",
")",
"{",
"if",
"(",
"state",
"!=",
"null",
")",
"{",
"this",
".",
"state",
"=",
"state",
";",
"this",
".",
"init",
"(",
")",
";",
"// Handles escape keystrokes",
"this",
".",
"escapeHandler",
"=",
"mxUtils",
".... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxEdgeHandler
Graph event handler that reconnects edges and modifies control points and
the edge label location. Uses <mxTerminalMarker> for finding and
highlighting new source and target vertices. This handler is automatically
created in <mxGraph.createHandler> for each selected edge.
To enable adding/removing control points, the following code can be used:
(code)
mxEdgeHandler.prototype.addEnabled = true;
mxEdgeHandler.prototype.removeEnabled = true;
(end)
Note: This experimental feature is not recommended for production use.
Constructor: mxEdgeHandler
Constructs an edge handler for the specified <mxCellState>.
Parameters:
state - <mxCellState> of the cell to be handled. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxEdgeHandler"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L77540-L77561 | train | This is the main entry point for the edge event handler. It is called when the edge event handler is called. | [
30522,
3853,
25630,
24225,
11774,
3917,
1006,
2110,
1007,
1063,
2065,
1006,
2110,
999,
1027,
19701,
1007,
1063,
2023,
1012,
2110,
1027,
2110,
1025,
2023,
1012,
1999,
4183,
1006,
1007,
1025,
1013,
1013,
16024,
4019,
6309,
13181,
9681,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js | function(oTable, sColumnId) {
var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId);
if (!oColumnMapItem) {
return undefined;
}
var mColumns = {};
if (sColumnId) {
// initialize the column map with the start column for which the boundaries shall be determined
mColumns[sColumnId] = oColumnMapItem.column;
}
var fnTraverseColumnRelations = function(mColumns, aNewRelations) {
var oColumn;
var i;
var aDirectRelations = [];
aNewRelations = aNewRelations || [];
// get the direct relations for all collected columns
// columns have a logical relation with each other, if they are spanned by other column headers or
// of they by itself are spanning other columns. Since those columns are logically tightly coupled,
// they can be seen as an immutable block of columns.
for (i = 0; i < aNewRelations.length; i++) {
oColumn = mColumns[aNewRelations[i]];
aDirectRelations = aDirectRelations.concat(TableColumnUtils.getParentSpannedColumns(oTable, oColumn.getId()));
aDirectRelations = aDirectRelations.concat(TableColumnUtils.getChildrenSpannedColumns(oTable, oColumn.getId()));
}
aNewRelations = [];
for (i = 0; i < aDirectRelations.length; i++) {
oColumn = aDirectRelations[i].column;
var sColumnId = oColumn.getId();
if (!mColumns[sColumnId]) {
// keep track about new found relations for later recursion to avoid collecting information about
// already known related columns again.
aNewRelations.push(sColumnId);
mColumns[sColumnId] = oColumn;
}
}
if (aNewRelations.length > 0) {
// if new relations where found, another round of recursion is required to get the related columns
// of the new relations. Afterwards merge the result with the already known related columns
return fnTraverseColumnRelations(mColumns, aNewRelations);
} else {
return mColumns;
}
};
mColumns = fnTraverseColumnRelations(mColumns, [sColumnId]);
// all columns which are somehow related to each other by spanning column headers are collected now.
// It is time to calculate the boundaries, which is the start index and the end index in the columns aggregation
// of the table
var iColumnIndex = oTable.indexOfColumn(oColumnMapItem.column);
var mBoundaries = {startColumn: oColumnMapItem.column, startIndex: iColumnIndex, endColumn: oColumnMapItem.column, endIndex: -1};
var aColumns = oTable.getColumns();
var aKeys = Object.getOwnPropertyNames(mColumns);
for (var i = 0; i < aKeys.length; i++) {
var oColumn = mColumns[aKeys[i]];
iColumnIndex = oTable.indexOfColumn(oColumn);
var iHeaderSpan = TableColumnUtils.getMaxHeaderSpan(oColumn);
// start
if (iColumnIndex < mBoundaries.startIndex) {
mBoundaries.startIndex = iColumnIndex;
mBoundaries.startColumn = oColumn;
}
var iEndIndex = iColumnIndex + iHeaderSpan - 1;
// end
if (iEndIndex > mBoundaries.endIndex) {
mBoundaries.endIndex = iEndIndex;
mBoundaries.endColumn = aColumns[iEndIndex];
}
}
return mBoundaries;
} | javascript | function(oTable, sColumnId) {
var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId);
if (!oColumnMapItem) {
return undefined;
}
var mColumns = {};
if (sColumnId) {
// initialize the column map with the start column for which the boundaries shall be determined
mColumns[sColumnId] = oColumnMapItem.column;
}
var fnTraverseColumnRelations = function(mColumns, aNewRelations) {
var oColumn;
var i;
var aDirectRelations = [];
aNewRelations = aNewRelations || [];
// get the direct relations for all collected columns
// columns have a logical relation with each other, if they are spanned by other column headers or
// of they by itself are spanning other columns. Since those columns are logically tightly coupled,
// they can be seen as an immutable block of columns.
for (i = 0; i < aNewRelations.length; i++) {
oColumn = mColumns[aNewRelations[i]];
aDirectRelations = aDirectRelations.concat(TableColumnUtils.getParentSpannedColumns(oTable, oColumn.getId()));
aDirectRelations = aDirectRelations.concat(TableColumnUtils.getChildrenSpannedColumns(oTable, oColumn.getId()));
}
aNewRelations = [];
for (i = 0; i < aDirectRelations.length; i++) {
oColumn = aDirectRelations[i].column;
var sColumnId = oColumn.getId();
if (!mColumns[sColumnId]) {
// keep track about new found relations for later recursion to avoid collecting information about
// already known related columns again.
aNewRelations.push(sColumnId);
mColumns[sColumnId] = oColumn;
}
}
if (aNewRelations.length > 0) {
// if new relations where found, another round of recursion is required to get the related columns
// of the new relations. Afterwards merge the result with the already known related columns
return fnTraverseColumnRelations(mColumns, aNewRelations);
} else {
return mColumns;
}
};
mColumns = fnTraverseColumnRelations(mColumns, [sColumnId]);
// all columns which are somehow related to each other by spanning column headers are collected now.
// It is time to calculate the boundaries, which is the start index and the end index in the columns aggregation
// of the table
var iColumnIndex = oTable.indexOfColumn(oColumnMapItem.column);
var mBoundaries = {startColumn: oColumnMapItem.column, startIndex: iColumnIndex, endColumn: oColumnMapItem.column, endIndex: -1};
var aColumns = oTable.getColumns();
var aKeys = Object.getOwnPropertyNames(mColumns);
for (var i = 0; i < aKeys.length; i++) {
var oColumn = mColumns[aKeys[i]];
iColumnIndex = oTable.indexOfColumn(oColumn);
var iHeaderSpan = TableColumnUtils.getMaxHeaderSpan(oColumn);
// start
if (iColumnIndex < mBoundaries.startIndex) {
mBoundaries.startIndex = iColumnIndex;
mBoundaries.startColumn = oColumn;
}
var iEndIndex = iColumnIndex + iHeaderSpan - 1;
// end
if (iEndIndex > mBoundaries.endIndex) {
mBoundaries.endIndex = iEndIndex;
mBoundaries.endColumn = aColumns[iEndIndex];
}
}
return mBoundaries;
} | [
"function",
"(",
"oTable",
",",
"sColumnId",
")",
"{",
"var",
"oColumnMapItem",
"=",
"TableColumnUtils",
".",
"getColumnMapItem",
"(",
"oTable",
",",
"sColumnId",
")",
";",
"if",
"(",
"!",
"oColumnMapItem",
")",
"{",
"return",
"undefined",
";",
"}",
"var",
... | Returns a map of the column boundaries for the column identified by <code>sColumnId</code>.
This function considers all overlapping spans of columns to determine the start and end indices.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {string} sColumnId ID of the column.
@returns {{startColumn: sap.ui.table.Column, startIndex: int, endColumn: sap.ui.table.Column, endIndex: int}|undefined}
Map of column boundaries.
@private | [
"Returns",
"a",
"map",
"of",
"the",
"column",
"boundaries",
"for",
"the",
"column",
"identified",
"by",
"<code",
">",
"sColumnId<",
"/",
"code",
">",
".",
"This",
"function",
"considers",
"all",
"overlapping",
"spans",
"of",
"columns",
"to",
"determine",
"th... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L301-L378 | train | Returns the column map for the given column. | [
30522,
3853,
1006,
27178,
3085,
1010,
8040,
4747,
2819,
3490,
2094,
1007,
1063,
13075,
1051,
25778,
2819,
2078,
2863,
23270,
6633,
1027,
2795,
25778,
2819,
24072,
12146,
1012,
2131,
25778,
2819,
2078,
2863,
23270,
6633,
1006,
27178,
3085,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js | offset | function offset(a,b,va,vb) {
return abOffset[a * N + b] + va * params[b].n + vb;
} | javascript | function offset(a,b,va,vb) {
return abOffset[a * N + b] + va * params[b].n + vb;
} | [
"function",
"offset",
"(",
"a",
",",
"b",
",",
"va",
",",
"vb",
")",
"{",
"return",
"abOffset",
"[",
"a",
"*",
"N",
"+",
"b",
"]",
"+",
"va",
"*",
"params",
"[",
"b",
"]",
".",
"n",
"+",
"vb",
";",
"}"
] | Helper that calculates the offset into the occurs array
for a given combination of a,b and the values of a and b. | [
"Helper",
"that",
"calculates",
"the",
"offset",
"into",
"the",
"occurs",
"array",
"for",
"a",
"given",
"combination",
"of",
"a",
"b",
"and",
"the",
"values",
"of",
"a",
"and",
"b",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L981-L983 | train | offset function for a given parameter | [
30522,
3853,
16396,
1006,
1037,
1010,
1038,
1010,
12436,
1010,
1058,
2497,
1007,
1063,
2709,
11113,
27475,
3388,
1031,
1037,
1008,
1050,
1009,
1038,
1033,
1009,
12436,
1008,
11498,
5244,
1031,
1038,
1033,
1012,
1050,
1009,
1058,
2497,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/node/TernNodeDomain.js | initTernServer | function initTernServer(env, files) {
ternOptions = {
defs: env,
async: true,
getFile: getFile,
plugins: {requirejs: {}, doc_comment: true, angular: true},
ecmaVersion: 9
};
// If a server is already created just reset the analysis data before marking it for GC
if (ternServer) {
ternServer.reset();
Infer.resetGuessing();
}
ternServer = new Tern.Server(ternOptions);
files.forEach(function (file) {
ternServer.addFile(file);
});
} | javascript | function initTernServer(env, files) {
ternOptions = {
defs: env,
async: true,
getFile: getFile,
plugins: {requirejs: {}, doc_comment: true, angular: true},
ecmaVersion: 9
};
// If a server is already created just reset the analysis data before marking it for GC
if (ternServer) {
ternServer.reset();
Infer.resetGuessing();
}
ternServer = new Tern.Server(ternOptions);
files.forEach(function (file) {
ternServer.addFile(file);
});
} | [
"function",
"initTernServer",
"(",
"env",
",",
"files",
")",
"{",
"ternOptions",
"=",
"{",
"defs",
":",
"env",
",",
"async",
":",
"true",
",",
"getFile",
":",
"getFile",
",",
"plugins",
":",
"{",
"requirejs",
":",
"{",
"}",
",",
"doc_comment",
":",
"... | Create a new tern server.
@param {Object} env - an Object with the environment, as read in from
the json files in thirdparty/tern/defs
@param {Array.<string>} files - a list of filenames tern should be aware of | [
"Create",
"a",
"new",
"tern",
"server",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/node/TernNodeDomain.js#L153-L174 | train | Initializes the tern server | [
30522,
3853,
1999,
27100,
6826,
8043,
6299,
1006,
4372,
2615,
1010,
6764,
1007,
1063,
28774,
3630,
16790,
2015,
1027,
1063,
13366,
2015,
1024,
4372,
2615,
1010,
2004,
6038,
2278,
1024,
2995,
1010,
2131,
8873,
2571,
1024,
2131,
8873,
2571,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
pixijs/pixi.js | packages/prepare/src/BasePrepare.js | findText | function findText(item, queue)
{
if (item instanceof Text)
{
// push the text style to prepare it - this can be really expensive
if (queue.indexOf(item.style) === -1)
{
queue.push(item.style);
}
// also push the text object so that we can render it (to canvas/texture) if needed
if (queue.indexOf(item) === -1)
{
queue.push(item);
}
// also push the Text's texture for upload to GPU
const texture = item._texture.baseTexture;
if (queue.indexOf(texture) === -1)
{
queue.push(texture);
}
return true;
}
return false;
} | javascript | function findText(item, queue)
{
if (item instanceof Text)
{
// push the text style to prepare it - this can be really expensive
if (queue.indexOf(item.style) === -1)
{
queue.push(item.style);
}
// also push the text object so that we can render it (to canvas/texture) if needed
if (queue.indexOf(item) === -1)
{
queue.push(item);
}
// also push the Text's texture for upload to GPU
const texture = item._texture.baseTexture;
if (queue.indexOf(texture) === -1)
{
queue.push(texture);
}
return true;
}
return false;
} | [
"function",
"findText",
"(",
"item",
",",
"queue",
")",
"{",
"if",
"(",
"item",
"instanceof",
"Text",
")",
"{",
"// push the text style to prepare it - this can be really expensive",
"if",
"(",
"queue",
".",
"indexOf",
"(",
"item",
".",
"style",
")",
"===",
"-",... | Built-in hook to find Text objects.
@private
@param {PIXI.DisplayObject} item - Display object to check
@param {Array<*>} queue - Collection of items to upload
@return {boolean} if a PIXI.Text object was found. | [
"Built",
"-",
"in",
"hook",
"to",
"find",
"Text",
"objects",
"."
] | 99ae03b7565ae7ca5a6de633b0a277f7128fa4d0 | https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/prepare/src/BasePrepare.js#L448-L474 | train | Find Text in the queue | [
30522,
3853,
2424,
18209,
1006,
8875,
1010,
24240,
1007,
1063,
2065,
1006,
8875,
6013,
11253,
3793,
1007,
1063,
1013,
1013,
5245,
1996,
3793,
2806,
2000,
7374,
2009,
1011,
2023,
2064,
2022,
2428,
6450,
2065,
1006,
24240,
1012,
5950,
11253,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/utils/src-loader.js | validateCubemapSrc | function validateCubemapSrc (src, cb) {
var aCubemap;
var cubemapSrcRegex = '';
var i;
var urls;
var validatedUrls = [];
for (i = 0; i < 5; i++) {
cubemapSrcRegex += '(url\\((?:[^\\)]+)\\),\\s*)';
}
cubemapSrcRegex += '(url\\((?:[^\\)]+)\\)\\s*)';
urls = src.match(new RegExp(cubemapSrcRegex));
// `src` is a comma-separated list of URLs.
// In this case, re-use validateSrc for each side of the cube.
function isImageCb (url) {
validatedUrls.push(url);
if (validatedUrls.length === 6) {
cb(validatedUrls);
}
}
if (urls) {
for (i = 1; i < 7; i++) {
validateSrc(parseUrl(urls[i]), isImageCb);
}
return;
}
// `src` is a query selector to <a-cubemap> containing six $([src])s.
aCubemap = validateAndGetQuerySelector(src);
if (!aCubemap) { return; }
if (aCubemap.tagName === 'A-CUBEMAP' && aCubemap.srcs) {
return cb(aCubemap.srcs);
}
// Else if aCubeMap is not a <a-cubemap>.
warn('Selector "%s" does not point to <a-cubemap>', src);
} | javascript | function validateCubemapSrc (src, cb) {
var aCubemap;
var cubemapSrcRegex = '';
var i;
var urls;
var validatedUrls = [];
for (i = 0; i < 5; i++) {
cubemapSrcRegex += '(url\\((?:[^\\)]+)\\),\\s*)';
}
cubemapSrcRegex += '(url\\((?:[^\\)]+)\\)\\s*)';
urls = src.match(new RegExp(cubemapSrcRegex));
// `src` is a comma-separated list of URLs.
// In this case, re-use validateSrc for each side of the cube.
function isImageCb (url) {
validatedUrls.push(url);
if (validatedUrls.length === 6) {
cb(validatedUrls);
}
}
if (urls) {
for (i = 1; i < 7; i++) {
validateSrc(parseUrl(urls[i]), isImageCb);
}
return;
}
// `src` is a query selector to <a-cubemap> containing six $([src])s.
aCubemap = validateAndGetQuerySelector(src);
if (!aCubemap) { return; }
if (aCubemap.tagName === 'A-CUBEMAP' && aCubemap.srcs) {
return cb(aCubemap.srcs);
}
// Else if aCubeMap is not a <a-cubemap>.
warn('Selector "%s" does not point to <a-cubemap>', src);
} | [
"function",
"validateCubemapSrc",
"(",
"src",
",",
"cb",
")",
"{",
"var",
"aCubemap",
";",
"var",
"cubemapSrcRegex",
"=",
"''",
";",
"var",
"i",
";",
"var",
"urls",
";",
"var",
"validatedUrls",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i... | Validates six images as a cubemap, either as selector or comma-separated
URLs.
@param {string} src - A selector or comma-separated image URLs. Image URLs
must be wrapped by `url()`.
@param {string} src - A selector or comma-separated image URLs. Image URLs
must be wrapped by `url()`. | [
"Validates",
"six",
"images",
"as",
"a",
"cubemap",
"either",
"as",
"selector",
"or",
"comma",
"-",
"separated",
"URLs",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/utils/src-loader.js#L36-L72 | train | Validate the source of a cube. | [
30522,
3853,
9398,
3686,
10841,
4783,
2863,
4523,
11890,
1006,
5034,
2278,
1010,
17324,
1007,
1063,
13075,
9353,
12083,
14545,
2361,
1025,
13075,
14291,
2863,
4523,
11890,
2890,
3351,
2595,
1027,
1005,
1005,
1025,
13075,
1045,
1025,
13075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zloirock/core-js | packages/core-js/modules/es.string.match.js | match | function match(regexp) {
var O = requireObjectCoercible(this);
var matcher = regexp == undefined ? undefined : regexp[MATCH];
return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
} | javascript | function match(regexp) {
var O = requireObjectCoercible(this);
var matcher = regexp == undefined ? undefined : regexp[MATCH];
return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
} | [
"function",
"match",
"(",
"regexp",
")",
"{",
"var",
"O",
"=",
"requireObjectCoercible",
"(",
"this",
")",
";",
"var",
"matcher",
"=",
"regexp",
"==",
"undefined",
"?",
"undefined",
":",
"regexp",
"[",
"MATCH",
"]",
";",
"return",
"matcher",
"!==",
"unde... | `String.prototype.match` method https://tc39.github.io/ecma262/#sec-string.prototype.match | [
"String",
".",
"prototype",
".",
"match",
"method",
"https",
":",
"//",
"tc39",
".",
"github",
".",
"io",
"/",
"ecma262",
"/",
"#sec",
"-",
"string",
".",
"prototype",
".",
"match"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/es.string.match.js#L17-L21 | train | Match the given regexp against the current object | [
30522,
3853,
2674,
1006,
19723,
10288,
2361,
1007,
1063,
13075,
1051,
1027,
5478,
16429,
20614,
16288,
11890,
7028,
1006,
2023,
1007,
1025,
13075,
2674,
2121,
1027,
19723,
10288,
2361,
1027,
1027,
6151,
28344,
1029,
6151,
28344,
1024,
19723,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ecomfe/zrender | src/Layer.js | createDom | function createDom(id, painter, dpr) {
var newDom = util.createCanvas();
var width = painter.getWidth();
var height = painter.getHeight();
var newDomStyle = newDom.style;
if (newDomStyle) { // In node or some other non-browser environment
newDomStyle.position = 'absolute';
newDomStyle.left = 0;
newDomStyle.top = 0;
newDomStyle.width = width + 'px';
newDomStyle.height = height + 'px';
newDom.setAttribute('data-zr-dom-id', id);
}
newDom.width = width * dpr;
newDom.height = height * dpr;
return newDom;
} | javascript | function createDom(id, painter, dpr) {
var newDom = util.createCanvas();
var width = painter.getWidth();
var height = painter.getHeight();
var newDomStyle = newDom.style;
if (newDomStyle) { // In node or some other non-browser environment
newDomStyle.position = 'absolute';
newDomStyle.left = 0;
newDomStyle.top = 0;
newDomStyle.width = width + 'px';
newDomStyle.height = height + 'px';
newDom.setAttribute('data-zr-dom-id', id);
}
newDom.width = width * dpr;
newDom.height = height * dpr;
return newDom;
} | [
"function",
"createDom",
"(",
"id",
",",
"painter",
",",
"dpr",
")",
"{",
"var",
"newDom",
"=",
"util",
".",
"createCanvas",
"(",
")",
";",
"var",
"width",
"=",
"painter",
".",
"getWidth",
"(",
")",
";",
"var",
"height",
"=",
"painter",
".",
"getHeig... | 创建dom
@inner
@param {string} id dom id 待用
@param {Painter} painter painter instance
@param {number} number | [
"创建dom"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/Layer.js#L23-L43 | train | Creates a dom element | [
30522,
3853,
2580,
5358,
1006,
8909,
1010,
5276,
1010,
1040,
18098,
1007,
1063,
13075,
2047,
9527,
1027,
21183,
4014,
1012,
3443,
9336,
12044,
1006,
1007,
1025,
13075,
9381,
1027,
5276,
1012,
2131,
9148,
11927,
2232,
1006,
1007,
1025,
13075... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/MainViewManager.js | _removeView | function _removeView(paneId, file, suppressRedraw) {
var pane = _getPane(paneId);
if (pane.removeView(file)) {
_removeFileFromMRU(pane.id, file);
exports.trigger("workingSetRemove", file, suppressRedraw, pane.id);
}
} | javascript | function _removeView(paneId, file, suppressRedraw) {
var pane = _getPane(paneId);
if (pane.removeView(file)) {
_removeFileFromMRU(pane.id, file);
exports.trigger("workingSetRemove", file, suppressRedraw, pane.id);
}
} | [
"function",
"_removeView",
"(",
"paneId",
",",
"file",
",",
"suppressRedraw",
")",
"{",
"var",
"pane",
"=",
"_getPane",
"(",
"paneId",
")",
";",
"if",
"(",
"pane",
".",
"removeView",
"(",
"file",
")",
")",
"{",
"_removeFileFromMRU",
"(",
"pane",
".",
"... | Removes a file the specified pane
@param {!string} paneId - Must be a valid paneId (not a shortcut e.g. ALL_PANES)
@param {!File} file - the File to remove
@param {boolean=} suppressRedraw - true to tell listeners not to redraw
Use the suppressRedraw flag when calling this function along with many changes to prevent flicker
@private | [
"Removes",
"a",
"file",
"the",
"specified",
"pane"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L804-L811 | train | Remove a file from the working set | [
30522,
3853,
1035,
6366,
8584,
1006,
6090,
7416,
2094,
1010,
5371,
1010,
16081,
5596,
2527,
2860,
1007,
1063,
13075,
6090,
2063,
1027,
1035,
2131,
9739,
2063,
1006,
6090,
7416,
2094,
1007,
1025,
2065,
1006,
6090,
2063,
1012,
6366,
8584,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
catapult-project/catapult | netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js | queryRequiredElement | function queryRequiredElement(selectors, opt_context) {
var element = (opt_context || document).querySelector(selectors);
return assertInstanceof(element, HTMLElement,
'Missing required element: ' + selectors);
} | javascript | function queryRequiredElement(selectors, opt_context) {
var element = (opt_context || document).querySelector(selectors);
return assertInstanceof(element, HTMLElement,
'Missing required element: ' + selectors);
} | [
"function",
"queryRequiredElement",
"(",
"selectors",
",",
"opt_context",
")",
"{",
"var",
"element",
"=",
"(",
"opt_context",
"||",
"document",
")",
".",
"querySelector",
"(",
"selectors",
")",
";",
"return",
"assertInstanceof",
"(",
"element",
",",
"HTMLElemen... | Query an element that's known to exist by a selector. We use this instead of
just calling querySelector and not checking the result because this lets us
satisfy the JSCompiler type system.
@param {string} selectors CSS selectors to query the element.
@param {(!Document|!DocumentFragment|!Element)=} opt_context An optional
context object for querySelector.
@return {!HTMLElement} the Element. | [
"Query",
"an",
"element",
"that",
"s",
"known",
"to",
"exist",
"by",
"a",
"selector",
".",
"We",
"use",
"this",
"instead",
"of",
"just",
"calling",
"querySelector",
"and",
"not",
"checking",
"the",
"result",
"because",
"this",
"lets",
"us",
"satisfy",
"the... | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L207-L211 | train | Query required element | [
30522,
3853,
23032,
2890,
15549,
5596,
12260,
3672,
1006,
27000,
2015,
1010,
23569,
1035,
6123,
1007,
1063,
13075,
5783,
1027,
1006,
23569,
1035,
6123,
1064,
1064,
6254,
1007,
1012,
23032,
11246,
22471,
2953,
1006,
27000,
2015,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NavigationAndHistory/main.js | _handleWorkingSetMove | function _handleWorkingSetMove(event, file, sourcePaneId, destinationPaneId) {
// Check existing list for this doc path and source pane entry
var index = _.findIndex(_mrofList, function (record) {
return (record && record.file === file.fullPath && record.paneId === sourcePaneId);
}), tIndex;
// If an entry is found update the pane info
if (index >= 0) {
// But an entry with the target pane Id should not exist
tIndex = _.findIndex(_mrofList, function (record) {
return (record && record.file === file.fullPath && record.paneId === destinationPaneId);
});
if (tIndex === -1) {
_mrofList[index].paneId = destinationPaneId;
} else {
// Remove this entry as it has been moved.
_mrofList.splice(index, 1);
}
}
} | javascript | function _handleWorkingSetMove(event, file, sourcePaneId, destinationPaneId) {
// Check existing list for this doc path and source pane entry
var index = _.findIndex(_mrofList, function (record) {
return (record && record.file === file.fullPath && record.paneId === sourcePaneId);
}), tIndex;
// If an entry is found update the pane info
if (index >= 0) {
// But an entry with the target pane Id should not exist
tIndex = _.findIndex(_mrofList, function (record) {
return (record && record.file === file.fullPath && record.paneId === destinationPaneId);
});
if (tIndex === -1) {
_mrofList[index].paneId = destinationPaneId;
} else {
// Remove this entry as it has been moved.
_mrofList.splice(index, 1);
}
}
} | [
"function",
"_handleWorkingSetMove",
"(",
"event",
",",
"file",
",",
"sourcePaneId",
",",
"destinationPaneId",
")",
"{",
"// Check existing list for this doc path and source pane entry",
"var",
"index",
"=",
"_",
".",
"findIndex",
"(",
"_mrofList",
",",
"function",
"(",... | To update existing entry if a move has happened | [
"To",
"update",
"existing",
"entry",
"if",
"a",
"move",
"has",
"happened"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L621-L639 | train | Handle the file move event | [
30522,
3853,
1035,
5047,
21398,
13462,
5302,
3726,
1006,
2724,
1010,
5371,
1010,
3120,
9739,
7416,
2094,
1010,
7688,
9739,
7416,
2094,
1007,
1063,
1013,
1013,
4638,
4493,
2862,
2005,
2023,
9986,
4130,
1998,
3120,
6090,
2063,
4443,
13075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_ShortXLUnicodeString | function parse_ShortXLUnicodeString(blob, length, opts) {
var cch = blob.read_shift(opts && opts.biff >= 12 ? 2 : 1);
var encoding = 'sbcs-cont';
var cp = current_codepage;
if(opts && opts.biff >= 8) current_codepage = 1200;
if(!opts || opts.biff == 8 ) {
var fHighByte = blob.read_shift(1);
if(fHighByte) { encoding = 'dbcs-cont'; }
} else if(opts.biff == 12) {
encoding = 'wstr';
}
if(opts.biff >= 2 && opts.biff <= 5) encoding = 'cpstr';
var o = cch ? blob.read_shift(cch, encoding) : "";
current_codepage = cp;
return o;
} | javascript | function parse_ShortXLUnicodeString(blob, length, opts) {
var cch = blob.read_shift(opts && opts.biff >= 12 ? 2 : 1);
var encoding = 'sbcs-cont';
var cp = current_codepage;
if(opts && opts.biff >= 8) current_codepage = 1200;
if(!opts || opts.biff == 8 ) {
var fHighByte = blob.read_shift(1);
if(fHighByte) { encoding = 'dbcs-cont'; }
} else if(opts.biff == 12) {
encoding = 'wstr';
}
if(opts.biff >= 2 && opts.biff <= 5) encoding = 'cpstr';
var o = cch ? blob.read_shift(cch, encoding) : "";
current_codepage = cp;
return o;
} | [
"function",
"parse_ShortXLUnicodeString",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"cch",
"=",
"blob",
".",
"read_shift",
"(",
"opts",
"&&",
"opts",
".",
"biff",
">=",
"12",
"?",
"2",
":",
"1",
")",
";",
"var",
"encoding",
"=",
"'sbc... | /* [MS-XLS] 2.5.240 ShortXLUnicodeString | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"240",
"ShortXLUnicodeString"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5377-L5392 | train | Parse a shortXLUnicodeString | [
30522,
3853,
11968,
3366,
1035,
2460,
2595,
26896,
11261,
6155,
18886,
3070,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
10507,
2232,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
23569,
2015,
1004,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/core/utils/queue.js | function(e) {
err = e;
setTimeout(function() {
if (err !== undefined && err !== null) {
axe.log('Uncaught error (of queue)', err);
}
}, 1);
} | javascript | function(e) {
err = e;
setTimeout(function() {
if (err !== undefined && err !== null) {
axe.log('Uncaught error (of queue)', err);
}
}, 1);
} | [
"function",
"(",
"e",
")",
"{",
"err",
"=",
"e",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"err",
"!==",
"undefined",
"&&",
"err",
"!==",
"null",
")",
"{",
"axe",
".",
"log",
"(",
"'Uncaught error (of queue)'",
",",
"err",
")",
... | By default, wait until the next tick, if no catch was set, throw to console. | [
"By",
"default",
"wait",
"until",
"the",
"next",
"tick",
"if",
"no",
"catch",
"was",
"set",
"throw",
"to",
"console",
"."
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/queue.js#L24-L31 | train | Handle error | [
30522,
3853,
1006,
1041,
1007,
1063,
9413,
2099,
1027,
1041,
1025,
2275,
7292,
5833,
1006,
3853,
1006,
1007,
1063,
2065,
1006,
30524,
1006,
1997,
24240,
1007,
1005,
1010,
9413,
2099,
1007,
1025,
1065,
1065,
1010,
1015,
1007,
1025,
1065,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js | decodeCssEscape | function decodeCssEscape(s) {
var i = parseInt(s.substring(1), 16);
// If parseInt didn't find a hex diigt, it returns NaN so return the
// escaped character.
// Otherwise, parseInt will stop at the first non-hex digit so there's no
// need to worry about trailing whitespace.
if (i > 0xffff) {
// A supplemental codepoint.
return i -= 0x10000,
String.fromCharCode(
0xd800 + (i >> 10),
0xdc00 + (i & 0x3FF));
} else if (i == i) {
return String.fromCharCode(i);
} else if (s[1] < ' ') {
// "a backslash followed by a newline is ignored".
return '';
} else {
return s[1];
}
} | javascript | function decodeCssEscape(s) {
var i = parseInt(s.substring(1), 16);
// If parseInt didn't find a hex diigt, it returns NaN so return the
// escaped character.
// Otherwise, parseInt will stop at the first non-hex digit so there's no
// need to worry about trailing whitespace.
if (i > 0xffff) {
// A supplemental codepoint.
return i -= 0x10000,
String.fromCharCode(
0xd800 + (i >> 10),
0xdc00 + (i & 0x3FF));
} else if (i == i) {
return String.fromCharCode(i);
} else if (s[1] < ' ') {
// "a backslash followed by a newline is ignored".
return '';
} else {
return s[1];
}
} | [
"function",
"decodeCssEscape",
"(",
"s",
")",
"{",
"var",
"i",
"=",
"parseInt",
"(",
"s",
".",
"substring",
"(",
"1",
")",
",",
"16",
")",
";",
"// If parseInt didn't find a hex diigt, it returns NaN so return the",
"// escaped character.",
"// Otherwise, parseInt will ... | Decodes an escape sequence as specified in CSS3 section 4.1.
http://www.w3.org/TR/css3-syntax/#characters
@private | [
"Decodes",
"an",
"escape",
"sequence",
"as",
"specified",
"in",
"CSS3",
"section",
"4",
".",
"1",
".",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"css3",
"-",
"syntax",
"/",
"#characters"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js#L814-L834 | train | Decode a CSS escape character | [
30522,
3853,
21933,
3207,
6169,
8583,
19464,
1006,
1055,
1007,
1063,
13075,
1045,
1027,
11968,
20240,
3372,
1006,
1055,
1012,
4942,
3367,
4892,
1006,
1015,
1007,
1010,
2385,
1007,
1025,
1013,
1013,
2065,
11968,
20240,
3372,
2134,
1005,
1056... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/FileTreeView.js | function (nextProps, nextState) {
return nextProps.forceRender ||
this.props.entry !== nextProps.entry ||
this.props.sortDirectoriesFirst !== nextProps.sortDirectoriesFirst ||
this.props.extensions !== nextProps.extensions ||
(nextState !== undefined && this.state.draggedOver !== nextState.draggedOver);
} | javascript | function (nextProps, nextState) {
return nextProps.forceRender ||
this.props.entry !== nextProps.entry ||
this.props.sortDirectoriesFirst !== nextProps.sortDirectoriesFirst ||
this.props.extensions !== nextProps.extensions ||
(nextState !== undefined && this.state.draggedOver !== nextState.draggedOver);
} | [
"function",
"(",
"nextProps",
",",
"nextState",
")",
"{",
"return",
"nextProps",
".",
"forceRender",
"||",
"this",
".",
"props",
".",
"entry",
"!==",
"nextProps",
".",
"entry",
"||",
"this",
".",
"props",
".",
"sortDirectoriesFirst",
"!==",
"nextProps",
".",... | We need to update this component if the sort order changes or our entry object
changes. Thanks to immutability, if any of the directory contents change, our
entry object will change. | [
"We",
"need",
"to",
"update",
"this",
"component",
"if",
"the",
"sort",
"order",
"changes",
"or",
"our",
"entry",
"object",
"changes",
".",
"Thanks",
"to",
"immutability",
"if",
"any",
"of",
"the",
"directory",
"contents",
"change",
"our",
"entry",
"object",... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeView.js#L774-L780 | train | Check if the component is different from the current state | [
30522,
3853,
1006,
2279,
21572,
4523,
1010,
2279,
9153,
2618,
1007,
1063,
2709,
2279,
21572,
4523,
1012,
2486,
7389,
4063,
1064,
1064,
2023,
1012,
24387,
1012,
4443,
999,
1027,
1027,
2279,
21572,
4523,
1012,
4443,
1064,
1064,
2023,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.layout/src/sap/ui/layout/form/ResponsiveLayout.js | _deleteResponsiveFlowLayout | function _deleteResponsiveFlowLayout( oRFLayout ) {
if (oRFLayout.__myParentContainerId) {
oRFLayout.__myParentContainerId = undefined;
}
if (oRFLayout.__myParentElementId) {
oRFLayout.__myParentElementId = undefined;
}
oRFLayout.__myParentLayout = undefined;
oRFLayout.destroy();
} | javascript | function _deleteResponsiveFlowLayout( oRFLayout ) {
if (oRFLayout.__myParentContainerId) {
oRFLayout.__myParentContainerId = undefined;
}
if (oRFLayout.__myParentElementId) {
oRFLayout.__myParentElementId = undefined;
}
oRFLayout.__myParentLayout = undefined;
oRFLayout.destroy();
} | [
"function",
"_deleteResponsiveFlowLayout",
"(",
"oRFLayout",
")",
"{",
"if",
"(",
"oRFLayout",
".",
"__myParentContainerId",
")",
"{",
"oRFLayout",
".",
"__myParentContainerId",
"=",
"undefined",
";",
"}",
"if",
"(",
"oRFLayout",
".",
"__myParentElementId",
")",
"... | /*
clear variables before delete it | [
"/",
"*",
"clear",
"variables",
"before",
"delete",
"it"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/ResponsiveLayout.js#L726-L738 | train | Delete a responsive flow layout | [
30522,
3853,
1035,
3972,
15141,
2229,
26029,
12742,
12314,
8485,
5833,
1006,
2030,
10258,
28852,
4904,
1007,
1063,
2065,
1006,
2030,
10258,
28852,
4904,
1012,
1035,
1035,
2026,
19362,
4765,
8663,
18249,
11124,
2094,
1007,
1063,
2030,
10258,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js | function(oTable) {
var oScrollExtension = oTable._getScrollExtension();
var aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable);
var oVSb = oScrollExtension.getVerticalScrollbar();
if (oScrollExtension._onVerticalScrollEventHandler) {
for (var i = 0; i < aScrollAreas.length; i++) {
aScrollAreas[i].removeEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler);
}
delete oScrollExtension._onVerticalScrollEventHandler;
}
if (oVSb && oScrollExtension._onVerticalScrollbarMouseDownEventHandler) {
oVSb.removeEventListener("mousedown", oScrollExtension._onVerticalScrollbarMouseDownEventHandler);
delete oScrollExtension._onVerticalScrollbarMouseDownEventHandler;
}
oTable.detachEvent("_rowsUpdated", VerticalScrollingHelper.onRowsUpdated);
} | javascript | function(oTable) {
var oScrollExtension = oTable._getScrollExtension();
var aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable);
var oVSb = oScrollExtension.getVerticalScrollbar();
if (oScrollExtension._onVerticalScrollEventHandler) {
for (var i = 0; i < aScrollAreas.length; i++) {
aScrollAreas[i].removeEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler);
}
delete oScrollExtension._onVerticalScrollEventHandler;
}
if (oVSb && oScrollExtension._onVerticalScrollbarMouseDownEventHandler) {
oVSb.removeEventListener("mousedown", oScrollExtension._onVerticalScrollbarMouseDownEventHandler);
delete oScrollExtension._onVerticalScrollbarMouseDownEventHandler;
}
oTable.detachEvent("_rowsUpdated", VerticalScrollingHelper.onRowsUpdated);
} | [
"function",
"(",
"oTable",
")",
"{",
"var",
"oScrollExtension",
"=",
"oTable",
".",
"_getScrollExtension",
"(",
")",
";",
"var",
"aScrollAreas",
"=",
"VerticalScrollingHelper",
".",
"getScrollAreas",
"(",
"oTable",
")",
";",
"var",
"oVSb",
"=",
"oScrollExtension... | Removes event listeners which are required for the vertical scrolling.
@param {sap.ui.table.Table} oTable Instance of the table. | [
"Removes",
"event",
"listeners",
"which",
"are",
"required",
"for",
"the",
"vertical",
"scrolling",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L792-L810 | train | Removes the event listeners for the vertical scroll area. | [
30522,
3853,
1006,
27178,
3085,
1007,
1063,
13075,
9808,
26775,
14511,
10288,
29048,
1027,
27178,
3085,
1012,
1035,
4152,
26775,
14511,
10288,
29048,
1006,
1007,
1025,
13075,
2004,
26775,
14511,
12069,
3022,
1027,
7471,
11020,
28402,
2075,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SheetJS/js-xlsx | xlsx.js | write_dos_date | function write_dos_date(buf, date) {
if(typeof date === "string") date = new Date(date);
var hms = date.getHours();
hms = hms << 6 | date.getMinutes();
hms = hms << 5 | (date.getSeconds()>>>1);
buf.write_shift(2, hms);
var ymd = (date.getFullYear() - 1980);
ymd = ymd << 4 | (date.getMonth()+1);
ymd = ymd << 5 | date.getDate();
buf.write_shift(2, ymd);
} | javascript | function write_dos_date(buf, date) {
if(typeof date === "string") date = new Date(date);
var hms = date.getHours();
hms = hms << 6 | date.getMinutes();
hms = hms << 5 | (date.getSeconds()>>>1);
buf.write_shift(2, hms);
var ymd = (date.getFullYear() - 1980);
ymd = ymd << 4 | (date.getMonth()+1);
ymd = ymd << 5 | date.getDate();
buf.write_shift(2, ymd);
} | [
"function",
"write_dos_date",
"(",
"buf",
",",
"date",
")",
"{",
"if",
"(",
"typeof",
"date",
"===",
"\"string\"",
")",
"date",
"=",
"new",
"Date",
"(",
"date",
")",
";",
"var",
"hms",
"=",
"date",
".",
"getHours",
"(",
")",
";",
"hms",
"=",
"hms",... | /* -------------------------------------------------------------------------- /* DOS Date format:
high|YYYYYYYm.mmmddddd.HHHHHMMM.MMMSSSSS|low
add 1980 to stored year
stored second should be doubled
/* write JS date to buf as a DOS date | [
"/",
"*",
"--------------------------------------------------------------------------",
"/",
"*",
"DOS",
"Date",
"format",
":",
"high|YYYYYYYm",
".",
"mmmddddd",
".",
"HHHHHMMM",
".",
"MMMSSSSS|low",
"add",
"1980",
"to",
"stored",
"year",
"stored",
"second",
"should",
... | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L1278-L1288 | train | Writes a Date to a Buffer | [
30522,
3853,
4339,
1035,
9998,
1035,
3058,
1006,
20934,
2546,
1010,
3058,
1007,
1063,
2065,
1006,
2828,
11253,
3058,
1027,
1027,
1027,
1000,
5164,
1000,
1007,
3058,
1027,
2047,
3058,
1006,
3058,
1007,
1025,
13075,
7220,
1027,
3058,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js | function(oCol, iColIndex) {
oCol = oCol || this.getColumns()[iColIndex];
var $this = this.$();
var $hiddenArea = jQuery("<div>").addClass("sapUiTableHiddenSizeDetector sapUiTableHeaderDataCell sapUiTableDataCell");
$this.append($hiddenArea);
// Create a copy of all visible cells in the column, including the header cells without colspan
var $cells = $this.find("td[data-sap-ui-colid = \"" + oCol.getId() + "\"]:not([colspan])")
.filter(function(index, element) {
return element.style.display != "none";
}).children().clone();
$cells.removeAttr("id"); // remove all id attributes
// Determine the column width
var iWidth = $hiddenArea.append($cells).width() + 4; // widest cell + 4px for borders, padding and rounding
iWidth = Math.min(iWidth, $this.find(".sapUiTableCnt").width()); // no wider as the table
iWidth = Math.max(iWidth + 4, TableUtils.Column.getMinColumnWidth()); // not to small
$hiddenArea.remove();
return iWidth;
} | javascript | function(oCol, iColIndex) {
oCol = oCol || this.getColumns()[iColIndex];
var $this = this.$();
var $hiddenArea = jQuery("<div>").addClass("sapUiTableHiddenSizeDetector sapUiTableHeaderDataCell sapUiTableDataCell");
$this.append($hiddenArea);
// Create a copy of all visible cells in the column, including the header cells without colspan
var $cells = $this.find("td[data-sap-ui-colid = \"" + oCol.getId() + "\"]:not([colspan])")
.filter(function(index, element) {
return element.style.display != "none";
}).children().clone();
$cells.removeAttr("id"); // remove all id attributes
// Determine the column width
var iWidth = $hiddenArea.append($cells).width() + 4; // widest cell + 4px for borders, padding and rounding
iWidth = Math.min(iWidth, $this.find(".sapUiTableCnt").width()); // no wider as the table
iWidth = Math.max(iWidth + 4, TableUtils.Column.getMinColumnWidth()); // not to small
$hiddenArea.remove();
return iWidth;
} | [
"function",
"(",
"oCol",
",",
"iColIndex",
")",
"{",
"oCol",
"=",
"oCol",
"||",
"this",
".",
"getColumns",
"(",
")",
"[",
"iColIndex",
"]",
";",
"var",
"$this",
"=",
"this",
".",
"$",
"(",
")",
";",
"var",
"$hiddenArea",
"=",
"jQuery",
"(",
"\"<div... | /*
Calculates the widest content width of the currently visible column cells including headers.
Headers with column span are not taken into account.
@param {sap.ui.table.Column} oCol the column
@param {int} iColIndex index of the column
@returns {int} iWidth calculated column width
@private | [
"/",
"*",
"Calculates",
"the",
"widest",
"content",
"width",
"of",
"the",
"currently",
"visible",
"column",
"cells",
"including",
"headers",
".",
"Headers",
"with",
"column",
"span",
"are",
"not",
"taken",
"into",
"account",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L292-L313 | train | Calculates the width of the hidden area of the given column. | [
30522,
3853,
1006,
1051,
25778,
1010,
24582,
18861,
3207,
2595,
1007,
1063,
1051,
25778,
1027,
1051,
25778,
1064,
1064,
2023,
1012,
2131,
25778,
2819,
3619,
1006,
1007,
1031,
24582,
18861,
3207,
2595,
1033,
1025,
13075,
1002,
2023,
1027,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
airyland/vux | src/directives/transfer-dom/index.js | getTarget | function getTarget (node) {
if (node === void 0) {
return document.body
}
if (typeof node === 'string' && node.indexOf('?') === 0) {
return document.body
} else if (typeof node === 'string' && node.indexOf('?') > 0) {
node = node.split('?')[0]
}
if (node === 'body' || node === true) {
return document.body
}
return node instanceof window.Node ? node : document.querySelector(node)
} | javascript | function getTarget (node) {
if (node === void 0) {
return document.body
}
if (typeof node === 'string' && node.indexOf('?') === 0) {
return document.body
} else if (typeof node === 'string' && node.indexOf('?') > 0) {
node = node.split('?')[0]
}
if (node === 'body' || node === true) {
return document.body
}
return node instanceof window.Node ? node : document.querySelector(node)
} | [
"function",
"getTarget",
"(",
"node",
")",
"{",
"if",
"(",
"node",
"===",
"void",
"0",
")",
"{",
"return",
"document",
".",
"body",
"}",
"if",
"(",
"typeof",
"node",
"===",
"'string'",
"&&",
"node",
".",
"indexOf",
"(",
"'?'",
")",
"===",
"0",
")",... | Get target DOM Node
@param {(Node|string|Boolean)} [node=document.body] DOM Node, CSS selector, or Boolean
@return {Node} The target that the el will be appended to | [
"Get",
"target",
"DOM",
"Node"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/directives/transfer-dom/index.js#L9-L25 | train | Get target element | [
30522,
3853,
2131,
7559,
18150,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1027,
1027,
1027,
11675,
1014,
1007,
1063,
2709,
6254,
1012,
2303,
1065,
2065,
1006,
2828,
11253,
13045,
1027,
1027,
1027,
1005,
5164,
1005,
1004,
1004,
13045,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/DropdownEventHandler.js | _keydownHook | function _keydownHook(event) {
var keyCode;
// (page) up, (page) down, enter and tab key are handled by the list
if (event.type === "keydown") {
keyCode = event.keyCode;
if (keyCode === KeyEvent.DOM_VK_TAB) {
self.close();
} else if (keyCode === KeyEvent.DOM_VK_UP) {
// Move up one, wrapping at edges (if nothing selected, select the last item)
self._tryToSelect(self._selectedIndex === -1 ? -1 : self._selectedIndex - 1, -1);
} else if (keyCode === KeyEvent.DOM_VK_DOWN) {
// Move down one, wrapping at edges (if nothing selected, select the first item)
self._tryToSelect(self._selectedIndex === -1 ? 0 : self._selectedIndex + 1, +1);
} else if (keyCode === KeyEvent.DOM_VK_PAGE_UP) {
// Move up roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the first item)
self._tryToSelect((self._selectedIndex || 0) - self._itemsPerPage(), -1, true);
} else if (keyCode === KeyEvent.DOM_VK_PAGE_DOWN) {
// Move down roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the item one page down from the top)
self._tryToSelect((self._selectedIndex || 0) + self._itemsPerPage(), +1, true);
} else if (keyCode === KeyEvent.DOM_VK_HOME) {
self._tryToSelect(0, +1);
} else if (keyCode === KeyEvent.DOM_VK_END) {
self._tryToSelect(self.$items.length - 1, -1);
} else if (self._selectedIndex !== -1 &&
(keyCode === KeyEvent.DOM_VK_RETURN)) {
// Trigger a click handler to commmit the selected item
self._selectionHandler();
} else {
// Let the event bubble.
return false;
}
event.stopImmediatePropagation();
event.preventDefault();
return true;
}
// If we didn't handle it, let other global keydown hooks handle it.
return false;
} | javascript | function _keydownHook(event) {
var keyCode;
// (page) up, (page) down, enter and tab key are handled by the list
if (event.type === "keydown") {
keyCode = event.keyCode;
if (keyCode === KeyEvent.DOM_VK_TAB) {
self.close();
} else if (keyCode === KeyEvent.DOM_VK_UP) {
// Move up one, wrapping at edges (if nothing selected, select the last item)
self._tryToSelect(self._selectedIndex === -1 ? -1 : self._selectedIndex - 1, -1);
} else if (keyCode === KeyEvent.DOM_VK_DOWN) {
// Move down one, wrapping at edges (if nothing selected, select the first item)
self._tryToSelect(self._selectedIndex === -1 ? 0 : self._selectedIndex + 1, +1);
} else if (keyCode === KeyEvent.DOM_VK_PAGE_UP) {
// Move up roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the first item)
self._tryToSelect((self._selectedIndex || 0) - self._itemsPerPage(), -1, true);
} else if (keyCode === KeyEvent.DOM_VK_PAGE_DOWN) {
// Move down roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the item one page down from the top)
self._tryToSelect((self._selectedIndex || 0) + self._itemsPerPage(), +1, true);
} else if (keyCode === KeyEvent.DOM_VK_HOME) {
self._tryToSelect(0, +1);
} else if (keyCode === KeyEvent.DOM_VK_END) {
self._tryToSelect(self.$items.length - 1, -1);
} else if (self._selectedIndex !== -1 &&
(keyCode === KeyEvent.DOM_VK_RETURN)) {
// Trigger a click handler to commmit the selected item
self._selectionHandler();
} else {
// Let the event bubble.
return false;
}
event.stopImmediatePropagation();
event.preventDefault();
return true;
}
// If we didn't handle it, let other global keydown hooks handle it.
return false;
} | [
"function",
"_keydownHook",
"(",
"event",
")",
"{",
"var",
"keyCode",
";",
"// (page) up, (page) down, enter and tab key are handled by the list",
"if",
"(",
"event",
".",
"type",
"===",
"\"keydown\"",
")",
"{",
"keyCode",
"=",
"event",
".",
"keyCode",
";",
"if",
... | Convert keydown events into hint list navigation actions.
@param {KeyboardEvent} event
@return {boolean} true if key was handled, otherwise false. | [
"Convert",
"keydown",
"events",
"into",
"hint",
"list",
"navigation",
"actions",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/DropdownEventHandler.js#L82-L126 | train | The keydown event handler | [
30522,
3853,
1035,
3145,
7698,
6806,
6559,
1006,
2724,
1007,
1063,
13075,
3145,
16044,
1025,
1013,
1013,
1006,
3931,
1007,
2039,
1010,
1006,
3931,
1007,
2091,
1010,
4607,
1998,
21628,
3145,
2024,
8971,
2011,
1996,
2862,
2065,
1006,
2724,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | src/components/orientation/orientation.js | function (e) {
var self = this
var info = this.getInfo()
var subs = this._subs
var i
var l
// 如果不等于上次方向,则触发
if (info.landscape !== this.info.landscape) {
this.info = merge(info)
info.originEvent = e
info.originType = e.type
// 执行on
for (i = 0, l = subs.on.length; i < l; i++) {
subs.on[i].call(self, e)
}
// 执行after
setTimeout(function () {
for (i = 0, l = subs.after.length; i < l; i++) {
subs.after[i].call(self, e)
}
}, 0)
}
} | javascript | function (e) {
var self = this
var info = this.getInfo()
var subs = this._subs
var i
var l
// 如果不等于上次方向,则触发
if (info.landscape !== this.info.landscape) {
this.info = merge(info)
info.originEvent = e
info.originType = e.type
// 执行on
for (i = 0, l = subs.on.length; i < l; i++) {
subs.on[i].call(self, e)
}
// 执行after
setTimeout(function () {
for (i = 0, l = subs.after.length; i < l; i++) {
subs.after[i].call(self, e)
}
}, 0)
}
} | [
"function",
"(",
"e",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"info",
"=",
"this",
".",
"getInfo",
"(",
")",
"var",
"subs",
"=",
"this",
".",
"_subs",
"var",
"i",
"var",
"l",
"// 如果不等于上次方向,则触发",
"if",
"(",
"info",
".",
"landscape",
"!==",
"thi... | 触发横竖屏事件
@method _fireChange
@param {EventFacade} e
@protected | [
"触发横竖屏事件"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/orientation/orientation.js#L180-L205 | train | event handler for the node | [
30522,
3853,
1006,
1041,
1007,
1063,
13075,
2969,
1027,
2023,
13075,
18558,
1027,
2023,
1012,
2131,
2378,
14876,
1006,
1007,
13075,
4942,
2015,
1027,
2023,
1012,
1035,
4942,
2015,
13075,
1045,
13075,
1048,
1013,
1013,
100,
100,
1744,
100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/datepicker/js/dateUtil.js | isDateWithinRange | function isDateWithinRange(date, minDate, maxDate) {
var dateAtMidnight = createDateAtMidnight(date);
var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null;
var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null;
return (!minDateAtMidnight || minDateAtMidnight <= dateAtMidnight) &&
(!maxDateAtMidnight || maxDateAtMidnight >= dateAtMidnight);
} | javascript | function isDateWithinRange(date, minDate, maxDate) {
var dateAtMidnight = createDateAtMidnight(date);
var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null;
var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null;
return (!minDateAtMidnight || minDateAtMidnight <= dateAtMidnight) &&
(!maxDateAtMidnight || maxDateAtMidnight >= dateAtMidnight);
} | [
"function",
"isDateWithinRange",
"(",
"date",
",",
"minDate",
",",
"maxDate",
")",
"{",
"var",
"dateAtMidnight",
"=",
"createDateAtMidnight",
"(",
"date",
")",
";",
"var",
"minDateAtMidnight",
"=",
"isValidDate",
"(",
"minDate",
")",
"?",
"createDateAtMidnight",
... | Checks if a date is within a min and max range, ignoring the time component.
If minDate or maxDate are not dates, they are ignored.
@param {Date} date
@param {Date} minDate
@param {Date} maxDate | [
"Checks",
"if",
"a",
"date",
"is",
"within",
"a",
"min",
"and",
"max",
"range",
"ignoring",
"the",
"time",
"component",
".",
"If",
"minDate",
"or",
"maxDate",
"are",
"not",
"dates",
"they",
"are",
"ignored",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L235-L241 | train | Check if date is within range | [
30522,
3853,
2003,
13701,
24415,
2378,
24388,
2063,
1006,
3058,
1010,
2568,
3686,
1010,
4098,
13701,
1007,
1063,
13075,
3058,
4017,
4328,
2094,
15864,
1027,
2580,
3686,
4017,
4328,
2094,
15864,
1006,
3058,
1007,
1025,
13075,
2568,
3686,
401... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lovell/sharp | lib/output.js | png | function png (options) {
if (is.object(options)) {
if (is.defined(options.progressive)) {
this._setBooleanOption('pngProgressive', options.progressive);
}
if (is.defined(options.compressionLevel)) {
if (is.integer(options.compressionLevel) && is.inRange(options.compressionLevel, 0, 9)) {
this.options.pngCompressionLevel = options.compressionLevel;
} else {
throw new Error('Invalid compressionLevel (integer, 0-9) ' + options.compressionLevel);
}
}
if (is.defined(options.adaptiveFiltering)) {
this._setBooleanOption('pngAdaptiveFiltering', options.adaptiveFiltering);
}
if (is.defined(options.palette)) {
this._setBooleanOption('pngPalette', options.palette);
if (this.options.pngPalette) {
if (is.defined(options.quality)) {
if (is.integer(options.quality) && is.inRange(options.quality, 0, 100)) {
this.options.pngQuality = options.quality;
} else {
throw is.invalidParameterError('quality', 'integer between 0 and 100', options.quality);
}
}
const colours = options.colours || options.colors;
if (is.defined(colours)) {
if (is.integer(colours) && is.inRange(colours, 2, 256)) {
this.options.pngColours = colours;
} else {
throw is.invalidParameterError('colours', 'integer between 2 and 256', colours);
}
}
if (is.defined(options.dither)) {
if (is.number(options.dither) && is.inRange(options.dither, 0, 1)) {
this.options.pngDither = options.dither;
} else {
throw is.invalidParameterError('dither', 'number between 0.0 and 1.0', options.dither);
}
}
}
}
}
return this._updateFormatOut('png', options);
} | javascript | function png (options) {
if (is.object(options)) {
if (is.defined(options.progressive)) {
this._setBooleanOption('pngProgressive', options.progressive);
}
if (is.defined(options.compressionLevel)) {
if (is.integer(options.compressionLevel) && is.inRange(options.compressionLevel, 0, 9)) {
this.options.pngCompressionLevel = options.compressionLevel;
} else {
throw new Error('Invalid compressionLevel (integer, 0-9) ' + options.compressionLevel);
}
}
if (is.defined(options.adaptiveFiltering)) {
this._setBooleanOption('pngAdaptiveFiltering', options.adaptiveFiltering);
}
if (is.defined(options.palette)) {
this._setBooleanOption('pngPalette', options.palette);
if (this.options.pngPalette) {
if (is.defined(options.quality)) {
if (is.integer(options.quality) && is.inRange(options.quality, 0, 100)) {
this.options.pngQuality = options.quality;
} else {
throw is.invalidParameterError('quality', 'integer between 0 and 100', options.quality);
}
}
const colours = options.colours || options.colors;
if (is.defined(colours)) {
if (is.integer(colours) && is.inRange(colours, 2, 256)) {
this.options.pngColours = colours;
} else {
throw is.invalidParameterError('colours', 'integer between 2 and 256', colours);
}
}
if (is.defined(options.dither)) {
if (is.number(options.dither) && is.inRange(options.dither, 0, 1)) {
this.options.pngDither = options.dither;
} else {
throw is.invalidParameterError('dither', 'number between 0.0 and 1.0', options.dither);
}
}
}
}
}
return this._updateFormatOut('png', options);
} | [
"function",
"png",
"(",
"options",
")",
"{",
"if",
"(",
"is",
".",
"object",
"(",
"options",
")",
")",
"{",
"if",
"(",
"is",
".",
"defined",
"(",
"options",
".",
"progressive",
")",
")",
"{",
"this",
".",
"_setBooleanOption",
"(",
"'pngProgressive'",
... | Use these PNG options for output image.
PNG output is always full colour at 8 or 16 bits per pixel.
Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pixel.
@example
// Convert any input to PNG output
const data = await sharp(input)
.png()
.toBuffer();
@param {Object} [options]
@param {Boolean} [options.progressive=false] - use progressive (interlace) scan
@param {Number} [options.compressionLevel=9] - zlib compression level, 0-9
@param {Boolean} [options.adaptiveFiltering=false] - use adaptive row filtering
@param {Boolean} [options.palette=false] - quantise to a palette-based image with alpha transparency support, requires libvips compiled with support for libimagequant
@param {Number} [options.quality=100] - use the lowest number of colours needed to achieve given quality, requires libvips compiled with support for libimagequant
@param {Number} [options.colours=256] - maximum number of palette entries, requires libvips compiled with support for libimagequant
@param {Number} [options.colors=256] - alternative spelling of `options.colours`, requires libvips compiled with support for libimagequant
@param {Number} [options.dither=1.0] - level of Floyd-Steinberg error diffusion, requires libvips compiled with support for libimagequant
@param {Boolean} [options.force=true] - force PNG output, otherwise attempt to use input format
@returns {Sharp}
@throws {Error} Invalid options | [
"Use",
"these",
"PNG",
"options",
"for",
"output",
"image",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/output.js#L233-L277 | train | Set png options | [
30522,
3853,
1052,
3070,
1006,
7047,
1007,
1063,
2065,
1006,
2003,
1012,
4874,
1006,
7047,
1007,
1007,
1063,
2065,
1006,
2003,
1012,
4225,
1006,
7047,
1012,
6555,
1007,
1007,
1063,
2023,
1012,
1035,
2275,
5092,
9890,
6761,
16790,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mochajs/mocha | lib/reporters/xunit.js | tag | function tag(name, attrs, close, content) {
var end = close ? '/>' : '>';
var pairs = [];
var tag;
for (var key in attrs) {
if (Object.prototype.hasOwnProperty.call(attrs, key)) {
pairs.push(key + '="' + escape(attrs[key]) + '"');
}
}
tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
if (content) {
tag += content + '</' + name + end;
}
return tag;
} | javascript | function tag(name, attrs, close, content) {
var end = close ? '/>' : '>';
var pairs = [];
var tag;
for (var key in attrs) {
if (Object.prototype.hasOwnProperty.call(attrs, key)) {
pairs.push(key + '="' + escape(attrs[key]) + '"');
}
}
tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
if (content) {
tag += content + '</' + name + end;
}
return tag;
} | [
"function",
"tag",
"(",
"name",
",",
"attrs",
",",
"close",
",",
"content",
")",
"{",
"var",
"end",
"=",
"close",
"?",
"'/>'",
":",
"'>'",
";",
"var",
"pairs",
"=",
"[",
"]",
";",
"var",
"tag",
";",
"for",
"(",
"var",
"key",
"in",
"attrs",
")",... | HTML tag helper.
@param name
@param attrs
@param close
@param content
@return {string} | [
"HTML",
"tag",
"helper",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/xunit.js#L198-L214 | train | tag function | [
30522,
3853,
6415,
1006,
2171,
1010,
2012,
16344,
2015,
1010,
2485,
1010,
4180,
1007,
1063,
13075,
2203,
1027,
2485,
1029,
1005,
1013,
1028,
1005,
1024,
1005,
1028,
1005,
1025,
13075,
7689,
1027,
1031,
1033,
1025,
13075,
6415,
1025,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/hello-mui/js/mui.imageViewer.js | function() {
var self = this;
self.mask.style.display = 'block';
self.index++;
var newItem = self.createImage(self.index, 'right');
setTimeout(function() {
self.currentItem.classList.remove('mui-imageviewer-item-center');
self.currentItem.classList.add('mui-imageviewer-item-left');
newItem.classList.remove('mui-imageviewer-item-right');
newItem.classList.add('mui-imageviewer-item-center');
self.oldItem = self.currentItem;
self.currentItem = newItem;
// TODO: 临时,稍候将调整
setTimeout(function() {
self.disposeImage();
self.mask.style.display = 'none';
}, 600);
}, 25);
} | javascript | function() {
var self = this;
self.mask.style.display = 'block';
self.index++;
var newItem = self.createImage(self.index, 'right');
setTimeout(function() {
self.currentItem.classList.remove('mui-imageviewer-item-center');
self.currentItem.classList.add('mui-imageviewer-item-left');
newItem.classList.remove('mui-imageviewer-item-right');
newItem.classList.add('mui-imageviewer-item-center');
self.oldItem = self.currentItem;
self.currentItem = newItem;
// TODO: 临时,稍候将调整
setTimeout(function() {
self.disposeImage();
self.mask.style.display = 'none';
}, 600);
}, 25);
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"mask",
".",
"style",
".",
"display",
"=",
"'block'",
";",
"self",
".",
"index",
"++",
";",
"var",
"newItem",
"=",
"self",
".",
"createImage",
"(",
"self",
".",
"index",
",",
... | 下一张图片 | [
"下一张图片"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.imageViewer.js#L191-L209 | train | This function is called when the image is clicked | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2969,
1012,
7308,
1012,
2806,
1012,
4653,
1027,
1005,
3796,
1005,
1025,
2969,
1012,
5950,
1009,
1009,
1025,
13075,
2047,
4221,
2213,
1027,
2969,
1012,
3443,
9581,
3351,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/datepicker/js/calendar.spec.js | dispatchKeyEvent | function dispatchKeyEvent(keyCode, opt_modifiers) {
var mod = opt_modifiers || {};
angular.element(element).triggerHandler({
type: 'keydown',
keyCode: keyCode,
which: keyCode,
ctrlKey: mod.ctrl,
altKey: mod.alt,
metaKey: mod.meta,
shortKey: mod.shift
});
} | javascript | function dispatchKeyEvent(keyCode, opt_modifiers) {
var mod = opt_modifiers || {};
angular.element(element).triggerHandler({
type: 'keydown',
keyCode: keyCode,
which: keyCode,
ctrlKey: mod.ctrl,
altKey: mod.alt,
metaKey: mod.meta,
shortKey: mod.shift
});
} | [
"function",
"dispatchKeyEvent",
"(",
"keyCode",
",",
"opt_modifiers",
")",
"{",
"var",
"mod",
"=",
"opt_modifiers",
"||",
"{",
"}",
";",
"angular",
".",
"element",
"(",
"element",
")",
".",
"triggerHandler",
"(",
"{",
"type",
":",
"'keydown'",
",",
"keyCod... | Dispatches a KeyboardEvent for the calendar.
@param {number} keyCode
@param {Object=} opt_modifiers | [
"Dispatches",
"a",
"KeyboardEvent",
"for",
"the",
"calendar",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.spec.js#L116-L129 | train | Dispatches a keydown event to the element | [
30522,
3853,
18365,
14839,
18697,
3372,
1006,
3145,
16044,
1010,
23569,
1035,
16913,
28295,
1007,
1063,
13075,
16913,
1027,
23569,
1035,
16913,
28295,
1064,
1064,
1063,
1065,
1025,
16108,
1012,
5783,
1006,
5783,
1007,
1012,
9495,
11774,
3917,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/addons.js | addToWhiteList | function addToWhiteList(aDomain) {
pm.add(utils.createURI(aDomain),
"install",
Ci.nsIPermissionManager.ALLOW_ACTION);
} | javascript | function addToWhiteList(aDomain) {
pm.add(utils.createURI(aDomain),
"install",
Ci.nsIPermissionManager.ALLOW_ACTION);
} | [
"function",
"addToWhiteList",
"(",
"aDomain",
")",
"{",
"pm",
".",
"add",
"(",
"utils",
".",
"createURI",
"(",
"aDomain",
")",
",",
"\"install\"",
",",
"Ci",
".",
"nsIPermissionManager",
".",
"ALLOW_ACTION",
")",
";",
"}"
] | Whitelist permission for the specified domain
@param {string} aDomain
The domain to add the permission for | [
"Whitelist",
"permission",
"for",
"the",
"specified",
"domain"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L1234-L1238 | train | Add a domain to white list | [
30522,
3853,
5587,
18790,
16584,
29282,
2102,
1006,
4748,
9626,
2378,
1007,
1063,
7610,
1012,
5587,
1006,
21183,
12146,
1012,
3443,
9496,
1006,
4748,
9626,
2378,
1007,
1010,
1000,
16500,
1000,
1010,
25022,
1012,
24978,
15457,
28550,
28231,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
material-components/material-components-web | scripts/cherry-pick-commits.js | getCommitsAfter | async function getCommitsAfter(commit) {
if (!args.includes('--no-fetch')) {
await simpleGit.fetch();
}
const log = await simpleGit.log({
from: commit,
to: 'origin/master',
format: logFormat,
splitter: logSplitter,
});
return log.all.reverse();
} | javascript | async function getCommitsAfter(commit) {
if (!args.includes('--no-fetch')) {
await simpleGit.fetch();
}
const log = await simpleGit.log({
from: commit,
to: 'origin/master',
format: logFormat,
splitter: logSplitter,
});
return log.all.reverse();
} | [
"async",
"function",
"getCommitsAfter",
"(",
"commit",
")",
"{",
"if",
"(",
"!",
"args",
".",
"includes",
"(",
"'--no-fetch'",
")",
")",
"{",
"await",
"simpleGit",
".",
"fetch",
"(",
")",
";",
"}",
"const",
"log",
"=",
"await",
"simpleGit",
".",
"log",... | Resolves to an array of commits after the given tag, from earliest to latest (for proper cherry-picking). | [
"Resolves",
"to",
"an",
"array",
"of",
"commits",
"after",
"the",
"given",
"tag",
"from",
"earliest",
"to",
"latest",
"(",
"for",
"proper",
"cherry",
"-",
"picking",
")",
"."
] | 9f8b9ae5103ff86de4f6a5cb02e700d6eb851e5f | https://github.com/material-components/material-components-web/blob/9f8b9ae5103ff86de4f6a5cb02e700d6eb851e5f/scripts/cherry-pick-commits.js#L99-L110 | train | Get commits after commit | [
30522,
2004,
6038,
2278,
3853,
2131,
9006,
22930,
3736,
6199,
2121,
1006,
10797,
1007,
1063,
2065,
1006,
999,
12098,
5620,
1012,
2950,
1006,
1005,
1011,
1011,
2053,
1011,
18584,
1005,
1007,
1007,
1063,
26751,
3722,
23806,
1012,
18584,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
NetEase/pomelo | lib/server/server.js | function(cron, crons, server) {
if(!containCron(cron.id, crons)) {
server.crons.push(cron);
} else {
logger.warn('cron is duplicated: %j', cron);
}
} | javascript | function(cron, crons, server) {
if(!containCron(cron.id, crons)) {
server.crons.push(cron);
} else {
logger.warn('cron is duplicated: %j', cron);
}
} | [
"function",
"(",
"cron",
",",
"crons",
",",
"server",
")",
"{",
"if",
"(",
"!",
"containCron",
"(",
"cron",
".",
"id",
",",
"crons",
")",
")",
"{",
"server",
".",
"crons",
".",
"push",
"(",
"cron",
")",
";",
"}",
"else",
"{",
"logger",
".",
"wa... | If cron is not in crons then put it in the array. | [
"If",
"cron",
"is",
"not",
"in",
"crons",
"then",
"put",
"it",
"in",
"the",
"array",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/server/server.js#L434-L440 | train | Add a cron to the server | [
30522,
3853,
1006,
13675,
2239,
1010,
13675,
5644,
1010,
8241,
1007,
1063,
2065,
1006,
999,
5383,
26775,
2239,
1006,
13675,
2239,
1012,
8909,
1010,
13675,
5644,
1007,
1007,
1063,
8241,
1012,
13675,
5644,
1012,
5245,
1006,
13675,
2239,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
aframevr/aframe | src/components/tracked-controls-webvr.js | function (id, buttonState) {
var evtName;
var previousButtonState = this.buttonStates[id];
// Not changed.
if (buttonState.pressed === previousButtonState.pressed) { return false; }
evtName = buttonState.pressed ? EVENTS.BUTTONDOWN : EVENTS.BUTTONUP;
this.el.emit(evtName, this.buttonEventDetails[id], false);
previousButtonState.pressed = buttonState.pressed;
return true;
} | javascript | function (id, buttonState) {
var evtName;
var previousButtonState = this.buttonStates[id];
// Not changed.
if (buttonState.pressed === previousButtonState.pressed) { return false; }
evtName = buttonState.pressed ? EVENTS.BUTTONDOWN : EVENTS.BUTTONUP;
this.el.emit(evtName, this.buttonEventDetails[id], false);
previousButtonState.pressed = buttonState.pressed;
return true;
} | [
"function",
"(",
"id",
",",
"buttonState",
")",
"{",
"var",
"evtName",
";",
"var",
"previousButtonState",
"=",
"this",
".",
"buttonStates",
"[",
"id",
"]",
";",
"// Not changed.",
"if",
"(",
"buttonState",
".",
"pressed",
"===",
"previousButtonState",
".",
"... | Determine whether a button press has occured and emit events as appropriate.
@param {string} id - ID of the button to check.
@param {object} buttonState - State of the button to check.
@returns {boolean} Whether button press state changed. | [
"Determine",
"whether",
"a",
"button",
"press",
"has",
"occured",
"and",
"emit",
"events",
"as",
"appropriate",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/tracked-controls-webvr.js#L286-L297 | train | Emit a button event | [
30522,
3853,
1006,
8909,
1010,
11287,
12259,
1007,
1063,
13075,
23408,
2102,
18442,
1025,
13075,
3025,
8569,
15474,
9153,
2618,
1027,
2023,
1012,
11287,
12259,
2015,
1031,
8909,
1033,
1025,
1013,
1013,
2025,
2904,
1012,
2065,
1006,
11287,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
PrismJS/prism | plugins/line-numbers/prism-line-numbers.js | function (element) {
if (!element) {
return null;
}
return window.getComputedStyle ? getComputedStyle(element) : (element.currentStyle || null);
} | javascript | function (element) {
if (!element) {
return null;
}
return window.getComputedStyle ? getComputedStyle(element) : (element.currentStyle || null);
} | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"element",
")",
"{",
"return",
"null",
";",
"}",
"return",
"window",
".",
"getComputedStyle",
"?",
"getComputedStyle",
"(",
"element",
")",
":",
"(",
"element",
".",
"currentStyle",
"||",
"null",
")",... | Returns style declarations for the element
@param {Element} element | [
"Returns",
"style",
"declarations",
"for",
"the",
"element"
] | acceb3b56f0e8362a7ef274dbd85b17611df2ec4 | https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/plugins/line-numbers/prism-line-numbers.js#L57-L63 | train | Returns the current style of an element | [
30522,
3853,
1006,
5783,
1007,
1063,
2065,
1006,
999,
5783,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
3332,
1012,
2131,
9006,
29462,
21756,
2571,
1029,
2131,
9006,
29462,
21756,
2571,
1006,
5783,
1007,
1024,
1006,
5783,
1012,
14731,
27983,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js | function (vValue) {
var sStringified,
bEscaped = false,
sResult = "",
i, c;
sStringified = JSON.stringify(vValue);
if (sStringified === undefined) {
return undefined;
}
for (i = 0; i < sStringified.length; i += 1) {
switch (c = sStringified.charAt(i)) {
case "'": // a single quote must be escaped (can only occur in a string)
sResult += "\\'";
break;
case '"':
if (bEscaped) { // a double quote needs no escaping (only in a string)
sResult += c;
bEscaped = false;
} else { // string begin or end with single quotes
sResult += "'";
}
break;
case "\\":
if (bEscaped) { // an escaped backslash
sResult += "\\\\";
}
bEscaped = !bEscaped;
break;
default:
if (bEscaped) {
sResult += "\\";
bEscaped = false;
}
sResult += c;
}
}
return sResult;
} | javascript | function (vValue) {
var sStringified,
bEscaped = false,
sResult = "",
i, c;
sStringified = JSON.stringify(vValue);
if (sStringified === undefined) {
return undefined;
}
for (i = 0; i < sStringified.length; i += 1) {
switch (c = sStringified.charAt(i)) {
case "'": // a single quote must be escaped (can only occur in a string)
sResult += "\\'";
break;
case '"':
if (bEscaped) { // a double quote needs no escaping (only in a string)
sResult += c;
bEscaped = false;
} else { // string begin or end with single quotes
sResult += "'";
}
break;
case "\\":
if (bEscaped) { // an escaped backslash
sResult += "\\\\";
}
bEscaped = !bEscaped;
break;
default:
if (bEscaped) {
sResult += "\\";
bEscaped = false;
}
sResult += c;
}
}
return sResult;
} | [
"function",
"(",
"vValue",
")",
"{",
"var",
"sStringified",
",",
"bEscaped",
"=",
"false",
",",
"sResult",
"=",
"\"\"",
",",
"i",
",",
"c",
";",
"sStringified",
"=",
"JSON",
".",
"stringify",
"(",
"vValue",
")",
";",
"if",
"(",
"sStringified",
"===",
... | Converts the value to a JSON string. Prefers the single quote over the double quote.
This suits better for usage in an XML attribute.
@param {any} vValue the value
@returns {string} the stringified value | [
"Converts",
"the",
"value",
"to",
"a",
"JSON",
"string",
".",
"Prefers",
"the",
"single",
"quote",
"over",
"the",
"double",
"quote",
".",
"This",
"suits",
"better",
"for",
"usage",
"in",
"an",
"XML",
"attribute",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js#L427-L465 | train | Converts a value to a string | [
30522,
3853,
1006,
1058,
10175,
5657,
1007,
1063,
13075,
7020,
18886,
3070,
7810,
1010,
2022,
15782,
5669,
1027,
6270,
1010,
5034,
2229,
11314,
1027,
1000,
1000,
1010,
1045,
1010,
1039,
1025,
7020,
18886,
3070,
7810,
1027,
1046,
3385,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/view/MainViewManager.js | _swapWorkingSetListIndexes | function _swapWorkingSetListIndexes(paneId, index1, index2) {
var pane = _getPane(paneId);
pane.swapViewListIndexes(index1, index2);
exports.trigger("workingSetSort", pane.id);
exports.trigger("_workingSetDisableAutoSort", pane.id);
} | javascript | function _swapWorkingSetListIndexes(paneId, index1, index2) {
var pane = _getPane(paneId);
pane.swapViewListIndexes(index1, index2);
exports.trigger("workingSetSort", pane.id);
exports.trigger("_workingSetDisableAutoSort", pane.id);
} | [
"function",
"_swapWorkingSetListIndexes",
"(",
"paneId",
",",
"index1",
",",
"index2",
")",
"{",
"var",
"pane",
"=",
"_getPane",
"(",
"paneId",
")",
";",
"pane",
".",
"swapViewListIndexes",
"(",
"index1",
",",
"index2",
")",
";",
"exports",
".",
"trigger",
... | Mutually exchanges the files at the indexes passed by parameters.
@param {!string} paneId - id of the pane to swap indices or ACTIVE_PANE
@param {!number} index1 - the index on the left
@param {!number} index2 - the index on the rigth
@private | [
"Mutually",
"exchanges",
"the",
"files",
"at",
"the",
"indexes",
"passed",
"by",
"parameters",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L919-L925 | train | Swap the working set list indexes. | [
30522,
3853,
1035,
19948,
21398,
13462,
9863,
22254,
10288,
2229,
1006,
6090,
7416,
2094,
1010,
5950,
2487,
1010,
5950,
2475,
1007,
1063,
13075,
6090,
2063,
1027,
1035,
2131,
9739,
2063,
1006,
6090,
7416,
2094,
1007,
1025,
6090,
2063,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/qunit.js | diffHalfMatchI | function diffHalfMatchI(longtext, shorttext, i) {
var seed, j, bestCommon, prefixLength, suffixLength,
bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB;
// Start with a 1/4 length substring at position i as a seed.
seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
j = -1;
bestCommon = "";
while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {
prefixLength = dmp.diffCommonPrefix(longtext.substring(i),
shorttext.substring(j));
suffixLength = dmp.diffCommonSuffix(longtext.substring(0, i),
shorttext.substring(0, j));
if (bestCommon.length < suffixLength + prefixLength) {
bestCommon = shorttext.substring(j - suffixLength, j) +
shorttext.substring(j, j + prefixLength);
bestLongtextA = longtext.substring(0, i - suffixLength);
bestLongtextB = longtext.substring(i + prefixLength);
bestShorttextA = shorttext.substring(0, j - suffixLength);
bestShorttextB = shorttext.substring(j + prefixLength);
}
}
if (bestCommon.length * 2 >= longtext.length) {
return [ bestLongtextA, bestLongtextB,
bestShorttextA, bestShorttextB, bestCommon
];
} else {
return null;
}
} | javascript | function diffHalfMatchI(longtext, shorttext, i) {
var seed, j, bestCommon, prefixLength, suffixLength,
bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB;
// Start with a 1/4 length substring at position i as a seed.
seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
j = -1;
bestCommon = "";
while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {
prefixLength = dmp.diffCommonPrefix(longtext.substring(i),
shorttext.substring(j));
suffixLength = dmp.diffCommonSuffix(longtext.substring(0, i),
shorttext.substring(0, j));
if (bestCommon.length < suffixLength + prefixLength) {
bestCommon = shorttext.substring(j - suffixLength, j) +
shorttext.substring(j, j + prefixLength);
bestLongtextA = longtext.substring(0, i - suffixLength);
bestLongtextB = longtext.substring(i + prefixLength);
bestShorttextA = shorttext.substring(0, j - suffixLength);
bestShorttextB = shorttext.substring(j + prefixLength);
}
}
if (bestCommon.length * 2 >= longtext.length) {
return [ bestLongtextA, bestLongtextB,
bestShorttextA, bestShorttextB, bestCommon
];
} else {
return null;
}
} | [
"function",
"diffHalfMatchI",
"(",
"longtext",
",",
"shorttext",
",",
"i",
")",
"{",
"var",
"seed",
",",
"j",
",",
"bestCommon",
",",
"prefixLength",
",",
"suffixLength",
",",
"bestLongtextA",
",",
"bestLongtextB",
",",
"bestShorttextA",
",",
"bestShorttextB",
... | 'this' becomes 'window' in a closure.
Does a substring of shorttext exist within longtext such that the substring
is at least half the length of longtext?
Closure, but does not reference any external variables.
@param {string} longtext Longer string.
@param {string} shorttext Shorter string.
@param {number} i Start index of quarter length substring within longtext.
@return {Array.<string>} Five element Array, containing the prefix of
longtext, the suffix of longtext, the prefix of shorttext, the suffix
of shorttext and the common middle. Or null if there was no match.
@private | [
"this",
"becomes",
"window",
"in",
"a",
"closure",
".",
"Does",
"a",
"substring",
"of",
"shorttext",
"exist",
"within",
"longtext",
"such",
"that",
"the",
"substring",
"is",
"at",
"least",
"half",
"the",
"length",
"of",
"longtext?",
"Closure",
"but",
"does",... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L2406-L2434 | train | diff half match | [
30522,
3853,
4487,
4246,
8865,
16715,
4017,
5428,
1006,
2146,
18209,
1010,
2460,
18209,
1010,
1045,
1007,
1063,
13075,
6534,
1010,
1046,
1010,
2190,
9006,
30524,
2232,
1010,
16809,
7770,
13512,
2232,
1010,
2190,
10052,
18209,
2050,
1010,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
NetEase/pomelo | lib/util/appUtil.js | function(args) {
var argsMap = {};
var mainPos = 1;
while (args[mainPos].indexOf('--') > 0) {
mainPos++;
}
argsMap.main = args[mainPos];
for (var i = (mainPos + 1); i < args.length; i++) {
var arg = args[i];
var sep = arg.indexOf('=');
var key = arg.slice(0, sep);
var value = arg.slice(sep + 1);
if (!isNaN(Number(value)) && (value.indexOf('.') < 0)) {
value = Number(value);
}
argsMap[key] = value;
}
return argsMap;
} | javascript | function(args) {
var argsMap = {};
var mainPos = 1;
while (args[mainPos].indexOf('--') > 0) {
mainPos++;
}
argsMap.main = args[mainPos];
for (var i = (mainPos + 1); i < args.length; i++) {
var arg = args[i];
var sep = arg.indexOf('=');
var key = arg.slice(0, sep);
var value = arg.slice(sep + 1);
if (!isNaN(Number(value)) && (value.indexOf('.') < 0)) {
value = Number(value);
}
argsMap[key] = value;
}
return argsMap;
} | [
"function",
"(",
"args",
")",
"{",
"var",
"argsMap",
"=",
"{",
"}",
";",
"var",
"mainPos",
"=",
"1",
";",
"while",
"(",
"args",
"[",
"mainPos",
"]",
".",
"indexOf",
"(",
"'--'",
")",
">",
"0",
")",
"{",
"mainPos",
"++",
";",
"}",
"argsMap",
"."... | Parse command line arguments.
@param args command line arguments
@return Object argsMap map of arguments | [
"Parse",
"command",
"line",
"arguments",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/util/appUtil.js#L222-L243 | train | Get argsMap from args | [
30522,
3853,
1006,
12098,
5620,
1007,
1063,
13075,
12098,
5620,
2863,
2361,
1027,
1063,
1065,
1025,
13075,
2364,
6873,
2015,
1027,
1015,
1025,
2096,
1006,
12098,
5620,
1031,
2364,
6873,
2015,
1033,
1012,
5950,
11253,
1006,
1005,
1011,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.m/src/sap/m/library.js | function(rm, oControl, vCssClass, sBgImgUrl, bRepeat, fOpacity) {
rm.write("<div id='" + oControl.getId() + "-BG' ");
if (Array.isArray(vCssClass)) {
for (var i = 0; i < vCssClass.length; i++) {
rm.addClass(vCssClass[i]);
}
} else {
rm.addClass(vCssClass);
}
rm.addClass("sapUiGlobalBackgroundImage"); // this adds the background image from the theme
if (sBgImgUrl) { // use the settings only if a background image is configured
rm.addStyle("display", "block"); // enforce visibility even if a parent has also a background image
rm.addStyle("background-image", "url(" + encodeCSS(sBgImgUrl) + ")");
rm.addStyle("background-repeat", bRepeat ? "repeat" : "no-repeat");
if (!bRepeat) {
rm.addStyle("background-size", "cover");
rm.addStyle("background-position", "center");
} else { // repeat
rm.addStyle("background-position", "left top");
}
} //else {
// the theme defines the background
//}
if (fOpacity !== 1) {
if (fOpacity > 1) { // greater than 1 enforces 1
fOpacity = 1;
}
rm.addStyle("opacity", fOpacity);
}
// no custom class from the control's custom class
// If a class is added using addStyleClass, this class will be output to this background image div without the 'false' param.
rm.writeClasses(false);
rm.writeStyles();
rm.write("></div>");
} | javascript | function(rm, oControl, vCssClass, sBgImgUrl, bRepeat, fOpacity) {
rm.write("<div id='" + oControl.getId() + "-BG' ");
if (Array.isArray(vCssClass)) {
for (var i = 0; i < vCssClass.length; i++) {
rm.addClass(vCssClass[i]);
}
} else {
rm.addClass(vCssClass);
}
rm.addClass("sapUiGlobalBackgroundImage"); // this adds the background image from the theme
if (sBgImgUrl) { // use the settings only if a background image is configured
rm.addStyle("display", "block"); // enforce visibility even if a parent has also a background image
rm.addStyle("background-image", "url(" + encodeCSS(sBgImgUrl) + ")");
rm.addStyle("background-repeat", bRepeat ? "repeat" : "no-repeat");
if (!bRepeat) {
rm.addStyle("background-size", "cover");
rm.addStyle("background-position", "center");
} else { // repeat
rm.addStyle("background-position", "left top");
}
} //else {
// the theme defines the background
//}
if (fOpacity !== 1) {
if (fOpacity > 1) { // greater than 1 enforces 1
fOpacity = 1;
}
rm.addStyle("opacity", fOpacity);
}
// no custom class from the control's custom class
// If a class is added using addStyleClass, this class will be output to this background image div without the 'false' param.
rm.writeClasses(false);
rm.writeStyles();
rm.write("></div>");
} | [
"function",
"(",
"rm",
",",
"oControl",
",",
"vCssClass",
",",
"sBgImgUrl",
",",
"bRepeat",
",",
"fOpacity",
")",
"{",
"rm",
".",
"write",
"(",
"\"<div id='\"",
"+",
"oControl",
".",
"getId",
"(",
")",
"+",
"\"-BG' \"",
")",
";",
"if",
"(",
"Array",
... | /*
@protected
@returns
/* currently not needed
isThemeBackgroundImageModified: function() {
var Parameters = sap.ui.requireSync("sap/ui/core/theming/Parameters");
var sBgImgUrl = Parameters.get('sapUiGlobalBackgroundImage'); // the global background image from the theme
if (sBgImgUrl && sBgImgUrl !== "''") {
var sBgImgUrlDefault = Parameters.get('sapUiGlobalBackgroundImageDefault');
if (sBgImgUrl !== sBgImgUrlDefault) {
return true;
}
}
return false;
},
Renders an HTML tag into the given RenderManager which carries the background image which is either configured and given or coming from the current theme.
Should be called right after the opening root tag has been completed, so this is the first child element inside the control.
@param {sap.ui.core.RenderManager} rm The RenderManager
@param {sap.ui.core.Control} oControl Control within which the tag will be rendered; its ID will be used to generate the element ID
@param {string|string[]} vCssClass A CSS class or an array of CSS classes to add to the element
@param {sap.ui.core.URI} [sBgImgUrl] The image of a configured background image; if this is not given, the theme background will be used and also the other settings are ignored.
@param {boolean} [bRepeat] Whether the background image should be repeated/tiled (or stretched)
@param {float} [fOpacity] The background image opacity, if any
@protected | [
"/",
"*",
"@protected",
"@returns",
"/",
"*",
"currently",
"not",
"needed",
"isThemeBackgroundImageModified",
":",
"function",
"()",
"{",
"var",
"Parameters",
"=",
"sap",
".",
"ui",
".",
"requireSync",
"(",
"sap",
"/",
"ui",
"/",
"core",
"/",
"theming",
"/... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/library.js#L4229-L4270 | train | Writes the background image div | [
30522,
3853,
1006,
28549,
1010,
1051,
8663,
13181,
2140,
1010,
18315,
4757,
26266,
1010,
24829,
5856,
24798,
3126,
2140,
1010,
7987,
13699,
5243,
2102,
1010,
1042,
29477,
12972,
1007,
1063,
28549,
1012,
4339,
1006,
1000,
1026,
4487,
2615,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
discordjs/discord.js | src/errors/DJSError.js | message | function message(key, args) {
if (typeof key !== 'string') throw new Error('Error message key must be a string');
const msg = messages.get(key);
if (!msg) throw new Error(`An invalid error message key was used: ${key}.`);
if (typeof msg === 'function') return msg(...args);
if (args === undefined || args.length === 0) return msg;
args.unshift(msg);
return String(...args);
} | javascript | function message(key, args) {
if (typeof key !== 'string') throw new Error('Error message key must be a string');
const msg = messages.get(key);
if (!msg) throw new Error(`An invalid error message key was used: ${key}.`);
if (typeof msg === 'function') return msg(...args);
if (args === undefined || args.length === 0) return msg;
args.unshift(msg);
return String(...args);
} | [
"function",
"message",
"(",
"key",
",",
"args",
")",
"{",
"if",
"(",
"typeof",
"key",
"!==",
"'string'",
")",
"throw",
"new",
"Error",
"(",
"'Error message key must be a string'",
")",
";",
"const",
"msg",
"=",
"messages",
".",
"get",
"(",
"key",
")",
";... | Format the message for an error.
@param {string} key Error key
@param {Array<*>} args Arguments to pass for util format or as function args
@returns {string} Formatted string | [
"Format",
"the",
"message",
"for",
"an",
"error",
"."
] | 75d5598fdada9ad1913b533e70d049de0d4ff7af | https://github.com/discordjs/discord.js/blob/75d5598fdada9ad1913b533e70d049de0d4ff7af/src/errors/DJSError.js#L37-L45 | train | Returns an error message. | [
30522,
3853,
4471,
1006,
3145,
1010,
12098,
5620,
1007,
1063,
2065,
1006,
2828,
11253,
3145,
999,
1027,
1027,
1005,
5164,
1005,
1007,
5466,
2047,
7561,
1006,
1005,
7561,
4471,
3145,
2442,
2022,
1037,
5164,
1005,
1007,
1025,
9530,
3367,
57... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | mxTooltipHandler | function mxTooltipHandler(graph, delay)
{
if (graph != null)
{
this.graph = graph;
this.delay = delay || 500;
this.graph.addMouseListener(this);
}
} | javascript | function mxTooltipHandler(graph, delay)
{
if (graph != null)
{
this.graph = graph;
this.delay = delay || 500;
this.graph.addMouseListener(this);
}
} | [
"function",
"mxTooltipHandler",
"(",
"graph",
",",
"delay",
")",
"{",
"if",
"(",
"graph",
"!=",
"null",
")",
"{",
"this",
".",
"graph",
"=",
"graph",
";",
"this",
".",
"delay",
"=",
"delay",
"||",
"500",
";",
"this",
".",
"graph",
".",
"addMouseListe... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxTooltipHandler
Graph event handler that displays tooltips. <mxGraph.getTooltip> is used to
get the tooltip for a cell or handle. This handler is built-into
<mxGraph.tooltipHandler> and enabled using <mxGraph.setTooltips>.
Example:
(code>
new mxTooltipHandler(graph);
(end)
Constructor: mxTooltipHandler
Constructs an event handler that displays tooltips with the specified
delay (in milliseconds). If no delay is specified then a default delay
of 500 ms (0.5 sec) is used.
Parameters:
graph - Reference to the enclosing <mxGraph>.
delay - Optional delay in milliseconds. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxTooltipHandler"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L81059-L81067 | train | This function is called when the tooltip is clicked | [
30522,
3853,
25630,
3406,
27914,
11514,
11774,
3917,
1006,
10629,
1010,
8536,
1007,
1063,
2065,
1006,
10629,
999,
1027,
19701,
1007,
1063,
2023,
1012,
10629,
1027,
10629,
1025,
2023,
1012,
8536,
1027,
8536,
1064,
1064,
3156,
1025,
2023,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/TreeBindingAdapter.js | function (oNode) {
// do not count the artifical root node
if (!oNode || !oNode.isArtificial) {
iNodeCounter++;
}
if (oNode) {
// Always reset selectAllMode
oNode.nodeState.selectAllMode = false;
if (this._mTreeState.selected[oNode.groupID]) {
// remember changed index, push it to the limit!
if (!oNode.isArtificial) {
aChangedIndices.push(iNodeCounter);
}
// deslect the node
this.setNodeSelection(oNode.nodeState, false);
//also remember the old lead index
if (oNode.groupID === this._sLeadSelectionGroupID) {
iOldLeadIndex = iNodeCounter;
}
return true;
}
}
} | javascript | function (oNode) {
// do not count the artifical root node
if (!oNode || !oNode.isArtificial) {
iNodeCounter++;
}
if (oNode) {
// Always reset selectAllMode
oNode.nodeState.selectAllMode = false;
if (this._mTreeState.selected[oNode.groupID]) {
// remember changed index, push it to the limit!
if (!oNode.isArtificial) {
aChangedIndices.push(iNodeCounter);
}
// deslect the node
this.setNodeSelection(oNode.nodeState, false);
//also remember the old lead index
if (oNode.groupID === this._sLeadSelectionGroupID) {
iOldLeadIndex = iNodeCounter;
}
return true;
}
}
} | [
"function",
"(",
"oNode",
")",
"{",
"// do not count the artifical root node",
"if",
"(",
"!",
"oNode",
"||",
"!",
"oNode",
".",
"isArtificial",
")",
"{",
"iNodeCounter",
"++",
";",
"}",
"if",
"(",
"oNode",
")",
"{",
"// Always reset selectAllMode",
"oNode",
"... | matches all selected nodes and retrieves their absolute row index | [
"matches",
"all",
"selected",
"nodes",
"and",
"retrieves",
"their",
"absolute",
"row",
"index"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/TreeBindingAdapter.js#L1547-L1574 | train | This function is called when the selection of a node is changed | [
30522,
3853,
1006,
21058,
3207,
1007,
1063,
1013,
1013,
2079,
2025,
4175,
1996,
2396,
18513,
2389,
7117,
13045,
2065,
1006,
999,
21058,
3207,
1064,
1064,
999,
21058,
3207,
1012,
18061,
28228,
8873,
13247,
1007,
1063,
1999,
10244,
3597,
1667... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensibility/node/ExtensionManagerDomain.js | deleteTempAndCallback | function deleteTempAndCallback(err) {
if (validationResult.extractDir) {
fs.remove(validationResult.extractDir);
delete validationResult.extractDir;
}
callback(err, validationResult);
} | javascript | function deleteTempAndCallback(err) {
if (validationResult.extractDir) {
fs.remove(validationResult.extractDir);
delete validationResult.extractDir;
}
callback(err, validationResult);
} | [
"function",
"deleteTempAndCallback",
"(",
"err",
")",
"{",
"if",
"(",
"validationResult",
".",
"extractDir",
")",
"{",
"fs",
".",
"remove",
"(",
"validationResult",
".",
"extractDir",
")",
";",
"delete",
"validationResult",
".",
"extractDir",
";",
"}",
"callba... | This is a wrapper for the callback that will delete the temporary directory to which the package was unzipped. | [
"This",
"is",
"a",
"wrapper",
"for",
"the",
"callback",
"that",
"will",
"delete",
"the",
"temporary",
"directory",
"to",
"which",
"the",
"package",
"was",
"unzipped",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/node/ExtensionManagerDomain.js#L228-L234 | train | Delete temp and callback | [
30522,
3853,
3972,
12870,
18532,
9739,
16409,
8095,
5963,
1006,
9413,
2099,
1007,
1063,
2065,
1006,
27354,
6072,
11314,
1012,
14817,
4305,
2099,
1007,
1063,
1042,
2015,
1012,
6366,
1006,
27354,
6072,
11314,
1012,
14817,
4305,
2099,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mui-org/material-ui | packages/material-ui-codemod/src/v1.0.0/color-imports.js | transformMemberExpressions | function transformMemberExpressions(identifier, j, root) {
// replace all expressions using `identifier` to access color palettes
root.find(j.MemberExpression).forEach(path => {
if (path.node.object.name !== identifier) {
return;
}
const colorProperty = path.node.property.name;
const { palette, hue } = colorAccent(colorProperty);
const colorModuleName = colorImportPath(palette);
const property = hue || palette;
path.node.property =
hue || colorModuleName === 'common'
? j.memberExpression(
j.identifier(colorModuleName),
/^[_|a-z]/i.test(property) ? j.identifier(property) : j.literal(property),
)
: j.identifier(colorModuleName);
});
} | javascript | function transformMemberExpressions(identifier, j, root) {
// replace all expressions using `identifier` to access color palettes
root.find(j.MemberExpression).forEach(path => {
if (path.node.object.name !== identifier) {
return;
}
const colorProperty = path.node.property.name;
const { palette, hue } = colorAccent(colorProperty);
const colorModuleName = colorImportPath(palette);
const property = hue || palette;
path.node.property =
hue || colorModuleName === 'common'
? j.memberExpression(
j.identifier(colorModuleName),
/^[_|a-z]/i.test(property) ? j.identifier(property) : j.literal(property),
)
: j.identifier(colorModuleName);
});
} | [
"function",
"transformMemberExpressions",
"(",
"identifier",
",",
"j",
",",
"root",
")",
"{",
"// replace all expressions using `identifier` to access color palettes",
"root",
".",
"find",
"(",
"j",
".",
"MemberExpression",
")",
".",
"forEach",
"(",
"path",
"=>",
"{",... | Replace all expressions that use identifier to access color palettes.
e.g. colors.amber100 -> colors.amber['100']
@param {sting} identifier
@param {jscodeshift_api_object} j
@param {jscodeshift_ast_object} root | [
"Replace",
"all",
"expressions",
"that",
"use",
"identifier",
"to",
"access",
"color",
"palettes",
".",
"e",
".",
"g",
".",
"colors",
".",
"amber100",
"-",
">",
"colors",
".",
"amber",
"[",
"100",
"]"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-codemod/src/v1.0.0/color-imports.js#L44-L64 | train | Transform all member expressions using the identifier | [
30522,
3853,
10938,
4168,
21784,
10288,
20110,
8496,
1006,
8909,
4765,
18095,
1010,
1046,
1010,
7117,
1007,
1063,
1013,
1013,
5672,
2035,
11423,
2478,
1036,
8909,
4765,
18095,
1036,
2000,
3229,
3609,
27396,
2015,
7117,
1012,
2424,
1006,
104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/max-len.js | computeLineLength | function computeLineLength(line, tabWidth) {
let extraCharacterCount = 0;
line.replace(/\t/gu, (match, offset) => {
const totalOffset = offset + extraCharacterCount,
previousTabStopOffset = tabWidth ? totalOffset % tabWidth : 0,
spaceCount = tabWidth - previousTabStopOffset;
extraCharacterCount += spaceCount - 1; // -1 for the replaced tab
});
return Array.from(line).length + extraCharacterCount;
} | javascript | function computeLineLength(line, tabWidth) {
let extraCharacterCount = 0;
line.replace(/\t/gu, (match, offset) => {
const totalOffset = offset + extraCharacterCount,
previousTabStopOffset = tabWidth ? totalOffset % tabWidth : 0,
spaceCount = tabWidth - previousTabStopOffset;
extraCharacterCount += spaceCount - 1; // -1 for the replaced tab
});
return Array.from(line).length + extraCharacterCount;
} | [
"function",
"computeLineLength",
"(",
"line",
",",
"tabWidth",
")",
"{",
"let",
"extraCharacterCount",
"=",
"0",
";",
"line",
".",
"replace",
"(",
"/",
"\\t",
"/",
"gu",
",",
"(",
"match",
",",
"offset",
")",
"=>",
"{",
"const",
"totalOffset",
"=",
"of... | Computes the length of a line that may contain tabs. The width of each
tab will be the number of spaces to the next tab stop.
@param {string} line The line.
@param {int} tabWidth The width of each tab stop in spaces.
@returns {int} The computed line length.
@private | [
"Computes",
"the",
"length",
"of",
"a",
"line",
"that",
"may",
"contain",
"tabs",
".",
"The",
"width",
"of",
"each",
"tab",
"will",
"be",
"the",
"number",
"of",
"spaces",
"to",
"the",
"next",
"tab",
"stop",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/max-len.js#L110-L121 | train | Compute the line length | [
30522,
3853,
24134,
4179,
7770,
13512,
2232,
1006,
2240,
1010,
21628,
9148,
11927,
2232,
1007,
1063,
2292,
4469,
7507,
22648,
3334,
3597,
16671,
1027,
1014,
1025,
2240,
1012,
5672,
1006,
1013,
1032,
1056,
1013,
19739,
1010,
1006,
2674,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/nonblock-statement-body-position.js | validateStatement | function validateStatement(node, keywordName) {
const option = getOption(keywordName);
if (node.type === "BlockStatement" || option === "any") {
return;
}
const tokenBefore = sourceCode.getTokenBefore(node);
if (tokenBefore.loc.end.line === node.loc.start.line && option === "below") {
context.report({
node,
message: "Expected a linebreak before this statement.",
fix: fixer => fixer.insertTextBefore(node, "\n")
});
} else if (tokenBefore.loc.end.line !== node.loc.start.line && option === "beside") {
context.report({
node,
message: "Expected no linebreak before this statement.",
fix(fixer) {
if (sourceCode.getText().slice(tokenBefore.range[1], node.range[0]).trim()) {
return null;
}
return fixer.replaceTextRange([tokenBefore.range[1], node.range[0]], " ");
}
});
}
} | javascript | function validateStatement(node, keywordName) {
const option = getOption(keywordName);
if (node.type === "BlockStatement" || option === "any") {
return;
}
const tokenBefore = sourceCode.getTokenBefore(node);
if (tokenBefore.loc.end.line === node.loc.start.line && option === "below") {
context.report({
node,
message: "Expected a linebreak before this statement.",
fix: fixer => fixer.insertTextBefore(node, "\n")
});
} else if (tokenBefore.loc.end.line !== node.loc.start.line && option === "beside") {
context.report({
node,
message: "Expected no linebreak before this statement.",
fix(fixer) {
if (sourceCode.getText().slice(tokenBefore.range[1], node.range[0]).trim()) {
return null;
}
return fixer.replaceTextRange([tokenBefore.range[1], node.range[0]], " ");
}
});
}
} | [
"function",
"validateStatement",
"(",
"node",
",",
"keywordName",
")",
"{",
"const",
"option",
"=",
"getOption",
"(",
"keywordName",
")",
";",
"if",
"(",
"node",
".",
"type",
"===",
"\"BlockStatement\"",
"||",
"option",
"===",
"\"any\"",
")",
"{",
"return",
... | Validates the location of a single-line statement
@param {ASTNode} node The single-line statement
@param {string} keywordName The applicable keyword name for the single-line statement
@returns {void} | [
"Validates",
"the",
"location",
"of",
"a",
"single",
"-",
"line",
"statement"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/nonblock-statement-body-position.js#L70-L97 | train | Validate a statement | [
30522,
3853,
9398,
8520,
12259,
3672,
1006,
13045,
1010,
3145,
18351,
18442,
1007,
1063,
9530,
3367,
5724,
1027,
2131,
7361,
3508,
1006,
3145,
18351,
18442,
1007,
1025,
2065,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
5991,
12259,
367... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/tabview.js | tabView_undoCloseGroup | function tabView_undoCloseGroup(aSpec) {
var spec = aSpec || {};
var group = spec.group;
if (!group) {
throw new Error(arguments.callee.name + ": Group not specified.");
}
var undo = this.getElement({
type: "group_undoButton",
value: group
});
this._controller.click(undo);
this.waitForGroupUndo({group: group});
} | javascript | function tabView_undoCloseGroup(aSpec) {
var spec = aSpec || {};
var group = spec.group;
if (!group) {
throw new Error(arguments.callee.name + ": Group not specified.");
}
var undo = this.getElement({
type: "group_undoButton",
value: group
});
this._controller.click(undo);
this.waitForGroupUndo({group: group});
} | [
"function",
"tabView_undoCloseGroup",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"var",
"group",
"=",
"spec",
".",
"group",
";",
"if",
"(",
"!",
"group",
")",
"{",
"throw",
"new",
"Error",
"(",
"arguments",
".",
"callee... | Undo the closing of the specified tab group
@param {object} aSpec
Information on which group to operate on
Elements: group - Group | [
"Undo",
"the",
"closing",
"of",
"the",
"specified",
"tab",
"group"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabview.js#L265-L280 | train | Undo close a group | [
30522,
3853,
21628,
8584,
1035,
25672,
20464,
9232,
17058,
1006,
2004,
5051,
2278,
1007,
1063,
13075,
28699,
1027,
2004,
5051,
2278,
1064,
1064,
1063,
1065,
1025,
13075,
2177,
1027,
28699,
1012,
2177,
1025,
2065,
1006,
999,
2177,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/AutoUpdate/main.js | postMessageToNode | function postMessageToNode(messageId) {
var msg = {
fn: messageId,
args: getFunctionArgs(arguments),
requester: domainID
};
updateDomain.exec('data', msg);
} | javascript | function postMessageToNode(messageId) {
var msg = {
fn: messageId,
args: getFunctionArgs(arguments),
requester: domainID
};
updateDomain.exec('data', msg);
} | [
"function",
"postMessageToNode",
"(",
"messageId",
")",
"{",
"var",
"msg",
"=",
"{",
"fn",
":",
"messageId",
",",
"args",
":",
"getFunctionArgs",
"(",
"arguments",
")",
",",
"requester",
":",
"domainID",
"}",
";",
"updateDomain",
".",
"exec",
"(",
"'data'"... | Posts messages to node
@param {string} messageId - Message to be passed | [
"Posts",
"messages",
"to",
"node"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L185-L192 | train | post a message to the node | [
30522,
3853,
2695,
7834,
3736,
18150,
17175,
3207,
1006,
4471,
3593,
1007,
1063,
30524,
1065,
1025,
7172,
9626,
2378,
1012,
4654,
8586,
1006,
1005,
2951,
1005,
1010,
5796,
2290,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | etc/build/Gruntfile.js | function (content, srcpath) {
var afterContent = "",
moduleName = path.basename(srcpath, ".js");
afterContent += "\n__mxOutput." + path.basename(srcpath, ".js") +
" = typeof " + moduleName + " !== 'undefined' ? " + moduleName + " : undefined;\n";
return content + afterContent;
} | javascript | function (content, srcpath) {
var afterContent = "",
moduleName = path.basename(srcpath, ".js");
afterContent += "\n__mxOutput." + path.basename(srcpath, ".js") +
" = typeof " + moduleName + " !== 'undefined' ? " + moduleName + " : undefined;\n";
return content + afterContent;
} | [
"function",
"(",
"content",
",",
"srcpath",
")",
"{",
"var",
"afterContent",
"=",
"\"\"",
",",
"moduleName",
"=",
"path",
".",
"basename",
"(",
"srcpath",
",",
"\".js\"",
")",
";",
"afterContent",
"+=",
"\"\\n__mxOutput.\"",
"+",
"path",
".",
"basename",
"... | After each module, add the object to the '__mxOutput' namespace E.g. __mxOutput.mxLog, etc. | [
"After",
"each",
"module",
"add",
"the",
"object",
"to",
"the",
"__mxOutput",
"namespace",
"E",
".",
"g",
".",
"__mxOutput",
".",
"mxLog",
"etc",
"."
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/etc/build/Gruntfile.js#L31-L39 | train | return content | [
30522,
3853,
1006,
4180,
1010,
5034,
21906,
8988,
1007,
1063,
13075,
2044,
8663,
6528,
2102,
1027,
1000,
1000,
1010,
11336,
18442,
1027,
4130,
1012,
2918,
18442,
1006,
5034,
21906,
8988,
1010,
1000,
1012,
1046,
2015,
1000,
1007,
1025,
2044,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
goldfire/howler.js | dist/howler.js | function(sound, from, to, len, id, isGroup) {
var self = this;
var vol = from;
var diff = to - from;
var steps = Math.abs(diff / 0.01);
var stepLen = Math.max(4, (steps > 0) ? len / steps : len);
var lastTick = Date.now();
// Store the value being faded to.
sound._fadeTo = to;
// Update the volume value on each interval tick.
sound._interval = setInterval(function() {
// Update the volume based on the time since the last tick.
var tick = (Date.now() - lastTick) / len;
lastTick = Date.now();
vol += diff * tick;
// Make sure the volume is in the right bounds.
vol = Math.max(0, vol);
vol = Math.min(1, vol);
// Round to within 2 decimal points.
vol = Math.round(vol * 100) / 100;
// Change the volume.
if (self._webAudio) {
sound._volume = vol;
} else {
self.volume(vol, sound._id, true);
}
// Set the group's volume.
if (isGroup) {
self._volume = vol;
}
// When the fade is complete, stop it and fire event.
if ((to < from && vol <= to) || (to > from && vol >= to)) {
clearInterval(sound._interval);
sound._interval = null;
sound._fadeTo = null;
self.volume(to, sound._id);
self._emit('fade', sound._id);
}
}, stepLen);
} | javascript | function(sound, from, to, len, id, isGroup) {
var self = this;
var vol = from;
var diff = to - from;
var steps = Math.abs(diff / 0.01);
var stepLen = Math.max(4, (steps > 0) ? len / steps : len);
var lastTick = Date.now();
// Store the value being faded to.
sound._fadeTo = to;
// Update the volume value on each interval tick.
sound._interval = setInterval(function() {
// Update the volume based on the time since the last tick.
var tick = (Date.now() - lastTick) / len;
lastTick = Date.now();
vol += diff * tick;
// Make sure the volume is in the right bounds.
vol = Math.max(0, vol);
vol = Math.min(1, vol);
// Round to within 2 decimal points.
vol = Math.round(vol * 100) / 100;
// Change the volume.
if (self._webAudio) {
sound._volume = vol;
} else {
self.volume(vol, sound._id, true);
}
// Set the group's volume.
if (isGroup) {
self._volume = vol;
}
// When the fade is complete, stop it and fire event.
if ((to < from && vol <= to) || (to > from && vol >= to)) {
clearInterval(sound._interval);
sound._interval = null;
sound._fadeTo = null;
self.volume(to, sound._id);
self._emit('fade', sound._id);
}
}, stepLen);
} | [
"function",
"(",
"sound",
",",
"from",
",",
"to",
",",
"len",
",",
"id",
",",
"isGroup",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"vol",
"=",
"from",
";",
"var",
"diff",
"=",
"to",
"-",
"from",
";",
"var",
"steps",
"=",
"Math",
".",
... | Starts the internal interval to fade a sound.
@param {Object} sound Reference to sound to fade.
@param {Number} from The value to fade from (0.0 to 1.0).
@param {Number} to The volume to fade to (0.0 to 1.0).
@param {Number} len Time in milliseconds to fade.
@param {Number} id The sound id to fade.
@param {Boolean} isGroup If true, set the volume on the group. | [
"Starts",
"the",
"internal",
"interval",
"to",
"fade",
"a",
"sound",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L1322-L1368 | train | Fade the sound to the given value | [
30522,
3853,
1006,
2614,
1010,
2013,
1010,
2000,
1010,
18798,
1010,
8909,
1010,
2003,
17058,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
13075,
5285,
1027,
2013,
1025,
13075,
4487,
4246,
1027,
2000,
1011,
2013,
1025,
13075,
4084,
1027,
8785,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js | function(vPropertyValues, oProperties, sTarget, oSchema) {
function setEdmType(vValueIndex) {
var oPropertyValue, sEdmType = '';
if (vPropertyValues[vValueIndex]) {
oPropertyValue = vPropertyValues[vValueIndex];
if (oPropertyValue.Value && oPropertyValue.Value.Path) {
sEdmType = AnnotationParser.getEdmType(oPropertyValue.Value.Path, oProperties, sTarget, oSchema);
if (sEdmType) {
vPropertyValues[vValueIndex].EdmType = sEdmType;
}
} else if (oPropertyValue.Path) {
sEdmType = AnnotationParser.getEdmType(oPropertyValue.Path, oProperties, sTarget, oSchema);
if (sEdmType) {
vPropertyValues[vValueIndex].EdmType = sEdmType;
}
} else if (oPropertyValue.Facets) {
vPropertyValues[vValueIndex].Facets = AnnotationParser.setEdmTypes(oPropertyValue.Facets, oProperties, sTarget, oSchema);
} else if (oPropertyValue.Data) {
vPropertyValues[vValueIndex].Data = AnnotationParser.setEdmTypes(oPropertyValue.Data, oProperties, sTarget, oSchema);
} else if (vValueIndex === "Data") {
vPropertyValues.Data = AnnotationParser.setEdmTypes(oPropertyValue, oProperties, sTarget, oSchema);
} else if (oPropertyValue.Value && oPropertyValue.Value.Apply) {
vPropertyValues[vValueIndex].Value.Apply.Parameters = AnnotationParser.setEdmTypes(oPropertyValue.Value.Apply.Parameters,
oProperties, sTarget, oSchema);
} else if (oPropertyValue.Value && oPropertyValue.Type && (oPropertyValue.Type === "Path")) {
sEdmType = AnnotationParser.getEdmType(oPropertyValue.Value, oProperties, sTarget, oSchema);
if (sEdmType) {
vPropertyValues[vValueIndex].EdmType = sEdmType;
}
}
}
}
if (Array.isArray(vPropertyValues)) {
for (var iValueIndex = 0; iValueIndex < vPropertyValues.length; iValueIndex += 1) {
setEdmType(iValueIndex);
}
} else {
for (var sValueIndex in vPropertyValues) {
setEdmType(sValueIndex);
}
}
return vPropertyValues;
} | javascript | function(vPropertyValues, oProperties, sTarget, oSchema) {
function setEdmType(vValueIndex) {
var oPropertyValue, sEdmType = '';
if (vPropertyValues[vValueIndex]) {
oPropertyValue = vPropertyValues[vValueIndex];
if (oPropertyValue.Value && oPropertyValue.Value.Path) {
sEdmType = AnnotationParser.getEdmType(oPropertyValue.Value.Path, oProperties, sTarget, oSchema);
if (sEdmType) {
vPropertyValues[vValueIndex].EdmType = sEdmType;
}
} else if (oPropertyValue.Path) {
sEdmType = AnnotationParser.getEdmType(oPropertyValue.Path, oProperties, sTarget, oSchema);
if (sEdmType) {
vPropertyValues[vValueIndex].EdmType = sEdmType;
}
} else if (oPropertyValue.Facets) {
vPropertyValues[vValueIndex].Facets = AnnotationParser.setEdmTypes(oPropertyValue.Facets, oProperties, sTarget, oSchema);
} else if (oPropertyValue.Data) {
vPropertyValues[vValueIndex].Data = AnnotationParser.setEdmTypes(oPropertyValue.Data, oProperties, sTarget, oSchema);
} else if (vValueIndex === "Data") {
vPropertyValues.Data = AnnotationParser.setEdmTypes(oPropertyValue, oProperties, sTarget, oSchema);
} else if (oPropertyValue.Value && oPropertyValue.Value.Apply) {
vPropertyValues[vValueIndex].Value.Apply.Parameters = AnnotationParser.setEdmTypes(oPropertyValue.Value.Apply.Parameters,
oProperties, sTarget, oSchema);
} else if (oPropertyValue.Value && oPropertyValue.Type && (oPropertyValue.Type === "Path")) {
sEdmType = AnnotationParser.getEdmType(oPropertyValue.Value, oProperties, sTarget, oSchema);
if (sEdmType) {
vPropertyValues[vValueIndex].EdmType = sEdmType;
}
}
}
}
if (Array.isArray(vPropertyValues)) {
for (var iValueIndex = 0; iValueIndex < vPropertyValues.length; iValueIndex += 1) {
setEdmType(iValueIndex);
}
} else {
for (var sValueIndex in vPropertyValues) {
setEdmType(sValueIndex);
}
}
return vPropertyValues;
} | [
"function",
"(",
"vPropertyValues",
",",
"oProperties",
",",
"sTarget",
",",
"oSchema",
")",
"{",
"function",
"setEdmType",
"(",
"vValueIndex",
")",
"{",
"var",
"oPropertyValue",
",",
"sEdmType",
"=",
"''",
";",
"if",
"(",
"vPropertyValues",
"[",
"vValueIndex"... | /*
@static
@private | [
"/",
"*"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js#L730-L776 | train | Sets the EdmType of the given property value. | [
30522,
3853,
1006,
21210,
18981,
15010,
10175,
15808,
1010,
6728,
18981,
8743,
3111,
1010,
2732,
18150,
1010,
9808,
5403,
2863,
1007,
1063,
3853,
2275,
2098,
20492,
18863,
1006,
1058,
10175,
5657,
22254,
10288,
1007,
1063,
13075,
6728,
18981,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/tabview.js | tabView_close | function tabView_close() {
var menuitem = new elementslib.Elem(this._controller.menus['view-menu'].menu_tabview);
this._controller.click(menuitem);
this.waitForClosed();
this._tabView = null;
this._tabViewDoc = this._controller.window.document;
} | javascript | function tabView_close() {
var menuitem = new elementslib.Elem(this._controller.menus['view-menu'].menu_tabview);
this._controller.click(menuitem);
this.waitForClosed();
this._tabView = null;
this._tabViewDoc = this._controller.window.document;
} | [
"function",
"tabView_close",
"(",
")",
"{",
"var",
"menuitem",
"=",
"new",
"elementslib",
".",
"Elem",
"(",
"this",
".",
"_controller",
".",
"menus",
"[",
"'view-menu'",
"]",
".",
"menu_tabview",
")",
";",
"this",
".",
"_controller",
".",
"click",
"(",
"... | Close the Tab View | [
"Close",
"the",
"Tab",
"View"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabview.js#L120-L127 | train | Close the tabview | [
30522,
3853,
21628,
8584,
1035,
2485,
1006,
1007,
1063,
13075,
12183,
4221,
2213,
1027,
2047,
3787,
29521,
1012,
3449,
6633,
1006,
2023,
1012,
1035,
11486,
1012,
12183,
2015,
1031,
1005,
3193,
1011,
12183,
1005,
1033,
1012,
12183,
1035,
216... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/MainViewManager.js | _sortWorkingSet | function _sortWorkingSet(paneId, compareFn) {
_forEachPaneOrPanes(paneId, function (pane) {
pane.sortViewList(compareFn);
exports.trigger("workingSetSort", pane.id);
});
} | javascript | function _sortWorkingSet(paneId, compareFn) {
_forEachPaneOrPanes(paneId, function (pane) {
pane.sortViewList(compareFn);
exports.trigger("workingSetSort", pane.id);
});
} | [
"function",
"_sortWorkingSet",
"(",
"paneId",
",",
"compareFn",
")",
"{",
"_forEachPaneOrPanes",
"(",
"paneId",
",",
"function",
"(",
"pane",
")",
"{",
"pane",
".",
"sortViewList",
"(",
"compareFn",
")",
";",
"exports",
".",
"trigger",
"(",
"\"workingSetSort\"... | sorts the pane's view list
@param {!string} paneId - id of the pane to sort, ALL_PANES or ACTIVE_PANE
@param {sortFunctionCallback} compareFn - callback to determine sort order (called on each item)
@see {@link Pane#sortViewList} for more information
@see {@link https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort|Sort Array - MDN}
@private | [
"sorts",
"the",
"pane",
"s",
"view",
"list"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L889-L894 | train | sort working set by paneId | [
30522,
3853,
1035,
4066,
21398,
13462,
1006,
6090,
7416,
2094,
1010,
12826,
2546,
2078,
1007,
1063,
1035,
18921,
6776,
9739,
8780,
14536,
7231,
2015,
1006,
6090,
7416,
2094,
1010,
3853,
1006,
6090,
2063,
1007,
1063,
6090,
2063,
1012,
4066,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/icon/js/iconService.js | loadByURL | function loadByURL(url) {
/* Load the icon from embedded data URL. */
function loadByDataUrl(url) {
var results = dataUrlRegex.exec(url);
var isBase64 = /base64/i.test(url);
var data = isBase64 ? window.atob(results[2]) : results[2];
return $q.when(angular.element(data)[0]);
}
/* Load the icon by URL using HTTP. */
function loadByHttpUrl(url) {
return $q(function(resolve, reject) {
// Catch HTTP or generic errors not related to incorrect icon IDs.
var announceAndReject = function(err) {
var msg = angular.isString(err) ? err : (err.message || err.data || err.statusText);
$log.warn(msg);
reject(err);
},
extractSvg = function(response) {
if (!svgCache[url]) {
svgCache[url] = angular.element('<div>').append(response)[0].querySelector('svg');
}
resolve(svgCache[url]);
};
$templateRequest(url, true).then(extractSvg, announceAndReject);
});
}
return dataUrlRegex.test(url)
? loadByDataUrl(url)
: loadByHttpUrl(url);
} | javascript | function loadByURL(url) {
/* Load the icon from embedded data URL. */
function loadByDataUrl(url) {
var results = dataUrlRegex.exec(url);
var isBase64 = /base64/i.test(url);
var data = isBase64 ? window.atob(results[2]) : results[2];
return $q.when(angular.element(data)[0]);
}
/* Load the icon by URL using HTTP. */
function loadByHttpUrl(url) {
return $q(function(resolve, reject) {
// Catch HTTP or generic errors not related to incorrect icon IDs.
var announceAndReject = function(err) {
var msg = angular.isString(err) ? err : (err.message || err.data || err.statusText);
$log.warn(msg);
reject(err);
},
extractSvg = function(response) {
if (!svgCache[url]) {
svgCache[url] = angular.element('<div>').append(response)[0].querySelector('svg');
}
resolve(svgCache[url]);
};
$templateRequest(url, true).then(extractSvg, announceAndReject);
});
}
return dataUrlRegex.test(url)
? loadByDataUrl(url)
: loadByHttpUrl(url);
} | [
"function",
"loadByURL",
"(",
"url",
")",
"{",
"/* Load the icon from embedded data URL. */",
"function",
"loadByDataUrl",
"(",
"url",
")",
"{",
"var",
"results",
"=",
"dataUrlRegex",
".",
"exec",
"(",
"url",
")",
";",
"var",
"isBase64",
"=",
"/",
"base64",
"/... | Load the icon by URL (may use the $templateCache).
Extract the data for later conversion to Icon
@param {string} url icon URL
@returns {angular.$q.Promise} | [
"Load",
"the",
"icon",
"by",
"URL",
"(",
"may",
"use",
"the",
"$templateCache",
")",
".",
"Extract",
"the",
"data",
"for",
"later",
"conversion",
"to",
"Icon"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L628-L661 | train | Load the icon by URL using HTTP. | [
30522,
3853,
7170,
3762,
3126,
2140,
1006,
24471,
2140,
1007,
1063,
1013,
1008,
7170,
1996,
12696,
2013,
11157,
2951,
24471,
2140,
1012,
1008,
1013,
3853,
7170,
3762,
2850,
2696,
3126,
2140,
1006,
24471,
2140,
1007,
1063,
13075,
3463,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chartjs/Chart.js | src/core/core.interaction.js | function(chart, e, options) {
var position = getRelativePosition(e, chart);
options.axis = options.axis || 'xy';
var distanceMetric = getDistanceMetricForAxis(options.axis);
return getNearestItems(chart, position, options.intersect, distanceMetric);
} | javascript | function(chart, e, options) {
var position = getRelativePosition(e, chart);
options.axis = options.axis || 'xy';
var distanceMetric = getDistanceMetricForAxis(options.axis);
return getNearestItems(chart, position, options.intersect, distanceMetric);
} | [
"function",
"(",
"chart",
",",
"e",
",",
"options",
")",
"{",
"var",
"position",
"=",
"getRelativePosition",
"(",
"e",
",",
"chart",
")",
";",
"options",
".",
"axis",
"=",
"options",
".",
"axis",
"||",
"'xy'",
";",
"var",
"distanceMetric",
"=",
"getDis... | nearest mode returns the element closest to the point
@function Chart.Interaction.modes.intersect
@param {Chart} chart - the chart we are returning items from
@param {Event} e - the event we are find things at
@param {IInteractionOptions} options - options to use
@return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned | [
"nearest",
"mode",
"returns",
"the",
"element",
"closest",
"to",
"the",
"point"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.interaction.js#L241-L246 | train | Returns the nearest items of the given event | [
30522,
3853,
1006,
3673,
1010,
1041,
1010,
7047,
1007,
1063,
13075,
2597,
1027,
2131,
16570,
8082,
26994,
1006,
1041,
1010,
3673,
1007,
1025,
7047,
1012,
8123,
1027,
7047,
1012,
8123,
1064,
1064,
1005,
1060,
2100,
1005,
1025,
13075,
3292,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
sparksuite/simplemde-markdown-editor | src/js/simplemde.js | fixShortcut | function fixShortcut(name) {
if(isMac) {
name = name.replace("Ctrl", "Cmd");
} else {
name = name.replace("Cmd", "Ctrl");
}
return name;
} | javascript | function fixShortcut(name) {
if(isMac) {
name = name.replace("Ctrl", "Cmd");
} else {
name = name.replace("Cmd", "Ctrl");
}
return name;
} | [
"function",
"fixShortcut",
"(",
"name",
")",
"{",
"if",
"(",
"isMac",
")",
"{",
"name",
"=",
"name",
".",
"replace",
"(",
"\"Ctrl\"",
",",
"\"Cmd\"",
")",
";",
"}",
"else",
"{",
"name",
"=",
"name",
".",
"replace",
"(",
"\"Cmd\"",
",",
"\"Ctrl\"",
... | Fix shortcut. Mac use Command, others use Ctrl. | [
"Fix",
"shortcut",
".",
"Mac",
"use",
"Command",
"others",
"use",
"Ctrl",
"."
] | 6abda7ab68cc20f4aca870eb243747951b90ab04 | https://github.com/sparksuite/simplemde-markdown-editor/blob/6abda7ab68cc20f4aca870eb243747951b90ab04/src/js/simplemde.js#L84-L91 | train | fixShortcut - fix the shortcut | [
30522,
3853,
8081,
22231,
5339,
12690,
1006,
2171,
1007,
1063,
2065,
1006,
2003,
22911,
1007,
1063,
2171,
1027,
2171,
1012,
5672,
1006,
1000,
14931,
12190,
1000,
1010,
1000,
4642,
2094,
1000,
1007,
1025,
1065,
2842,
1063,
2171,
1027,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mochajs/mocha | lib/stats-collector.js | createStatsCollector | function createStatsCollector(runner) {
/**
* @type StatsCollector
*/
var stats = {
suites: 0,
tests: 0,
passes: 0,
pending: 0,
failures: 0
};
if (!runner) {
throw new TypeError('Missing runner argument');
}
runner.stats = stats;
runner.once(EVENT_RUN_BEGIN, function() {
stats.start = new Date();
});
runner.on(EVENT_SUITE_BEGIN, function(suite) {
suite.root || stats.suites++;
});
runner.on(EVENT_TEST_PASS, function() {
stats.passes++;
});
runner.on(EVENT_TEST_FAIL, function() {
stats.failures++;
});
runner.on(EVENT_TEST_PENDING, function() {
stats.pending++;
});
runner.on(EVENT_TEST_END, function() {
stats.tests++;
});
runner.once(EVENT_RUN_END, function() {
stats.end = new Date();
stats.duration = stats.end - stats.start;
});
} | javascript | function createStatsCollector(runner) {
/**
* @type StatsCollector
*/
var stats = {
suites: 0,
tests: 0,
passes: 0,
pending: 0,
failures: 0
};
if (!runner) {
throw new TypeError('Missing runner argument');
}
runner.stats = stats;
runner.once(EVENT_RUN_BEGIN, function() {
stats.start = new Date();
});
runner.on(EVENT_SUITE_BEGIN, function(suite) {
suite.root || stats.suites++;
});
runner.on(EVENT_TEST_PASS, function() {
stats.passes++;
});
runner.on(EVENT_TEST_FAIL, function() {
stats.failures++;
});
runner.on(EVENT_TEST_PENDING, function() {
stats.pending++;
});
runner.on(EVENT_TEST_END, function() {
stats.tests++;
});
runner.once(EVENT_RUN_END, function() {
stats.end = new Date();
stats.duration = stats.end - stats.start;
});
} | [
"function",
"createStatsCollector",
"(",
"runner",
")",
"{",
"/**\n * @type StatsCollector\n */",
"var",
"stats",
"=",
"{",
"suites",
":",
"0",
",",
"tests",
":",
"0",
",",
"passes",
":",
"0",
",",
"pending",
":",
"0",
",",
"failures",
":",
"0",
"}",
... | Provides stats such as test duration, number of tests passed / failed etc., by listening for events emitted by `runner`.
@private
@param {Runner} runner - Runner instance
@throws {TypeError} If falsy `runner` | [
"Provides",
"stats",
"such",
"as",
"test",
"duration",
"number",
"of",
"tests",
"passed",
"/",
"failed",
"etc",
".",
"by",
"listening",
"for",
"events",
"emitted",
"by",
"runner",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/stats-collector.js#L41-L81 | train | Creates a stats collector object. | [
30522,
3853,
30524,
1006,
999,
5479,
1007,
1063,
5466,
2047,
2828,
2121,
29165,
1006,
1005,
4394,
5479,
6685,
1005,
1007,
1025,
1065,
5479,
1012,
26319,
1027,
26319,
1025,
5479,
1012,
2320,
1006,
2724,
1035,
2448,
1035,
4088,
1010,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/ui5/plugin.js | preprocessComment | function preprocessComment(e) {
var src = e.comment;
// add a default visibility
if ( !/@private|@public|@protected|@sap-restricted|@ui5-restricted/.test(src) ) {
src = unwrap(src);
src = src + "\n@private";
src = wrap(src);
// console.log("added default visibility to '" + src + "'");
}
if ( /@class/.test(src) && /@static/.test(src) ) {
warning("combination of @class and @static is no longer supported with jsdoc3, converting it to @namespace and @classdesc: (line " + e.lineno + ")");
src = unwrap(src);
src = src.replace(/@class/, "@classdesc").replace(/@static/, "@namespace");
src = wrap(src);
//console.log(src);
}
return src;
} | javascript | function preprocessComment(e) {
var src = e.comment;
// add a default visibility
if ( !/@private|@public|@protected|@sap-restricted|@ui5-restricted/.test(src) ) {
src = unwrap(src);
src = src + "\n@private";
src = wrap(src);
// console.log("added default visibility to '" + src + "'");
}
if ( /@class/.test(src) && /@static/.test(src) ) {
warning("combination of @class and @static is no longer supported with jsdoc3, converting it to @namespace and @classdesc: (line " + e.lineno + ")");
src = unwrap(src);
src = src.replace(/@class/, "@classdesc").replace(/@static/, "@namespace");
src = wrap(src);
//console.log(src);
}
return src;
} | [
"function",
"preprocessComment",
"(",
"e",
")",
"{",
"var",
"src",
"=",
"e",
".",
"comment",
";",
"// add a default visibility",
"if",
"(",
"!",
"/",
"@private|@public|@protected|@sap-restricted|@ui5-restricted",
"/",
".",
"test",
"(",
"src",
")",
")",
"{",
"src... | Pre-processes a JSDoc comment string to ensure some UI5 standards.
@param {event} e Event for the new comment
@returns {event} Returns the modified event | [
"Pre",
"-",
"processes",
"a",
"JSDoc",
"comment",
"string",
"to",
"ensure",
"some",
"UI5",
"standards",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L1910-L1932 | train | Preprocess a comment | [
30522,
3853,
17463,
3217,
9623,
9363,
20058,
3372,
1006,
1041,
1007,
1063,
13075,
5034,
2278,
1027,
1041,
1012,
7615,
1025,
1013,
1013,
5587,
1037,
12398,
16476,
2065,
1006,
999,
1013,
1030,
2797,
1064,
1030,
2270,
1064,
1030,
5123,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc-node | packages/grpc-native-core/src/client_interceptors.js | _buildChain | function _buildChain(interceptors, options) {
var next = function(interceptors) {
if (interceptors.length === 0) {
return function (options) {};
}
var head_interceptor = interceptors[0];
var rest_interceptors = interceptors.slice(1);
return function (options) {
return head_interceptor(options, next(rest_interceptors));
};
};
var chain = next(interceptors)(options);
return new InterceptingCall(chain);
} | javascript | function _buildChain(interceptors, options) {
var next = function(interceptors) {
if (interceptors.length === 0) {
return function (options) {};
}
var head_interceptor = interceptors[0];
var rest_interceptors = interceptors.slice(1);
return function (options) {
return head_interceptor(options, next(rest_interceptors));
};
};
var chain = next(interceptors)(options);
return new InterceptingCall(chain);
} | [
"function",
"_buildChain",
"(",
"interceptors",
",",
"options",
")",
"{",
"var",
"next",
"=",
"function",
"(",
"interceptors",
")",
"{",
"if",
"(",
"interceptors",
".",
"length",
"===",
"0",
")",
"{",
"return",
"function",
"(",
"options",
")",
"{",
"}",
... | Chain a list of interceptors together and return the first InterceptingCall.
@private
@param {Interceptor[]} interceptors An interceptor stack.
@param {grpc.Client~CallOptions} options Call options.
@return {InterceptingCall} | [
"Chain",
"a",
"list",
"of",
"interceptors",
"together",
"and",
"return",
"the",
"first",
"InterceptingCall",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L1389-L1402 | train | Build a chain of interceptors | [
30522,
3853,
1035,
3857,
24925,
2078,
1006,
24727,
2015,
1010,
7047,
1007,
1063,
13075,
2279,
1027,
3853,
1006,
24727,
2015,
1007,
1063,
2065,
1006,
24727,
2015,
1012,
3091,
1027,
1027,
1027,
1014,
1007,
1063,
2709,
3853,
1006,
7047,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
NetEase/pomelo | lib/server/server.js | function(isGlobal, server, msg, session, cb) {
var fm;
if(isGlobal) {
fm = server.globalFilterService;
} else {
fm = server.filterService;
}
if(fm) {
fm.beforeFilter(msg, session, cb);
} else {
utils.invokeCallback(cb);
}
} | javascript | function(isGlobal, server, msg, session, cb) {
var fm;
if(isGlobal) {
fm = server.globalFilterService;
} else {
fm = server.filterService;
}
if(fm) {
fm.beforeFilter(msg, session, cb);
} else {
utils.invokeCallback(cb);
}
} | [
"function",
"(",
"isGlobal",
",",
"server",
",",
"msg",
",",
"session",
",",
"cb",
")",
"{",
"var",
"fm",
";",
"if",
"(",
"isGlobal",
")",
"{",
"fm",
"=",
"server",
".",
"globalFilterService",
";",
"}",
"else",
"{",
"fm",
"=",
"server",
".",
"filte... | Fire before filter chain if any | [
"Fire",
"before",
"filter",
"chain",
"if",
"any"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/server/server.js#L234-L246 | train | Before filter the message | [
30522,
3853,
1006,
2003,
23296,
16429,
2389,
1010,
8241,
1010,
5796,
2290,
1010,
5219,
1010,
17324,
1007,
1063,
13075,
4718,
1025,
2065,
1006,
2003,
23296,
16429,
2389,
1007,
1063,
4718,
1027,
8241,
1012,
3795,
8873,
21928,
8043,
7903,
2063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/preferences/PreferencesBase.js | function (id, context) {
var scopeCounter;
context = this._getContext(context);
var scopeOrder = this._getScopeOrder(context);
for (scopeCounter = 0; scopeCounter < scopeOrder.length; scopeCounter++) {
var scope = this._scopes[scopeOrder[scopeCounter]];
if (scope) {
var result = scope.get(id, context);
if (result !== undefined) {
var pref = this.getPreference(id),
validator = pref && pref.validator;
if (!validator || validator(result)) {
if (pref && pref.type === "object") {
result = _.extend({}, pref.initial, result);
}
return _.cloneDeep(result);
}
}
}
}
} | javascript | function (id, context) {
var scopeCounter;
context = this._getContext(context);
var scopeOrder = this._getScopeOrder(context);
for (scopeCounter = 0; scopeCounter < scopeOrder.length; scopeCounter++) {
var scope = this._scopes[scopeOrder[scopeCounter]];
if (scope) {
var result = scope.get(id, context);
if (result !== undefined) {
var pref = this.getPreference(id),
validator = pref && pref.validator;
if (!validator || validator(result)) {
if (pref && pref.type === "object") {
result = _.extend({}, pref.initial, result);
}
return _.cloneDeep(result);
}
}
}
}
} | [
"function",
"(",
"id",
",",
"context",
")",
"{",
"var",
"scopeCounter",
";",
"context",
"=",
"this",
".",
"_getContext",
"(",
"context",
")",
";",
"var",
"scopeOrder",
"=",
"this",
".",
"_getScopeOrder",
"(",
"context",
")",
";",
"for",
"(",
"scopeCounte... | Get the current value of a preference. The optional context provides a way to
change scope ordering or the reference filename for path-based scopes.
@param {string} id Name of the preference for which the value should be retrieved
@param {Object|string=} context Optional context object or name of context to change the preference lookup | [
"Get",
"the",
"current",
"value",
"of",
"a",
"preference",
".",
"The",
"optional",
"context",
"provides",
"a",
"way",
"to",
"change",
"scope",
"ordering",
"or",
"the",
"reference",
"filename",
"for",
"path",
"-",
"based",
"scopes",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1654-L1677 | train | Get a record from the cache | [
30522,
3853,
1006,
8909,
1010,
6123,
1007,
1063,
13075,
9531,
3597,
16671,
2121,
1025,
6123,
1027,
2023,
1012,
1035,
2131,
8663,
18209,
1006,
6123,
1007,
1025,
13075,
9531,
8551,
2121,
1027,
2023,
1012,
1035,
4152,
16186,
8551,
2121,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
avajs/ava | lib/babel-pipeline.js | makeValueChecker | function makeValueChecker(ref) {
const expected = require(ref);
return ({value}) => value === expected || value === expected.default;
} | javascript | function makeValueChecker(ref) {
const expected = require(ref);
return ({value}) => value === expected || value === expected.default;
} | [
"function",
"makeValueChecker",
"(",
"ref",
")",
"{",
"const",
"expected",
"=",
"require",
"(",
"ref",
")",
";",
"return",
"(",
"{",
"value",
"}",
")",
"=>",
"value",
"===",
"expected",
"||",
"value",
"===",
"expected",
".",
"default",
";",
"}"
] | Compare actual values rather than file paths, which should be more reliable. | [
"Compare",
"actual",
"values",
"rather",
"than",
"file",
"paths",
"which",
"should",
"be",
"more",
"reliable",
"."
] | 08e99e516e13af75d3ebe70f12194a89b610217c | https://github.com/avajs/ava/blob/08e99e516e13af75d3ebe70f12194a89b610217c/lib/babel-pipeline.js#L64-L67 | train | Returns a function that checks if the given value is a valid value. | [
30522,
3853,
2191,
10175,
5657,
5403,
9102,
1006,
25416,
1007,
1063,
9530,
3367,
3517,
1027,
5478,
1006,
25416,
1007,
1025,
2709,
1006,
1063,
3643,
1065,
1007,
1027,
1028,
3643,
1027,
1027,
1027,
3517,
1064,
1064,
3643,
1027,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | src/ol/source/Raster.js | createLayers | function createLayers(sources) {
const len = sources.length;
const layers = new Array(len);
for (let i = 0; i < len; ++i) {
layers[i] = createLayer(sources[i]);
}
return layers;
} | javascript | function createLayers(sources) {
const len = sources.length;
const layers = new Array(len);
for (let i = 0; i < len; ++i) {
layers[i] = createLayer(sources[i]);
}
return layers;
} | [
"function",
"createLayers",
"(",
"sources",
")",
"{",
"const",
"len",
"=",
"sources",
".",
"length",
";",
"const",
"layers",
"=",
"new",
"Array",
"(",
"len",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
... | Create layers for all sources.
@param {Array<import("./Source.js").default|import("../layer/Layer.js").default>} sources The sources.
@return {Array<import("../layer/Layer.js").default>} Array of layers. | [
"Create",
"layers",
"for",
"all",
"sources",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/source/Raster.js#L488-L495 | train | Creates a layer array from a list of sources | [
30522,
3853,
3443,
24314,
2015,
1006,
4216,
1007,
1063,
9530,
3367,
18798,
1027,
4216,
1012,
3091,
1025,
9530,
3367,
9014,
1027,
2047,
9140,
1006,
18798,
1007,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026,
18798,
1025,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
PrismJS/prism | plugins/show-invisibles/prism-show-invisibles.js | handleToken | function handleToken(tokens, name) {
var value = tokens[name];
var type = Prism.util.type(value);
switch (type) {
case 'RegExp':
var inside = {};
tokens[name] = {
pattern: value,
inside: inside
};
addInvisibles(inside);
break;
case 'Array':
for (var i = 0, l = value.length; i < l; i++) {
handleToken(value, i);
}
break;
default: // 'Object'
var inside = value.inside || (value.inside = {});
addInvisibles(inside);
break;
}
} | javascript | function handleToken(tokens, name) {
var value = tokens[name];
var type = Prism.util.type(value);
switch (type) {
case 'RegExp':
var inside = {};
tokens[name] = {
pattern: value,
inside: inside
};
addInvisibles(inside);
break;
case 'Array':
for (var i = 0, l = value.length; i < l; i++) {
handleToken(value, i);
}
break;
default: // 'Object'
var inside = value.inside || (value.inside = {});
addInvisibles(inside);
break;
}
} | [
"function",
"handleToken",
"(",
"tokens",
",",
"name",
")",
"{",
"var",
"value",
"=",
"tokens",
"[",
"name",
"]",
";",
"var",
"type",
"=",
"Prism",
".",
"util",
".",
"type",
"(",
"value",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"'RegExp'... | Handles the recursive calling of `addInvisibles` for one token.
@param {Object|Array} tokens The grammar or array which contains the token.
@param {string|number} name The name or index of the token in `tokens`. | [
"Handles",
"the",
"recursive",
"calling",
"of",
"addInvisibles",
"for",
"one",
"token",
"."
] | acceb3b56f0e8362a7ef274dbd85b17611df2ec4 | https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/plugins/show-invisibles/prism-show-invisibles.js#L26-L51 | train | Handle a token | [
30522,
3853,
5047,
18715,
2368,
1006,
19204,
2015,
1010,
2171,
1007,
1063,
13075,
3643,
1027,
19204,
2015,
1031,
2171,
1033,
1025,
13075,
2828,
1027,
26113,
1012,
21183,
4014,
1012,
2828,
1006,
3643,
1007,
1025,
6942,
1006,
2828,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc-node | packages/grpc-native-core/src/client.js | _emitStatusIfDone | function _emitStatusIfDone() {
/* jshint validthis: true */
var status;
if (this.read_status && this.received_status) {
if (this.read_status.code !== constants.status.OK) {
status = this.read_status;
} else {
status = this.received_status;
}
if (status.code === constants.status.OK) {
this.push(null);
} else {
var error = common.createStatusError(status);
this.emit('error', error);
}
this.emit('status', status);
}
} | javascript | function _emitStatusIfDone() {
/* jshint validthis: true */
var status;
if (this.read_status && this.received_status) {
if (this.read_status.code !== constants.status.OK) {
status = this.read_status;
} else {
status = this.received_status;
}
if (status.code === constants.status.OK) {
this.push(null);
} else {
var error = common.createStatusError(status);
this.emit('error', error);
}
this.emit('status', status);
}
} | [
"function",
"_emitStatusIfDone",
"(",
")",
"{",
"/* jshint validthis: true */",
"var",
"status",
";",
"if",
"(",
"this",
".",
"read_status",
"&&",
"this",
".",
"received_status",
")",
"{",
"if",
"(",
"this",
".",
"read_status",
".",
"code",
"!==",
"constants",... | If we have both processed all incoming messages and received the status from
the server, emit the status. Otherwise, do nothing.
@private | [
"If",
"we",
"have",
"both",
"processed",
"all",
"incoming",
"messages",
"and",
"received",
"the",
"status",
"from",
"the",
"server",
"emit",
"the",
"status",
".",
"Otherwise",
"do",
"nothing",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client.js#L221-L238 | train | If the status is not OK then emit an error or status | [
30522,
3853,
1035,
12495,
3215,
29336,
2271,
10128,
5280,
2063,
1006,
1007,
1063,
1013,
1008,
1046,
17426,
2102,
9398,
15222,
2015,
1024,
2995,
1008,
1013,
13075,
3570,
1025,
2065,
1006,
2023,
30524,
1012,
3642,
999,
1027,
1027,
5377,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/core/utils/are-styles-set.js | areStylesSet | function areStylesSet(el, styles, stopAt) {
'use strict';
var styl = window.getComputedStyle(el, null);
var set = false;
if (!styl) {
return false;
}
styles.forEach(function(att) {
if (styl.getPropertyValue(att.property) === att.value) {
set = true;
}
});
if (set) {
return true;
}
if (el.nodeName.toUpperCase() === stopAt.toUpperCase() || !el.parentNode) {
return false;
}
return areStylesSet(el.parentNode, styles, stopAt);
} | javascript | function areStylesSet(el, styles, stopAt) {
'use strict';
var styl = window.getComputedStyle(el, null);
var set = false;
if (!styl) {
return false;
}
styles.forEach(function(att) {
if (styl.getPropertyValue(att.property) === att.value) {
set = true;
}
});
if (set) {
return true;
}
if (el.nodeName.toUpperCase() === stopAt.toUpperCase() || !el.parentNode) {
return false;
}
return areStylesSet(el.parentNode, styles, stopAt);
} | [
"function",
"areStylesSet",
"(",
"el",
",",
"styles",
",",
"stopAt",
")",
"{",
"'use strict'",
";",
"var",
"styl",
"=",
"window",
".",
"getComputedStyle",
"(",
"el",
",",
"null",
")",
";",
"var",
"set",
"=",
"false",
";",
"if",
"(",
"!",
"styl",
")",... | /* global axe | [
"/",
"*",
"global",
"axe"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/are-styles-set.js#L3-L22 | train | Check if the element has the given styles set | [
30522,
3853,
23631,
27983,
11393,
2102,
1006,
3449,
1010,
6782,
1010,
2644,
4017,
1007,
1063,
1005,
2224,
9384,
1005,
1025,
13075,
2358,
8516,
1027,
3332,
1012,
2131,
9006,
29462,
21756,
2571,
1006,
3449,
1010,
19701,
1007,
1025,
13075,
227... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zloirock/core-js | packages/core-js/modules/es.promise.js | all | function all(iterable) {
var C = this;
var capability = newPromiseCapability(C);
var resolve = capability.resolve;
var reject = capability.reject;
var result = perform(function () {
var $promiseResolve = aFunction(C.resolve);
var values = [];
var counter = 0;
var remaining = 1;
iterate(iterable, function (promise) {
var index = counter++;
var alreadyCalled = false;
values.push(undefined);
remaining++;
$promiseResolve.call(C, promise).then(function (value) {
if (alreadyCalled) return;
alreadyCalled = true;
values[index] = value;
--remaining || resolve(values);
}, reject);
});
--remaining || resolve(values);
});
if (result.error) reject(result.value);
return capability.promise;
} | javascript | function all(iterable) {
var C = this;
var capability = newPromiseCapability(C);
var resolve = capability.resolve;
var reject = capability.reject;
var result = perform(function () {
var $promiseResolve = aFunction(C.resolve);
var values = [];
var counter = 0;
var remaining = 1;
iterate(iterable, function (promise) {
var index = counter++;
var alreadyCalled = false;
values.push(undefined);
remaining++;
$promiseResolve.call(C, promise).then(function (value) {
if (alreadyCalled) return;
alreadyCalled = true;
values[index] = value;
--remaining || resolve(values);
}, reject);
});
--remaining || resolve(values);
});
if (result.error) reject(result.value);
return capability.promise;
} | [
"function",
"all",
"(",
"iterable",
")",
"{",
"var",
"C",
"=",
"this",
";",
"var",
"capability",
"=",
"newPromiseCapability",
"(",
"C",
")",
";",
"var",
"resolve",
"=",
"capability",
".",
"resolve",
";",
"var",
"reject",
"=",
"capability",
".",
"reject",... | `Promise.all` method https://tc39.github.io/ecma262/#sec-promise.all | [
"Promise",
".",
"all",
"method",
"https",
":",
"//",
"tc39",
".",
"github",
".",
"io",
"/",
"ecma262",
"/",
"#sec",
"-",
"promise",
".",
"all"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/es.promise.js#L306-L332 | train | Returns a promise that resolves to all the values of the iterable. | [
30522,
3853,
2035,
1006,
2009,
6906,
3468,
1007,
1063,
13075,
1039,
1027,
2023,
1025,
13075,
10673,
1027,
2047,
21572,
28732,
17695,
8010,
1006,
1039,
1007,
1025,
13075,
10663,
1027,
30524,
1006,
3853,
1006,
1007,
1063,
13075,
1002,
4872,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/lib/promise.js | fullyResolved | async function fullyResolved(value) {
value = await Promise.resolve(value);
if (Array.isArray(value)) {
return fullyResolveKeys(/** @type {!Array} */ (value));
}
if (value && typeof value === 'object') {
return fullyResolveKeys(/** @type {!Object} */ (value));
}
if (typeof value === 'function') {
return fullyResolveKeys(/** @type {!Object} */ (value));
}
return value;
} | javascript | async function fullyResolved(value) {
value = await Promise.resolve(value);
if (Array.isArray(value)) {
return fullyResolveKeys(/** @type {!Array} */ (value));
}
if (value && typeof value === 'object') {
return fullyResolveKeys(/** @type {!Object} */ (value));
}
if (typeof value === 'function') {
return fullyResolveKeys(/** @type {!Object} */ (value));
}
return value;
} | [
"async",
"function",
"fullyResolved",
"(",
"value",
")",
"{",
"value",
"=",
"await",
"Promise",
".",
"resolve",
"(",
"value",
")",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"return",
"fullyResolveKeys",
"(",
"/** @type {!Array} ... | Returns a promise that will be resolved with the input value in a
fully-resolved state. If the value is an array, each element will be fully
resolved. Likewise, if the value is an object, all keys will be fully
resolved. In both cases, all nested arrays and objects will also be
fully resolved. All fields are resolved in place; the returned promise will
resolve on {@code value} and not a copy.
Warning: This function makes no checks against objects that contain
cyclical references:
var value = {};
value['self'] = value;
promise.fullyResolved(value); // Stack overflow.
@param {*} value The value to fully resolve.
@return {!Thenable} A promise for a fully resolved version
of the input value. | [
"Returns",
"a",
"promise",
"that",
"will",
"be",
"resolved",
"with",
"the",
"input",
"value",
"in",
"a",
"fully",
"-",
"resolved",
"state",
".",
"If",
"the",
"value",
"is",
"an",
"array",
"each",
"element",
"will",
"be",
"fully",
"resolved",
".",
"Likewi... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/promise.js#L236-L251 | train | Resolve the key value | [
30522,
2004,
6038,
2278,
3853,
3929,
6072,
16116,
1006,
3643,
1007,
1063,
3643,
1027,
26751,
4872,
1012,
10663,
1006,
3643,
1007,
1025,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
3643,
1007,
1007,
1063,
2709,
3929,
6072,
4747,
3726,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-useless-constructor.js | checkForConstructor | function checkForConstructor(node) {
if (node.kind !== "constructor") {
return;
}
const body = node.value.body.body;
const ctorParams = node.value.params;
const superClass = node.parent.parent.superClass;
if (superClass ? isRedundantSuperCall(body, ctorParams) : (body.length === 0)) {
context.report({
node,
message: "Useless constructor."
});
}
} | javascript | function checkForConstructor(node) {
if (node.kind !== "constructor") {
return;
}
const body = node.value.body.body;
const ctorParams = node.value.params;
const superClass = node.parent.parent.superClass;
if (superClass ? isRedundantSuperCall(body, ctorParams) : (body.length === 0)) {
context.report({
node,
message: "Useless constructor."
});
}
} | [
"function",
"checkForConstructor",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"kind",
"!==",
"\"constructor\"",
")",
"{",
"return",
";",
"}",
"const",
"body",
"=",
"node",
".",
"value",
".",
"body",
".",
"body",
";",
"const",
"ctorParams",
"=",
"no... | Checks whether a node is a redundant constructor
@param {ASTNode} node - node to check
@returns {void} | [
"Checks",
"whether",
"a",
"node",
"is",
"a",
"redundant",
"constructor"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-constructor.js#L164-L179 | train | Check if a node is a constructor | [
30522,
3853,
4638,
29278,
8663,
3367,
6820,
16761,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
2785,
999,
1027,
1027,
1000,
9570,
2953,
1000,
1007,
1063,
2709,
1025,
1065,
9530,
3367,
2303,
1027,
13045,
1012,
3643,
1012,
2303,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/AutoUpdate/main.js | getAdditionalParams | function getAdditionalParams() {
var retval = {};
var installDir = FileUtils.getNativeBracketsDirectoryPath();
if (installDir) {
var appPath = installDir.split("/Contents/www")[0];
installDir = appPath.substr(0, appPath.lastIndexOf('/'));
var appName = appPath.substr(appPath.lastIndexOf('/') + 1);
retval = {
installDir: installDir,
appName: appName,
updateDir: updateDir
};
}
return retval;
} | javascript | function getAdditionalParams() {
var retval = {};
var installDir = FileUtils.getNativeBracketsDirectoryPath();
if (installDir) {
var appPath = installDir.split("/Contents/www")[0];
installDir = appPath.substr(0, appPath.lastIndexOf('/'));
var appName = appPath.substr(appPath.lastIndexOf('/') + 1);
retval = {
installDir: installDir,
appName: appName,
updateDir: updateDir
};
}
return retval;
} | [
"function",
"getAdditionalParams",
"(",
")",
"{",
"var",
"retval",
"=",
"{",
"}",
";",
"var",
"installDir",
"=",
"FileUtils",
".",
"getNativeBracketsDirectoryPath",
"(",
")",
";",
"if",
"(",
"installDir",
")",
"{",
"var",
"appPath",
"=",
"installDir",
".",
... | Get additional update parameters on Mac : installDir, appName, and updateDir | [
"Get",
"additional",
"update",
"parameters",
"on",
"Mac",
":",
"installDir",
"appName",
"and",
"updateDir"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L832-L848 | train | get additional parameters | [
30522,
3853,
2131,
4215,
27064,
28689,
5244,
1006,
1007,
1063,
13075,
2128,
9189,
2389,
1027,
1063,
1065,
1025,
13075,
16500,
4305,
2099,
1027,
5371,
21823,
4877,
1012,
2131,
19833,
3512,
10024,
19869,
3215,
4305,
2890,
16761,
22571,
8988,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/wysiwygCommands/tableRemoveCol.js | getCellByRange | function getCellByRange(range) {
let cell = range.startContainer;
if (domUtils.getNodeName(cell) === 'TD' || domUtils.getNodeName(cell) === 'TH') {
cell = $(cell);
} else {
cell = $(cell).parentsUntil('tr');
}
return cell;
} | javascript | function getCellByRange(range) {
let cell = range.startContainer;
if (domUtils.getNodeName(cell) === 'TD' || domUtils.getNodeName(cell) === 'TH') {
cell = $(cell);
} else {
cell = $(cell).parentsUntil('tr');
}
return cell;
} | [
"function",
"getCellByRange",
"(",
"range",
")",
"{",
"let",
"cell",
"=",
"range",
".",
"startContainer",
";",
"if",
"(",
"domUtils",
".",
"getNodeName",
"(",
"cell",
")",
"===",
"'TD'",
"||",
"domUtils",
".",
"getNodeName",
"(",
"cell",
")",
"===",
"'TH... | Get cell by range object
@param {Range} range range
@returns {HTMLElement|Node} | [
"Get",
"cell",
"by",
"range",
"object"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveCol.js#L68-L78 | train | Get cell by range | [
30522,
3853,
2131,
29109,
14510,
24388,
2063,
1006,
2846,
1007,
1063,
2292,
3526,
1027,
2846,
1012,
2707,
8663,
18249,
2121,
1025,
2065,
1006,
14383,
21823,
4877,
1012,
2131,
3630,
4181,
14074,
1006,
3526,
1007,
1027,
1027,
1027,
1005,
1459... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | extras/noUiSlider/nouislider.js | removeEvent | function removeEvent ( namespacedEvent ) {
var event = namespacedEvent && namespacedEvent.split('.')[0];
var namespace = event && namespacedEvent.substring(event.length);
Object.keys(scope_Events).forEach(function( bind ){
var tEvent = bind.split('.')[0],
tNamespace = bind.substring(tEvent.length);
if ( (!event || event === tEvent) && (!namespace || namespace === tNamespace) ) {
delete scope_Events[bind];
}
});
} | javascript | function removeEvent ( namespacedEvent ) {
var event = namespacedEvent && namespacedEvent.split('.')[0];
var namespace = event && namespacedEvent.substring(event.length);
Object.keys(scope_Events).forEach(function( bind ){
var tEvent = bind.split('.')[0],
tNamespace = bind.substring(tEvent.length);
if ( (!event || event === tEvent) && (!namespace || namespace === tNamespace) ) {
delete scope_Events[bind];
}
});
} | [
"function",
"removeEvent",
"(",
"namespacedEvent",
")",
"{",
"var",
"event",
"=",
"namespacedEvent",
"&&",
"namespacedEvent",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
";",
"var",
"namespace",
"=",
"event",
"&&",
"namespacedEvent",
".",
"substring",
"(",... | Undo attachment of event | [
"Undo",
"attachment",
"of",
"event"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L2020-L2034 | train | Remove event from scope_Events | [
30522,
3853,
6366,
18697,
3372,
1006,
3415,
15327,
24844,
4765,
1007,
1063,
13075,
2724,
1027,
3415,
15327,
24844,
4765,
1004,
1004,
3415,
15327,
24844,
4765,
1012,
3975,
1006,
1005,
1012,
1005,
1007,
1031,
1014,
1033,
1025,
13075,
3415,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js | function(oTable, iColumnIndex) {
if (!oTable ||
iColumnIndex == null || iColumnIndex < 0) {
return;
}
var oColumns = oTable.getColumns();
if (iColumnIndex >= oColumns.length) {
return;
}
var oColumn = oColumns[iColumnIndex];
oColumn._closeMenu();
} | javascript | function(oTable, iColumnIndex) {
if (!oTable ||
iColumnIndex == null || iColumnIndex < 0) {
return;
}
var oColumns = oTable.getColumns();
if (iColumnIndex >= oColumns.length) {
return;
}
var oColumn = oColumns[iColumnIndex];
oColumn._closeMenu();
} | [
"function",
"(",
"oTable",
",",
"iColumnIndex",
")",
"{",
"if",
"(",
"!",
"oTable",
"||",
"iColumnIndex",
"==",
"null",
"||",
"iColumnIndex",
"<",
"0",
")",
"{",
"return",
";",
"}",
"var",
"oColumns",
"=",
"oTable",
".",
"getColumns",
"(",
")",
";",
... | Closes the context menu of a column.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {int} iColumnIndex The index of the column to close the context menu on.
@see openContextMenu
@see openColumnContextMenu
@private | [
"Closes",
"the",
"context",
"menu",
"of",
"a",
"column",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L194-L207 | train | Closes the column with the given index. | [
30522,
3853,
1006,
27178,
3085,
1010,
24582,
4747,
2819,
11483,
3207,
2595,
1007,
1063,
2065,
1006,
999,
27178,
3085,
1064,
1064,
24582,
4747,
2819,
11483,
3207,
2595,
1027,
1027,
19701,
1064,
1064,
24582,
4747,
2819,
11483,
3207,
2595,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
netlify/netlify-cms | packages/netlify-cms-backend-github/src/implementation.js | getPreviewStatus | function getPreviewStatus(statuses, config) {
const previewContext = config.getIn(['backend', 'preview_context']);
return statuses.find(({ context }) => {
return isPreviewContext(context, previewContext);
});
} | javascript | function getPreviewStatus(statuses, config) {
const previewContext = config.getIn(['backend', 'preview_context']);
return statuses.find(({ context }) => {
return isPreviewContext(context, previewContext);
});
} | [
"function",
"getPreviewStatus",
"(",
"statuses",
",",
"config",
")",
"{",
"const",
"previewContext",
"=",
"config",
".",
"getIn",
"(",
"[",
"'backend'",
",",
"'preview_context'",
"]",
")",
";",
"return",
"statuses",
".",
"find",
"(",
"(",
"{",
"context",
"... | Retrieve a deploy preview URL from an array of statuses. By default, a
matching status is inferred via `isPreviewContext`. | [
"Retrieve",
"a",
"deploy",
"preview",
"URL",
"from",
"an",
"array",
"of",
"statuses",
".",
"By",
"default",
"a",
"matching",
"status",
"is",
"inferred",
"via",
"isPreviewContext",
"."
] | 2488556590cbfdcefa626f2f2de01e7a160cf6ee | https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-backend-github/src/implementation.js#L30-L35 | train | Get preview status | [
30522,
3853,
2131,
30524,
1006,
1063,
6123,
1065,
1007,
1027,
1028,
1063,
2709,
2003,
28139,
8584,
8663,
18209,
1006,
6123,
1010,
19236,
8663,
18209,
1007,
1025,
1065,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Agents/DOMAgent.js | _onChildNodeRemoved | function _onChildNodeRemoved(event, res) {
// res = {parentNodeId, nodeId}
if (res.nodeId > 0) {
var node = nodeWithId(res.nodeId);
node.remove();
}
} | javascript | function _onChildNodeRemoved(event, res) {
// res = {parentNodeId, nodeId}
if (res.nodeId > 0) {
var node = nodeWithId(res.nodeId);
node.remove();
}
} | [
"function",
"_onChildNodeRemoved",
"(",
"event",
",",
"res",
")",
"{",
"// res = {parentNodeId, nodeId}",
"if",
"(",
"res",
".",
"nodeId",
">",
"0",
")",
"{",
"var",
"node",
"=",
"nodeWithId",
"(",
"res",
".",
"nodeId",
")",
";",
"node",
".",
"remove",
"... | WebInspector Event: DOM.childNodeRemoved | [
"WebInspector",
"Event",
":",
"DOM",
".",
"childNodeRemoved"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMAgent.js#L238-L244 | train | Remove a node from the tree | [
30522,
3853,
1035,
2006,
19339,
3630,
4063,
6633,
21818,
2094,
1006,
2724,
1010,
24501,
1007,
1063,
1013,
1013,
24501,
1027,
1063,
6687,
3630,
3207,
3593,
1010,
13045,
3593,
1065,
2065,
1006,
24501,
1012,
13045,
3593,
1028,
1014,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mui-org/material-ui | packages/material-ui-utils/src/getDisplayName.js | getDisplayName | function getDisplayName(Component) {
if (Component == null) {
return undefined;
}
if (typeof Component === 'string') {
return Component;
}
if (typeof Component === 'function') {
return getFunctionComponentName(Component, 'Component');
}
if (typeof Component === 'object') {
switch (Component.$$typeof) {
case ForwardRef:
return getWrappedName(Component, Component.render, 'ForwardRef');
default:
return undefined;
}
}
return undefined;
} | javascript | function getDisplayName(Component) {
if (Component == null) {
return undefined;
}
if (typeof Component === 'string') {
return Component;
}
if (typeof Component === 'function') {
return getFunctionComponentName(Component, 'Component');
}
if (typeof Component === 'object') {
switch (Component.$$typeof) {
case ForwardRef:
return getWrappedName(Component, Component.render, 'ForwardRef');
default:
return undefined;
}
}
return undefined;
} | [
"function",
"getDisplayName",
"(",
"Component",
")",
"{",
"if",
"(",
"Component",
"==",
"null",
")",
"{",
"return",
"undefined",
";",
"}",
"if",
"(",
"typeof",
"Component",
"===",
"'string'",
")",
"{",
"return",
"Component",
";",
"}",
"if",
"(",
"typeof"... | cherry-pick from
https://github.com/facebook/react/blob/769b1f270e1251d9dbdce0fcbd9e92e502d059b8/packages/shared/getComponentName.js
originally forked from recompose/getDisplayName with added IE 11 support
@param {React.ReactType} Component
@returns {string | undefined} | [
"cherry",
"-",
"pick",
"from",
"https",
":",
"//",
"github",
".",
"com",
"/",
"facebook",
"/",
"react",
"/",
"blob",
"/",
"769b1f270e1251d9dbdce0fcbd9e92e502d059b8",
"/",
"packages",
"/",
"shared",
"/",
"getComponentName",
".",
"js",
"originally",
"forked",
"f... | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-utils/src/getDisplayName.js#L36-L59 | train | Get the name of a component | [
30522,
3853,
2131,
10521,
13068,
18442,
1006,
6922,
1007,
1063,
2065,
1006,
6922,
1027,
1027,
19701,
1007,
1063,
2709,
6151,
28344,
1025,
1065,
2065,
1006,
2828,
11253,
6922,
1027,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
2709,
6922,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/ViewUtils.js | getDirNamesForDuplicateFiles | function getDirNamesForDuplicateFiles(files) {
// Must have at least two files in list for this to make sense
if (files.length <= 1) {
return [];
}
// First collect paths from the list of files and fill map with them
var map = {}, filePaths = [], displayPaths = [];
files.forEach(function (file, index) {
var fp = file.fullPath.split("/");
fp.pop(); // Remove the filename itself
displayPaths[index] = fp.pop();
filePaths[index] = fp;
if (!map[displayPaths[index]]) {
map[displayPaths[index]] = [index];
} else {
map[displayPaths[index]].push(index);
}
});
// This function is used to loop through map and resolve duplicate names
var processMap = function (map) {
var didSomething = false;
_.forEach(map, function (arr, key) {
// length > 1 means we have duplicates that need to be resolved
if (arr.length > 1) {
arr.forEach(function (index) {
if (filePaths[index].length !== 0) {
displayPaths[index] = filePaths[index].pop() + "/" + displayPaths[index];
didSomething = true;
if (!map[displayPaths[index]]) {
map[displayPaths[index]] = [index];
} else {
map[displayPaths[index]].push(index);
}
}
});
}
delete map[key];
});
return didSomething;
};
var repeat;
do {
repeat = processMap(map);
} while (repeat);
return displayPaths;
} | javascript | function getDirNamesForDuplicateFiles(files) {
// Must have at least two files in list for this to make sense
if (files.length <= 1) {
return [];
}
// First collect paths from the list of files and fill map with them
var map = {}, filePaths = [], displayPaths = [];
files.forEach(function (file, index) {
var fp = file.fullPath.split("/");
fp.pop(); // Remove the filename itself
displayPaths[index] = fp.pop();
filePaths[index] = fp;
if (!map[displayPaths[index]]) {
map[displayPaths[index]] = [index];
} else {
map[displayPaths[index]].push(index);
}
});
// This function is used to loop through map and resolve duplicate names
var processMap = function (map) {
var didSomething = false;
_.forEach(map, function (arr, key) {
// length > 1 means we have duplicates that need to be resolved
if (arr.length > 1) {
arr.forEach(function (index) {
if (filePaths[index].length !== 0) {
displayPaths[index] = filePaths[index].pop() + "/" + displayPaths[index];
didSomething = true;
if (!map[displayPaths[index]]) {
map[displayPaths[index]] = [index];
} else {
map[displayPaths[index]].push(index);
}
}
});
}
delete map[key];
});
return didSomething;
};
var repeat;
do {
repeat = processMap(map);
} while (repeat);
return displayPaths;
} | [
"function",
"getDirNamesForDuplicateFiles",
"(",
"files",
")",
"{",
"// Must have at least two files in list for this to make sense",
"if",
"(",
"files",
".",
"length",
"<=",
"1",
")",
"{",
"return",
"[",
"]",
";",
"}",
"// First collect paths from the list of files and fil... | Determine the minimum directory path to distinguish duplicate file names
for each file in list.
@param {Array.<File>} files - list of Files with the same filename
@return {Array.<string>} directory paths to match list of files | [
"Determine",
"the",
"minimum",
"directory",
"path",
"to",
"distinguish",
"duplicate",
"file",
"names",
"for",
"each",
"file",
"in",
"list",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ViewUtils.js#L418-L469 | train | Get the list of files that have duplicate names | [
30522,
3853,
2131,
4305,
12789,
7834,
3877,
6279,
19341,
2618,
8873,
4244,
1006,
6764,
1007,
1063,
1013,
1013,
2442,
2031,
2012,
2560,
2048,
6764,
1999,
2862,
2005,
2023,
2000,
2191,
3168,
2065,
1006,
6764,
1012,
3091,
1026,
1027,
1015,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_AddinUdf | function parse_AddinUdf(blob, length, opts) {
blob.l += 4; length -= 4;
var l = blob.l + length;
var udfName = parse_ShortXLUnicodeString(blob, length, opts);
var cb = blob.read_shift(2);
l -= blob.l;
if(cb !== l) throw new Error("Malformed AddinUdf: padding = " + l + " != " + cb);
blob.l += cb;
return udfName;
} | javascript | function parse_AddinUdf(blob, length, opts) {
blob.l += 4; length -= 4;
var l = blob.l + length;
var udfName = parse_ShortXLUnicodeString(blob, length, opts);
var cb = blob.read_shift(2);
l -= blob.l;
if(cb !== l) throw new Error("Malformed AddinUdf: padding = " + l + " != " + cb);
blob.l += cb;
return udfName;
} | [
"function",
"parse_AddinUdf",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"blob",
".",
"l",
"+=",
"4",
";",
"length",
"-=",
"4",
";",
"var",
"l",
"=",
"blob",
".",
"l",
"+",
"length",
";",
"var",
"udfName",
"=",
"parse_ShortXLUnicodeString",
"... | /* [MS-XLS] 2.5.1 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"1"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5613-L5622 | train | Parse AddinUdf | [
30522,
3853,
11968,
3366,
1035,
5587,
2378,
6784,
2546,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
1038,
4135,
2497,
1012,
1048,
1009,
1027,
1018,
1025,
3091,
1011,
1027,
1018,
1025,
13075,
1048,
1027,
1038,
4135,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
expressjs/express | lib/router/index.js | paramCallback | function paramCallback(err) {
var fn = paramCallbacks[paramIndex++];
// store updated value
paramCalled.value = req.params[key.name];
if (err) {
// store error
paramCalled.error = err;
param(err);
return;
}
if (!fn) return param();
try {
fn(req, res, paramCallback, paramVal, key.name);
} catch (e) {
paramCallback(e);
}
} | javascript | function paramCallback(err) {
var fn = paramCallbacks[paramIndex++];
// store updated value
paramCalled.value = req.params[key.name];
if (err) {
// store error
paramCalled.error = err;
param(err);
return;
}
if (!fn) return param();
try {
fn(req, res, paramCallback, paramVal, key.name);
} catch (e) {
paramCallback(e);
}
} | [
"function",
"paramCallback",
"(",
"err",
")",
"{",
"var",
"fn",
"=",
"paramCallbacks",
"[",
"paramIndex",
"++",
"]",
";",
"// store updated value",
"paramCalled",
".",
"value",
"=",
"req",
".",
"params",
"[",
"key",
".",
"name",
"]",
";",
"if",
"(",
"err... | single param callbacks | [
"single",
"param",
"callbacks"
] | dc538f6e810bd462c98ee7e6aae24c64d4b1da93 | https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/lib/router/index.js#L388-L408 | train | callback function for param | [
30522,
3853,
11498,
12458,
8095,
5963,
1006,
9413,
2099,
1007,
1063,
13075,
1042,
2078,
1027,
11498,
12458,
8095,
12221,
1031,
11498,
23356,
10288,
1009,
1009,
1033,
1025,
1013,
1013,
3573,
7172,
3643,
11498,
12458,
24164,
2094,
1012,
3643,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | src/components/clocker/clocker.js | parseDateString | function parseDateString (dateString) {
// Pass through when a native object is sent
if (dateString instanceof Date) {
return dateString
}
// Caste string to date object
if (String(dateString).match(matchers)) {
// If looks like a milisecond value cast to number before
// final casting (Thanks to @msigley)
if (String(dateString).match(/^[0-9]*$/)) {
dateString = Number(dateString)
}
// Replace dashes to slashes
if (String(dateString).match(/-/)) {
dateString = String(dateString).replace(/-/g, '/')
}
return new Date(dateString)
} else {
throw new Error('Couldn\'t cast `' + dateString +
'` to a date object.')
}
} | javascript | function parseDateString (dateString) {
// Pass through when a native object is sent
if (dateString instanceof Date) {
return dateString
}
// Caste string to date object
if (String(dateString).match(matchers)) {
// If looks like a milisecond value cast to number before
// final casting (Thanks to @msigley)
if (String(dateString).match(/^[0-9]*$/)) {
dateString = Number(dateString)
}
// Replace dashes to slashes
if (String(dateString).match(/-/)) {
dateString = String(dateString).replace(/-/g, '/')
}
return new Date(dateString)
} else {
throw new Error('Couldn\'t cast `' + dateString +
'` to a date object.')
}
} | [
"function",
"parseDateString",
"(",
"dateString",
")",
"{",
"// Pass through when a native object is sent",
"if",
"(",
"dateString",
"instanceof",
"Date",
")",
"{",
"return",
"dateString",
"}",
"// Caste string to date object",
"if",
"(",
"String",
"(",
"dateString",
")... | Parse a Date formatted has String to a native object | [
"Parse",
"a",
"Date",
"formatted",
"has",
"String",
"to",
"a",
"native",
"object"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/clocker/clocker.js#L19-L40 | train | Parse a date string into a date object | [
30522,
3853,
11968,
6924,
8520,
18886,
3070,
1006,
5246,
18886,
3070,
1007,
1063,
1013,
1013,
3413,
2083,
2043,
1037,
3128,
4874,
2003,
2741,
2065,
1006,
5246,
18886,
3070,
6013,
11253,
3058,
1007,
1063,
2709,
5246,
18886,
3070,
1065,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-var.js | isUsedFromOutsideOf | function isUsedFromOutsideOf(scopeNode) {
/**
* Checks whether a given reference is inside of the specified scope or not.
*
* @param {eslint-scope.Reference} reference - A reference to check.
* @returns {boolean} `true` if the reference is inside of the specified
* scope.
*/
function isOutsideOfScope(reference) {
const scope = scopeNode.range;
const id = reference.identifier.range;
return id[0] < scope[0] || id[1] > scope[1];
}
return function(variable) {
return variable.references.some(isOutsideOfScope);
};
} | javascript | function isUsedFromOutsideOf(scopeNode) {
/**
* Checks whether a given reference is inside of the specified scope or not.
*
* @param {eslint-scope.Reference} reference - A reference to check.
* @returns {boolean} `true` if the reference is inside of the specified
* scope.
*/
function isOutsideOfScope(reference) {
const scope = scopeNode.range;
const id = reference.identifier.range;
return id[0] < scope[0] || id[1] > scope[1];
}
return function(variable) {
return variable.references.some(isOutsideOfScope);
};
} | [
"function",
"isUsedFromOutsideOf",
"(",
"scopeNode",
")",
"{",
"/**\n * Checks whether a given reference is inside of the specified scope or not.\n *\n * @param {eslint-scope.Reference} reference - A reference to check.\n * @returns {boolean} `true` if the reference is inside of the spec... | Checks whether a given variable is used from outside of the specified scope.
@param {ASTNode} scopeNode - A scope node to check.
@returns {Function} The predicate function which checks whether a given
variable is used from outside of the specified scope. | [
"Checks",
"whether",
"a",
"given",
"variable",
"is",
"used",
"from",
"outside",
"of",
"the",
"specified",
"scope",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-var.js#L119-L138 | train | Checks whether a given reference is used from outside of the specified scope. | [
30522,
3853,
2003,
13901,
19699,
19506,
16446,
5178,
11253,
1006,
9531,
3630,
3207,
1007,
1063,
1013,
1008,
1008,
1008,
14148,
3251,
1037,
2445,
4431,
2003,
2503,
1997,
1996,
9675,
9531,
2030,
2025,
1012,
1008,
1008,
1030,
11498,
2213,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zloirock/core-js | packages/core-js/modules/es.string.search.js | function (regexp) {
var res = maybeCallNative(nativeSearch, regexp, this);
if (res.done) return res.value;
var rx = anObject(regexp);
var S = String(this);
var previousLastIndex = rx.lastIndex;
if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
var result = regExpExec(rx, S);
if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
return result === null ? -1 : result.index;
} | javascript | function (regexp) {
var res = maybeCallNative(nativeSearch, regexp, this);
if (res.done) return res.value;
var rx = anObject(regexp);
var S = String(this);
var previousLastIndex = rx.lastIndex;
if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
var result = regExpExec(rx, S);
if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
return result === null ? -1 : result.index;
} | [
"function",
"(",
"regexp",
")",
"{",
"var",
"res",
"=",
"maybeCallNative",
"(",
"nativeSearch",
",",
"regexp",
",",
"this",
")",
";",
"if",
"(",
"res",
".",
"done",
")",
"return",
"res",
".",
"value",
";",
"var",
"rx",
"=",
"anObject",
"(",
"regexp",... | `RegExp.prototype[@@search]` method https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search | [
"RegExp",
".",
"prototype",
"["
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/es.string.search.js#L23-L35 | train | Search for a string in the current context | [
30522,
3853,
1006,
19723,
10288,
2361,
1007,
1063,
13075,
24501,
1027,
2672,
9289,
19666,
8082,
1006,
12493,
14644,
2818,
1010,
19723,
10288,
2361,
1010,
2023,
1007,
1025,
2065,
1006,
24501,
1012,
2589,
1007,
2709,
24501,
1012,
3643,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
firebase/firebase-js-sdk | scripts/docgen/generate-docs.js | generateTempHomeMdFile | function generateTempHomeMdFile(tocRaw, homeRaw) {
const { toc } = yaml.safeLoad(tocRaw);
let tocPageLines = [homeRaw, '# API Reference'];
toc.forEach(group => {
tocPageLines.push(`\n## [${group.title}](${stripPath(group.path)}.html)`);
group.section.forEach(item => {
tocPageLines.push(`- [${item.title}](${stripPath(item.path)}.html)`);
});
});
return fs.writeFile(tempHomePath, tocPageLines.join('\n'));
} | javascript | function generateTempHomeMdFile(tocRaw, homeRaw) {
const { toc } = yaml.safeLoad(tocRaw);
let tocPageLines = [homeRaw, '# API Reference'];
toc.forEach(group => {
tocPageLines.push(`\n## [${group.title}](${stripPath(group.path)}.html)`);
group.section.forEach(item => {
tocPageLines.push(`- [${item.title}](${stripPath(item.path)}.html)`);
});
});
return fs.writeFile(tempHomePath, tocPageLines.join('\n'));
} | [
"function",
"generateTempHomeMdFile",
"(",
"tocRaw",
",",
"homeRaw",
")",
"{",
"const",
"{",
"toc",
"}",
"=",
"yaml",
".",
"safeLoad",
"(",
"tocRaw",
")",
";",
"let",
"tocPageLines",
"=",
"[",
"homeRaw",
",",
"'# API Reference'",
"]",
";",
"toc",
".",
"f... | Generates temporary markdown file that will be sourced by Typedoc to
create index.html.
@param {string} tocRaw
@param {string} homeRaw | [
"Generates",
"temporary",
"markdown",
"file",
"that",
"will",
"be",
"sourced",
"by",
"Typedoc",
"to",
"create",
"index",
".",
"html",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/scripts/docgen/generate-docs.js#L113-L123 | train | Generate a markdown file for the TOC | [
30522,
3853,
9699,
18532,
8458,
8462,
26876,
8873,
2571,
1006,
2000,
26775,
10376,
1010,
11525,
10376,
1007,
1063,
9530,
3367,
1063,
2000,
2278,
1065,
1027,
8038,
19968,
1012,
3647,
11066,
1006,
2000,
26775,
10376,
1007,
1025,
2292,
2000,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/places.js | isBookmarkInFolder | function isBookmarkInFolder(uri, folderId)
{
var ids = bookmarksService.getBookmarkIdsForURI(uri, {});
for (let i = 0; i < ids.length; i++) {
if (bookmarksService.getFolderIdForItem(ids[i]) == folderId)
return true;
}
return false;
} | javascript | function isBookmarkInFolder(uri, folderId)
{
var ids = bookmarksService.getBookmarkIdsForURI(uri, {});
for (let i = 0; i < ids.length; i++) {
if (bookmarksService.getFolderIdForItem(ids[i]) == folderId)
return true;
}
return false;
} | [
"function",
"isBookmarkInFolder",
"(",
"uri",
",",
"folderId",
")",
"{",
"var",
"ids",
"=",
"bookmarksService",
".",
"getBookmarkIdsForURI",
"(",
"uri",
",",
"{",
"}",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"ids",
".",
"length",
"... | Check if an URI is bookmarked within the specified folder
@param (nsIURI) uri
URI of the bookmark
@param {String} folderId
Folder in which the search has to take place
@return Returns if the URI exists in the given folder
@type Boolean | [
"Check",
"if",
"an",
"URI",
"is",
"bookmarked",
"within",
"the",
"specified",
"folder"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/places.js#L111-L120 | train | Check if a URI is a bookmark in a folder | [
30522,
3853,
2003,
8654,
10665,
2378,
10371,
2121,
1006,
24471,
2072,
1010,
19622,
3593,
1007,
1063,
13075,
8909,
2015,
1027,
2338,
27373,
8043,
7903,
2063,
1012,
2131,
8654,
10665,
9821,
29278,
9496,
1006,
24471,
2072,
1010,
1063,
1065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
exceljs/exceljs | lib/doc/column.js | function(name, value) {
this.style[name] = value;
this.eachCell(function(cell) {
cell[name] = value;
});
return value;
} | javascript | function(name, value) {
this.style[name] = value;
this.eachCell(function(cell) {
cell[name] = value;
});
return value;
} | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"this",
".",
"style",
"[",
"name",
"]",
"=",
"value",
";",
"this",
".",
"eachCell",
"(",
"function",
"(",
"cell",
")",
"{",
"cell",
"[",
"name",
"]",
"=",
"value",
";",
"}",
")",
";",
"return",
"... | ========================================================================= styles | [
"=========================================================================",
"styles"
] | c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2 | https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/doc/column.js#L183-L189 | train | set the value of a style property | [
30522,
3853,
1006,
2171,
1010,
3643,
1007,
1063,
2023,
1012,
2806,
1031,
2171,
1033,
1027,
3643,
1025,
2023,
1012,
2169,
29109,
2140,
1006,
3853,
1006,
3526,
1007,
1063,
3526,
1031,
2171,
1033,
1027,
3643,
1025,
1065,
1007,
1025,
2709,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/view/ThemeManager.js | toDisplayName | function toDisplayName(name) {
var extIndex = name.lastIndexOf('.');
name = name.substring(0, extIndex !== -1 ? extIndex : undefined).replace(/-/g, ' ');
return name.split(" ").map(function (part) {
return part[0].toUpperCase() + part.substring(1);
}).join(" ");
} | javascript | function toDisplayName(name) {
var extIndex = name.lastIndexOf('.');
name = name.substring(0, extIndex !== -1 ? extIndex : undefined).replace(/-/g, ' ');
return name.split(" ").map(function (part) {
return part[0].toUpperCase() + part.substring(1);
}).join(" ");
} | [
"function",
"toDisplayName",
"(",
"name",
")",
"{",
"var",
"extIndex",
"=",
"name",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"name",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"extIndex",
"!==",
"-",
"1",
"?",
"extIndex",
":",
"undefined",
")",
"... | @private
Takes all dashes and converts them to white spaces. Then takes all first letters
and capitalizes them.
@param {string} name is what needs to be procseed to generate a display name
@return {string} theme name properly formatted for display | [
"@private",
"Takes",
"all",
"dashes",
"and",
"converts",
"them",
"to",
"white",
"spaces",
".",
"Then",
"takes",
"all",
"first",
"letters",
"and",
"capitalizes",
"them",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/ThemeManager.js#L58-L65 | train | Converts a name to a human readable name | [
30522,
3853,
28681,
2483,
13068,
18442,
1006,
2171,
1007,
1063,
13075,
4654,
7629,
3207,
2595,
1027,
2171,
1012,
2197,
22254,
10288,
11253,
1006,
1005,
1012,
1005,
1007,
1025,
2171,
1027,
2171,
1012,
4942,
3367,
4892,
1006,
1014,
1010,
4654... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js | function (sUrl, oSettings) {
this._pingUrl(sUrl)
.then(function success() {
this.close();
var aSettings = [oSettings.support];
sap.ui.getCore().loadLibrary("sap.ui.support", { async: true, url: sUrl })
.then(function () {
if (oSettings.window) {
aSettings.push("window");
}
if (aSettings[0].toLowerCase() === "true" || aSettings[0].toLowerCase() === "silent") {
sap.ui.require(["sap/ui/support/Bootstrap"], function (oBootstrap) {
oBootstrap.initSupportRules(aSettings);
});
}
});
}, function error(jqXHR, exception) {
var msg = this._getText("TechInfo.SupportAssistantConfigPopup.SupportAssistantNotFound");
if (jqXHR.status === 0) {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorTryingToGetRecourse");
} else if (jqXHR.status === 404) {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorNotFound");
} else if (jqXHR.status === 500) {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.InternalServerError");
} else if (exception === 'parsererror') {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorOnJsonParse");
} else if (exception === 'timeout') {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorOnTimeout");
} else if (exception === 'abort') {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorWhenAborted");
} else {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.UncaughtError") + jqXHR.responseText;
}
this._sErrorMessage = msg;
this.onConfigureAssistantBootstrap();
Log.error("Support Assistant could not be loaded from the URL you entered");
});
} | javascript | function (sUrl, oSettings) {
this._pingUrl(sUrl)
.then(function success() {
this.close();
var aSettings = [oSettings.support];
sap.ui.getCore().loadLibrary("sap.ui.support", { async: true, url: sUrl })
.then(function () {
if (oSettings.window) {
aSettings.push("window");
}
if (aSettings[0].toLowerCase() === "true" || aSettings[0].toLowerCase() === "silent") {
sap.ui.require(["sap/ui/support/Bootstrap"], function (oBootstrap) {
oBootstrap.initSupportRules(aSettings);
});
}
});
}, function error(jqXHR, exception) {
var msg = this._getText("TechInfo.SupportAssistantConfigPopup.SupportAssistantNotFound");
if (jqXHR.status === 0) {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorTryingToGetRecourse");
} else if (jqXHR.status === 404) {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorNotFound");
} else if (jqXHR.status === 500) {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.InternalServerError");
} else if (exception === 'parsererror') {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorOnJsonParse");
} else if (exception === 'timeout') {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorOnTimeout");
} else if (exception === 'abort') {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.ErrorWhenAborted");
} else {
msg += this._getText("TechInfo.SupportAssistantConfigPopup.UncaughtError") + jqXHR.responseText;
}
this._sErrorMessage = msg;
this.onConfigureAssistantBootstrap();
Log.error("Support Assistant could not be loaded from the URL you entered");
});
} | [
"function",
"(",
"sUrl",
",",
"oSettings",
")",
"{",
"this",
".",
"_pingUrl",
"(",
"sUrl",
")",
".",
"then",
"(",
"function",
"success",
"(",
")",
"{",
"this",
".",
"close",
"(",
")",
";",
"var",
"aSettings",
"=",
"[",
"oSettings",
".",
"support",
... | Try to load Support Assistant with passed sUrl and aParams by making ajax request to Bootstrap.js.
If Bootsrap.js is missing error occurs in the console otherwise starts Support Assistant.
@param {string} sUrl Url where to load Support Assistant from.
@param {object} oSettings Parameters that needs to be passed to Support Assistant.
@private | [
"Try",
"to",
"load",
"Support",
"Assistant",
"with",
"passed",
"sUrl",
"and",
"aParams",
"by",
"making",
"ajax",
"request",
"to",
"Bootstrap",
".",
"js",
".",
"If",
"Bootsrap",
".",
"js",
"is",
"missing",
"error",
"occurs",
"in",
"the",
"console",
"otherwi... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L530-L568 | train | This function is called when the browser is ready to load the library and load the library | [
30522,
3853,
1006,
7505,
2140,
1010,
9808,
18319,
3070,
2015,
1007,
1063,
2023,
1012,
1035,
17852,
3126,
2140,
1006,
7505,
2140,
1007,
1012,
2059,
1006,
3853,
3112,
1006,
1007,
1063,
2023,
1012,
2485,
1006,
1007,
1025,
13075,
2004,
18319,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
wix/Detox | generation/core/generator.js | hasProblematicOverloading | function hasProblematicOverloading(instances) {
// Check if there are same lengthed argument sets
const knownLengths = [];
return instances.map(({ args }) => args.length).reduce((carry, item) => {
if (carry || knownLengths.some((l) => l === item)) {
return true;
}
knownLengths.push(item);
return false;
}, false);
} | javascript | function hasProblematicOverloading(instances) {
// Check if there are same lengthed argument sets
const knownLengths = [];
return instances.map(({ args }) => args.length).reduce((carry, item) => {
if (carry || knownLengths.some((l) => l === item)) {
return true;
}
knownLengths.push(item);
return false;
}, false);
} | [
"function",
"hasProblematicOverloading",
"(",
"instances",
")",
"{",
"// Check if there are same lengthed argument sets",
"const",
"knownLengths",
"=",
"[",
"]",
";",
"return",
"instances",
".",
"map",
"(",
"(",
"{",
"args",
"}",
")",
"=>",
"args",
".",
"length",
... | We don't handle same lengthed argument sets right now. In the future we could write the type checks in a way that would allow us to do an either or switch in this case | [
"We",
"don",
"t",
"handle",
"same",
"lengthed",
"argument",
"sets",
"right",
"now",
".",
"In",
"the",
"future",
"we",
"could",
"write",
"the",
"type",
"checks",
"in",
"a",
"way",
"that",
"would",
"allow",
"us",
"to",
"do",
"an",
"either",
"or",
"switch... | 0ed5e8c7ba279a3a409130b4d4bad3f9a9c2f1f9 | https://github.com/wix/Detox/blob/0ed5e8c7ba279a3a409130b4d4bad3f9a9c2f1f9/generation/core/generator.js#L159-L170 | train | Check if there are multiple arguments that are the same lengthed | [
30522,
3853,
2038,
21572,
3468,
12644,
7840,
18570,
1006,
12107,
1007,
1063,
1013,
1013,
4638,
2065,
2045,
2024,
2168,
3091,
2098,
6685,
4520,
9530,
3367,
2124,
7770,
13512,
7898,
1027,
1031,
1033,
1025,
2709,
12107,
1012,
4949,
1006,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.