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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Freeboard/freeboard | js/freeboard.thirdparty.js | function( element, set ) {
var val, i;
for( i=0; i < set.length; i++ ) {
if ( set[ i ] !== null ) {
val = element.data( dataSpace + set[ i ] );
// support: jQuery 1.6.2
// http://bugs.jquery.com/ticket/9917
// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
// We can't differentiate between "" and 0 here, so we just assume
// empty string since it's likely to be a more common value...
if ( val === undefined ) {
val = "";
}
element.css( set[ i ], val );
}
}
} | javascript | function( element, set ) {
var val, i;
for( i=0; i < set.length; i++ ) {
if ( set[ i ] !== null ) {
val = element.data( dataSpace + set[ i ] );
// support: jQuery 1.6.2
// http://bugs.jquery.com/ticket/9917
// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
// We can't differentiate between "" and 0 here, so we just assume
// empty string since it's likely to be a more common value...
if ( val === undefined ) {
val = "";
}
element.css( set[ i ], val );
}
}
} | [
"function",
"(",
"element",
",",
"set",
")",
"{",
"var",
"val",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"set",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"set",
"[",
"i",
"]",
"!==",
"null",
")",
"{",
"val",
"=",... | Restores a set of previously saved properties from a data storage | [
"Restores",
"a",
"set",
"of",
"previously",
"saved",
"properties",
"from",
"a",
"data",
"storage"
] | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L5686-L5702 | train | Sets the CSS properties of an element | [
30522,
3853,
1006,
5783,
1010,
2275,
1007,
1063,
13075,
11748,
1010,
1045,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
2275,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
2065,
1006,
2275,
1031,
1045,
1033,
999,
1027,
1027,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/InlineTimingFunctionEditor/StepEditor.js | StepCanvas | function StepCanvas(canvas, stepParams, padding) {
this.canvas = canvas;
this.stepParams = stepParams;
this.padding = this.getPadding(padding);
// Convert to a cartesian coordinate system with axes from 0 to 1
var ctx = this.canvas.getContext("2d"),
p = this.padding;
ctx.scale(canvas.width * (1 - p[1] - p[3]), -canvas.height * (1 - p[0] - p[2]));
ctx.translate(p[3] / (1 - p[1] - p[3]), (-1 - p[0] / (1 - p[0] - p[2])));
} | javascript | function StepCanvas(canvas, stepParams, padding) {
this.canvas = canvas;
this.stepParams = stepParams;
this.padding = this.getPadding(padding);
// Convert to a cartesian coordinate system with axes from 0 to 1
var ctx = this.canvas.getContext("2d"),
p = this.padding;
ctx.scale(canvas.width * (1 - p[1] - p[3]), -canvas.height * (1 - p[0] - p[2]));
ctx.translate(p[3] / (1 - p[1] - p[3]), (-1 - p[0] / (1 - p[0] - p[2])));
} | [
"function",
"StepCanvas",
"(",
"canvas",
",",
"stepParams",
",",
"padding",
")",
"{",
"this",
".",
"canvas",
"=",
"canvas",
";",
"this",
".",
"stepParams",
"=",
"stepParams",
";",
"this",
".",
"padding",
"=",
"this",
".",
"getPadding",
"(",
"padding",
")... | StepCanvas object constructor
@param {Element} canvas Inline editor <canvas> element
@param {StepParameters} stepParams Associated StepParameters object
@param {number|Array.number} padding Element padding | [
"StepCanvas",
"object",
"constructor"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/StepEditor.js#L62-L73 | train | StepCanvas constructor. | [
30522,
3853,
3357,
9336,
12044,
1006,
10683,
1010,
3357,
28689,
5244,
1010,
11687,
4667,
1007,
1063,
2023,
1012,
10683,
1027,
10683,
1025,
2023,
1012,
3357,
28689,
5244,
1027,
3357,
28689,
5244,
1025,
2023,
1012,
11687,
4667,
1027,
2023,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/less.js | function () {
var comment;
if (input.charAt(i) !== '/') { return; }
if (input.charAt(i + 1) === '/') {
return new(tree.Comment)($re(/^\/\/.*/), true, i, env.currentFileInfo);
}
comment = $re(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/);
if (comment) {
return new(tree.Comment)(comment, false, i, env.currentFileInfo);
}
} | javascript | function () {
var comment;
if (input.charAt(i) !== '/') { return; }
if (input.charAt(i + 1) === '/') {
return new(tree.Comment)($re(/^\/\/.*/), true, i, env.currentFileInfo);
}
comment = $re(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/);
if (comment) {
return new(tree.Comment)(comment, false, i, env.currentFileInfo);
}
} | [
"function",
"(",
")",
"{",
"var",
"comment",
";",
"if",
"(",
"input",
".",
"charAt",
"(",
"i",
")",
"!==",
"'/'",
")",
"{",
"return",
";",
"}",
"if",
"(",
"input",
".",
"charAt",
"(",
"i",
"+",
"1",
")",
"===",
"'/'",
")",
"{",
"return",
"new... | We create a Comment node for CSS comments `/* */`, but keep the LeSS comments `//` silent, by just skipping over them. | [
"We",
"create",
"a",
"Comment",
"node",
"for",
"CSS",
"comments",
"/",
"*",
"*",
"/",
"but",
"keep",
"the",
"LeSS",
"comments",
"//",
"silent",
"by",
"just",
"skipping",
"over",
"them",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L775-L787 | train | Returns the next comment in the input string | [
30522,
3853,
1006,
1007,
1063,
13075,
7615,
30524,
1005,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
7953,
1012,
25869,
4017,
1006,
1045,
1009,
1015,
1007,
1027,
1027,
1027,
1005,
1013,
1005,
1007,
1063,
2709,
2047,
1006,
3392,
1012,
7615,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/MultiBrowserImpl/language/HTMLInstrumentation.js | _markTextFromDOM | function _markTextFromDOM(editor, dom) {
var cm = editor._codeMirror;
// Remove existing marks
var marks = cm.getAllMarks();
cm.operation(function () {
marks.forEach(function (mark) {
if (mark.hasOwnProperty("tagID")) {
mark.clear();
}
});
});
// Mark
_markTags(cm, dom);
} | javascript | function _markTextFromDOM(editor, dom) {
var cm = editor._codeMirror;
// Remove existing marks
var marks = cm.getAllMarks();
cm.operation(function () {
marks.forEach(function (mark) {
if (mark.hasOwnProperty("tagID")) {
mark.clear();
}
});
});
// Mark
_markTags(cm, dom);
} | [
"function",
"_markTextFromDOM",
"(",
"editor",
",",
"dom",
")",
"{",
"var",
"cm",
"=",
"editor",
".",
"_codeMirror",
";",
"// Remove existing marks",
"var",
"marks",
"=",
"cm",
".",
"getAllMarks",
"(",
")",
";",
"cm",
".",
"operation",
"(",
"function",
"("... | Clears the marks from the document and creates new ones.
@param {Editor} editor Editor object holding this document
@param {Object} dom SimpleDOM root object that contains the parsed structure | [
"Clears",
"the",
"marks",
"from",
"the",
"document",
"and",
"creates",
"new",
"ones",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js#L208-L223 | train | Mark text from DOM | [
30522,
3853,
1035,
2928,
30524,
29165,
1025,
1013,
1013,
6366,
4493,
6017,
13075,
6017,
1027,
4642,
1012,
2131,
8095,
27373,
1006,
1007,
1025,
4642,
1012,
3169,
1006,
3853,
1006,
1007,
1063,
6017,
1012,
18921,
6776,
1006,
3853,
1006,
2928,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js | function () {
var that = this;
var oSelectedContentModel = this.getView().getModel("selectedContent");
var oContentData = oSelectedContentModel.getData();
var sSelectedLayer = oContentData.layer;
var sContentLayer = "";
var sTransportIdFromContent, sPackageFromContent, sTransportId;
oContentData.metadata.some(function (mMetadata) {
if (mMetadata.name === "layer") {
sContentLayer = mMetadata.value;
return true;
}
});
oContentData.metadata.some(function (mMetadata) {
if (mMetadata.name === "transportId") {
sTransportIdFromContent = mMetadata.value;
return true;
}
});
try {
sPackageFromContent = JSON.parse(oContentData.data).packageName;
} catch (e) {
//when content is not in JSON format, package is undefined but does not break the code.
}
var sNamespace = oContentData.namespace;
var sFileName = oContentData.fileName;
var sFileType = oContentData.fileType;
if ((sContentLayer === "USER") ||
(sContentLayer === "LOAD") ||
(sContentLayer === "VENDOR_LOAD") ||
(!sTransportIdFromContent && (!sPackageFromContent || sPackageFromContent === "$TMP"))){
//USER, LOAD (and VENDOR_LOAD) layers together with non-ABAP and local ABAP content do not need transport
sTransportId = undefined;
that._deleteFile(sContentLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer);
} else if (sTransportIdFromContent === "ATO_NOTIFICATION") {
//ATO_NOTIFICATION content
sTransportId = sTransportIdFromContent;
that._deleteFile(sContentLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer);
} else {
//Bring up an simple transport input dialog
var oTransportInput = new Input({placeholder: "Transport ID or ATO_NOTIFICATION" });
var oDialog = new Dialog({
title: "{i18n>transportInput}",
type: "Message",
content: [
new Text({text: "{i18n>transportInputDescription}"}),
oTransportInput],
beginButton: new Button({
text: "{i18n>confirm}",
type: ButtonType.Accept,
press: function () {
sTransportId = oTransportInput.getValue();
oDialog.close();
that._deleteFile(sContentLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer);
}
}),
endButton: new Button({
text: "{i18n>cancel}",
press: function () {
oDialog.close();
}
}),
afterClose: function () {
oDialog.destroy();
}
});
this.getView().addDependent(oDialog);
oDialog.open();
}
} | javascript | function () {
var that = this;
var oSelectedContentModel = this.getView().getModel("selectedContent");
var oContentData = oSelectedContentModel.getData();
var sSelectedLayer = oContentData.layer;
var sContentLayer = "";
var sTransportIdFromContent, sPackageFromContent, sTransportId;
oContentData.metadata.some(function (mMetadata) {
if (mMetadata.name === "layer") {
sContentLayer = mMetadata.value;
return true;
}
});
oContentData.metadata.some(function (mMetadata) {
if (mMetadata.name === "transportId") {
sTransportIdFromContent = mMetadata.value;
return true;
}
});
try {
sPackageFromContent = JSON.parse(oContentData.data).packageName;
} catch (e) {
//when content is not in JSON format, package is undefined but does not break the code.
}
var sNamespace = oContentData.namespace;
var sFileName = oContentData.fileName;
var sFileType = oContentData.fileType;
if ((sContentLayer === "USER") ||
(sContentLayer === "LOAD") ||
(sContentLayer === "VENDOR_LOAD") ||
(!sTransportIdFromContent && (!sPackageFromContent || sPackageFromContent === "$TMP"))){
//USER, LOAD (and VENDOR_LOAD) layers together with non-ABAP and local ABAP content do not need transport
sTransportId = undefined;
that._deleteFile(sContentLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer);
} else if (sTransportIdFromContent === "ATO_NOTIFICATION") {
//ATO_NOTIFICATION content
sTransportId = sTransportIdFromContent;
that._deleteFile(sContentLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer);
} else {
//Bring up an simple transport input dialog
var oTransportInput = new Input({placeholder: "Transport ID or ATO_NOTIFICATION" });
var oDialog = new Dialog({
title: "{i18n>transportInput}",
type: "Message",
content: [
new Text({text: "{i18n>transportInputDescription}"}),
oTransportInput],
beginButton: new Button({
text: "{i18n>confirm}",
type: ButtonType.Accept,
press: function () {
sTransportId = oTransportInput.getValue();
oDialog.close();
that._deleteFile(sContentLayer, sNamespace, sFileName, sFileType, sTransportId, sSelectedLayer);
}
}),
endButton: new Button({
text: "{i18n>cancel}",
press: function () {
oDialog.close();
}
}),
afterClose: function () {
oDialog.destroy();
}
});
this.getView().addDependent(oDialog);
oDialog.open();
}
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"oSelectedContentModel",
"=",
"this",
".",
"getView",
"(",
")",
".",
"getModel",
"(",
"\"selectedContent\"",
")",
";",
"var",
"oContentData",
"=",
"oSelectedContentModel",
".",
"getData",
"("... | Select correct transport id (through a dialog if necessary) and trigger deletion of file.
@private | [
"Select",
"correct",
"transport",
"id",
"(",
"through",
"a",
"dialog",
"if",
"necessary",
")",
"and",
"trigger",
"deletion",
"of",
"file",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js#L196-L268 | train | Delete the selected content | [
30522,
3853,
1006,
1007,
1063,
13075,
2008,
1027,
2023,
1025,
13075,
9808,
12260,
10985,
8663,
6528,
21246,
10244,
2140,
1027,
2023,
1012,
2131,
8584,
1006,
1007,
1012,
2131,
5302,
9247,
1006,
1000,
3479,
8663,
6528,
2102,
1000,
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... | |
angular/material | src/components/icon/js/iconService.js | loadByHttpUrl | 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);
});
} | javascript | 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);
});
} | [
"function",
"loadByHttpUrl",
"(",
"url",
")",
"{",
"return",
"$q",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"// Catch HTTP or generic errors not related to incorrect icon IDs.",
"var",
"announceAndReject",
"=",
"function",
"(",
"err",
")",
"{",
"var... | /* Load the icon by URL using HTTP. | [
"/",
"*",
"Load",
"the",
"icon",
"by",
"URL",
"using",
"HTTP",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L639-L656 | train | Load the image by HTTP URL | [
30522,
3853,
7170,
3762,
11039,
25856,
3126,
2140,
1006,
24471,
2140,
1007,
1063,
2709,
1002,
1053,
1006,
3853,
1006,
10663,
1010,
15454,
1007,
1063,
1013,
1013,
4608,
8299,
2030,
12391,
10697,
2025,
3141,
2000,
16542,
12696,
8909,
2015,
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... |
chartjs/Chart.js | src/core/core.scale.js | computeLabelSizes | function computeLabelSizes(ctx, tickFonts, ticks, caches) {
var length = ticks.length;
var widths = [];
var heights = [];
var offsets = [];
var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest;
for (i = 0; i < length; ++i) {
label = ticks[i].label;
tickFont = ticks[i].major ? tickFonts.major : tickFonts.minor;
ctx.font = fontString = tickFont.string;
cache = caches[fontString] = caches[fontString] || {data: {}, gc: []};
lineHeight = tickFont.lineHeight;
width = height = 0;
// Undefined labels and arrays should not be measured
if (!helpers.isNullOrUndef(label) && !helpers.isArray(label)) {
width = helpers.measureText(ctx, cache.data, cache.gc, width, label);
height = lineHeight;
} else if (helpers.isArray(label)) {
// if it is an array let's measure each element
for (j = 0, jlen = label.length; j < jlen; ++j) {
nestedLabel = label[j];
// Undefined labels and arrays should not be measured
if (!helpers.isNullOrUndef(nestedLabel) && !helpers.isArray(nestedLabel)) {
width = helpers.measureText(ctx, cache.data, cache.gc, width, nestedLabel);
height += lineHeight;
}
}
}
widths.push(width);
heights.push(height);
offsets.push(lineHeight / 2);
}
garbageCollect(caches, length);
widest = widths.indexOf(Math.max.apply(null, widths));
highest = heights.indexOf(Math.max.apply(null, heights));
function valueAt(idx) {
return {
width: widths[idx] || 0,
height: heights[idx] || 0,
offset: offsets[idx] || 0
};
}
return {
first: valueAt(0),
last: valueAt(length - 1),
widest: valueAt(widest),
highest: valueAt(highest)
};
} | javascript | function computeLabelSizes(ctx, tickFonts, ticks, caches) {
var length = ticks.length;
var widths = [];
var heights = [];
var offsets = [];
var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest;
for (i = 0; i < length; ++i) {
label = ticks[i].label;
tickFont = ticks[i].major ? tickFonts.major : tickFonts.minor;
ctx.font = fontString = tickFont.string;
cache = caches[fontString] = caches[fontString] || {data: {}, gc: []};
lineHeight = tickFont.lineHeight;
width = height = 0;
// Undefined labels and arrays should not be measured
if (!helpers.isNullOrUndef(label) && !helpers.isArray(label)) {
width = helpers.measureText(ctx, cache.data, cache.gc, width, label);
height = lineHeight;
} else if (helpers.isArray(label)) {
// if it is an array let's measure each element
for (j = 0, jlen = label.length; j < jlen; ++j) {
nestedLabel = label[j];
// Undefined labels and arrays should not be measured
if (!helpers.isNullOrUndef(nestedLabel) && !helpers.isArray(nestedLabel)) {
width = helpers.measureText(ctx, cache.data, cache.gc, width, nestedLabel);
height += lineHeight;
}
}
}
widths.push(width);
heights.push(height);
offsets.push(lineHeight / 2);
}
garbageCollect(caches, length);
widest = widths.indexOf(Math.max.apply(null, widths));
highest = heights.indexOf(Math.max.apply(null, heights));
function valueAt(idx) {
return {
width: widths[idx] || 0,
height: heights[idx] || 0,
offset: offsets[idx] || 0
};
}
return {
first: valueAt(0),
last: valueAt(length - 1),
widest: valueAt(widest),
highest: valueAt(highest)
};
} | [
"function",
"computeLabelSizes",
"(",
"ctx",
",",
"tickFonts",
",",
"ticks",
",",
"caches",
")",
"{",
"var",
"length",
"=",
"ticks",
".",
"length",
";",
"var",
"widths",
"=",
"[",
"]",
";",
"var",
"heights",
"=",
"[",
"]",
";",
"var",
"offsets",
"=",... | Returns {width, height, offset} objects for the first, last, widest, highest tick
labels where offset indicates the anchor point offset from the top in pixels. | [
"Returns",
"{",
"width",
"height",
"offset",
"}",
"objects",
"for",
"the",
"first",
"last",
"widest",
"highest",
"tick",
"labels",
"where",
"offset",
"indicates",
"the",
"anchor",
"point",
"offset",
"from",
"the",
"top",
"in",
"pixels",
"."
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.scale.js#L103-L155 | train | Compute the sizes of the labels | [
30522,
3853,
24134,
20470,
9050,
10057,
1006,
14931,
2595,
1010,
16356,
14876,
7666,
1010,
16356,
2015,
1010,
17053,
2015,
1007,
1063,
13075,
3091,
1027,
16356,
2015,
1012,
3091,
1025,
13075,
9381,
2015,
1027,
1031,
1033,
1025,
13075,
7535,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/28_binstructs.js | parse_RfX | function parse_RfX(data /*::, length*/)/*:Range*/ {
var cell/*:Range*/ = ({s: {}, e: {}}/*:any*/);
cell.s.r = data.read_shift(4);
cell.e.r = data.read_shift(4);
cell.s.c = data.read_shift(4);
cell.e.c = data.read_shift(4);
return cell;
} | javascript | function parse_RfX(data /*::, length*/)/*:Range*/ {
var cell/*:Range*/ = ({s: {}, e: {}}/*:any*/);
cell.s.r = data.read_shift(4);
cell.e.r = data.read_shift(4);
cell.s.c = data.read_shift(4);
cell.e.c = data.read_shift(4);
return cell;
} | [
"function",
"parse_RfX",
"(",
"data",
"/*::, length*/",
")",
"/*:Range*/",
"{",
"var",
"cell",
"/*:Range*/",
"=",
"(",
"{",
"s",
":",
"{",
"}",
",",
"e",
":",
"{",
"}",
"}",
"/*:any*/",
")",
";",
"cell",
".",
"s",
".",
"r",
"=",
"data",
".",
"rea... | /* [MS-XLSB] 2.5.117 RfX | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"5",
".",
"117",
"RfX"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/28_binstructs.js#L131-L138 | train | Parse RFX cell | [
30522,
3853,
11968,
3366,
1035,
21792,
2595,
1006,
2951,
1013,
1008,
1024,
1024,
1010,
3091,
1008,
1013,
1007,
1013,
1008,
1024,
2846,
1008,
1013,
1063,
13075,
3526,
1013,
1008,
1024,
2846,
1008,
1013,
1027,
1006,
1063,
1055,
1024,
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... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Entity.controller.js | function (oEvt) {
// navigate to entity
var sType = oEvt.getSource().data("type");
this.getRouter().navTo("entity", {id: sType}, false);
} | javascript | function (oEvt) {
// navigate to entity
var sType = oEvt.getSource().data("type");
this.getRouter().navTo("entity", {id: sType}, false);
} | [
"function",
"(",
"oEvt",
")",
"{",
"// navigate to entity",
"var",
"sType",
"=",
"oEvt",
".",
"getSource",
"(",
")",
".",
"data",
"(",
"\"type\"",
")",
";",
"this",
".",
"getRouter",
"(",
")",
".",
"navTo",
"(",
"\"entity\"",
",",
"{",
"id",
":",
"sT... | /* =========================================================== /* begin: internal methods /* =========================================================== | [
"/",
"*",
"===========================================================",
"/",
"*",
"begin",
":",
"internal",
"methods",
"/",
"*",
"==========================================================="
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Entity.controller.js#L43-L47 | train | Navigates to the specified entity type | [
30522,
3853,
1006,
1051,
6777,
2102,
1007,
1063,
1013,
1013,
22149,
2000,
9178,
13075,
2358,
18863,
1027,
1051,
6777,
2102,
1012,
4152,
8162,
3401,
1006,
1007,
1012,
2951,
1006,
1000,
2828,
1000,
1007,
1025,
2023,
1012,
2131,
22494,
3334,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_BrtFont | function parse_BrtFont(data, length, opts) {
var out = ({});
out.sz = data.read_shift(2) / 20;
var grbit = parse_FontFlags(data, 2, opts);
if(grbit.fCondense) out.condense = 1;
if(grbit.fExtend) out.extend = 1;
if(grbit.fShadow) out.shadow = 1;
if(grbit.fOutline) out.outline = 1;
if(grbit.fStrikeout) out.strike = 1;
if(grbit.fItalic) out.italic = 1;
var bls = data.read_shift(2);
if(bls === 0x02BC) out.bold = 1;
switch(data.read_shift(2)) {
/* case 0: out.vertAlign = "baseline"; break; */
case 1: out.vertAlign = "superscript"; break;
case 2: out.vertAlign = "subscript"; break;
}
var underline = data.read_shift(1);
if(underline != 0) out.underline = underline;
var family = data.read_shift(1);
if(family > 0) out.family = family;
var bCharSet = data.read_shift(1);
if(bCharSet > 0) out.charset = bCharSet;
data.l++;
out.color = parse_BrtColor(data, 8);
switch(data.read_shift(1)) {
/* case 0: out.scheme = "none": break; */
case 1: out.scheme = "major"; break;
case 2: out.scheme = "minor"; break;
}
out.name = parse_XLWideString(data, length - 21);
return out;
} | javascript | function parse_BrtFont(data, length, opts) {
var out = ({});
out.sz = data.read_shift(2) / 20;
var grbit = parse_FontFlags(data, 2, opts);
if(grbit.fCondense) out.condense = 1;
if(grbit.fExtend) out.extend = 1;
if(grbit.fShadow) out.shadow = 1;
if(grbit.fOutline) out.outline = 1;
if(grbit.fStrikeout) out.strike = 1;
if(grbit.fItalic) out.italic = 1;
var bls = data.read_shift(2);
if(bls === 0x02BC) out.bold = 1;
switch(data.read_shift(2)) {
/* case 0: out.vertAlign = "baseline"; break; */
case 1: out.vertAlign = "superscript"; break;
case 2: out.vertAlign = "subscript"; break;
}
var underline = data.read_shift(1);
if(underline != 0) out.underline = underline;
var family = data.read_shift(1);
if(family > 0) out.family = family;
var bCharSet = data.read_shift(1);
if(bCharSet > 0) out.charset = bCharSet;
data.l++;
out.color = parse_BrtColor(data, 8);
switch(data.read_shift(1)) {
/* case 0: out.scheme = "none": break; */
case 1: out.scheme = "major"; break;
case 2: out.scheme = "minor"; break;
}
out.name = parse_XLWideString(data, length - 21);
return out;
} | [
"function",
"parse_BrtFont",
"(",
"data",
",",
"length",
",",
"opts",
")",
"{",
"var",
"out",
"=",
"(",
"{",
"}",
")",
";",
"out",
".",
"sz",
"=",
"data",
".",
"read_shift",
"(",
"2",
")",
"/",
"20",
";",
"var",
"grbit",
"=",
"parse_FontFlags",
"... | /* [MS-XLSB] 2.4.659 BrtFont TODO | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"4",
".",
"659",
"BrtFont",
"TODO"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L9036-L9079 | train | Parse BrtFont | [
30522,
3853,
11968,
3366,
1035,
7987,
24475,
12162,
1006,
2951,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
2041,
1027,
1006,
1063,
1065,
1007,
1025,
2041,
1012,
1055,
2480,
1027,
2951,
1012,
3191,
1035,
5670,
1006,
1016,
1007,
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... |
apache/incubator-echarts | src/chart/treemap/treemapVisual.js | getRangeVisual | function getRangeVisual(nodeModel, name) {
// 'colorRange', 'colorARange', 'colorSRange'.
// If not exsits on this node, fetch from levels and series.
var range = nodeModel.get(name);
return (isArray(range) && range.length) ? {name: name, range: range} : null;
} | javascript | function getRangeVisual(nodeModel, name) {
// 'colorRange', 'colorARange', 'colorSRange'.
// If not exsits on this node, fetch from levels and series.
var range = nodeModel.get(name);
return (isArray(range) && range.length) ? {name: name, range: range} : null;
} | [
"function",
"getRangeVisual",
"(",
"nodeModel",
",",
"name",
")",
"{",
"// 'colorRange', 'colorARange', 'colorSRange'.",
"// If not exsits on this node, fetch from levels and series.",
"var",
"range",
"=",
"nodeModel",
".",
"get",
"(",
"name",
")",
";",
"return",
"(",
"is... | Notice: If we dont have the attribute 'colorRange', but only use attribute 'color' to represent both concepts of 'colorRange' and 'color', (It means 'colorRange' when 'color' is Array, means 'color' when not array), this problem will be encountered: If a level-1 node dont have children, and its siblings has children, and colorRange is set on level-1, then the node can not be colored. So we separate 'colorRange' and 'color' to different attributes. | [
"Notice",
":",
"If",
"we",
"dont",
"have",
"the",
"attribute",
"colorRange",
"but",
"only",
"use",
"attribute",
"color",
"to",
"represent",
"both",
"concepts",
"of",
"colorRange",
"and",
"color",
"(",
"It",
"means",
"colorRange",
"when",
"color",
"is",
"Arra... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/treemapVisual.js#L217-L222 | train | Get range visual | [
30522,
3853,
2131,
24388,
6777,
2483,
8787,
1006,
13045,
5302,
9247,
1010,
2171,
1007,
1063,
1013,
1013,
1005,
3609,
24388,
2063,
1005,
1010,
1005,
3609,
20486,
3351,
1005,
1010,
1005,
6087,
24388,
2063,
1005,
1012,
1013,
1013,
2065,
2025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/HealthLogger.js | sendAnalyticsData | function sendAnalyticsData(eventName, eventCategory, eventSubCategory, eventType, eventSubType) {
var isEventDataAlreadySent = analyticsEventMap.get(eventName),
isHDTracking = PreferencesManager.getExtensionPrefs("healthData").get("healthDataTracking"),
eventParams = {};
if (isHDTracking && !isEventDataAlreadySent && eventName && eventCategory) {
eventParams = {
eventName: eventName,
eventCategory: eventCategory,
eventSubCategory: eventSubCategory || "",
eventType: eventType || "",
eventSubType: eventSubType || ""
};
notifyHealthManagerToSendData(eventParams);
}
} | javascript | function sendAnalyticsData(eventName, eventCategory, eventSubCategory, eventType, eventSubType) {
var isEventDataAlreadySent = analyticsEventMap.get(eventName),
isHDTracking = PreferencesManager.getExtensionPrefs("healthData").get("healthDataTracking"),
eventParams = {};
if (isHDTracking && !isEventDataAlreadySent && eventName && eventCategory) {
eventParams = {
eventName: eventName,
eventCategory: eventCategory,
eventSubCategory: eventSubCategory || "",
eventType: eventType || "",
eventSubType: eventSubType || ""
};
notifyHealthManagerToSendData(eventParams);
}
} | [
"function",
"sendAnalyticsData",
"(",
"eventName",
",",
"eventCategory",
",",
"eventSubCategory",
",",
"eventType",
",",
"eventSubType",
")",
"{",
"var",
"isEventDataAlreadySent",
"=",
"analyticsEventMap",
".",
"get",
"(",
"eventName",
")",
",",
"isHDTracking",
"=",... | Send Analytics Data
@param {string} eventCategory The kind of Event Category that
needs to be logged- should be a js var compatible string
@param {string} eventSubCategory The kind of Event Sub Category that
needs to be logged- should be a js var compatible string
@param {string} eventType The kind of Event Type that needs to be logged- should be a js var compatible string
@param {string} eventSubType The kind of Event Sub Type that
needs to be logged- should be a js var compatible string | [
"Send",
"Analytics",
"Data"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/HealthLogger.js#L324-L339 | train | send analytics data | [
30522,
3853,
4604,
27953,
21252,
16150,
6790,
1006,
2724,
18442,
1010,
2724,
16280,
20255,
2100,
1010,
2824,
12083,
16280,
20255,
2100,
1010,
2724,
13874,
1010,
2824,
12083,
13874,
1007,
1063,
13075,
2003,
18697,
3372,
2850,
2696,
2389,
16416... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
google/closure-library | closure/goog/html/cssspecificity.js | replaceWithEmptyText | function replaceWithEmptyText(selector, specificity, regex, typeIndex) {
return selector.replace(regex, function(match) {
specificity[typeIndex] += 1;
// Replace this simple selector with whitespace so it won't be counted
// in further simple selectors.
return Array(match.length + 1).join(' ');
});
} | javascript | function replaceWithEmptyText(selector, specificity, regex, typeIndex) {
return selector.replace(regex, function(match) {
specificity[typeIndex] += 1;
// Replace this simple selector with whitespace so it won't be counted
// in further simple selectors.
return Array(match.length + 1).join(' ');
});
} | [
"function",
"replaceWithEmptyText",
"(",
"selector",
",",
"specificity",
",",
"regex",
",",
"typeIndex",
")",
"{",
"return",
"selector",
".",
"replace",
"(",
"regex",
",",
"function",
"(",
"match",
")",
"{",
"specificity",
"[",
"typeIndex",
"]",
"+=",
"1",
... | Find matches for a regular expression in the selector and increase count.
@param {string} selector The selector to match the regex with.
@param {!Array<number>} specificity The current specificity.
@param {!RegExp} regex The regular expression.
@param {number} typeIndex Index of type count.
@return {string} | [
"Find",
"matches",
"for",
"a",
"regular",
"expression",
"in",
"the",
"selector",
"and",
"increase",
"count",
"."
] | 97390e9ca4483cebb9628e06026139fbb3023d65 | https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/html/cssspecificity.js#L68-L75 | train | Replace empty text with a number | [
30522,
3853,
5672,
24415,
6633,
13876,
17250,
18413,
1006,
27000,
1010,
3563,
3012,
30524,
15327,
2061,
2009,
2180,
1005,
1056,
2022,
8897,
1013,
1013,
1999,
2582,
3722,
27000,
2015,
1012,
2709,
9140,
1006,
2674,
1012,
3091,
1009,
1015,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js | updateChangeReason | function updateChangeReason(sName) {
if (sName === "$filter" || sName === "$search") {
sChangeReason = ChangeReason.Filter;
} else if (sName === "$orderby" && sChangeReason !== ChangeReason.Filter) {
sChangeReason = ChangeReason.Sort;
} else if (!sChangeReason) {
sChangeReason = ChangeReason.Change;
}
} | javascript | function updateChangeReason(sName) {
if (sName === "$filter" || sName === "$search") {
sChangeReason = ChangeReason.Filter;
} else if (sName === "$orderby" && sChangeReason !== ChangeReason.Filter) {
sChangeReason = ChangeReason.Sort;
} else if (!sChangeReason) {
sChangeReason = ChangeReason.Change;
}
} | [
"function",
"updateChangeReason",
"(",
"sName",
")",
"{",
"if",
"(",
"sName",
"===",
"\"$filter\"",
"||",
"sName",
"===",
"\"$search\"",
")",
"{",
"sChangeReason",
"=",
"ChangeReason",
".",
"Filter",
";",
"}",
"else",
"if",
"(",
"sName",
"===",
"\"$orderby\"... | /*
Updates <code>sChangeReason</code> depending on the given custom or system query option
name:
- "$filter" and "$search" cause <code>ChangeReason.Filter</code>,
- "$orderby" causes <code>ChangeReason.Sort</code>,
- default is <code>ChangeReason.Change</code>.
The "strongest" change reason wins: Filter > Sort > Change.
@param {string} sName
The name of a custom or system query option | [
"/",
"*",
"Updates",
"<code",
">",
"sChangeReason<",
"/",
"code",
">",
"depending",
"on",
"the",
"given",
"custom",
"or",
"system",
"query",
"option",
"name",
":",
"-",
"$filter",
"and",
"$search",
"cause",
"<code",
">",
"ChangeReason",
".",
"Filter<",
"/"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js#L281-L289 | train | Updates the change reason of the given property | [
30522,
3853,
10651,
22305,
7869,
3022,
2239,
1006,
1055,
18442,
1007,
1063,
2065,
1006,
1055,
18442,
1027,
1027,
1027,
1000,
1002,
11307,
1000,
1064,
1064,
1055,
18442,
1027,
1027,
1027,
1000,
1002,
3945,
1000,
1007,
1063,
8040,
18003,
7869... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/bold.js | styleBold | function styleBold(sq) {
if (sq.hasFormat('b') || sq.hasFormat('strong')) {
sq.changeFormat(null, {tag: 'b'});
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
}
sq.bold();
}
} | javascript | function styleBold(sq) {
if (sq.hasFormat('b') || sq.hasFormat('strong')) {
sq.changeFormat(null, {tag: 'b'});
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
}
sq.bold();
}
} | [
"function",
"styleBold",
"(",
"sq",
")",
"{",
"if",
"(",
"sq",
".",
"hasFormat",
"(",
"'b'",
")",
"||",
"sq",
".",
"hasFormat",
"(",
"'strong'",
")",
")",
"{",
"sq",
".",
"changeFormat",
"(",
"null",
",",
"{",
"tag",
":",
"'b'",
"}",
")",
";",
... | Style bold.
@param {object} sq - squire editor instance | [
"Style",
"bold",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/bold.js#L43-L52 | train | Style bold. | [
30522,
3853,
2806,
27495,
1006,
5490,
1007,
1063,
2065,
1006,
5490,
1012,
2038,
14192,
4017,
1006,
1005,
1038,
1005,
1007,
1064,
1064,
5490,
1012,
2038,
14192,
4017,
1006,
1005,
2844,
1005,
1007,
1007,
1063,
5490,
1012,
2689,
14192,
4017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 () {
var oModel = this._oDialog.getModel("view"),
sVersionString = oModel.getProperty("/ProductName") + ": " +
oModel.getProperty("/ProductVersion") + " " +
this._getControl("versionBuiltAt", this._TECHNICAL_INFO_DIALOG_ID).getText(),
sVersionOpenUI5String = "OpenUI5 Version: " +
oModel.getProperty("/OpenUI5ProductVersion") + " " +
this._getControl("versionOpenUI5BuiltAt", this._TECHNICAL_INFO_DIALOG_ID).getText(),
sString = sVersionString + "\r\n" +
(oModel.getProperty("/OpenUI5ProductVersion") ? sVersionOpenUI5String + "\r\n" : "") +
this._getText("TechInfo.UserAgent.Label") + ": " + oModel.getProperty("/UserAgent") + "\r\n" +
this._getText("TechInfo.AppUrl.Label") + ": " + oModel.getProperty("/ApplicationURL") + "\r\n";
this._copyToClipboard(sString, "TechInfo.CopyToClipboard");
} | javascript | function () {
var oModel = this._oDialog.getModel("view"),
sVersionString = oModel.getProperty("/ProductName") + ": " +
oModel.getProperty("/ProductVersion") + " " +
this._getControl("versionBuiltAt", this._TECHNICAL_INFO_DIALOG_ID).getText(),
sVersionOpenUI5String = "OpenUI5 Version: " +
oModel.getProperty("/OpenUI5ProductVersion") + " " +
this._getControl("versionOpenUI5BuiltAt", this._TECHNICAL_INFO_DIALOG_ID).getText(),
sString = sVersionString + "\r\n" +
(oModel.getProperty("/OpenUI5ProductVersion") ? sVersionOpenUI5String + "\r\n" : "") +
this._getText("TechInfo.UserAgent.Label") + ": " + oModel.getProperty("/UserAgent") + "\r\n" +
this._getText("TechInfo.AppUrl.Label") + ": " + oModel.getProperty("/ApplicationURL") + "\r\n";
this._copyToClipboard(sString, "TechInfo.CopyToClipboard");
} | [
"function",
"(",
")",
"{",
"var",
"oModel",
"=",
"this",
".",
"_oDialog",
".",
"getModel",
"(",
"\"view\"",
")",
",",
"sVersionString",
"=",
"oModel",
".",
"getProperty",
"(",
"\"/ProductName\"",
")",
"+",
"\": \"",
"+",
"oModel",
".",
"getProperty",
"(",
... | Copies the technical information shown in the dialog to the clipboard | [
"Copies",
"the",
"technical",
"information",
"shown",
"in",
"the",
"dialog",
"to",
"the",
"clipboard"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L127-L141 | train | This method is called when the user clicks the version dialog | [
30522,
3853,
1006,
1007,
1063,
13075,
18168,
10244,
2140,
1027,
2023,
1012,
1035,
21045,
23067,
2290,
1012,
2131,
5302,
9247,
1006,
1000,
3193,
1000,
1007,
1010,
17917,
2545,
8496,
18886,
3070,
1027,
18168,
10244,
2140,
1012,
2131,
21572,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.unified/src/sap/ui/unified/CalendarTimeInterval.js | _handleSelectYear | function _handleSelectYear(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oYearPicker = this.getAggregation("yearPicker");
var oDate = CalendarUtils._createUniversalUTCDate(oYearPicker.getDate());
var iMonth = oFocusedDate.getUTCMonth();
oDate.setUTCMonth(oFocusedDate.getUTCMonth(), oFocusedDate.getUTCDate()); // to keep day and month stable also for islamic date
oDate.setUTCHours(oFocusedDate.getUTCHours());
oDate.setUTCMinutes(oFocusedDate.getUTCMinutes());
oFocusedDate = oDate;
if (iMonth != oFocusedDate.getUTCMonth() ) {
// day did not exist in this year (29. Feb) -> go to last day of month
oFocusedDate.setUTCDate(0);
}
_focusDate.call(this, oFocusedDate, true);
_hideYearPicker.call(this);
} | javascript | function _handleSelectYear(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oYearPicker = this.getAggregation("yearPicker");
var oDate = CalendarUtils._createUniversalUTCDate(oYearPicker.getDate());
var iMonth = oFocusedDate.getUTCMonth();
oDate.setUTCMonth(oFocusedDate.getUTCMonth(), oFocusedDate.getUTCDate()); // to keep day and month stable also for islamic date
oDate.setUTCHours(oFocusedDate.getUTCHours());
oDate.setUTCMinutes(oFocusedDate.getUTCMinutes());
oFocusedDate = oDate;
if (iMonth != oFocusedDate.getUTCMonth() ) {
// day did not exist in this year (29. Feb) -> go to last day of month
oFocusedDate.setUTCDate(0);
}
_focusDate.call(this, oFocusedDate, true);
_hideYearPicker.call(this);
} | [
"function",
"_handleSelectYear",
"(",
"oEvent",
")",
"{",
"var",
"oFocusedDate",
"=",
"new",
"UniversalDate",
"(",
"this",
".",
"_getFocusedDate",
"(",
")",
".",
"getTime",
"(",
")",
")",
";",
"var",
"oYearPicker",
"=",
"this",
".",
"getAggregation",
"(",
... | Handles the user year selection.
This function assumes there is a "yearPicker" aggregation.
So callers must take care.
@return {void}
@private | [
"Handles",
"the",
"user",
"year",
"selection",
".",
"This",
"function",
"assumes",
"there",
"is",
"a",
"yearPicker",
"aggregation",
".",
"So",
"callers",
"must",
"take",
"care",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1953-L1974 | train | Handles the year selection event. | [
30522,
3853,
1035,
16024,
12260,
6593,
29100,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
1997,
10085,
13901,
13701,
1027,
2047,
5415,
13701,
1006,
2023,
1012,
1035,
2131,
14876,
7874,
22367,
3686,
1006,
1007,
1012,
2131,
7292,
1006,
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... |
adobe/brackets | src/project/ProjectModel.js | _addWelcomeProjectPath | function _addWelcomeProjectPath(path, currentProjects) {
var pathNoSlash = FileUtils.stripTrailingSlash(path); // "welcomeProjects" pref has standardized on no trailing "/"
var newProjects;
if (currentProjects) {
newProjects = _.clone(currentProjects);
} else {
newProjects = [];
}
if (newProjects.indexOf(pathNoSlash) === -1) {
newProjects.push(pathNoSlash);
}
return newProjects;
} | javascript | function _addWelcomeProjectPath(path, currentProjects) {
var pathNoSlash = FileUtils.stripTrailingSlash(path); // "welcomeProjects" pref has standardized on no trailing "/"
var newProjects;
if (currentProjects) {
newProjects = _.clone(currentProjects);
} else {
newProjects = [];
}
if (newProjects.indexOf(pathNoSlash) === -1) {
newProjects.push(pathNoSlash);
}
return newProjects;
} | [
"function",
"_addWelcomeProjectPath",
"(",
"path",
",",
"currentProjects",
")",
"{",
"var",
"pathNoSlash",
"=",
"FileUtils",
".",
"stripTrailingSlash",
"(",
"path",
")",
";",
"// \"welcomeProjects\" pref has standardized on no trailing \"/\"",
"var",
"newProjects",
";",
"... | @private
Adds the path to the list of welcome projects we've ever seen, if not on the list already.
@param {string} path Path to possibly add
@param {Array.<string>=} currentProjects Array of current welcome projects
@return {Array.<string>} New array of welcome projects with the additional project added | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectModel.js#L1326-L1341 | train | Add a path to the list of projects | [
30522,
3853,
1035,
5587,
8545,
22499,
4168,
21572,
20614,
15069,
1006,
4130,
1010,
2783,
21572,
20614,
2015,
1007,
1063,
13075,
4130,
15460,
27067,
1027,
5371,
21823,
4877,
1012,
6167,
6494,
16281,
14540,
11823,
1006,
4130,
1007,
1025,
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... |
keplergl/kepler.gl | examples/webpack.config.local.js | makeLocalDevConfig | function makeLocalDevConfig(EXAMPLE_DIR = LIB_DIR) {
return {
// suppress warnings about bundle size
devServer: {
stats: {
warnings: false
}
},
devtool: 'source-map',
resolve: {
alias: {
// Imports kepler.gl library from the src directory in this repo
'kepler.gl': SRC_DIR,
react: resolve(EXAMPLE_DIR, './node_modules/react'),
'styled-components': resolve(EXAMPLE_DIR, './node_modules/styled-components')
}
},
module: {
rules: [
{
// Unfortunately, webpack doesn't import library source maps on its own...
test: /\.js$/,
use: ['source-map-loader'],
enforce: 'pre',
exclude: [
/node_modules\/react-palm/,
/node_modules\/react-data-grid/
]
}
]
},
// Optional: Enables reading mapbox token from environment variable
plugins: [
new webpack.EnvironmentPlugin([
'MapboxAccessToken',
'DropboxClientId',
'MapboxExportToken'
])
]
};
} | javascript | function makeLocalDevConfig(EXAMPLE_DIR = LIB_DIR) {
return {
// suppress warnings about bundle size
devServer: {
stats: {
warnings: false
}
},
devtool: 'source-map',
resolve: {
alias: {
// Imports kepler.gl library from the src directory in this repo
'kepler.gl': SRC_DIR,
react: resolve(EXAMPLE_DIR, './node_modules/react'),
'styled-components': resolve(EXAMPLE_DIR, './node_modules/styled-components')
}
},
module: {
rules: [
{
// Unfortunately, webpack doesn't import library source maps on its own...
test: /\.js$/,
use: ['source-map-loader'],
enforce: 'pre',
exclude: [
/node_modules\/react-palm/,
/node_modules\/react-data-grid/
]
}
]
},
// Optional: Enables reading mapbox token from environment variable
plugins: [
new webpack.EnvironmentPlugin([
'MapboxAccessToken',
'DropboxClientId',
'MapboxExportToken'
])
]
};
} | [
"function",
"makeLocalDevConfig",
"(",
"EXAMPLE_DIR",
"=",
"LIB_DIR",
")",
"{",
"return",
"{",
"// suppress warnings about bundle size",
"devServer",
":",
"{",
"stats",
":",
"{",
"warnings",
":",
"false",
"}",
"}",
",",
"devtool",
":",
"'source-map'",
",",
"reso... | Support for hot reloading changes to the deck.gl library: | [
"Support",
"for",
"hot",
"reloading",
"changes",
"to",
"the",
"deck",
".",
"gl",
"library",
":"
] | 779238435707cc54335c2d00001e4b9334b314aa | https://github.com/keplergl/kepler.gl/blob/779238435707cc54335c2d00001e4b9334b314aa/examples/webpack.config.local.js#L37-L79 | train | Creates a webpack config object for local development. | [
30522,
3853,
2191,
4135,
9289,
24844,
8663,
8873,
2290,
1006,
2742,
1035,
16101,
1027,
5622,
2497,
1035,
16101,
1007,
1063,
2709,
1063,
1013,
1013,
16081,
16234,
2055,
14012,
2946,
16475,
8043,
6299,
1024,
1063,
26319,
1024,
1063,
16234,
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... |
chriso/validator.js | lib/isISO8601.js | isValidDate | function isValidDate(str) {
// str must have passed the ISO8601 check
// this check is meant to catch invalid dates
// like 2009-02-31
// first check for ordinal dates
var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);
if (ordinalMatch) {
var oYear = Number(ordinalMatch[1]);
var oDay = Number(ordinalMatch[2]); // if is leap year
if (oYear % 4 === 0 && oYear % 100 !== 0) return oDay <= 366;
return oDay <= 365;
}
var match = str.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number);
var year = match[1];
var month = match[2];
var day = match[3];
var monthString = month ? "0".concat(month).slice(-2) : month;
var dayString = day ? "0".concat(day).slice(-2) : day; // create a date object and compare
var d = new Date("".concat(year, "-").concat(monthString || '01', "-").concat(dayString || '01'));
if (isNaN(d.getUTCFullYear())) return false;
if (month && day) {
return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day;
}
return true;
} | javascript | function isValidDate(str) {
// str must have passed the ISO8601 check
// this check is meant to catch invalid dates
// like 2009-02-31
// first check for ordinal dates
var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);
if (ordinalMatch) {
var oYear = Number(ordinalMatch[1]);
var oDay = Number(ordinalMatch[2]); // if is leap year
if (oYear % 4 === 0 && oYear % 100 !== 0) return oDay <= 366;
return oDay <= 365;
}
var match = str.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number);
var year = match[1];
var month = match[2];
var day = match[3];
var monthString = month ? "0".concat(month).slice(-2) : month;
var dayString = day ? "0".concat(day).slice(-2) : day; // create a date object and compare
var d = new Date("".concat(year, "-").concat(monthString || '01', "-").concat(dayString || '01'));
if (isNaN(d.getUTCFullYear())) return false;
if (month && day) {
return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day;
}
return true;
} | [
"function",
"isValidDate",
"(",
"str",
")",
"{",
"// str must have passed the ISO8601 check",
"// this check is meant to catch invalid dates",
"// like 2009-02-31",
"// first check for ordinal dates",
"var",
"ordinalMatch",
"=",
"str",
".",
"match",
"(",
"/",
"^(\\d{4})-?(\\d{3})... | /* eslint-enable max-len | [
"/",
"*",
"eslint",
"-",
"enable",
"max",
"-",
"len"
] | 63e4c78f07d08543af4be7b6c2c9cf24df009003 | https://github.com/chriso/validator.js/blob/63e4c78f07d08543af4be7b6c2c9cf24df009003/lib/isISO8601.js#L17-L47 | train | Check if a date string is valid | [
30522,
3853,
2003,
10175,
3593,
13701,
1006,
2358,
2099,
1007,
1063,
1013,
1013,
2358,
2099,
2442,
2031,
2979,
1996,
11163,
20842,
24096,
4638,
1013,
1013,
2023,
4638,
2003,
3214,
2000,
4608,
19528,
5246,
1013,
1013,
2066,
2268,
1011,
6185,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.unified/src/sap/ui/unified/Menu.js | checkCozyMode | function checkCozyMode(oRef) {
if (!oRef) {
return false;
}
oRef = oRef.$ ? oRef.$() : jQuery(oRef);
return oRef.closest(".sapUiSizeCompact,.sapUiSizeCondensed,.sapUiSizeCozy").hasClass("sapUiSizeCozy");
} | javascript | function checkCozyMode(oRef) {
if (!oRef) {
return false;
}
oRef = oRef.$ ? oRef.$() : jQuery(oRef);
return oRef.closest(".sapUiSizeCompact,.sapUiSizeCondensed,.sapUiSizeCozy").hasClass("sapUiSizeCozy");
} | [
"function",
"checkCozyMode",
"(",
"oRef",
")",
"{",
"if",
"(",
"!",
"oRef",
")",
"{",
"return",
"false",
";",
"}",
"oRef",
"=",
"oRef",
".",
"$",
"?",
"oRef",
".",
"$",
"(",
")",
":",
"jQuery",
"(",
"oRef",
")",
";",
"return",
"oRef",
".",
"clo... | /////////////////////////////////////// Hidden Functions ///////////////////////////////////////// | [
"///////////////////////////////////////",
"Hidden",
"Functions",
"/////////////////////////////////////////"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/Menu.js#L1170-L1176 | train | Checks if the given reference is cozy mode. | [
30522,
3853,
4638,
3597,
9096,
5302,
3207,
1006,
10848,
2546,
1007,
1063,
2065,
1006,
999,
10848,
2546,
1007,
1063,
2709,
6270,
1025,
1065,
10848,
2546,
1027,
10848,
2546,
1012,
1002,
1029,
10848,
2546,
1012,
1002,
1006,
1007,
1024,
1046,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
jakesgordon/javascript-state-machine | src/plugin/visualize.js | dotcfg | function dotcfg(fsm, options) {
options = options || {}
var config = dotcfg.fetch(fsm),
name = options.name,
rankdir = dotcfg.rankdir(options.orientation),
states = dotcfg.states(config, options),
transitions = dotcfg.transitions(config, options),
result = { }
if (name)
result.name = name
if (rankdir)
result.rankdir = rankdir
if (states && states.length > 0)
result.states = states
if (transitions && transitions.length > 0)
result.transitions = transitions
return result
} | javascript | function dotcfg(fsm, options) {
options = options || {}
var config = dotcfg.fetch(fsm),
name = options.name,
rankdir = dotcfg.rankdir(options.orientation),
states = dotcfg.states(config, options),
transitions = dotcfg.transitions(config, options),
result = { }
if (name)
result.name = name
if (rankdir)
result.rankdir = rankdir
if (states && states.length > 0)
result.states = states
if (transitions && transitions.length > 0)
result.transitions = transitions
return result
} | [
"function",
"dotcfg",
"(",
"fsm",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"var",
"config",
"=",
"dotcfg",
".",
"fetch",
"(",
"fsm",
")",
",",
"name",
"=",
"options",
".",
"name",
",",
"rankdir",
"=",
"dotcfg",
".",
"ran... | ------------------------------------------------------------------------------------------------- | [
"-------------------------------------------------------------------------------------------------"
] | 0d603577423244228cebcd62e60dbbfff27c6ea3 | https://github.com/jakesgordon/javascript-state-machine/blob/0d603577423244228cebcd62e60dbbfff27c6ea3/src/plugin/visualize.js#L15-L39 | train | Get the dotcfg object | [
30522,
3853,
11089,
2278,
2546,
2290,
1006,
1042,
6491,
1010,
7047,
1007,
1063,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
13075,
9530,
8873,
2290,
1027,
11089,
2278,
2546,
2290,
1012,
18584,
1006,
1042,
6491,
1007,
1010,
2171,
1027,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/panel/demoPanelProvider/script.js | PanelProviderConfig | function PanelProviderConfig($mdPanelProvider) {
$mdPanelProvider.definePreset('demoPreset', {
attachTo: angular.element(document.body),
controller: PanelMenuCtrl,
controllerAs: 'ctrl',
template: '' +
'<div class="menu-panel" md-whiteframe="4">' +
' <div class="menu-content">' +
' <div class="menu-item" ng-repeat="item in ctrl.items">' +
' <button class="md-button">' +
' <span>{{item}}</span>' +
' </button>' +
' </div>' +
' <md-divider></md-divider>' +
' <div class="menu-item">' +
' <button class="md-button" ng-click="ctrl.closeMenu()">' +
' <span>Close Menu</span>' +
' </button>' +
' </div>' +
' </div>' +
'</div>',
panelClass: 'menu-panel-container',
focusOnOpen: false,
zIndex: 100,
propagateContainerEvents: true,
groupName: 'menus'
});
} | javascript | function PanelProviderConfig($mdPanelProvider) {
$mdPanelProvider.definePreset('demoPreset', {
attachTo: angular.element(document.body),
controller: PanelMenuCtrl,
controllerAs: 'ctrl',
template: '' +
'<div class="menu-panel" md-whiteframe="4">' +
' <div class="menu-content">' +
' <div class="menu-item" ng-repeat="item in ctrl.items">' +
' <button class="md-button">' +
' <span>{{item}}</span>' +
' </button>' +
' </div>' +
' <md-divider></md-divider>' +
' <div class="menu-item">' +
' <button class="md-button" ng-click="ctrl.closeMenu()">' +
' <span>Close Menu</span>' +
' </button>' +
' </div>' +
' </div>' +
'</div>',
panelClass: 'menu-panel-container',
focusOnOpen: false,
zIndex: 100,
propagateContainerEvents: true,
groupName: 'menus'
});
} | [
"function",
"PanelProviderConfig",
"(",
"$mdPanelProvider",
")",
"{",
"$mdPanelProvider",
".",
"definePreset",
"(",
"'demoPreset'",
",",
"{",
"attachTo",
":",
"angular",
".",
"element",
"(",
"document",
".",
"body",
")",
",",
"controller",
":",
"PanelMenuCtrl",
... | Configuration method that is used to define a preset for the upcoming panel
element. Each parameter in the preset is an available parameter in the
`$mdPanel.create` and `$mdPanel.open` methods. When the parameters are
defined here, they overwrite the default parameters for any panel that the
preset is requested for.
@param {!MdPanelProvider} $mdPanelProvider Provider method of the MdPanel
API. | [
"Configuration",
"method",
"that",
"is",
"used",
"to",
"define",
"a",
"preset",
"for",
"the",
"upcoming",
"panel",
"element",
".",
"Each",
"parameter",
"in",
"the",
"preset",
"is",
"an",
"available",
"parameter",
"in",
"the",
"$mdPanel",
".",
"create",
"and"... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/panel/demoPanelProvider/script.js#L19-L46 | train | PanelProvider Config | [
30522,
3853,
5997,
21572,
17258,
2121,
8663,
8873,
2290,
1006,
1002,
9108,
9739,
2884,
21572,
17258,
2121,
1007,
1063,
1002,
9108,
9739,
2884,
21572,
17258,
2121,
30524,
3022,
1024,
1005,
14931,
12190,
1005,
1010,
23561,
1024,
1005,
1005,
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... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (name)
{
if (!name) { return null; }
var node = Strophe.xmlGenerator().createElement(name);
// FIXME: this should throw errors if args are the wrong type or
// there are more than two optional args
var a, i, k;
for (a = 1; a < arguments.length; a++) {
if (!arguments[a]) { continue; }
if (typeof(arguments[a]) == "string" ||
typeof(arguments[a]) == "number") {
node.appendChild(Strophe.xmlTextNode(arguments[a]));
} else if (typeof(arguments[a]) == "object" &&
typeof(arguments[a].sort) == "function") {
for (i = 0; i < arguments[a].length; i++) {
if (typeof(arguments[a][i]) == "object" &&
typeof(arguments[a][i].sort) == "function") {
node.setAttribute(arguments[a][i][0],
arguments[a][i][1]);
}
}
} else if (typeof(arguments[a]) == "object") {
for (k in arguments[a]) {
if (arguments[a].hasOwnProperty(k)) {
node.setAttribute(k, arguments[a][k]);
}
}
}
}
return node;
} | javascript | function (name)
{
if (!name) { return null; }
var node = Strophe.xmlGenerator().createElement(name);
// FIXME: this should throw errors if args are the wrong type or
// there are more than two optional args
var a, i, k;
for (a = 1; a < arguments.length; a++) {
if (!arguments[a]) { continue; }
if (typeof(arguments[a]) == "string" ||
typeof(arguments[a]) == "number") {
node.appendChild(Strophe.xmlTextNode(arguments[a]));
} else if (typeof(arguments[a]) == "object" &&
typeof(arguments[a].sort) == "function") {
for (i = 0; i < arguments[a].length; i++) {
if (typeof(arguments[a][i]) == "object" &&
typeof(arguments[a][i].sort) == "function") {
node.setAttribute(arguments[a][i][0],
arguments[a][i][1]);
}
}
} else if (typeof(arguments[a]) == "object") {
for (k in arguments[a]) {
if (arguments[a].hasOwnProperty(k)) {
node.setAttribute(k, arguments[a][k]);
}
}
}
}
return node;
} | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"!",
"name",
")",
"{",
"return",
"null",
";",
"}",
"var",
"node",
"=",
"Strophe",
".",
"xmlGenerator",
"(",
")",
".",
"createElement",
"(",
"name",
")",
";",
"// FIXME: this should throw errors if args are the wr... | Function: xmlElement
Create an XML DOM element.
This function creates an XML DOM element correctly across all
implementations. Note that these are not HTML DOM elements, which
aren't appropriate for XMPP stanzas.
Parameters:
(String) name - The name for the element.
(Array|Object) attrs - An optional array or object containing
key/value pairs to use as element attributes. The object should
be in the format {'key': 'value'} or {key: 'value'}. The array
should have the format [['key1', 'value1'], ['key2', 'value2']].
(String) text - The text child data for the element.
Returns:
A new XML DOM element. | [
"Function",
":",
"xmlElement",
"Create",
"an",
"XML",
"DOM",
"element",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L996-L1029 | train | Returns a node containing the node with the specified name | [
30522,
3853,
1006,
2171,
1007,
1063,
2065,
1006,
999,
2171,
1007,
1063,
2709,
19701,
1025,
1065,
13075,
13045,
1027,
2358,
18981,
5369,
1012,
20950,
6914,
6906,
4263,
1006,
1007,
1012,
3443,
12260,
3672,
1006,
2171,
1007,
1025,
1013,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/hasher.js | function(){
if(_isActive) return;
_hash = _getWindowHash();
//thought about branching/overloading hasher.init() to avoid checking multiple times but
//don't think worth doing it since it probably won't be called multiple times.
if(_isHashChangeSupported){
_addListener(window, 'hashchange', _checkHistory);
}else {
if(_isLegacyIE){
if(! _frame){
_createFrame();
}
_updateFrame();
}
_checkInterval = setInterval(_checkHistory, POOL_INTERVAL);
}
_isActive = true;
hasher.initialized.dispatch(_trimHash(_hash));
} | javascript | function(){
if(_isActive) return;
_hash = _getWindowHash();
//thought about branching/overloading hasher.init() to avoid checking multiple times but
//don't think worth doing it since it probably won't be called multiple times.
if(_isHashChangeSupported){
_addListener(window, 'hashchange', _checkHistory);
}else {
if(_isLegacyIE){
if(! _frame){
_createFrame();
}
_updateFrame();
}
_checkInterval = setInterval(_checkHistory, POOL_INTERVAL);
}
_isActive = true;
hasher.initialized.dispatch(_trimHash(_hash));
} | [
"function",
"(",
")",
"{",
"if",
"(",
"_isActive",
")",
"return",
";",
"_hash",
"=",
"_getWindowHash",
"(",
")",
";",
"//thought about branching/overloading hasher.init() to avoid checking multiple times but",
"//don't think worth doing it since it probably won't be called multiple... | Start listening/dispatching changes in the hash/history.
<ul>
<li>hasher won't dispatch CHANGE events by manually typing a new value or pressing the back/forward buttons before calling this method.</li>
</ul> | [
"Start",
"listening",
"/",
"dispatching",
"changes",
"in",
"the",
"hash",
"/",
"history",
".",
"<ul",
">",
"<li",
">",
"hasher",
"won",
"t",
"dispatch",
"CHANGE",
"events",
"by",
"manually",
"typing",
"a",
"new",
"value",
"or",
"pressing",
"the",
"back",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/hasher.js#L289-L310 | train | This function is called when the hash is changed | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
1035,
18061,
15277,
1007,
2709,
1025,
1035,
23325,
1027,
1035,
2131,
11101,
5004,
14949,
2232,
1006,
1007,
1025,
1013,
1013,
2245,
2055,
23346,
1013,
2058,
18570,
23325,
2121,
1012,
1999,
4183,
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... | |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | delay | function delay() {
return function delayImpl(time, complete) {
var cy = this._private.cy || this;
if (!cy.styleEnabled()) {
return this;
}
return this.animate({
delay: time,
duration: time,
complete: complete
});
};
} | javascript | function delay() {
return function delayImpl(time, complete) {
var cy = this._private.cy || this;
if (!cy.styleEnabled()) {
return this;
}
return this.animate({
delay: time,
duration: time,
complete: complete
});
};
} | [
"function",
"delay",
"(",
")",
"{",
"return",
"function",
"delayImpl",
"(",
"time",
",",
"complete",
")",
"{",
"var",
"cy",
"=",
"this",
".",
"_private",
".",
"cy",
"||",
"this",
";",
"if",
"(",
"!",
"cy",
".",
"styleEnabled",
"(",
")",
")",
"{",
... | clearQueue | [
"clearQueue"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L5768-L5782 | train | Returns a function that will delay the current task | [
30522,
3853,
8536,
1006,
1007,
1063,
2709,
3853,
8536,
5714,
24759,
1006,
2051,
1010,
3143,
1007,
1063,
13075,
22330,
1027,
2023,
1012,
1035,
2797,
1012,
22330,
1064,
1064,
2023,
1025,
2065,
1006,
999,
22330,
1012,
2806,
8189,
23242,
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... |
LLK/scratch-blocks | blocks_vertical/sound.js | function() {
this.jsonInit({
"message0": "%1",
"args0": [
{
"type": "field_dropdown",
"name": "SOUND_MENU",
"options": [
['1', '0'],
['2', '1'],
['3', '2'],
['4', '3'],
['5', '4'],
['6', '5'],
['7', '6'],
['8', '7'],
['9', '8'],
['10', '9'],
['call a function', function() {
window.alert('function called!');}
]
]
}
],
"colour": Blockly.Colours.sounds.secondary,
"colourSecondary": Blockly.Colours.sounds.secondary,
"colourTertiary": Blockly.Colours.sounds.tertiary,
"extensions": ["output_string"]
});
} | javascript | function() {
this.jsonInit({
"message0": "%1",
"args0": [
{
"type": "field_dropdown",
"name": "SOUND_MENU",
"options": [
['1', '0'],
['2', '1'],
['3', '2'],
['4', '3'],
['5', '4'],
['6', '5'],
['7', '6'],
['8', '7'],
['9', '8'],
['10', '9'],
['call a function', function() {
window.alert('function called!');}
]
]
}
],
"colour": Blockly.Colours.sounds.secondary,
"colourSecondary": Blockly.Colours.sounds.secondary,
"colourTertiary": Blockly.Colours.sounds.tertiary,
"extensions": ["output_string"]
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"jsonInit",
"(",
"{",
"\"message0\"",
":",
"\"%1\"",
",",
"\"args0\"",
":",
"[",
"{",
"\"type\"",
":",
"\"field_dropdown\"",
",",
"\"name\"",
":",
"\"SOUND_MENU\"",
",",
"\"options\"",
":",
"[",
"[",
"'1'",
",",
"'... | Sound effects drop-down menu.
@this Blockly.Block | [
"Sound",
"effects",
"drop",
"-",
"down",
"menu",
"."
] | 455b2a854435c0a67da1da92320ddc3ec3e2b799 | https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/sound.js#L35-L64 | train | Block for the cluster menu. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1046,
3385,
5498,
2102,
1006,
1063,
1000,
4471,
2692,
1000,
1024,
1000,
1003,
1015,
1000,
1010,
1000,
12098,
5620,
2692,
1000,
1024,
1031,
1063,
1000,
2828,
1000,
1024,
1000,
2492,
1035,
4530,
76... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/jszip.js | function(expectedSignature) {
var signature = this.reader.readString(4);
if (signature !== expectedSignature) {
throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")");
}
} | javascript | function(expectedSignature) {
var signature = this.reader.readString(4);
if (signature !== expectedSignature) {
throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")");
}
} | [
"function",
"(",
"expectedSignature",
")",
"{",
"var",
"signature",
"=",
"this",
".",
"reader",
".",
"readString",
"(",
"4",
")",
";",
"if",
"(",
"signature",
"!==",
"expectedSignature",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Corrupted zip or bug : unexpec... | Check that the reader is on the speficied signature.
@param {string} expectedSignature the expected signature.
@throws {Error} if it is an other signature. | [
"Check",
"that",
"the",
"reader",
"is",
"on",
"the",
"speficied",
"signature",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1713-L1718 | train | Check the signature of the archive | [
30522,
3853,
1006,
3517,
5332,
16989,
11244,
1007,
1063,
13075,
8085,
1027,
2023,
1012,
8068,
1012,
9631,
18886,
3070,
1006,
1018,
1007,
1025,
2065,
1006,
8085,
999,
1027,
1027,
3517,
5332,
16989,
11244,
1007,
1063,
5466,
2047,
7561,
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... | |
SAP/openui5 | src/sap.f/src/sap/f/cards/ActionEnablement.js | _setActionEnabledState | function _setActionEnabledState(oAction) {
var oBindingInfo;
if (typeof oAction.enabled === "string") {
oBindingInfo = ManagedObject.bindingParser(oAction.enabled);
oBindingInfo.formatter = function (vValue) {
if (vValue && (typeof vValue === "string")) {
return "Navigation";
} else {
return "Inactive";
}
};
}
if (oBindingInfo) {
this._oItemTemplate.bindProperty("type", oBindingInfo);
} else {
var bEnabled = oAction.enabled !== false ? true : false;
var sType = bEnabled ? "Navigation" : "Inactive";
this._oItemTemplate.setProperty("type", sType);
}
} | javascript | function _setActionEnabledState(oAction) {
var oBindingInfo;
if (typeof oAction.enabled === "string") {
oBindingInfo = ManagedObject.bindingParser(oAction.enabled);
oBindingInfo.formatter = function (vValue) {
if (vValue && (typeof vValue === "string")) {
return "Navigation";
} else {
return "Inactive";
}
};
}
if (oBindingInfo) {
this._oItemTemplate.bindProperty("type", oBindingInfo);
} else {
var bEnabled = oAction.enabled !== false ? true : false;
var sType = bEnabled ? "Navigation" : "Inactive";
this._oItemTemplate.setProperty("type", sType);
}
} | [
"function",
"_setActionEnabledState",
"(",
"oAction",
")",
"{",
"var",
"oBindingInfo",
";",
"if",
"(",
"typeof",
"oAction",
".",
"enabled",
"===",
"\"string\"",
")",
"{",
"oBindingInfo",
"=",
"ManagedObject",
".",
"bindingParser",
"(",
"oAction",
".",
"enabled",... | List and Table card specific | [
"List",
"and",
"Table",
"card",
"specific"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/cards/ActionEnablement.js#L127-L147 | train | Sets the enabled state of the action | [
30522,
3853,
1035,
2275,
18908,
3258,
8189,
23242,
9153,
2618,
1006,
1051,
18908,
3258,
1007,
1063,
13075,
27885,
22254,
2075,
2378,
14876,
1025,
2065,
1006,
2828,
11253,
1051,
18908,
3258,
1012,
9124,
1027,
1027,
1027,
1000,
5164,
1000,
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... |
SAP/openui5 | lib/jsdoc/ui5/template/publish.js | Version | function Version(versionStr) {
var match = rVersion.exec(versionStr) || [];
function norm(v) {
v = parseInt(v);
return isNaN(v) ? 0 : v;
}
Object.defineProperty(this, "major", {
enumerable: true,
value: norm(match[0])
});
Object.defineProperty(this, "minor", {
enumerable: true,
value: norm(match[1])
});
Object.defineProperty(this, "patch", {
enumerable: true,
value: norm(match[2])
});
Object.defineProperty(this, "suffix", {
enumerable: true,
value: String(match[3] || "")
});
} | javascript | function Version(versionStr) {
var match = rVersion.exec(versionStr) || [];
function norm(v) {
v = parseInt(v);
return isNaN(v) ? 0 : v;
}
Object.defineProperty(this, "major", {
enumerable: true,
value: norm(match[0])
});
Object.defineProperty(this, "minor", {
enumerable: true,
value: norm(match[1])
});
Object.defineProperty(this, "patch", {
enumerable: true,
value: norm(match[2])
});
Object.defineProperty(this, "suffix", {
enumerable: true,
value: String(match[3] || "")
});
} | [
"function",
"Version",
"(",
"versionStr",
")",
"{",
"var",
"match",
"=",
"rVersion",
".",
"exec",
"(",
"versionStr",
")",
"||",
"[",
"]",
";",
"function",
"norm",
"(",
"v",
")",
"{",
"v",
"=",
"parseInt",
"(",
"v",
")",
";",
"return",
"isNaN",
"(",... | Creates a Version object from the given version string.
@param {string} versionStr A dot-separated version string
@classdesc Represents a version consisting of major, minor, patch version and suffix,
e.g. '1.2.7-SNAPSHOT'. All parts after the major version are optional.
@class | [
"Creates",
"a",
"Version",
"object",
"from",
"the",
"given",
"version",
"string",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L211-L237 | train | Version constructor. | [
30522,
3853,
2544,
1006,
4617,
16344,
1007,
1063,
13075,
2674,
1027,
27634,
2545,
3258,
1012,
4654,
8586,
1006,
4617,
16344,
1007,
1064,
1064,
1031,
1033,
1025,
3853,
13373,
1006,
1058,
1007,
1063,
1058,
1027,
11968,
20240,
3372,
1006,
1058... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/zyngascroll.js | function(left, top, zoom, animate) {
var self = this;
// Remember whether we had an animation, then we try to continue based on the current "drive" of the animation
var wasAnimating = self.__isAnimating;
if (wasAnimating) {
core.effect.Animate.stop(wasAnimating);
self.__isAnimating = false;
}
if (animate && self.options.animating) {
// Keep scheduled positions for scrollBy/zoomBy functionality
self.__scheduledLeft = left;
self.__scheduledTop = top;
self.__scheduledZoom = zoom;
var oldLeft = self.__scrollLeft;
var oldTop = self.__scrollTop;
var oldZoom = self.__zoomLevel;
var diffLeft = left - oldLeft;
var diffTop = top - oldTop;
var diffZoom = zoom - oldZoom;
var step = function(percent, now, render) {
if (render) {
self.__scrollLeft = oldLeft + (diffLeft * percent);
self.__scrollTop = oldTop + (diffTop * percent);
self.__zoomLevel = oldZoom + (diffZoom * percent);
// Push values out
if (self.__callback) {
self.__callback(self.__scrollLeft, self.__scrollTop, self.__zoomLevel);
}
}
};
var verify = function(id) {
return self.__isAnimating === id;
};
var completed = function(renderedFramesPerSecond, animationId, wasFinished) {
if (animationId === self.__isAnimating) {
self.__isAnimating = false;
}
if (self.options.zooming) {
self.__computeScrollMax();
}
};
// When continuing based on previous animation we choose an ease-out animation instead of ease-in-out
self.__isAnimating = core.effect.Animate.start(step, verify, completed, 250, wasAnimating ? easeOutCubic : easeInOutCubic);
} else {
self.__scheduledLeft = self.__scrollLeft = left;
self.__scheduledTop = self.__scrollTop = top;
self.__scheduledZoom = self.__zoomLevel = zoom;
// Push values out
if (self.__callback) {
self.__callback(left, top, zoom);
}
// Fix max scroll ranges
if (self.options.zooming) {
self.__computeScrollMax();
}
}
} | javascript | function(left, top, zoom, animate) {
var self = this;
// Remember whether we had an animation, then we try to continue based on the current "drive" of the animation
var wasAnimating = self.__isAnimating;
if (wasAnimating) {
core.effect.Animate.stop(wasAnimating);
self.__isAnimating = false;
}
if (animate && self.options.animating) {
// Keep scheduled positions for scrollBy/zoomBy functionality
self.__scheduledLeft = left;
self.__scheduledTop = top;
self.__scheduledZoom = zoom;
var oldLeft = self.__scrollLeft;
var oldTop = self.__scrollTop;
var oldZoom = self.__zoomLevel;
var diffLeft = left - oldLeft;
var diffTop = top - oldTop;
var diffZoom = zoom - oldZoom;
var step = function(percent, now, render) {
if (render) {
self.__scrollLeft = oldLeft + (diffLeft * percent);
self.__scrollTop = oldTop + (diffTop * percent);
self.__zoomLevel = oldZoom + (diffZoom * percent);
// Push values out
if (self.__callback) {
self.__callback(self.__scrollLeft, self.__scrollTop, self.__zoomLevel);
}
}
};
var verify = function(id) {
return self.__isAnimating === id;
};
var completed = function(renderedFramesPerSecond, animationId, wasFinished) {
if (animationId === self.__isAnimating) {
self.__isAnimating = false;
}
if (self.options.zooming) {
self.__computeScrollMax();
}
};
// When continuing based on previous animation we choose an ease-out animation instead of ease-in-out
self.__isAnimating = core.effect.Animate.start(step, verify, completed, 250, wasAnimating ? easeOutCubic : easeInOutCubic);
} else {
self.__scheduledLeft = self.__scrollLeft = left;
self.__scheduledTop = self.__scrollTop = top;
self.__scheduledZoom = self.__zoomLevel = zoom;
// Push values out
if (self.__callback) {
self.__callback(left, top, zoom);
}
// Fix max scroll ranges
if (self.options.zooming) {
self.__computeScrollMax();
}
}
} | [
"function",
"(",
"left",
",",
"top",
",",
"zoom",
",",
"animate",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Remember whether we had an animation, then we try to continue based on the current \"drive\" of the animation",
"var",
"wasAnimating",
"=",
"self",
".",
"__isA... | /*
---------------------------------------------------------------------------
PRIVATE API
---------------------------------------------------------------------------
Applies the scroll position to the content element
@param {Number} left Left scroll position
@param {Number} top Top scroll position
@param {Boolean?false} animate Whether animation should be used to move to the new coordinates | [
"/",
"*",
"---------------------------------------------------------------------------",
"PRIVATE",
"API",
"---------------------------------------------------------------------------",
"Applies",
"the",
"scroll",
"position",
"to",
"the",
"content",
"element"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js#L1294-L1369 | train | Scrolls the page by the given position and zoom level. | [
30522,
3853,
1006,
2187,
1010,
2327,
1010,
24095,
1010,
2019,
21499,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
3342,
3251,
2057,
2018,
2019,
7284,
1010,
2059,
2057,
3046,
2000,
3613,
2241,
2006,
1996,
2783,
1000,
3298,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js | createColoredCanvas | function createColoredCanvas(color)
{
const canvas = document.createElement('canvas');
canvas.width = 6;
canvas.height = 1;
const context = canvas.getContext('2d');
context.fillStyle = color;
context.fillRect(0, 0, 6, 1);
return canvas;
} | javascript | function createColoredCanvas(color)
{
const canvas = document.createElement('canvas');
canvas.width = 6;
canvas.height = 1;
const context = canvas.getContext('2d');
context.fillStyle = color;
context.fillRect(0, 0, 6, 1);
return canvas;
} | [
"function",
"createColoredCanvas",
"(",
"color",
")",
"{",
"const",
"canvas",
"=",
"document",
".",
"createElement",
"(",
"'canvas'",
")",
";",
"canvas",
".",
"width",
"=",
"6",
";",
"canvas",
".",
"height",
"=",
"1",
";",
"const",
"context",
"=",
"canva... | Creates a little colored canvas
@ignore
@param {string} color - The color to make the canvas
@return {canvas} a small canvas element | [
"Creates",
"a",
"little",
"colored",
"canvas"
] | 99ae03b7565ae7ca5a6de633b0a277f7128fa4d0 | https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.js#L8-L21 | train | Creates a colored canvas | [
30522,
3853,
3443,
18717,
2098,
9336,
12044,
1006,
3609,
1007,
1063,
9530,
3367,
10683,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1005,
10683,
1005,
1007,
1025,
10683,
1012,
9381,
1027,
1020,
1025,
10683,
1012,
4578,
1027,
1015,
1025,
9530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.commons/src/sap/ui/commons/RoadMapRenderer.js | function(jStepArea, jStep){
var iPos = jStep.position().left;
if (sap.ui.getCore().getConfiguration().getRTL()) { //Recompute in RTL case
iPos = jStepArea.width() - iPos - jStep.outerWidth();
}
return iPos;
} | javascript | function(jStepArea, jStep){
var iPos = jStep.position().left;
if (sap.ui.getCore().getConfiguration().getRTL()) { //Recompute in RTL case
iPos = jStepArea.width() - iPos - jStep.outerWidth();
}
return iPos;
} | [
"function",
"(",
"jStepArea",
",",
"jStep",
")",
"{",
"var",
"iPos",
"=",
"jStep",
".",
"position",
"(",
")",
".",
"left",
";",
"if",
"(",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getConfiguration",
"(",
")",
".",
"getRTL",
"(",
")",
")"... | Returns the position left attribute of the given step within the scroll area | [
"Returns",
"the",
"position",
"left",
"attribute",
"of",
"the",
"given",
"step",
"within",
"the",
"scroll",
"area"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js#L831-L837 | train | Returns the left position of the step | [
30522,
3853,
1006,
1046,
13473,
19362,
5243,
1010,
1046,
13473,
2361,
1007,
1063,
13075,
12997,
2891,
1027,
1046,
13473,
2361,
1012,
2597,
1006,
1007,
1012,
2187,
1025,
2065,
1006,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
1012,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | function (mVariables, bReplace) {
var oContext,
bHasVariables = false,
sName,
oNewWithControl = new With();
if (!bReplace) {
oWithControl.setChild(oNewWithControl);
}
for (sName in mVariables) {
oContext = mVariables[sName];
bHasVariables = true;
oNewWithControl.setModel(oContext.getModel(), sName);
oNewWithControl.bindObject({
model : sName,
path : oContext.getPath()
});
}
return bHasVariables || bReplace
? createCallbackInterface(oNewWithControl)
: this;
} | javascript | function (mVariables, bReplace) {
var oContext,
bHasVariables = false,
sName,
oNewWithControl = new With();
if (!bReplace) {
oWithControl.setChild(oNewWithControl);
}
for (sName in mVariables) {
oContext = mVariables[sName];
bHasVariables = true;
oNewWithControl.setModel(oContext.getModel(), sName);
oNewWithControl.bindObject({
model : sName,
path : oContext.getPath()
});
}
return bHasVariables || bReplace
? createCallbackInterface(oNewWithControl)
: this;
} | [
"function",
"(",
"mVariables",
",",
"bReplace",
")",
"{",
"var",
"oContext",
",",
"bHasVariables",
"=",
"false",
",",
"sName",
",",
"oNewWithControl",
"=",
"new",
"With",
"(",
")",
";",
"if",
"(",
"!",
"bReplace",
")",
"{",
"oWithControl",
".",
"setChild... | Returns a callback interface instance for the given map of variables which
override currently known variables of the same name in <code>this</code>
parent interface or replace them altogether. Each variable name becomes a
named model with a corresponding object binding and can be used inside the
XML template in the usual way, that is, with a binding expression like
<code>"{var>some/relative/path}"</code> (see example).
<b>Example:</b> Suppose the XML pre-processor knows a variable named "old"
and a visitor defines a new variable relative to it as follows.
Then {@link sap.ui.core.util.XMLPreprocessor.ICallback.getResult getResult}
for a binding which refers to the new variable using a relative path
("{new>relative}") has the same result as for a binding to the old variable
with a compound path ("{old>prefix/relative}").
<pre>
oInterface.with({"new" : oInterface.getContext("old>prefix")})
.getResult("{new>relative}")
=== oInterface.getResult("{old>prefix/relative}"); // true
</pre>
BEWARE: Previous callback interface instances derived from the same parent
(<code>this</code>) become invalid (that is, they forget about inherited
variables) once a new instance is derived.
@param {object} [mVariables={}]
Map from variable name (string) to value ({@link sap.ui.model.Context})
@param {boolean} [bReplace=false]
Whether only the given variables are known in the new callback interface
instance, no inherited ones
@returns {sap.ui.core.util.XMLPreprocessor.ICallback}
A callback interface instance
@function
@public
@see sap.ui.core.util.XMLPreprocessor.ICallback.getResult
@since 1.39.0 | [
"Returns",
"a",
"callback",
"interface",
"instance",
"for",
"the",
"given",
"map",
"of",
"variables",
"which",
"override",
"currently",
"known",
"variables",
"of",
"the",
"same",
"name",
"in",
"<code",
">",
"this<",
"/",
"code",
">",
"parent",
"interface",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L898-L921 | train | Creates a new with control with the given variables. | [
30522,
3853,
1006,
19842,
10980,
13510,
1010,
7987,
13699,
19217,
1007,
1063,
13075,
1051,
8663,
18209,
1010,
1038,
14949,
10755,
19210,
2015,
1027,
6270,
1010,
1055,
18442,
1010,
2028,
2860,
24415,
8663,
13181,
2140,
1027,
2047,
2007,
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... | |
adobe/brackets | src/search/FindInFiles.js | function (child) {
// Replicate filtering that getAllFiles() does
if (ProjectManager.shouldShow(child)) {
if (child.isFile && _isReadableText(child.name)) {
// Re-check the filtering that the initial search applied
if (_inSearchScope(child)) {
addedFiles.push(child);
addedFilePaths.push(child.fullPath);
}
}
return true;
}
return false;
} | javascript | function (child) {
// Replicate filtering that getAllFiles() does
if (ProjectManager.shouldShow(child)) {
if (child.isFile && _isReadableText(child.name)) {
// Re-check the filtering that the initial search applied
if (_inSearchScope(child)) {
addedFiles.push(child);
addedFilePaths.push(child.fullPath);
}
}
return true;
}
return false;
} | [
"function",
"(",
"child",
")",
"{",
"// Replicate filtering that getAllFiles() does",
"if",
"(",
"ProjectManager",
".",
"shouldShow",
"(",
"child",
")",
")",
"{",
"if",
"(",
"child",
".",
"isFile",
"&&",
"_isReadableText",
"(",
"child",
".",
"name",
")",
")",
... | gather up added files | [
"gather",
"up",
"added",
"files"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindInFiles.js#L783-L796 | train | This function is called by the project manager to add a file to the list of added files | [
30522,
3853,
1006,
2775,
1007,
1063,
1013,
1013,
28024,
22910,
2008,
2131,
8095,
8873,
4244,
1006,
1007,
2515,
2065,
1006,
2622,
24805,
4590,
1012,
2323,
22231,
2860,
1006,
2775,
1007,
1007,
1063,
2065,
1006,
2775,
1012,
2003,
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... | |
NervJS/taro | packages/taro/src/internal/_common.js | getNative | function getNative(object, key) {
var value = getValue(object, key)
return baseIsNative(value) ? value : undefined
} | javascript | function getNative(object, key) {
var value = getValue(object, key)
return baseIsNative(value) ? value : undefined
} | [
"function",
"getNative",
"(",
"object",
",",
"key",
")",
"{",
"var",
"value",
"=",
"getValue",
"(",
"object",
",",
"key",
")",
"return",
"baseIsNative",
"(",
"value",
")",
"?",
"value",
":",
"undefined",
"}"
] | Gets the native function at `key` of `object`.
@private
@param {Object} object The object to query.
@param {string} key The key of the method to get.
@returns {*} Returns the function if it's native, else `undefined`. | [
"Gets",
"the",
"native",
"function",
"at",
"key",
"of",
"object",
"."
] | 274e76d731d7f158141287e31cbd51f092d472c5 | https://github.com/NervJS/taro/blob/274e76d731d7f158141287e31cbd51f092d472c5/packages/taro/src/internal/_common.js#L547-L550 | train | Returns the native value of the given key. | [
30522,
3853,
2131,
19833,
3512,
1006,
4874,
1010,
3145,
1007,
1063,
13075,
3643,
1027,
2131,
10175,
5657,
1006,
4874,
1010,
3145,
1007,
2709,
2918,
2483,
19833,
3512,
1006,
3643,
1007,
1029,
3643,
1024,
6151,
28344,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/examples/grapheditor/www/js/EditorUi.js | function(evt)
{
if (evt != null)
{
var source = mxEvent.getSource(evt);
if (source.nodeName == 'A')
{
while (source != null)
{
if (source.className == 'geHint')
{
return true;
}
source = source.parentNode;
}
}
}
return textEditing(evt);
} | javascript | function(evt)
{
if (evt != null)
{
var source = mxEvent.getSource(evt);
if (source.nodeName == 'A')
{
while (source != null)
{
if (source.className == 'geHint')
{
return true;
}
source = source.parentNode;
}
}
}
return textEditing(evt);
} | [
"function",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
"!=",
"null",
")",
"{",
"var",
"source",
"=",
"mxEvent",
".",
"getSource",
"(",
"evt",
")",
";",
"if",
"(",
"source",
".",
"nodeName",
"==",
"'A'",
")",
"{",
"while",
"(",
"source",
"!=",
"null"... | Allows context menu for links in hints | [
"Allows",
"context",
"menu",
"for",
"links",
"in",
"hints"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/examples/grapheditor/www/js/EditorUi.js#L96-L117 | train | Returns true if the event is a hint | [
30522,
3853,
1006,
23408,
2102,
1007,
1063,
2065,
1006,
23408,
2102,
999,
1027,
19701,
1007,
1063,
13075,
3120,
1027,
25630,
18697,
3372,
1012,
4152,
8162,
3401,
1006,
23408,
2102,
1007,
1025,
2065,
1006,
3120,
1012,
13045,
18442,
1027,
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... | |
parcel-bundler/parcel | packages/core/parcel-bundler/src/scope-hoisting/shake.js | treeShake | function treeShake(scope) {
// Keep passing over all bindings in the scope until we don't remove any.
// This handles cases where we remove one binding which had a reference to
// another one. That one will get removed in the next pass if it is now unreferenced.
let removed;
do {
removed = false;
// Recrawl to get all bindings.
scope.crawl();
Object.keys(scope.bindings).forEach(name => {
let binding = getUnusedBinding(scope.path, name);
// If it is not safe to remove the binding don't touch it.
if (!binding) {
return;
}
// Remove the binding and all references to it.
binding.path.remove();
binding.referencePaths.concat(binding.constantViolations).forEach(remove);
scope.removeBinding(name);
removed = true;
});
} while (removed);
} | javascript | function treeShake(scope) {
// Keep passing over all bindings in the scope until we don't remove any.
// This handles cases where we remove one binding which had a reference to
// another one. That one will get removed in the next pass if it is now unreferenced.
let removed;
do {
removed = false;
// Recrawl to get all bindings.
scope.crawl();
Object.keys(scope.bindings).forEach(name => {
let binding = getUnusedBinding(scope.path, name);
// If it is not safe to remove the binding don't touch it.
if (!binding) {
return;
}
// Remove the binding and all references to it.
binding.path.remove();
binding.referencePaths.concat(binding.constantViolations).forEach(remove);
scope.removeBinding(name);
removed = true;
});
} while (removed);
} | [
"function",
"treeShake",
"(",
"scope",
")",
"{",
"// Keep passing over all bindings in the scope until we don't remove any.",
"// This handles cases where we remove one binding which had a reference to",
"// another one. That one will get removed in the next pass if it is now unreferenced.",
"let"... | This is a small small implementation of dead code removal specialized to handle
removing unused exports. All other dead code removal happens in workers on each
individual file by babel-minify. | [
"This",
"is",
"a",
"small",
"small",
"implementation",
"of",
"dead",
"code",
"removal",
"specialized",
"to",
"handle",
"removing",
"unused",
"exports",
".",
"All",
"other",
"dead",
"code",
"removal",
"happens",
"in",
"workers",
"on",
"each",
"individual",
"fil... | 84b308511f87d4b69da62bcd352f0ff2f7bd4f1b | https://github.com/parcel-bundler/parcel/blob/84b308511f87d4b69da62bcd352f0ff2f7bd4f1b/packages/core/parcel-bundler/src/scope-hoisting/shake.js#L8-L34 | train | Recursively shake the scope. | [
30522,
3853,
3628,
20459,
2063,
1006,
9531,
1007,
1063,
1013,
1013,
2562,
4458,
2058,
2035,
8031,
2015,
1999,
1996,
9531,
2127,
2057,
2123,
1005,
1056,
6366,
2151,
1012,
1013,
1013,
2023,
16024,
3572,
2073,
2057,
6366,
2028,
8031,
2029,
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/JSUtils/ScopeManager.js | filterText | function filterText(text) {
var newText = text;
if (text.length > preferences.getMaxFileSize()) {
newText = "";
}
return newText;
} | javascript | function filterText(text) {
var newText = text;
if (text.length > preferences.getMaxFileSize()) {
newText = "";
}
return newText;
} | [
"function",
"filterText",
"(",
"text",
")",
"{",
"var",
"newText",
"=",
"text",
";",
"if",
"(",
"text",
".",
"length",
">",
"preferences",
".",
"getMaxFileSize",
"(",
")",
")",
"{",
"newText",
"=",
"\"\"",
";",
"}",
"return",
"newText",
";",
"}"
] | check to see if the text we are sending to Tern is too long.
@param {string} the text to check
@return {string} the text, or the empty text if the original was too long | [
"check",
"to",
"see",
"if",
"the",
"text",
"we",
"are",
"sending",
"to",
"Tern",
"is",
"too",
"long",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L360-L366 | train | Filter text to only contain the file size | [
30522,
3853,
11307,
18209,
1006,
3793,
1007,
1063,
13075,
25597,
10288,
2102,
1027,
3793,
1025,
2065,
1006,
3793,
1012,
3091,
1028,
18394,
1012,
2131,
17848,
8873,
4244,
4697,
1006,
1007,
1007,
1063,
30524,
1000,
1025,
1065,
2709,
25597,
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... |
SAP/openui5 | src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js | createUniversalUTCDate | function createUniversalUTCDate(oDate, sCalendarType) {
if (sCalendarType) {
return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType);
} else {
return new UniversalDate(createUTCDate(oDate).getTime());
}
} | javascript | function createUniversalUTCDate(oDate, sCalendarType) {
if (sCalendarType) {
return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType);
} else {
return new UniversalDate(createUTCDate(oDate).getTime());
}
} | [
"function",
"createUniversalUTCDate",
"(",
"oDate",
",",
"sCalendarType",
")",
"{",
"if",
"(",
"sCalendarType",
")",
"{",
"return",
"UniversalDate",
".",
"getInstance",
"(",
"createUTCDate",
"(",
"oDate",
")",
",",
"sCalendarType",
")",
";",
"}",
"else",
"{",
... | Creates an UniversalDate corresponding to the given date and calendar type.
@param {Date} oDate JavaScript date object to create the UniversalDate from. Local date information is used.
@param {sap.ui.core.CalendarType} sCalendarType The type to be used. If not specified, the calendar type from configuration will be used.
For more details on the Configuration, please check sap.ui.core.Configuration#getCalendarType
@returns {sap.ui.core.date.UniversalDate} The created date | [
"Creates",
"an",
"UniversalDate",
"corresponding",
"to",
"the",
"given",
"date",
"and",
"calendar",
"type",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js#L328-L334 | train | Creates an UniversalDate instance from the given date. | [
30522,
3853,
3443,
19496,
14028,
2389,
4904,
19797,
3686,
1006,
1051,
13701,
1010,
4094,
8943,
5339,
18863,
1007,
1063,
2065,
1006,
4094,
8943,
5339,
18863,
1007,
1063,
2709,
5415,
13701,
1012,
2131,
7076,
26897,
1006,
3443,
4904,
19797,
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... |
moleculerjs/moleculer | src/serializers/proto/packets.proto.js | PacketGossipRequest | function PacketGossipRequest(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function PacketGossipRequest(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"PacketGossipRequest",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
"... | Properties of a PacketGossipRequest.
@memberof packets
@interface IPacketGossipRequest
@property {string} ver PacketGossipRequest ver
@property {string} sender PacketGossipRequest sender
@property {string|null} [online] PacketGossipRequest online
@property {string|null} [offline] PacketGossipRequest offline
Constructs a new PacketGossipRequest.
@memberof packets
@classdesc Represents a PacketGossipRequest.
@implements IPacketGossipRequest
@constructor
@param {packets.IPacketGossipRequest=} [properties] Properties to set | [
"Properties",
"of",
"a",
"PacketGossipRequest",
"."
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/serializers/proto/packets.proto.js#L3178-L3183 | train | Properties of a PacketGossipRequest. | [
30522,
3853,
14771,
12333,
5332,
28139,
15500,
1006,
5144,
1007,
1063,
2065,
1006,
5144,
1007,
2005,
1006,
13075,
6309,
1027,
4874,
1012,
6309,
1006,
5144,
1007,
1010,
1045,
1027,
1014,
1025,
1045,
1026,
6309,
1012,
3091,
1025,
1009,
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... |
TryGhost/Ghost | core/server/web/shared/middlewares/serve-favicon.js | serveFavicon | function serveFavicon() {
let iconType;
let filePath;
return function serveFavicon(req, res, next) {
if (req.path.match(/^\/favicon\.(ico|png)/i)) {
// CASE: favicon is default
// confusing: if you upload an icon, it's same logic as storing images
// we store as /content/images, because this is the url path images get requested via the browser
// we are using an express route to skip /content/images and the result is a image path
// based on config.getContentPath('images') + req.path
// in this case we don't use path rewrite, that's why we have to make it manually
filePath = imageLib.blogIcon.getIconPath();
let originalExtension = path.extname(filePath).toLowerCase();
const requestedExtension = path.extname(req.path).toLowerCase();
// CASE: custom favicon exists, load it from local file storage
if (settingsCache.get('icon')) {
// depends on the uploaded icon extension
if (originalExtension !== requestedExtension) {
return res.redirect(302, urlService.utils.urlFor({relativeUrl: `/favicon${originalExtension}`}));
}
storage.getStorage()
.read({path: filePath})
.then((buf) => {
iconType = imageLib.blogIcon.getIconType();
content = buildContentResponse(iconType, buf);
res.writeHead(200, content.headers);
res.end(content.body);
})
.catch(next);
} else {
originalExtension = path.extname(filePath).toLowerCase();
// CASE: always redirect to .ico for default icon
if (originalExtension !== requestedExtension) {
return res.redirect(302, urlService.utils.urlFor({relativeUrl: '/favicon.ico'}));
}
fs.readFile(filePath, (err, buf) => {
if (err) {
return next(err);
}
content = buildContentResponse('x-icon', buf);
res.writeHead(200, content.headers);
res.end(content.body);
});
}
} else {
return next();
}
};
} | javascript | function serveFavicon() {
let iconType;
let filePath;
return function serveFavicon(req, res, next) {
if (req.path.match(/^\/favicon\.(ico|png)/i)) {
// CASE: favicon is default
// confusing: if you upload an icon, it's same logic as storing images
// we store as /content/images, because this is the url path images get requested via the browser
// we are using an express route to skip /content/images and the result is a image path
// based on config.getContentPath('images') + req.path
// in this case we don't use path rewrite, that's why we have to make it manually
filePath = imageLib.blogIcon.getIconPath();
let originalExtension = path.extname(filePath).toLowerCase();
const requestedExtension = path.extname(req.path).toLowerCase();
// CASE: custom favicon exists, load it from local file storage
if (settingsCache.get('icon')) {
// depends on the uploaded icon extension
if (originalExtension !== requestedExtension) {
return res.redirect(302, urlService.utils.urlFor({relativeUrl: `/favicon${originalExtension}`}));
}
storage.getStorage()
.read({path: filePath})
.then((buf) => {
iconType = imageLib.blogIcon.getIconType();
content = buildContentResponse(iconType, buf);
res.writeHead(200, content.headers);
res.end(content.body);
})
.catch(next);
} else {
originalExtension = path.extname(filePath).toLowerCase();
// CASE: always redirect to .ico for default icon
if (originalExtension !== requestedExtension) {
return res.redirect(302, urlService.utils.urlFor({relativeUrl: '/favicon.ico'}));
}
fs.readFile(filePath, (err, buf) => {
if (err) {
return next(err);
}
content = buildContentResponse('x-icon', buf);
res.writeHead(200, content.headers);
res.end(content.body);
});
}
} else {
return next();
}
};
} | [
"function",
"serveFavicon",
"(",
")",
"{",
"let",
"iconType",
";",
"let",
"filePath",
";",
"return",
"function",
"serveFavicon",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"if",
"(",
"req",
".",
"path",
".",
"match",
"(",
"/",
"^\\/favicon\\.(ico|png... | ### serveFavicon Middleware Handles requests to favicon.png and favicon.ico | [
"###",
"serveFavicon",
"Middleware",
"Handles",
"requests",
"to",
"favicon",
".",
"png",
"and",
"favicon",
".",
"ico"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/web/shared/middlewares/serve-favicon.js#L28-L85 | train | serveFavicon - serve the favicon | [
30522,
3853,
3710,
7011,
7903,
2239,
1006,
1007,
1063,
2292,
12696,
13874,
1025,
2292,
5371,
15069,
1025,
2709,
3853,
3710,
7011,
7903,
2239,
1006,
2128,
4160,
1010,
24501,
1010,
2279,
1007,
1063,
2065,
1006,
2128,
4160,
1012,
4130,
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.f/src/sap/f/shellBar/Accessibility.js | function (oContext) {
if (oContext) {
oControl = oContext;
oControl.addDelegate(this._controlDelegate, false, this);
}
this.oRb = Core.getLibraryResourceBundle("sap.f");
} | javascript | function (oContext) {
if (oContext) {
oControl = oContext;
oControl.addDelegate(this._controlDelegate, false, this);
}
this.oRb = Core.getLibraryResourceBundle("sap.f");
} | [
"function",
"(",
"oContext",
")",
"{",
"if",
"(",
"oContext",
")",
"{",
"oControl",
"=",
"oContext",
";",
"oControl",
".",
"addDelegate",
"(",
"this",
".",
"_controlDelegate",
",",
"false",
",",
"this",
")",
";",
"}",
"this",
".",
"oRb",
"=",
"Core",
... | This class is used to maintain all the accessibility roles, tooltips, etc., needed for the ShellBar control life cycle.
@alias sap/f/shellBar/Accessibility
@since 1.64
@private | [
"This",
"class",
"is",
"used",
"to",
"maintain",
"all",
"the",
"accessibility",
"roles",
"tooltips",
"etc",
".",
"needed",
"for",
"the",
"ShellBar",
"control",
"life",
"cycle",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/shellBar/Accessibility.js#L19-L26 | train | Sets the control context | [
30522,
3853,
1006,
1051,
8663,
18209,
1007,
1063,
2065,
1006,
1051,
8663,
18209,
1007,
1063,
1051,
8663,
13181,
2140,
1027,
1051,
8663,
18209,
1025,
1051,
8663,
13181,
2140,
1012,
5587,
9247,
29107,
2618,
1006,
2023,
1012,
1035,
2491,
9247,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
aws/aws-sdk-js | lib/s3/managed_upload.js | function() {
var self = this;
//abort putObject request
if (self.isDoneChunking === true && self.totalPartNumbers === 1 && self.singlePart) {
self.singlePart.abort();
} else {
self.cleanup(AWS.util.error(new Error('Request aborted by user'), {
code: 'RequestAbortedError', retryable: false
}));
}
} | javascript | function() {
var self = this;
//abort putObject request
if (self.isDoneChunking === true && self.totalPartNumbers === 1 && self.singlePart) {
self.singlePart.abort();
} else {
self.cleanup(AWS.util.error(new Error('Request aborted by user'), {
code: 'RequestAbortedError', retryable: false
}));
}
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"//abort putObject request",
"if",
"(",
"self",
".",
"isDoneChunking",
"===",
"true",
"&&",
"self",
".",
"totalPartNumbers",
"===",
"1",
"&&",
"self",
".",
"singlePart",
")",
"{",
"self",
".",
"... | @!method promise()
Returns a 'thenable' promise.
Two callbacks can be provided to the `then` method on the returned promise.
The first callback will be called if the promise is fulfilled, and the second
callback will be called if the promise is rejected.
@callback fulfilledCallback function(data)
Called if the promise is fulfilled.
@param data [map] The response data from the successful upload:
`Location` (String) the URL of the uploaded object
`ETag` (String) the ETag of the uploaded object
`Bucket` (String) the bucket to which the object was uploaded
`Key` (String) the key to which the object was uploaded
@callback rejectedCallback function(err)
Called if the promise is rejected.
@param err [Error] an error or null if no error occurred.
@return [Promise] A promise that represents the state of the upload request.
@example Sending an upload request using promises.
var upload = s3.upload({Bucket: 'bucket', Key: 'key', Body: stream});
var promise = upload.promise();
promise.then(function(data) { ... }, function(err) { ... });
Aborts a managed upload, including all concurrent upload requests.
@note By default, calling this function will cleanup a multipart upload
if one was created. To leave the multipart upload around after aborting
a request, configure `leavePartsOnError` to `true` in the {constructor}.
@note Calling {abort} in the browser environment will not abort any requests
that are already in flight. If a multipart upload was created, any parts
not yet uploaded will not be sent, and the multipart upload will be cleaned up.
@example Aborting an upload
var params = {
Bucket: 'bucket', Key: 'key',
Body: new Buffer(1024 * 1024 * 25) // 25MB payload
};
var upload = s3.upload(params);
upload.send(function (err, data) {
if (err) console.log("Error:", err.code, err.message);
else console.log(data);
});
// abort request in 1 second
setTimeout(upload.abort.bind(upload), 1000); | [
"@!method",
"promise",
"()",
"Returns",
"a",
"thenable",
"promise",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/s3/managed_upload.js#L248-L258 | train | Aborts the request if the request is aborted by the user | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
11113,
11589,
2404,
16429,
20614,
5227,
2065,
1006,
2969,
1012,
2003,
5280,
15937,
16814,
2075,
1027,
1027,
1027,
2995,
1004,
1004,
2969,
1012,
2561,
19362,
2102,
191... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | byGroup | function byGroup() {
var nodes = this.spawn();
var edges = this.spawn();
for (var i = 0; i < this.length; i++) {
var ele = this[i];
if (ele.isNode()) {
nodes.merge(ele);
} else {
edges.merge(ele);
}
}
return {
nodes: nodes,
edges: edges
};
} | javascript | function byGroup() {
var nodes = this.spawn();
var edges = this.spawn();
for (var i = 0; i < this.length; i++) {
var ele = this[i];
if (ele.isNode()) {
nodes.merge(ele);
} else {
edges.merge(ele);
}
}
return {
nodes: nodes,
edges: edges
};
} | [
"function",
"byGroup",
"(",
")",
"{",
"var",
"nodes",
"=",
"this",
".",
"spawn",
"(",
")",
";",
"var",
"edges",
"=",
"this",
".",
"spawn",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"length",
";",
"i",
"++",
... | internal helper to get nodes and edges as separate collections with single iteration over elements | [
"internal",
"helper",
"to",
"get",
"nodes",
"and",
"edges",
"as",
"separate",
"collections",
"with",
"single",
"iteration",
"over",
"elements"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L10039-L10057 | train | by group returns a new node or edge set | [
30522,
3853,
2011,
17058,
1006,
1007,
1063,
13075,
14164,
1027,
2023,
1012,
25645,
1006,
1007,
1025,
13075,
7926,
1027,
2023,
1012,
25645,
1006,
1007,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
2023,
1012,
3091,
1025,
1045... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/config/config-file.js | loadPackageJSONConfigFile | function loadPackageJSONConfigFile(filePath) {
debug(`Loading package.json config file: ${filePath}`);
try {
return loadJSONConfigFile(filePath).eslintConfig || null;
} catch (e) {
debug(`Error reading package.json file: ${filePath}`);
e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`;
throw e;
}
} | javascript | function loadPackageJSONConfigFile(filePath) {
debug(`Loading package.json config file: ${filePath}`);
try {
return loadJSONConfigFile(filePath).eslintConfig || null;
} catch (e) {
debug(`Error reading package.json file: ${filePath}`);
e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`;
throw e;
}
} | [
"function",
"loadPackageJSONConfigFile",
"(",
"filePath",
")",
"{",
"debug",
"(",
"`",
"${",
"filePath",
"}",
"`",
")",
";",
"try",
"{",
"return",
"loadJSONConfigFile",
"(",
"filePath",
")",
".",
"eslintConfig",
"||",
"null",
";",
"}",
"catch",
"(",
"e",
... | Loads a configuration from a package.json file.
@param {string} filePath The filename to load.
@returns {Object} The configuration object from the file.
@throws {Error} If the file cannot be read.
@private | [
"Loads",
"a",
"configuration",
"from",
"a",
"package",
".",
"json",
"file",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-file.js#L172-L181 | train | Loads a package. json config file. | [
30522,
3853,
7170,
23947,
4270,
22578,
2239,
8663,
8873,
25708,
9463,
1006,
5371,
15069,
1007,
1063,
2139,
8569,
2290,
1006,
1036,
10578,
7427,
1012,
1046,
3385,
9530,
8873,
2290,
5371,
1024,
1002,
1063,
5371,
15069,
1065,
1036,
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/search/QuickOpenHelper.js | itemFocus | function itemFocus(selectedItem, query, explicit) {
if (!selectedItem || (query.length < 2 && !explicit)) {
return;
}
var fileLocation = selectedItem.fileLocation;
var from = {line: fileLocation.line, ch: fileLocation.chFrom};
var to = {line: fileLocation.line, ch: fileLocation.chTo};
EditorManager.getCurrentFullEditor().setSelection(from, to, true);
} | javascript | function itemFocus(selectedItem, query, explicit) {
if (!selectedItem || (query.length < 2 && !explicit)) {
return;
}
var fileLocation = selectedItem.fileLocation;
var from = {line: fileLocation.line, ch: fileLocation.chFrom};
var to = {line: fileLocation.line, ch: fileLocation.chTo};
EditorManager.getCurrentFullEditor().setSelection(from, to, true);
} | [
"function",
"itemFocus",
"(",
"selectedItem",
",",
"query",
",",
"explicit",
")",
"{",
"if",
"(",
"!",
"selectedItem",
"||",
"(",
"query",
".",
"length",
"<",
"2",
"&&",
"!",
"explicit",
")",
")",
"{",
"return",
";",
"}",
"var",
"fileLocation",
"=",
... | Scroll to the selected item in the current document (unless no query string entered yet,
in which case the topmost list item is irrelevant)
@param {?SearchResult} selectedItem
@param {string} query
@param {boolean} explicit False if this is only highlighted due to being at top of list after search() | [
"Scroll",
"to",
"the",
"selected",
"item",
"in",
"the",
"current",
"document",
"(",
"unless",
"no",
"query",
"string",
"entered",
"yet",
"in",
"which",
"case",
"the",
"topmost",
"list",
"item",
"is",
"irrelevant",
")"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/QuickOpenHelper.js#L47-L56 | train | Focus the current item | [
30522,
3853,
8875,
14876,
7874,
1006,
3479,
4221,
2213,
1010,
23032,
1010,
13216,
1007,
1063,
2065,
1006,
999,
3479,
4221,
2213,
1064,
1064,
1006,
23032,
1012,
3091,
1026,
1016,
1004,
1004,
999,
13216,
1007,
1007,
1063,
2709,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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, scope, options) {
var promise;
options = options || {};
if (this._scopes[id]) {
throw new Error("Attempt to redefine preferences scope: " + id);
}
// Check to see if scope is a Storage that needs to be wrapped
if (!scope.get) {
scope = new Scope(scope);
}
promise = scope.load();
this._addToScopeOrder(id, scope, promise, options.before);
promise
.fail(function (err) {
// With preferences, it is valid for there to be no file.
// It is not valid to have an unparseable file.
if (err instanceof ParsingError) {
console.error(err);
}
});
return promise;
} | javascript | function (id, scope, options) {
var promise;
options = options || {};
if (this._scopes[id]) {
throw new Error("Attempt to redefine preferences scope: " + id);
}
// Check to see if scope is a Storage that needs to be wrapped
if (!scope.get) {
scope = new Scope(scope);
}
promise = scope.load();
this._addToScopeOrder(id, scope, promise, options.before);
promise
.fail(function (err) {
// With preferences, it is valid for there to be no file.
// It is not valid to have an unparseable file.
if (err instanceof ParsingError) {
console.error(err);
}
});
return promise;
} | [
"function",
"(",
"id",
",",
"scope",
",",
"options",
")",
"{",
"var",
"promise",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"this",
".",
"_scopes",
"[",
"id",
"]",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Attempt to redefine pr... | Adds a new Scope. New Scopes are added at the highest precedence, unless the "before" option
is given. The new Scope is automatically loaded.
@param {string} id Name of the Scope
@param {Scope|Storage} scope the Scope object itself. Optionally, can be given a Storage directly for convenience.
@param {{before: string}} options optional behavior when adding (e.g. setting which scope this comes before)
@return {Promise} Promise that is resolved when the Scope is loaded. It is resolved
with id and scope. | [
"Adds",
"a",
"new",
"Scope",
".",
"New",
"Scopes",
"are",
"added",
"at",
"the",
"highest",
"precedence",
"unless",
"the",
"before",
"option",
"is",
"given",
".",
"The",
"new",
"Scope",
"is",
"automatically",
"loaded",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1582-L1609 | train | Redefine preferences scope | [
30522,
3853,
1006,
8909,
1010,
9531,
1010,
7047,
1007,
1063,
13075,
4872,
1025,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
1025,
2065,
1006,
2023,
1012,
1035,
9531,
2015,
1031,
8909,
1033,
1007,
1063,
5466,
2047,
7561,
1006,
1000,
3535,
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... | |
angular/material | src/components/datepicker/js/calendar.js | calendarDirective | function calendarDirective() {
return {
template: function(tElement, tAttr) {
// TODO(crisbeto): This is a workaround that allows the calendar to work, without
// a datepicker, until issue #8585 gets resolved. It can safely be removed
// afterwards. This ensures that the virtual repeater scrolls to the proper place on load by
// deferring the execution until the next digest. It's necessary only if the calendar is used
// without a datepicker, otherwise it's already wrapped in an ngIf.
var extraAttrs = tAttr.hasOwnProperty('ngIf') ? '' : 'ng-if="calendarCtrl.isInitialized"';
var template = '' +
'<div ng-switch="calendarCtrl.currentView" ' + extraAttrs + '>' +
'<md-calendar-year ng-switch-when="year"></md-calendar-year>' +
'<md-calendar-month ng-switch-default></md-calendar-month>' +
'</div>';
return template;
},
scope: {
minDate: '=mdMinDate',
maxDate: '=mdMaxDate',
dateFilter: '=mdDateFilter',
// These need to be prefixed, because Angular resets
// any changes to the value due to bindToController.
_mode: '@mdMode',
_currentView: '@mdCurrentView'
},
require: ['ngModel', 'mdCalendar'],
controller: CalendarCtrl,
controllerAs: 'calendarCtrl',
bindToController: true,
link: function(scope, element, attrs, controllers) {
var ngModelCtrl = controllers[0];
var mdCalendarCtrl = controllers[1];
mdCalendarCtrl.configureNgModel(ngModelCtrl);
}
};
} | javascript | function calendarDirective() {
return {
template: function(tElement, tAttr) {
// TODO(crisbeto): This is a workaround that allows the calendar to work, without
// a datepicker, until issue #8585 gets resolved. It can safely be removed
// afterwards. This ensures that the virtual repeater scrolls to the proper place on load by
// deferring the execution until the next digest. It's necessary only if the calendar is used
// without a datepicker, otherwise it's already wrapped in an ngIf.
var extraAttrs = tAttr.hasOwnProperty('ngIf') ? '' : 'ng-if="calendarCtrl.isInitialized"';
var template = '' +
'<div ng-switch="calendarCtrl.currentView" ' + extraAttrs + '>' +
'<md-calendar-year ng-switch-when="year"></md-calendar-year>' +
'<md-calendar-month ng-switch-default></md-calendar-month>' +
'</div>';
return template;
},
scope: {
minDate: '=mdMinDate',
maxDate: '=mdMaxDate',
dateFilter: '=mdDateFilter',
// These need to be prefixed, because Angular resets
// any changes to the value due to bindToController.
_mode: '@mdMode',
_currentView: '@mdCurrentView'
},
require: ['ngModel', 'mdCalendar'],
controller: CalendarCtrl,
controllerAs: 'calendarCtrl',
bindToController: true,
link: function(scope, element, attrs, controllers) {
var ngModelCtrl = controllers[0];
var mdCalendarCtrl = controllers[1];
mdCalendarCtrl.configureNgModel(ngModelCtrl);
}
};
} | [
"function",
"calendarDirective",
"(",
")",
"{",
"return",
"{",
"template",
":",
"function",
"(",
"tElement",
",",
"tAttr",
")",
"{",
"// TODO(crisbeto): This is a workaround that allows the calendar to work, without",
"// a datepicker, until issue #8585 gets resolved. It can safely... | POST RELEASE TODO(jelbourn): Mac Cmd + left / right == Home / End TODO(jelbourn): Refactor month element creation to use cloneNode (performance). TODO(jelbourn): Define virtual scrolling constants (compactness) users can override. TODO(jelbourn): Animated month transition on ng-model change (virtual-repeat) TODO(jelbourn): Scroll snapping (virtual repeat) TODO(jelbourn): Remove superfluous row from short months (virtual-repeat) TODO(jelbourn): Month headers stick to top when scrolling. TODO(jelbourn): Previous month opacity is lowered when partially scrolled out of view. TODO(jelbourn): Support md-calendar standalone on a page (as a tabstop w/ aria-live announcement and key handling). Read-only calendar (not just date-picker). | [
"POST",
"RELEASE",
"TODO",
"(",
"jelbourn",
")",
":",
"Mac",
"Cmd",
"+",
"left",
"/",
"right",
"==",
"Home",
"/",
"End",
"TODO",
"(",
"jelbourn",
")",
":",
"Refactor",
"month",
"element",
"creation",
"to",
"use",
"cloneNode",
"(",
"performance",
")",
"... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.js#L46-L83 | train | A directive that renders the calendar. | [
30522,
3853,
8094,
4305,
2890,
15277,
1006,
1007,
1063,
2709,
1063,
23561,
1024,
3853,
1006,
10093,
13665,
1010,
11937,
4779,
2099,
1007,
1063,
1013,
1013,
28681,
2080,
1006,
13675,
2483,
20915,
2080,
1007,
1024,
2023,
2003,
1037,
2147,
244... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/toast/toast.js | MdToastProvider | function MdToastProvider($$interimElementProvider) {
// Differentiate promise resolves: hide timeout (value == true) and hide action clicks
// (value == ok).
var ACTION_RESOLVE = 'ok';
var activeToastContent;
var $mdToast = $$interimElementProvider('$mdToast')
.setDefaults({
methods: ['position', 'hideDelay', 'capsule', 'parent', 'position', 'toastClass'],
options: toastDefaultOptions
})
.addPreset('simple', {
argOption: 'textContent',
methods: ['textContent', 'content', 'action', 'actionKey', 'actionHint', 'highlightAction',
'highlightClass', 'theme', 'parent', 'dismissHint'],
options: /* @ngInject */ function($mdToast, $mdTheming) {
return {
template:
'<md-toast md-theme="{{ toast.theme }}" ng-class="{\'md-capsule\': toast.capsule}">' +
' <div class="md-toast-content" aria-live="polite" aria-relevant="all">' +
' <span class="md-toast-text">' +
' {{ toast.content }}' +
' </span>' +
' <span class="md-visually-hidden">{{ toast.dismissHint }}</span>' +
' <span class="md-visually-hidden" ng-if="toast.action && toast.actionKey">' +
' {{ toast.actionHint }}' +
' </span>' +
' <md-button class="md-action" ng-if="toast.action" ng-click="toast.resolve()" ' +
' ng-class="highlightClasses">' +
' {{ toast.action }}' +
' </md-button>' +
' </div>' +
'</md-toast>',
controller: MdToastController,
theme: $mdTheming.defaultTheme(),
controllerAs: 'toast',
bindToController: true
};
}
})
.addMethod('updateTextContent', updateTextContent)
// updateContent is deprecated. Use updateTextContent instead.
// TODO remove this in 1.2.
.addMethod('updateContent', updateTextContent);
function updateTextContent(newContent) {
activeToastContent = newContent;
}
return $mdToast;
/**
* Controller for the Toast interim elements.
* @ngInject
*/
function MdToastController($mdToast, $scope, $log) {
// For compatibility with AngularJS 1.6+, we should always use the $onInit hook in
// interimElements. The $mdCompiler simulates the $onInit hook for all versions.
this.$onInit = function() {
var self = this;
if (self.highlightAction) {
$scope.highlightClasses = [
'md-highlight',
self.highlightClass
];
}
// If an action is defined and no actionKey is specified, then log a warning.
if (self.action && !self.actionKey) {
$log.warn('Toasts with actions should define an actionKey for accessibility.',
'Details: https://material.angularjs.org/latest/api/service/$mdToast#mdtoast-simple');
}
if (self.actionKey && !self.actionHint) {
self.actionHint = 'Press Control-"' + self.actionKey + '" to ';
}
if (!self.dismissHint) {
self.dismissHint = 'Press Escape to dismiss.';
}
$scope.$watch(function() { return activeToastContent; }, function() {
self.content = activeToastContent;
});
this.resolve = function() {
$mdToast.hide(ACTION_RESOLVE);
};
};
}
/* @ngInject */
function toastDefaultOptions($animate, $mdToast, $mdUtil, $mdMedia, $document) {
var SWIPE_EVENTS = '$md.swipeleft $md.swiperight $md.swipeup $md.swipedown';
return {
onShow: onShow,
onRemove: onRemove,
toastClass: '',
position: 'bottom left',
themable: true,
hideDelay: 3000,
autoWrap: true,
transformTemplate: function(template, options) {
var shouldAddWrapper = options.autoWrap && template && !/md-toast-content/g.test(template);
if (shouldAddWrapper) {
// Root element of template will be <md-toast>. We need to wrap all of its content inside
// of <div class="md-toast-content">. All templates provided here should be static,
// developer-controlled content (meaning we're not attempting to guard against XSS).
var templateRoot = document.createElement('md-template');
templateRoot.innerHTML = template;
// Iterate through all root children, to detect possible md-toast directives.
for (var i = 0; i < templateRoot.children.length; i++) {
if (templateRoot.children[i].nodeName === 'MD-TOAST') {
var wrapper = angular.element('<div class="md-toast-content">');
// Wrap the children of the `md-toast` directive in jqLite, to be able to append
// multiple nodes with the same execution.
wrapper.append(angular.element(templateRoot.children[i].childNodes));
// Append the new wrapped element to the `md-toast` directive.
templateRoot.children[i].appendChild(wrapper[0]);
}
}
// We have to return the innerHTMl, because we do not want to have the `md-template`
// element to be the root element of our interimElement.
return templateRoot.innerHTML;
}
return template || '';
}
};
function onShow(scope, element, options) {
// support deprecated #content method
// TODO remove support for content in 1.2.
activeToastContent = options.textContent || options.content;
var isSmScreen = !$mdMedia('gt-sm');
element = $mdUtil.extractElementByName(element, 'md-toast', true);
options.element = element;
options.onSwipe = function(ev, gesture) {
// Add the relevant swipe class to the element so it can animate correctly
var swipe = ev.type.replace('$md.','');
var direction = swipe.replace('swipe', '');
// If the swipe direction is down/up but the toast came from top/bottom don't fade away
// Unless the screen is small, then the toast always on bottom
if ((direction === 'down' && options.position.indexOf('top') !== -1 && !isSmScreen) ||
(direction === 'up' && (options.position.indexOf('bottom') !== -1 || isSmScreen))) {
return;
}
if ((direction === 'left' || direction === 'right') && isSmScreen) {
return;
}
element.addClass('md-' + swipe);
$mdUtil.nextTick($mdToast.cancel);
};
options.openClass = toastOpenClass(options.position);
element.addClass(options.toastClass);
// 'top left' -> 'md-top md-left'
options.parent.addClass(options.openClass);
// static is the default position
if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {
options.parent.css('position', 'relative');
}
setupActionKeyListener(scope.toast && scope.toast.actionKey ?
scope.toast.actionKey : undefined);
element.on(SWIPE_EVENTS, options.onSwipe);
element.addClass(isSmScreen ? 'md-bottom' : options.position.split(' ').map(function(pos) {
return 'md-' + pos;
}).join(' '));
if (options.parent) {
options.parent.addClass('md-toast-animating');
}
return $animate.enter(element, options.parent).then(function() {
if (options.parent) {
options.parent.removeClass('md-toast-animating');
}
});
}
function onRemove(scope, element, options) {
if (scope.toast && scope.toast.actionKey) {
removeActionKeyListener();
}
element.off(SWIPE_EVENTS, options.onSwipe);
if (options.parent) options.parent.addClass('md-toast-animating');
if (options.openClass) options.parent.removeClass(options.openClass);
return ((options.$destroy === true) ? element.remove() : $animate.leave(element))
.then(function () {
if (options.parent) options.parent.removeClass('md-toast-animating');
if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {
options.parent.css('position', '');
}
});
}
function toastOpenClass(position) {
// For mobile, always open full-width on bottom
if (!$mdMedia('gt-xs')) {
return 'md-toast-open-bottom';
}
return 'md-toast-open-' + (position.indexOf('top') > -1 ? 'top' : 'bottom');
}
function setupActionKeyListener(actionKey) {
/**
* @param {KeyboardEvent} event
*/
var handleKeyDown = function(event) {
if (event.key === 'Escape') {
$mdToast.hide(false);
}
if (actionKey && event.key === actionKey && event.ctrlKey) {
$mdToast.hide(ACTION_RESOLVE);
}
};
$document.on('keydown', handleKeyDown);
}
function removeActionKeyListener() {
$document.off('keydown');
}
}
} | javascript | function MdToastProvider($$interimElementProvider) {
// Differentiate promise resolves: hide timeout (value == true) and hide action clicks
// (value == ok).
var ACTION_RESOLVE = 'ok';
var activeToastContent;
var $mdToast = $$interimElementProvider('$mdToast')
.setDefaults({
methods: ['position', 'hideDelay', 'capsule', 'parent', 'position', 'toastClass'],
options: toastDefaultOptions
})
.addPreset('simple', {
argOption: 'textContent',
methods: ['textContent', 'content', 'action', 'actionKey', 'actionHint', 'highlightAction',
'highlightClass', 'theme', 'parent', 'dismissHint'],
options: /* @ngInject */ function($mdToast, $mdTheming) {
return {
template:
'<md-toast md-theme="{{ toast.theme }}" ng-class="{\'md-capsule\': toast.capsule}">' +
' <div class="md-toast-content" aria-live="polite" aria-relevant="all">' +
' <span class="md-toast-text">' +
' {{ toast.content }}' +
' </span>' +
' <span class="md-visually-hidden">{{ toast.dismissHint }}</span>' +
' <span class="md-visually-hidden" ng-if="toast.action && toast.actionKey">' +
' {{ toast.actionHint }}' +
' </span>' +
' <md-button class="md-action" ng-if="toast.action" ng-click="toast.resolve()" ' +
' ng-class="highlightClasses">' +
' {{ toast.action }}' +
' </md-button>' +
' </div>' +
'</md-toast>',
controller: MdToastController,
theme: $mdTheming.defaultTheme(),
controllerAs: 'toast',
bindToController: true
};
}
})
.addMethod('updateTextContent', updateTextContent)
// updateContent is deprecated. Use updateTextContent instead.
// TODO remove this in 1.2.
.addMethod('updateContent', updateTextContent);
function updateTextContent(newContent) {
activeToastContent = newContent;
}
return $mdToast;
/**
* Controller for the Toast interim elements.
* @ngInject
*/
function MdToastController($mdToast, $scope, $log) {
// For compatibility with AngularJS 1.6+, we should always use the $onInit hook in
// interimElements. The $mdCompiler simulates the $onInit hook for all versions.
this.$onInit = function() {
var self = this;
if (self.highlightAction) {
$scope.highlightClasses = [
'md-highlight',
self.highlightClass
];
}
// If an action is defined and no actionKey is specified, then log a warning.
if (self.action && !self.actionKey) {
$log.warn('Toasts with actions should define an actionKey for accessibility.',
'Details: https://material.angularjs.org/latest/api/service/$mdToast#mdtoast-simple');
}
if (self.actionKey && !self.actionHint) {
self.actionHint = 'Press Control-"' + self.actionKey + '" to ';
}
if (!self.dismissHint) {
self.dismissHint = 'Press Escape to dismiss.';
}
$scope.$watch(function() { return activeToastContent; }, function() {
self.content = activeToastContent;
});
this.resolve = function() {
$mdToast.hide(ACTION_RESOLVE);
};
};
}
/* @ngInject */
function toastDefaultOptions($animate, $mdToast, $mdUtil, $mdMedia, $document) {
var SWIPE_EVENTS = '$md.swipeleft $md.swiperight $md.swipeup $md.swipedown';
return {
onShow: onShow,
onRemove: onRemove,
toastClass: '',
position: 'bottom left',
themable: true,
hideDelay: 3000,
autoWrap: true,
transformTemplate: function(template, options) {
var shouldAddWrapper = options.autoWrap && template && !/md-toast-content/g.test(template);
if (shouldAddWrapper) {
// Root element of template will be <md-toast>. We need to wrap all of its content inside
// of <div class="md-toast-content">. All templates provided here should be static,
// developer-controlled content (meaning we're not attempting to guard against XSS).
var templateRoot = document.createElement('md-template');
templateRoot.innerHTML = template;
// Iterate through all root children, to detect possible md-toast directives.
for (var i = 0; i < templateRoot.children.length; i++) {
if (templateRoot.children[i].nodeName === 'MD-TOAST') {
var wrapper = angular.element('<div class="md-toast-content">');
// Wrap the children of the `md-toast` directive in jqLite, to be able to append
// multiple nodes with the same execution.
wrapper.append(angular.element(templateRoot.children[i].childNodes));
// Append the new wrapped element to the `md-toast` directive.
templateRoot.children[i].appendChild(wrapper[0]);
}
}
// We have to return the innerHTMl, because we do not want to have the `md-template`
// element to be the root element of our interimElement.
return templateRoot.innerHTML;
}
return template || '';
}
};
function onShow(scope, element, options) {
// support deprecated #content method
// TODO remove support for content in 1.2.
activeToastContent = options.textContent || options.content;
var isSmScreen = !$mdMedia('gt-sm');
element = $mdUtil.extractElementByName(element, 'md-toast', true);
options.element = element;
options.onSwipe = function(ev, gesture) {
// Add the relevant swipe class to the element so it can animate correctly
var swipe = ev.type.replace('$md.','');
var direction = swipe.replace('swipe', '');
// If the swipe direction is down/up but the toast came from top/bottom don't fade away
// Unless the screen is small, then the toast always on bottom
if ((direction === 'down' && options.position.indexOf('top') !== -1 && !isSmScreen) ||
(direction === 'up' && (options.position.indexOf('bottom') !== -1 || isSmScreen))) {
return;
}
if ((direction === 'left' || direction === 'right') && isSmScreen) {
return;
}
element.addClass('md-' + swipe);
$mdUtil.nextTick($mdToast.cancel);
};
options.openClass = toastOpenClass(options.position);
element.addClass(options.toastClass);
// 'top left' -> 'md-top md-left'
options.parent.addClass(options.openClass);
// static is the default position
if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {
options.parent.css('position', 'relative');
}
setupActionKeyListener(scope.toast && scope.toast.actionKey ?
scope.toast.actionKey : undefined);
element.on(SWIPE_EVENTS, options.onSwipe);
element.addClass(isSmScreen ? 'md-bottom' : options.position.split(' ').map(function(pos) {
return 'md-' + pos;
}).join(' '));
if (options.parent) {
options.parent.addClass('md-toast-animating');
}
return $animate.enter(element, options.parent).then(function() {
if (options.parent) {
options.parent.removeClass('md-toast-animating');
}
});
}
function onRemove(scope, element, options) {
if (scope.toast && scope.toast.actionKey) {
removeActionKeyListener();
}
element.off(SWIPE_EVENTS, options.onSwipe);
if (options.parent) options.parent.addClass('md-toast-animating');
if (options.openClass) options.parent.removeClass(options.openClass);
return ((options.$destroy === true) ? element.remove() : $animate.leave(element))
.then(function () {
if (options.parent) options.parent.removeClass('md-toast-animating');
if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {
options.parent.css('position', '');
}
});
}
function toastOpenClass(position) {
// For mobile, always open full-width on bottom
if (!$mdMedia('gt-xs')) {
return 'md-toast-open-bottom';
}
return 'md-toast-open-' + (position.indexOf('top') > -1 ? 'top' : 'bottom');
}
function setupActionKeyListener(actionKey) {
/**
* @param {KeyboardEvent} event
*/
var handleKeyDown = function(event) {
if (event.key === 'Escape') {
$mdToast.hide(false);
}
if (actionKey && event.key === actionKey && event.ctrlKey) {
$mdToast.hide(ACTION_RESOLVE);
}
};
$document.on('keydown', handleKeyDown);
}
function removeActionKeyListener() {
$document.off('keydown');
}
}
} | [
"function",
"MdToastProvider",
"(",
"$$interimElementProvider",
")",
"{",
"// Differentiate promise resolves: hide timeout (value == true) and hide action clicks",
"// (value == ok).",
"var",
"ACTION_RESOLVE",
"=",
"'ok'",
";",
"var",
"activeToastContent",
";",
"var",
"$mdToast",
... | @ngdoc method
@name $mdToast#hide
@description
Hide an existing toast and resolve the promise returned from `$mdToast.show()`.
@param {*=} response An argument for the resolved promise.
@returns {promise} A promise that is called when the existing element is removed from the DOM.
The promise is resolved with either the Boolean value `true` or the value passed as the
argument to `$mdToast.hide()`.
@ngdoc method
@name $mdToast#cancel
@description
`DEPRECATED` - The promise returned from opening a toast is used only to notify about the
closing of the toast. As such, there isn't any reason to also allow that promise to be rejected,
since it's not clear what the difference between resolve and reject would be.
Hide the existing toast and reject the promise returned from
`$mdToast.show()`.
@param {*=} response An argument for the rejected promise.
@returns {promise} A promise that is called when the existing element is removed from the DOM
The promise is resolved with the Boolean value `false`. | [
"@ngdoc",
"method",
"@name",
"$mdToast#hide"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/toast/toast.js#L326-L566 | train | This function is the main entry point of the toast. | [
30522,
3853,
9108,
3406,
14083,
21572,
17258,
2121,
1006,
1002,
1002,
9455,
12260,
3672,
21572,
17258,
2121,
1007,
1063,
1013,
1013,
21032,
4872,
10663,
2015,
1024,
5342,
2051,
5833,
1006,
3643,
1027,
1027,
2995,
1007,
1998,
5342,
2895,
292... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
markdown-it/markdown-it | lib/rules_block/list.js | skipBulletListMarker | function skipBulletListMarker(state, startLine) {
var marker, pos, max, ch;
pos = state.bMarks[startLine] + state.tShift[startLine];
max = state.eMarks[startLine];
marker = state.src.charCodeAt(pos++);
// Check bullet
if (marker !== 0x2A/* * */ &&
marker !== 0x2D/* - */ &&
marker !== 0x2B/* + */) {
return -1;
}
if (pos < max) {
ch = state.src.charCodeAt(pos);
if (!isSpace(ch)) {
// " -test " - is not a list item
return -1;
}
}
return pos;
} | javascript | function skipBulletListMarker(state, startLine) {
var marker, pos, max, ch;
pos = state.bMarks[startLine] + state.tShift[startLine];
max = state.eMarks[startLine];
marker = state.src.charCodeAt(pos++);
// Check bullet
if (marker !== 0x2A/* * */ &&
marker !== 0x2D/* - */ &&
marker !== 0x2B/* + */) {
return -1;
}
if (pos < max) {
ch = state.src.charCodeAt(pos);
if (!isSpace(ch)) {
// " -test " - is not a list item
return -1;
}
}
return pos;
} | [
"function",
"skipBulletListMarker",
"(",
"state",
",",
"startLine",
")",
"{",
"var",
"marker",
",",
"pos",
",",
"max",
",",
"ch",
";",
"pos",
"=",
"state",
".",
"bMarks",
"[",
"startLine",
"]",
"+",
"state",
".",
"tShift",
"[",
"startLine",
"]",
";",
... | Search `[-+*][\n ]`, returns next pos after marker on success or -1 on fail. | [
"Search",
"[",
"-",
"+",
"*",
"]",
"[",
"\\",
"n",
"]",
"returns",
"next",
"pos",
"after",
"marker",
"on",
"success",
"or",
"-",
"1",
"on",
"fail",
"."
] | ba6830ba13fb92953a91fb90318964ccd15b82c4 | https://github.com/markdown-it/markdown-it/blob/ba6830ba13fb92953a91fb90318964ccd15b82c4/lib/rules_block/list.js#L10-L34 | train | Skips the next marker in the list | [
30522,
3853,
13558,
8569,
22592,
9863,
10665,
2121,
1006,
2110,
1010,
2707,
4179,
1007,
1063,
13075,
12115,
1010,
13433,
2015,
1010,
4098,
1010,
10381,
1025,
13433,
2015,
1027,
2110,
1012,
1038,
27373,
1031,
2707,
4179,
1033,
1009,
2110,
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... |
statsd/statsd | backends/graphite.js | Metric | function Metric(key, value, ts) {
var m = this;
this.key = key;
this.value = value;
this.ts = ts;
// return a string representation of this metric appropriate
// for sending to the graphite collector. does not include
// a trailing newline.
this.toText = function() {
return m.key + " " + m.value + " " + m.ts;
};
this.toPickle = function() {
return MARK + STRING + '\'' + m.key + '\'\n' + MARK + LONG + m.ts + 'L\n' + STRING + '\'' + m.value + '\'\n' + TUPLE + TUPLE + APPEND;
};
} | javascript | function Metric(key, value, ts) {
var m = this;
this.key = key;
this.value = value;
this.ts = ts;
// return a string representation of this metric appropriate
// for sending to the graphite collector. does not include
// a trailing newline.
this.toText = function() {
return m.key + " " + m.value + " " + m.ts;
};
this.toPickle = function() {
return MARK + STRING + '\'' + m.key + '\'\n' + MARK + LONG + m.ts + 'L\n' + STRING + '\'' + m.value + '\'\n' + TUPLE + TUPLE + APPEND;
};
} | [
"function",
"Metric",
"(",
"key",
",",
"value",
",",
"ts",
")",
"{",
"var",
"m",
"=",
"this",
";",
"this",
".",
"key",
"=",
"key",
";",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"ts",
"=",
"ts",
";",
"// return a string representation of ... | A single measurement for sending to graphite. | [
"A",
"single",
"measurement",
"for",
"sending",
"to",
"graphite",
"."
] | ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9 | https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/backends/graphite.js#L105-L121 | train | A metric object | [
30522,
3853,
12046,
1006,
3145,
1010,
3643,
1010,
24529,
1007,
1063,
13075,
1049,
1027,
2023,
1025,
2023,
1012,
3145,
1027,
3145,
1025,
2023,
1012,
3643,
1027,
3643,
1025,
2023,
1012,
24529,
1027,
24529,
1025,
1013,
1013,
2709,
1037,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.fl/src/sap/ui/fl/Utils.js | function (sAppVersion, bDeveloperMode, sScenario) {
return !!sAppVersion
&& !!bDeveloperMode
&& sScenario !== sap.ui.fl.Scenario.AdaptationProject
&& sScenario !== sap.ui.fl.Scenario.AppVariant;
} | javascript | function (sAppVersion, bDeveloperMode, sScenario) {
return !!sAppVersion
&& !!bDeveloperMode
&& sScenario !== sap.ui.fl.Scenario.AdaptationProject
&& sScenario !== sap.ui.fl.Scenario.AppVariant;
} | [
"function",
"(",
"sAppVersion",
",",
"bDeveloperMode",
",",
"sScenario",
")",
"{",
"return",
"!",
"!",
"sAppVersion",
"&&",
"!",
"!",
"bDeveloperMode",
"&&",
"sScenario",
"!==",
"sap",
".",
"ui",
".",
"fl",
".",
"Scenario",
".",
"AdaptationProject",
"&&",
... | Determines if a 'to' field is required in a validAppVersions object.
@param sAppVersion
@param bDeveloperMode
@param sScenario
@returns {boolean}
@private | [
"Determines",
"if",
"a",
"to",
"field",
"is",
"required",
"in",
"a",
"validAppVersions",
"object",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1065-L1070 | train | Returns true if the given app version is not a variant of AppVariant | [
30522,
3853,
1006,
20066,
2361,
27774,
1010,
1038,
24844,
18349,
4842,
5302,
3207,
1010,
7020,
27524,
16843,
1007,
1063,
2709,
999,
999,
20066,
2361,
27774,
1004,
1004,
999,
999,
1038,
24844,
18349,
4842,
5302,
3207,
1004,
1004,
7020,
27524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_FontFlags | function parse_FontFlags(data) {
var d = data.read_shift(1);
data.l++;
var out = {
/* fBold: d & 0x01 */
fItalic: d & 0x02,
/* fUnderline: d & 0x04 */
fStrikeout: d & 0x08,
fOutline: d & 0x10,
fShadow: d & 0x20,
fCondense: d & 0x40,
fExtend: d & 0x80
};
return out;
} | javascript | function parse_FontFlags(data) {
var d = data.read_shift(1);
data.l++;
var out = {
/* fBold: d & 0x01 */
fItalic: d & 0x02,
/* fUnderline: d & 0x04 */
fStrikeout: d & 0x08,
fOutline: d & 0x10,
fShadow: d & 0x20,
fCondense: d & 0x40,
fExtend: d & 0x80
};
return out;
} | [
"function",
"parse_FontFlags",
"(",
"data",
")",
"{",
"var",
"d",
"=",
"data",
".",
"read_shift",
"(",
"1",
")",
";",
"data",
".",
"l",
"++",
";",
"var",
"out",
"=",
"{",
"/* fBold: d & 0x01 */",
"fItalic",
":",
"d",
"&",
"0x02",
",",
"/* fUnderline: d... | /* [MS-XLSB] 2.5.52 | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"5",
".",
"52"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L3862-L3876 | train | Parse the font flags | [
30522,
3853,
11968,
3366,
1035,
15489,
10258,
26454,
1006,
2951,
1007,
1063,
13075,
1040,
1027,
2951,
1012,
3191,
1035,
5670,
1006,
1015,
1007,
1025,
2951,
1012,
1048,
1009,
1009,
1025,
13075,
2041,
1027,
1063,
1013,
1008,
1042,
27495,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
TryGhost/Ghost | core/server/data/importer/index.js | function (filePath) {
const tmpDir = path.join(os.tmpdir(), uuid.v4());
this.fileToDelete = tmpDir;
return Promise.promisify(extract)(filePath, {dir: tmpDir}).then(function () {
return tmpDir;
});
} | javascript | function (filePath) {
const tmpDir = path.join(os.tmpdir(), uuid.v4());
this.fileToDelete = tmpDir;
return Promise.promisify(extract)(filePath, {dir: tmpDir}).then(function () {
return tmpDir;
});
} | [
"function",
"(",
"filePath",
")",
"{",
"const",
"tmpDir",
"=",
"path",
".",
"join",
"(",
"os",
".",
"tmpdir",
"(",
")",
",",
"uuid",
".",
"v4",
"(",
")",
")",
";",
"this",
".",
"fileToDelete",
"=",
"tmpDir",
";",
"return",
"Promise",
".",
"promisif... | Use the extract module to extract the given zip file to a temp directory & return the temp directory path
@param {String} filePath
@returns {Promise[]} Files | [
"Use",
"the",
"extract",
"module",
"to",
"extract",
"the",
"given",
"zip",
"file",
"to",
"a",
"temp",
"directory",
"&",
"return",
"the",
"temp",
"directory",
"path"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/data/importer/index.js#L171-L178 | train | Extract a file to a temporary directory | [
30522,
3853,
1006,
5371,
15069,
1007,
1063,
9530,
3367,
1056,
8737,
4305,
2099,
1027,
4130,
1012,
3693,
1006,
9808,
1012,
1056,
8737,
4305,
2099,
1006,
1007,
1010,
1057,
21272,
1012,
1058,
2549,
1006,
1007,
1007,
1025,
2023,
1012,
5371,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/Painter.js | function (paintAll) {
var list = this.storage.getDisplayList(true);
var zlevelList = this._zlevelList;
this._redrawId = Math.random();
this._paintList(list, paintAll, this._redrawId);
// Paint custum layers
for (var i = 0; i < zlevelList.length; i++) {
var z = zlevelList[i];
var layer = this._layers[z];
if (!layer.__builtin__ && layer.refresh) {
var clearColor = i === 0 ? this._backgroundColor : null;
layer.refresh(clearColor);
}
}
this.refreshHover();
return this;
} | javascript | function (paintAll) {
var list = this.storage.getDisplayList(true);
var zlevelList = this._zlevelList;
this._redrawId = Math.random();
this._paintList(list, paintAll, this._redrawId);
// Paint custum layers
for (var i = 0; i < zlevelList.length; i++) {
var z = zlevelList[i];
var layer = this._layers[z];
if (!layer.__builtin__ && layer.refresh) {
var clearColor = i === 0 ? this._backgroundColor : null;
layer.refresh(clearColor);
}
}
this.refreshHover();
return this;
} | [
"function",
"(",
"paintAll",
")",
"{",
"var",
"list",
"=",
"this",
".",
"storage",
".",
"getDisplayList",
"(",
"true",
")",
";",
"var",
"zlevelList",
"=",
"this",
".",
"_zlevelList",
";",
"this",
".",
"_redrawId",
"=",
"Math",
".",
"random",
"(",
")",
... | 刷新
@param {boolean} [paintAll=false] 强制绘制所有displayable | [
"刷新"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/Painter.js#L257-L280 | train | Paints the display list | [
30522,
3853,
1006,
6773,
8095,
1007,
1063,
13075,
2862,
1027,
2023,
1012,
5527,
1012,
2131,
10521,
13068,
9863,
1006,
2995,
1007,
1025,
13075,
1062,
20414,
13348,
3367,
1027,
2023,
1012,
1035,
1062,
20414,
13348,
3367,
1025,
2023,
1012,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
LLK/scratch-blocks | blocks_vertical/data.js | function() {
this.jsonInit({
"message0": "%1",
"args0": [
{
"type": "field_numberdropdown",
"name": "INDEX",
"value": "1",
"min": 1,
"precision": 1,
"options": [
["1", "1"],
[Blockly.Msg.DATA_INDEX_LAST, "last"],
[Blockly.Msg.DATA_INDEX_ALL, "all"]
]
}
],
"category": Blockly.Categories.data,
"extensions": ["colours_textfield", "output_string"]
});
} | javascript | function() {
this.jsonInit({
"message0": "%1",
"args0": [
{
"type": "field_numberdropdown",
"name": "INDEX",
"value": "1",
"min": 1,
"precision": 1,
"options": [
["1", "1"],
[Blockly.Msg.DATA_INDEX_LAST, "last"],
[Blockly.Msg.DATA_INDEX_ALL, "all"]
]
}
],
"category": Blockly.Categories.data,
"extensions": ["colours_textfield", "output_string"]
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"jsonInit",
"(",
"{",
"\"message0\"",
":",
"\"%1\"",
",",
"\"args0\"",
":",
"[",
"{",
"\"type\"",
":",
"\"field_numberdropdown\"",
",",
"\"name\"",
":",
"\"INDEX\"",
",",
"\"value\"",
":",
"\"1\"",
",",
"\"min\"",
":... | List index menu, with all option.
@this Blockly.Block | [
"List",
"index",
"menu",
"with",
"all",
"option",
"."
] | 455b2a854435c0a67da1da92320ddc3ec3e2b799 | https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/data.js#L180-L200 | train | Block for
. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1046,
3385,
5498,
2102,
1006,
1063,
1000,
4471,
2692,
1000,
1024,
1000,
1003,
1015,
1000,
1010,
1000,
12098,
5620,
2692,
1000,
1024,
1031,
1063,
1000,
2828,
1000,
1024,
1000,
2492,
1035,
2193,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | isMonthWithinRange | function isMonthWithinRange(date, minDate, maxDate) {
var month = date.getMonth();
var year = date.getFullYear();
return (!minDate || minDate.getFullYear() < year || minDate.getMonth() <= month) &&
(!maxDate || maxDate.getFullYear() > year || maxDate.getMonth() >= month);
} | javascript | function isMonthWithinRange(date, minDate, maxDate) {
var month = date.getMonth();
var year = date.getFullYear();
return (!minDate || minDate.getFullYear() < year || minDate.getMonth() <= month) &&
(!maxDate || maxDate.getFullYear() > year || maxDate.getMonth() >= month);
} | [
"function",
"isMonthWithinRange",
"(",
"date",
",",
"minDate",
",",
"maxDate",
")",
"{",
"var",
"month",
"=",
"date",
".",
"getMonth",
"(",
")",
";",
"var",
"year",
"=",
"date",
".",
"getFullYear",
"(",
")",
";",
"return",
"(",
"!",
"minDate",
"||",
... | Checks if a month is within a min and max range, ignoring the date and time components.
If minDate or maxDate are not dates, they are ignored.
@param {Date} date
@param {Date} minDate
@param {Date} maxDate | [
"Checks",
"if",
"a",
"month",
"is",
"within",
"a",
"min",
"and",
"max",
"range",
"ignoring",
"the",
"date",
"and",
"time",
"components",
".",
"If",
"minDate",
"or",
"maxDate",
"are",
"not",
"dates",
"they",
"are",
"ignored",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L303-L309 | train | Check if a month is within a range of dates | [
30522,
3853,
2003,
9629,
2232,
24415,
2378,
24388,
2063,
1006,
3058,
1010,
2568,
3686,
1010,
4098,
13701,
1007,
1063,
13075,
3204,
1027,
3058,
1012,
2131,
9629,
2232,
1006,
1007,
1025,
13075,
2095,
1027,
3058,
1012,
2131,
7699,
14644,
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... |
Dogfalo/materialize | dist/js/materialize.js | destroy | function destroy() {
this._removeEventHandlers();
this._enableBodyScrolling();
this._overlay.parentNode.removeChild(this._overlay);
this.dragTarget.parentNode.removeChild(this.dragTarget);
this.el.M_Sidenav = undefined;
this.el.style.transform = '';
var index = Sidenav._sidenavs.indexOf(this);
if (index >= 0) {
Sidenav._sidenavs.splice(index, 1);
}
} | javascript | function destroy() {
this._removeEventHandlers();
this._enableBodyScrolling();
this._overlay.parentNode.removeChild(this._overlay);
this.dragTarget.parentNode.removeChild(this.dragTarget);
this.el.M_Sidenav = undefined;
this.el.style.transform = '';
var index = Sidenav._sidenavs.indexOf(this);
if (index >= 0) {
Sidenav._sidenavs.splice(index, 1);
}
} | [
"function",
"destroy",
"(",
")",
"{",
"this",
".",
"_removeEventHandlers",
"(",
")",
";",
"this",
".",
"_enableBodyScrolling",
"(",
")",
";",
"this",
".",
"_overlay",
".",
"parentNode",
".",
"removeChild",
"(",
"this",
".",
"_overlay",
")",
";",
"this",
... | Teardown component | [
"Teardown",
"component"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L5547-L5559 | train | Destroys the sidenav | [
30522,
3853,
6033,
1006,
1007,
1063,
2023,
1012,
1035,
6366,
18697,
3372,
11774,
12910,
1006,
1007,
1025,
2023,
1012,
1035,
9585,
23684,
11020,
28402,
2075,
1006,
1007,
1025,
2023,
1012,
1035,
2058,
8485,
1012,
6687,
3630,
3207,
1012,
6366,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | runTypedoc | function runTypedoc() {
const typeSource = apiType === 'node' ? tempNodeSourcePath : sourceFile;
const command = `${repoPath}/node_modules/.bin/typedoc ${typeSource} \
--out ${docPath} \
--readme ${tempHomePath} \
--options ${__dirname}/typedoc.js \
--theme ${__dirname}/theme`;
console.log('Running command:\n', command);
return exec(command);
} | javascript | function runTypedoc() {
const typeSource = apiType === 'node' ? tempNodeSourcePath : sourceFile;
const command = `${repoPath}/node_modules/.bin/typedoc ${typeSource} \
--out ${docPath} \
--readme ${tempHomePath} \
--options ${__dirname}/typedoc.js \
--theme ${__dirname}/theme`;
console.log('Running command:\n', command);
return exec(command);
} | [
"function",
"runTypedoc",
"(",
")",
"{",
"const",
"typeSource",
"=",
"apiType",
"===",
"'node'",
"?",
"tempNodeSourcePath",
":",
"sourceFile",
";",
"const",
"command",
"=",
"`",
"${",
"repoPath",
"}",
"${",
"typeSource",
"}",
"\\\n",
"${",
"docPath",
"}",
... | Runs Typedoc command.
Additional config options come from ./typedoc.js | [
"Runs",
"Typedoc",
"command",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/scripts/docgen/generate-docs.js#L62-L72 | train | Runs typedoc | [
30522,
3853,
2448,
13874,
3527,
2278,
1006,
1007,
1063,
9530,
3367,
4127,
8162,
3401,
1027,
17928,
13874,
1027,
1027,
1027,
1005,
13045,
1005,
1029,
8915,
8737,
3630,
6155,
8162,
3401,
15069,
1024,
3120,
8873,
2571,
1025,
9530,
3367,
3094,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/GrowingEnablement.js | function() {
if (this._oTrigger) {
this._oTrigger.destroy();
this._oTrigger = null;
}
if (this._oScrollDelegate) {
this._oScrollDelegate.setGrowingList(null);
this._oScrollDelegate = null;
}
if (this._oRM) {
this._oRM.destroy();
this._oRM = null;
}
this._oControl.$("triggerList").remove();
this._oControl.bUseExtendedChangeDetection = false;
this._oControl.removeDelegate(this);
this._oContainerDomRef = null;
this._oControl = null;
} | javascript | function() {
if (this._oTrigger) {
this._oTrigger.destroy();
this._oTrigger = null;
}
if (this._oScrollDelegate) {
this._oScrollDelegate.setGrowingList(null);
this._oScrollDelegate = null;
}
if (this._oRM) {
this._oRM.destroy();
this._oRM = null;
}
this._oControl.$("triggerList").remove();
this._oControl.bUseExtendedChangeDetection = false;
this._oControl.removeDelegate(this);
this._oContainerDomRef = null;
this._oControl = null;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_oTrigger",
")",
"{",
"this",
".",
"_oTrigger",
".",
"destroy",
"(",
")",
";",
"this",
".",
"_oTrigger",
"=",
"null",
";",
"}",
"if",
"(",
"this",
".",
"_oScrollDelegate",
")",
"{",
"this",
".",
... | Destroys this GrowingEnablement delegate.
This function must be called by the control which uses this delegate in the <code>exit</code> function. | [
"Destroys",
"this",
"GrowingEnablement",
"delegate",
".",
"This",
"function",
"must",
"be",
"called",
"by",
"the",
"control",
"which",
"uses",
"this",
"delegate",
"in",
"the",
"<code",
">",
"exit<",
"/",
"code",
">",
"function",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L74-L93 | train | Destroys the control and the trigger | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
27178,
3089,
13327,
1007,
1063,
2023,
1012,
1035,
27178,
3089,
13327,
1012,
6033,
1006,
1007,
1025,
2023,
1012,
1035,
27178,
3089,
13327,
1027,
19701,
1025,
1065,
2065,
1006,
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... | |
adobe/brackets | src/utils/NodeConnection.js | setDeferredTimeout | function setDeferredTimeout(deferred, delay) {
var timer = setTimeout(function () {
deferred.reject("timeout");
}, delay);
deferred.always(function () { clearTimeout(timer); });
} | javascript | function setDeferredTimeout(deferred, delay) {
var timer = setTimeout(function () {
deferred.reject("timeout");
}, delay);
deferred.always(function () { clearTimeout(timer); });
} | [
"function",
"setDeferredTimeout",
"(",
"deferred",
",",
"delay",
")",
"{",
"var",
"timer",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"deferred",
".",
"reject",
"(",
"\"timeout\"",
")",
";",
"}",
",",
"delay",
")",
";",
"deferred",
".",
"always",... | 2^32 - 1
@private
Helper function to auto-reject a deferred after a given amount of time.
If the deferred is resolved/rejected manually, then the timeout is
automatically cleared. | [
"2^32",
"-",
"1"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/NodeConnection.js#L64-L69 | train | Set deferred timeout | [
30522,
3853,
2275,
3207,
7512,
5596,
7292,
5833,
1006,
13366,
28849,
2094,
1010,
8536,
1007,
1063,
13075,
25309,
1027,
2275,
7292,
5833,
1006,
3853,
1006,
1007,
1063,
13366,
28849,
2094,
1012,
15454,
1006,
1000,
2051,
5833,
1000,
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... |
Shopify/draggable | src/Draggable/Plugins/Mirror/Mirror.js | computeMirrorDimensions | function computeMirrorDimensions({source, ...args}) {
return withPromise((resolve) => {
const sourceRect = source.getBoundingClientRect();
resolve({source, sourceRect, ...args});
});
} | javascript | function computeMirrorDimensions({source, ...args}) {
return withPromise((resolve) => {
const sourceRect = source.getBoundingClientRect();
resolve({source, sourceRect, ...args});
});
} | [
"function",
"computeMirrorDimensions",
"(",
"{",
"source",
",",
"...",
"args",
"}",
")",
"{",
"return",
"withPromise",
"(",
"(",
"resolve",
")",
"=>",
"{",
"const",
"sourceRect",
"=",
"source",
".",
"getBoundingClientRect",
"(",
")",
";",
"resolve",
"(",
"... | Computes mirror dimensions based on the source element
Adds sourceRect to state
@param {Object} state
@param {HTMLElement} state.source
@return {Promise}
@private | [
"Computes",
"mirror",
"dimensions",
"based",
"on",
"the",
"source",
"element",
"Adds",
"sourceRect",
"to",
"state"
] | ecc04b2cdb8b5009664862472ff8cb237c38cfeb | https://github.com/Shopify/draggable/blob/ecc04b2cdb8b5009664862472ff8cb237c38cfeb/src/Draggable/Plugins/Mirror/Mirror.js#L330-L335 | train | Compute the dimensions of a mirror element | [
30522,
3853,
24134,
14503,
29165,
22172,
6132,
8496,
1006,
1063,
3120,
1010,
1012,
1012,
1012,
12098,
5620,
1065,
1007,
1063,
2709,
2007,
30524,
1025,
10663,
1006,
1063,
3120,
1010,
3120,
2890,
6593,
1010,
1012,
1012,
1012,
12098,
5620,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ScopeManager.js | _maybeReset | function _maybeReset(session, document, force) {
var newTernModule;
// if we're in the middle of a reset, don't have to check
// the new module will be online soon
if (!resettingDeferred) {
// We don't reset if the debugging flag is set
// because it's easier to debug if the module isn't
// getting reset all the time.
if (currentModule.resetForced || force || (!config.noReset && ++_hintCount > MAX_HINTS)) {
if (config.debug) {
console.debug("Resetting tern module");
}
resettingDeferred = new $.Deferred();
newTernModule = new TernModule();
newTernModule.handleEditorChange(session, document, null);
newTernModule.whenReady(function () {
// reset the old module
currentModule.resetModule();
currentModule = newTernModule;
resettingDeferred.resolve(currentModule);
// all done reseting
resettingDeferred = null;
});
_hintCount = 0;
} else {
var d = new $.Deferred();
d.resolve(currentModule);
return d.promise();
}
}
return resettingDeferred.promise();
} | javascript | function _maybeReset(session, document, force) {
var newTernModule;
// if we're in the middle of a reset, don't have to check
// the new module will be online soon
if (!resettingDeferred) {
// We don't reset if the debugging flag is set
// because it's easier to debug if the module isn't
// getting reset all the time.
if (currentModule.resetForced || force || (!config.noReset && ++_hintCount > MAX_HINTS)) {
if (config.debug) {
console.debug("Resetting tern module");
}
resettingDeferred = new $.Deferred();
newTernModule = new TernModule();
newTernModule.handleEditorChange(session, document, null);
newTernModule.whenReady(function () {
// reset the old module
currentModule.resetModule();
currentModule = newTernModule;
resettingDeferred.resolve(currentModule);
// all done reseting
resettingDeferred = null;
});
_hintCount = 0;
} else {
var d = new $.Deferred();
d.resolve(currentModule);
return d.promise();
}
}
return resettingDeferred.promise();
} | [
"function",
"_maybeReset",
"(",
"session",
",",
"document",
",",
"force",
")",
"{",
"var",
"newTernModule",
";",
"// if we're in the middle of a reset, don't have to check",
"// the new module will be online soon",
"if",
"(",
"!",
"resettingDeferred",
")",
"{",
"// We don't... | reset the tern module, if necessary.
During debugging, you can turn this automatic resetting behavior off
by running this in the console:
brackets._configureJSCodeHints({ noReset: true })
This function is also used in unit testing with the "force" flag to
reset the module for each test to start with a clean environment.
@param {Session} session
@param {Document} document
@param {boolean} force true to force a reset regardless of how long since the last one
@return {Promise} Promise resolved when the module is ready.
The new (or current, if there was no reset) module is passed to the callback. | [
"reset",
"the",
"tern",
"module",
"if",
"necessary",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L1384-L1418 | train | If we re in the middle of a reset we need to reset the tern module | [
30522,
3853,
1035,
2672,
6072,
3388,
1006,
5219,
1010,
6254,
1010,
2486,
1007,
1063,
13075,
25597,
11795,
5302,
8566,
2571,
1025,
1013,
1013,
2065,
2057,
1005,
2128,
1999,
1996,
2690,
1997,
1037,
25141,
1010,
2123,
1005,
1056,
2031,
2000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
uber/deck.gl | modules/core/src/shaderlib/project/viewport-uniforms.js | calculateMatrixAndOffset | function calculateMatrixAndOffset({
// UNCHANGED
viewport,
// NEW PARAMS
coordinateSystem,
coordinateOrigin,
coordinateZoom
}) {
const {viewMatrixUncentered} = viewport;
let {viewMatrix} = viewport;
const {projectionMatrix} = viewport;
let {viewProjectionMatrix} = viewport;
let projectionCenter;
let cameraPos = viewport.cameraPosition;
let shaderCoordinateSystem = getShaderCoordinateSystem(coordinateSystem);
let shaderCoordinateOrigin = coordinateOrigin;
if (shaderCoordinateSystem === PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET) {
if (coordinateZoom < LNGLAT_AUTO_OFFSET_ZOOM_THRESHOLD) {
// Use LNG_LAT projection if not zooming
shaderCoordinateSystem = PROJECT_COORDINATE_SYSTEM.LNG_LAT;
} else {
// Use LNGLAT_AUTO_OFFSET
const lng = Math.fround(viewport.longitude);
const lat = Math.fround(viewport.latitude);
shaderCoordinateOrigin = [lng, lat];
}
}
switch (shaderCoordinateSystem) {
case PROJECT_COORDINATE_SYSTEM.IDENTITY:
case PROJECT_COORDINATE_SYSTEM.LNG_LAT:
projectionCenter = ZERO_VECTOR;
break;
// TODO: make lighting work for meter offset mode
case PROJECT_COORDINATE_SYSTEM.LNGLAT_OFFSETS:
case PROJECT_COORDINATE_SYSTEM.METER_OFFSETS:
case PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET:
// Calculate transformed projectionCenter (using 64 bit precision JS)
// This is the key to offset mode precision
// (avoids doing this addition in 32 bit precision in GLSL)
const positionPixels = viewport.projectFlat(
shaderCoordinateOrigin,
Math.pow(2, coordinateZoom)
);
cameraPos = [
cameraPos[0] - positionPixels[0],
cameraPos[1] - positionPixels[1],
cameraPos[2]
];
// projectionCenter = new Matrix4(viewProjectionMatrix)
// .transformVector([positionPixels[0], positionPixels[1], 0.0, 1.0]);
projectionCenter = vec4.transformMat4(
[],
[positionPixels[0], positionPixels[1], 0.0, 1.0],
viewProjectionMatrix
);
// Always apply uncentered projection matrix if available (shader adds center)
viewMatrix = viewMatrixUncentered || viewMatrix;
// Zero out 4th coordinate ("after" model matrix) - avoids further translations
// viewMatrix = new Matrix4(viewMatrixUncentered || viewMatrix)
// .multiplyRight(VECTOR_TO_POINT_MATRIX);
viewProjectionMatrix = mat4.multiply([], projectionMatrix, viewMatrix);
viewProjectionMatrix = mat4.multiply([], viewProjectionMatrix, VECTOR_TO_POINT_MATRIX);
break;
default:
throw new Error('Unknown projection mode');
}
return {
viewMatrix,
viewProjectionMatrix,
projectionCenter,
cameraPos,
shaderCoordinateSystem,
shaderCoordinateOrigin
};
} | javascript | function calculateMatrixAndOffset({
// UNCHANGED
viewport,
// NEW PARAMS
coordinateSystem,
coordinateOrigin,
coordinateZoom
}) {
const {viewMatrixUncentered} = viewport;
let {viewMatrix} = viewport;
const {projectionMatrix} = viewport;
let {viewProjectionMatrix} = viewport;
let projectionCenter;
let cameraPos = viewport.cameraPosition;
let shaderCoordinateSystem = getShaderCoordinateSystem(coordinateSystem);
let shaderCoordinateOrigin = coordinateOrigin;
if (shaderCoordinateSystem === PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET) {
if (coordinateZoom < LNGLAT_AUTO_OFFSET_ZOOM_THRESHOLD) {
// Use LNG_LAT projection if not zooming
shaderCoordinateSystem = PROJECT_COORDINATE_SYSTEM.LNG_LAT;
} else {
// Use LNGLAT_AUTO_OFFSET
const lng = Math.fround(viewport.longitude);
const lat = Math.fround(viewport.latitude);
shaderCoordinateOrigin = [lng, lat];
}
}
switch (shaderCoordinateSystem) {
case PROJECT_COORDINATE_SYSTEM.IDENTITY:
case PROJECT_COORDINATE_SYSTEM.LNG_LAT:
projectionCenter = ZERO_VECTOR;
break;
// TODO: make lighting work for meter offset mode
case PROJECT_COORDINATE_SYSTEM.LNGLAT_OFFSETS:
case PROJECT_COORDINATE_SYSTEM.METER_OFFSETS:
case PROJECT_COORDINATE_SYSTEM.LNGLAT_AUTO_OFFSET:
// Calculate transformed projectionCenter (using 64 bit precision JS)
// This is the key to offset mode precision
// (avoids doing this addition in 32 bit precision in GLSL)
const positionPixels = viewport.projectFlat(
shaderCoordinateOrigin,
Math.pow(2, coordinateZoom)
);
cameraPos = [
cameraPos[0] - positionPixels[0],
cameraPos[1] - positionPixels[1],
cameraPos[2]
];
// projectionCenter = new Matrix4(viewProjectionMatrix)
// .transformVector([positionPixels[0], positionPixels[1], 0.0, 1.0]);
projectionCenter = vec4.transformMat4(
[],
[positionPixels[0], positionPixels[1], 0.0, 1.0],
viewProjectionMatrix
);
// Always apply uncentered projection matrix if available (shader adds center)
viewMatrix = viewMatrixUncentered || viewMatrix;
// Zero out 4th coordinate ("after" model matrix) - avoids further translations
// viewMatrix = new Matrix4(viewMatrixUncentered || viewMatrix)
// .multiplyRight(VECTOR_TO_POINT_MATRIX);
viewProjectionMatrix = mat4.multiply([], projectionMatrix, viewMatrix);
viewProjectionMatrix = mat4.multiply([], viewProjectionMatrix, VECTOR_TO_POINT_MATRIX);
break;
default:
throw new Error('Unknown projection mode');
}
return {
viewMatrix,
viewProjectionMatrix,
projectionCenter,
cameraPos,
shaderCoordinateSystem,
shaderCoordinateOrigin
};
} | [
"function",
"calculateMatrixAndOffset",
"(",
"{",
"// UNCHANGED",
"viewport",
",",
"// NEW PARAMS",
"coordinateSystem",
",",
"coordinateOrigin",
",",
"coordinateZoom",
"}",
")",
"{",
"const",
"{",
"viewMatrixUncentered",
"}",
"=",
"viewport",
";",
"let",
"{",
"viewM... | The code that utilizes Matrix4 does the same calculation as their mat4 counterparts, has lower performance but provides error checking. Uncomment when debugging | [
"The",
"code",
"that",
"utilizes",
"Matrix4",
"does",
"the",
"same",
"calculation",
"as",
"their",
"mat4",
"counterparts",
"has",
"lower",
"performance",
"but",
"provides",
"error",
"checking",
".",
"Uncomment",
"when",
"debugging"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/core/src/shaderlib/project/viewport-uniforms.js#L70-L154 | train | Calculate the matrix and offset of the camera | [
30522,
3853,
18422,
18900,
17682,
28574,
21807,
3388,
1006,
1063,
1013,
1013,
15704,
3193,
6442,
1010,
1013,
1013,
2047,
11498,
5244,
12093,
27268,
6633,
1010,
13530,
10050,
11528,
1010,
13530,
23221,
2213,
1065,
1007,
1063,
9530,
3367,
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... |
eslint/eslint | lib/config/config-initializer.js | promptUser | function promptUser() {
return inquirer.prompt([
{
type: "list",
name: "purpose",
message: "How would you like to use ESLint?",
default: "problems",
choices: [
{ name: "To check syntax only", value: "syntax" },
{ name: "To check syntax and find problems", value: "problems" },
{ name: "To check syntax, find problems, and enforce code style", value: "style" }
]
},
{
type: "list",
name: "moduleType",
message: "What type of modules does your project use?",
default: "esm",
choices: [
{ name: "JavaScript modules (import/export)", value: "esm" },
{ name: "CommonJS (require/exports)", value: "commonjs" },
{ name: "None of these", value: "none" }
]
},
{
type: "list",
name: "framework",
message: "Which framework does your project use?",
default: "react",
choices: [
{ name: "React", value: "react" },
{ name: "Vue.js", value: "vue" },
{ name: "None of these", value: "none" }
]
},
{
type: "checkbox",
name: "env",
message: "Where does your code run?",
default: ["browser"],
choices: [
{ name: "Browser", value: "browser" },
{ name: "Node", value: "node" }
]
},
{
type: "list",
name: "source",
message: "How would you like to define a style for your project?",
default: "guide",
choices: [
{ name: "Use a popular style guide", value: "guide" },
{ name: "Answer questions about your style", value: "prompt" },
{ name: "Inspect your JavaScript file(s)", value: "auto" }
],
when(answers) {
return answers.purpose === "style";
}
},
{
type: "list",
name: "styleguide",
message: "Which style guide do you want to follow?",
choices: [
{ name: "Airbnb (https://github.com/airbnb/javascript)", value: "airbnb" },
{ name: "Standard (https://github.com/standard/standard)", value: "standard" },
{ name: "Google (https://github.com/google/eslint-config-google)", value: "google" }
],
when(answers) {
answers.packageJsonExists = npmUtils.checkPackageJson();
return answers.source === "guide" && answers.packageJsonExists;
}
},
{
type: "input",
name: "patterns",
message: "Which file(s), path(s), or glob(s) should be examined?",
when(answers) {
return (answers.source === "auto");
},
validate(input) {
if (input.trim().length === 0 && input.trim() !== ",") {
return "You must tell us what code to examine. Try again.";
}
return true;
}
},
{
type: "list",
name: "format",
message: "What format do you want your config file to be in?",
default: "JavaScript",
choices: ["JavaScript", "YAML", "JSON"]
},
{
type: "confirm",
name: "installESLint",
message(answers) {
const verb = semver.ltr(answers.localESLintVersion, answers.requiredESLintVersionRange)
? "upgrade"
: "downgrade";
return `The style guide "${answers.styleguide}" requires eslint@${answers.requiredESLintVersionRange}. You are currently using eslint@${answers.localESLintVersion}.\n Do you want to ${verb}?`;
},
default: true,
when(answers) {
return answers.source === "guide" && answers.packageJsonExists && hasESLintVersionConflict(answers);
}
}
]).then(earlyAnswers => {
// early exit if no style guide is necessary
if (earlyAnswers.purpose !== "style") {
const config = processAnswers(earlyAnswers);
const modules = getModulesList(config);
return askInstallModules(modules, earlyAnswers.packageJsonExists)
.then(() => writeFile(config, earlyAnswers.format));
}
// early exit if you are using a style guide
if (earlyAnswers.source === "guide") {
if (!earlyAnswers.packageJsonExists) {
log.info("A package.json is necessary to install plugins such as style guides. Run `npm init` to create a package.json file and try again.");
return void 0;
}
if (earlyAnswers.installESLint === false && !semver.satisfies(earlyAnswers.localESLintVersion, earlyAnswers.requiredESLintVersionRange)) {
log.info(`Note: it might not work since ESLint's version is mismatched with the ${earlyAnswers.styleguide} config.`);
}
if (earlyAnswers.styleguide === "airbnb" && earlyAnswers.framework !== "react") {
earlyAnswers.styleguide = "airbnb-base";
}
const config = ConfigOps.merge(processAnswers(earlyAnswers), getConfigForStyleGuide(earlyAnswers.styleguide));
const modules = getModulesList(config);
return askInstallModules(modules, earlyAnswers.packageJsonExists)
.then(() => writeFile(config, earlyAnswers.format));
}
if (earlyAnswers.source === "auto") {
const combinedAnswers = Object.assign({}, earlyAnswers);
const config = processAnswers(combinedAnswers);
const modules = getModulesList(config);
return askInstallModules(modules).then(() => writeFile(config, earlyAnswers.format));
}
// continue with the style questions otherwise...
return inquirer.prompt([
{
type: "list",
name: "indent",
message: "What style of indentation do you use?",
default: "tab",
choices: [{ name: "Tabs", value: "tab" }, { name: "Spaces", value: 4 }]
},
{
type: "list",
name: "quotes",
message: "What quotes do you use for strings?",
default: "double",
choices: [{ name: "Double", value: "double" }, { name: "Single", value: "single" }]
},
{
type: "list",
name: "linebreak",
message: "What line endings do you use?",
default: "unix",
choices: [{ name: "Unix", value: "unix" }, { name: "Windows", value: "windows" }]
},
{
type: "confirm",
name: "semi",
message: "Do you require semicolons?",
default: true
},
{
type: "list",
name: "format",
message: "What format do you want your config file to be in?",
default: "JavaScript",
choices: ["JavaScript", "YAML", "JSON"]
}
]).then(answers => {
const totalAnswers = Object.assign({}, earlyAnswers, answers);
const config = processAnswers(totalAnswers);
const modules = getModulesList(config);
return askInstallModules(modules).then(() => writeFile(config, answers.format));
});
});
} | javascript | function promptUser() {
return inquirer.prompt([
{
type: "list",
name: "purpose",
message: "How would you like to use ESLint?",
default: "problems",
choices: [
{ name: "To check syntax only", value: "syntax" },
{ name: "To check syntax and find problems", value: "problems" },
{ name: "To check syntax, find problems, and enforce code style", value: "style" }
]
},
{
type: "list",
name: "moduleType",
message: "What type of modules does your project use?",
default: "esm",
choices: [
{ name: "JavaScript modules (import/export)", value: "esm" },
{ name: "CommonJS (require/exports)", value: "commonjs" },
{ name: "None of these", value: "none" }
]
},
{
type: "list",
name: "framework",
message: "Which framework does your project use?",
default: "react",
choices: [
{ name: "React", value: "react" },
{ name: "Vue.js", value: "vue" },
{ name: "None of these", value: "none" }
]
},
{
type: "checkbox",
name: "env",
message: "Where does your code run?",
default: ["browser"],
choices: [
{ name: "Browser", value: "browser" },
{ name: "Node", value: "node" }
]
},
{
type: "list",
name: "source",
message: "How would you like to define a style for your project?",
default: "guide",
choices: [
{ name: "Use a popular style guide", value: "guide" },
{ name: "Answer questions about your style", value: "prompt" },
{ name: "Inspect your JavaScript file(s)", value: "auto" }
],
when(answers) {
return answers.purpose === "style";
}
},
{
type: "list",
name: "styleguide",
message: "Which style guide do you want to follow?",
choices: [
{ name: "Airbnb (https://github.com/airbnb/javascript)", value: "airbnb" },
{ name: "Standard (https://github.com/standard/standard)", value: "standard" },
{ name: "Google (https://github.com/google/eslint-config-google)", value: "google" }
],
when(answers) {
answers.packageJsonExists = npmUtils.checkPackageJson();
return answers.source === "guide" && answers.packageJsonExists;
}
},
{
type: "input",
name: "patterns",
message: "Which file(s), path(s), or glob(s) should be examined?",
when(answers) {
return (answers.source === "auto");
},
validate(input) {
if (input.trim().length === 0 && input.trim() !== ",") {
return "You must tell us what code to examine. Try again.";
}
return true;
}
},
{
type: "list",
name: "format",
message: "What format do you want your config file to be in?",
default: "JavaScript",
choices: ["JavaScript", "YAML", "JSON"]
},
{
type: "confirm",
name: "installESLint",
message(answers) {
const verb = semver.ltr(answers.localESLintVersion, answers.requiredESLintVersionRange)
? "upgrade"
: "downgrade";
return `The style guide "${answers.styleguide}" requires eslint@${answers.requiredESLintVersionRange}. You are currently using eslint@${answers.localESLintVersion}.\n Do you want to ${verb}?`;
},
default: true,
when(answers) {
return answers.source === "guide" && answers.packageJsonExists && hasESLintVersionConflict(answers);
}
}
]).then(earlyAnswers => {
// early exit if no style guide is necessary
if (earlyAnswers.purpose !== "style") {
const config = processAnswers(earlyAnswers);
const modules = getModulesList(config);
return askInstallModules(modules, earlyAnswers.packageJsonExists)
.then(() => writeFile(config, earlyAnswers.format));
}
// early exit if you are using a style guide
if (earlyAnswers.source === "guide") {
if (!earlyAnswers.packageJsonExists) {
log.info("A package.json is necessary to install plugins such as style guides. Run `npm init` to create a package.json file and try again.");
return void 0;
}
if (earlyAnswers.installESLint === false && !semver.satisfies(earlyAnswers.localESLintVersion, earlyAnswers.requiredESLintVersionRange)) {
log.info(`Note: it might not work since ESLint's version is mismatched with the ${earlyAnswers.styleguide} config.`);
}
if (earlyAnswers.styleguide === "airbnb" && earlyAnswers.framework !== "react") {
earlyAnswers.styleguide = "airbnb-base";
}
const config = ConfigOps.merge(processAnswers(earlyAnswers), getConfigForStyleGuide(earlyAnswers.styleguide));
const modules = getModulesList(config);
return askInstallModules(modules, earlyAnswers.packageJsonExists)
.then(() => writeFile(config, earlyAnswers.format));
}
if (earlyAnswers.source === "auto") {
const combinedAnswers = Object.assign({}, earlyAnswers);
const config = processAnswers(combinedAnswers);
const modules = getModulesList(config);
return askInstallModules(modules).then(() => writeFile(config, earlyAnswers.format));
}
// continue with the style questions otherwise...
return inquirer.prompt([
{
type: "list",
name: "indent",
message: "What style of indentation do you use?",
default: "tab",
choices: [{ name: "Tabs", value: "tab" }, { name: "Spaces", value: 4 }]
},
{
type: "list",
name: "quotes",
message: "What quotes do you use for strings?",
default: "double",
choices: [{ name: "Double", value: "double" }, { name: "Single", value: "single" }]
},
{
type: "list",
name: "linebreak",
message: "What line endings do you use?",
default: "unix",
choices: [{ name: "Unix", value: "unix" }, { name: "Windows", value: "windows" }]
},
{
type: "confirm",
name: "semi",
message: "Do you require semicolons?",
default: true
},
{
type: "list",
name: "format",
message: "What format do you want your config file to be in?",
default: "JavaScript",
choices: ["JavaScript", "YAML", "JSON"]
}
]).then(answers => {
const totalAnswers = Object.assign({}, earlyAnswers, answers);
const config = processAnswers(totalAnswers);
const modules = getModulesList(config);
return askInstallModules(modules).then(() => writeFile(config, answers.format));
});
});
} | [
"function",
"promptUser",
"(",
")",
"{",
"return",
"inquirer",
".",
"prompt",
"(",
"[",
"{",
"type",
":",
"\"list\"",
",",
"name",
":",
"\"purpose\"",
",",
"message",
":",
"\"How would you like to use ESLint?\"",
",",
"default",
":",
"\"problems\"",
",",
"choi... | /* istanbul ignore next: no need to test inquirer
Ask use a few questions on command prompt
@returns {Promise} The promise with the result of the prompt | [
"/",
"*",
"istanbul",
"ignore",
"next",
":",
"no",
"need",
"to",
"test",
"inquirer",
"Ask",
"use",
"a",
"few",
"questions",
"on",
"command",
"prompt"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-initializer.js#L442-L637 | train | Prompt user for user input | [
30522,
3853,
25732,
20330,
1006,
1007,
1063,
2709,
1999,
15549,
14544,
1012,
25732,
1006,
1031,
1063,
2828,
1024,
1000,
2862,
1000,
1010,
2171,
1024,
1000,
3800,
1000,
1010,
4471,
1024,
1000,
2129,
2052,
2017,
2066,
2000,
2224,
9686,
4115,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
laurent22/joplin | Clipper/joplin-webclipper/content_scripts/Readability.js | function(element) {
// There should be exactly 1 element child which is a P:
if (element.children.length != 1 || element.children[0].tagName !== "P") {
return false;
}
// And there should be no text nodes with real content
return !this._someNode(element.childNodes, function(node) {
return node.nodeType === this.TEXT_NODE &&
this.REGEXPS.hasContent.test(node.textContent);
});
} | javascript | function(element) {
// There should be exactly 1 element child which is a P:
if (element.children.length != 1 || element.children[0].tagName !== "P") {
return false;
}
// And there should be no text nodes with real content
return !this._someNode(element.childNodes, function(node) {
return node.nodeType === this.TEXT_NODE &&
this.REGEXPS.hasContent.test(node.textContent);
});
} | [
"function",
"(",
"element",
")",
"{",
"// There should be exactly 1 element child which is a P:",
"if",
"(",
"element",
".",
"children",
".",
"length",
"!=",
"1",
"||",
"element",
".",
"children",
"[",
"0",
"]",
".",
"tagName",
"!==",
"\"P\"",
")",
"{",
"retur... | Check if this node has only whitespace and a single P element
Returns false if the DIV node contains non-empty text nodes
or if it contains no P or more than 1 element.
@param Element | [
"Check",
"if",
"this",
"node",
"has",
"only",
"whitespace",
"and",
"a",
"single",
"P",
"element",
"Returns",
"false",
"if",
"the",
"DIV",
"node",
"contains",
"non",
"-",
"empty",
"text",
"nodes",
"or",
"if",
"it",
"contains",
"no",
"P",
"or",
"more",
"... | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L1284-L1295 | train | Returns true if the element has no children | [
30522,
3853,
1006,
5783,
1007,
1063,
1013,
1013,
2045,
2323,
2022,
3599,
1015,
5783,
2775,
2029,
2003,
1037,
1052,
1024,
2065,
1006,
5783,
1012,
2336,
1012,
3091,
999,
1027,
1015,
1064,
1064,
5783,
1012,
2336,
1031,
1014,
1033,
1012,
6415... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
zeit/now-cli | src/commands/billing/index.js | buildInquirerChoices | function buildInquirerChoices(cards) {
return cards.sources.map(source => {
const _default =
source.id === cards.defaultSource ? ` ${chalk.bold('(default)')}` : '';
const id = `${chalk.cyan(`ID: ${source.id}`)}${_default}`;
const number = `${chalk.gray('#### ').repeat(3)}${source.last4 ||
source.card.last4}`;
const str = [
id,
indent(source.name || source.owner.name, 2),
indent(`${source.brand || source.card.brand} ${number}`, 2)
].join('\n');
return {
name: str, // Will be displayed by Inquirer
value: source.id, // Will be used to identify the answer
short: source.id // Will be displayed after the users answers
};
});
} | javascript | function buildInquirerChoices(cards) {
return cards.sources.map(source => {
const _default =
source.id === cards.defaultSource ? ` ${chalk.bold('(default)')}` : '';
const id = `${chalk.cyan(`ID: ${source.id}`)}${_default}`;
const number = `${chalk.gray('#### ').repeat(3)}${source.last4 ||
source.card.last4}`;
const str = [
id,
indent(source.name || source.owner.name, 2),
indent(`${source.brand || source.card.brand} ${number}`, 2)
].join('\n');
return {
name: str, // Will be displayed by Inquirer
value: source.id, // Will be used to identify the answer
short: source.id // Will be displayed after the users answers
};
});
} | [
"function",
"buildInquirerChoices",
"(",
"cards",
")",
"{",
"return",
"cards",
".",
"sources",
".",
"map",
"(",
"source",
"=>",
"{",
"const",
"_default",
"=",
"source",
".",
"id",
"===",
"cards",
".",
"defaultSource",
"?",
"`",
"${",
"chalk",
".",
"bold"... | Builds a `choices` object that can be passesd to inquirer.prompt() | [
"Builds",
"a",
"choices",
"object",
"that",
"can",
"be",
"passesd",
"to",
"inquirer",
".",
"prompt",
"()"
] | b53d907b745126113bc3e251ac2451088026a363 | https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/commands/billing/index.js#L84-L103 | train | Build inquirer choices | [
30522,
3853,
3857,
2378,
15549,
14544,
9905,
23522,
1006,
5329,
1007,
1063,
2709,
5329,
1012,
4216,
1012,
4949,
1006,
3120,
1027,
1028,
1063,
9530,
3367,
1035,
12398,
1027,
3120,
1012,
8909,
1027,
1027,
1027,
5329,
1012,
12398,
6499,
3126,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/SinglePlanningCalendarUtilities.js | AppointmentNode | function AppointmentNode(oData) {
this.data = oData;
this.level = 0;
this.width = 1;
this.prev = null;
this.next = null;
} | javascript | function AppointmentNode(oData) {
this.data = oData;
this.level = 0;
this.width = 1;
this.prev = null;
this.next = null;
} | [
"function",
"AppointmentNode",
"(",
"oData",
")",
"{",
"this",
".",
"data",
"=",
"oData",
";",
"this",
".",
"level",
"=",
"0",
";",
"this",
".",
"width",
"=",
"1",
";",
"this",
".",
"prev",
"=",
"null",
";",
"this",
".",
"next",
"=",
"null",
";",... | Appointments Node | [
"Appointments",
"Node"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/SinglePlanningCalendarUtilities.js#L10-L16 | train | Appointment node | [
30522,
3853,
6098,
3630,
3207,
1006,
1051,
2850,
2696,
1007,
1063,
2023,
1012,
2951,
1027,
1051,
2850,
2696,
1025,
2023,
1012,
2504,
1027,
1014,
1025,
2023,
1012,
9381,
1027,
1015,
1025,
2023,
1012,
3653,
2615,
1027,
19701,
1025,
2023,
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... |
eslint/eslint | lib/rules/no-implicit-coercion.js | isConcatWithEmptyString | function isConcatWithEmptyString(node) {
return node.operator === "+" && (
(isEmptyString(node.left) && !astUtils.isStringLiteral(node.right)) ||
(isEmptyString(node.right) && !astUtils.isStringLiteral(node.left))
);
} | javascript | function isConcatWithEmptyString(node) {
return node.operator === "+" && (
(isEmptyString(node.left) && !astUtils.isStringLiteral(node.right)) ||
(isEmptyString(node.right) && !astUtils.isStringLiteral(node.left))
);
} | [
"function",
"isConcatWithEmptyString",
"(",
"node",
")",
"{",
"return",
"node",
".",
"operator",
"===",
"\"+\"",
"&&",
"(",
"(",
"isEmptyString",
"(",
"node",
".",
"left",
")",
"&&",
"!",
"astUtils",
".",
"isStringLiteral",
"(",
"node",
".",
"right",
")",
... | Checks whether or not a node is a concatenating with an empty string.
@param {ASTNode} node - A BinaryExpression node to check.
@returns {boolean} Whether or not the node is a concatenating with an empty string. | [
"Checks",
"whether",
"or",
"not",
"a",
"node",
"is",
"a",
"concatenating",
"with",
"an",
"empty",
"string",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-implicit-coercion.js#L124-L129 | train | Checks whether or not a node is a concatenation with an empty string | [
30522,
3853,
2003,
8663,
11266,
24415,
6633,
13876,
27268,
4892,
1006,
13045,
1007,
1063,
2709,
13045,
1012,
6872,
1027,
1027,
1027,
1000,
1009,
1000,
1004,
1004,
1006,
1006,
2003,
6633,
13876,
27268,
4892,
1006,
13045,
1012,
2187,
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... |
openlayers/openlayers | src/ol/interaction/Draw.js | getMode | function getMode(type) {
let mode;
if (type === GeometryType.POINT ||
type === GeometryType.MULTI_POINT) {
mode = Mode.POINT;
} else if (type === GeometryType.LINE_STRING ||
type === GeometryType.MULTI_LINE_STRING) {
mode = Mode.LINE_STRING;
} else if (type === GeometryType.POLYGON ||
type === GeometryType.MULTI_POLYGON) {
mode = Mode.POLYGON;
} else if (type === GeometryType.CIRCLE) {
mode = Mode.CIRCLE;
}
return (
/** @type {!Mode} */ (mode)
);
} | javascript | function getMode(type) {
let mode;
if (type === GeometryType.POINT ||
type === GeometryType.MULTI_POINT) {
mode = Mode.POINT;
} else if (type === GeometryType.LINE_STRING ||
type === GeometryType.MULTI_LINE_STRING) {
mode = Mode.LINE_STRING;
} else if (type === GeometryType.POLYGON ||
type === GeometryType.MULTI_POLYGON) {
mode = Mode.POLYGON;
} else if (type === GeometryType.CIRCLE) {
mode = Mode.CIRCLE;
}
return (
/** @type {!Mode} */ (mode)
);
} | [
"function",
"getMode",
"(",
"type",
")",
"{",
"let",
"mode",
";",
"if",
"(",
"type",
"===",
"GeometryType",
".",
"POINT",
"||",
"type",
"===",
"GeometryType",
".",
"MULTI_POINT",
")",
"{",
"mode",
"=",
"Mode",
".",
"POINT",
";",
"}",
"else",
"if",
"(... | Get the drawing mode. The mode for mult-part geometries is the same as for
their single-part cousins.
@param {GeometryType} type Geometry type.
@return {Mode} Drawing mode. | [
"Get",
"the",
"drawing",
"mode",
".",
"The",
"mode",
"for",
"mult",
"-",
"part",
"geometries",
"is",
"the",
"same",
"as",
"for",
"their",
"single",
"-",
"part",
"cousins",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/interaction/Draw.js#L1032-L1049 | train | Returns the mode of a polygon or polygon | [
30522,
3853,
2131,
5302,
3207,
1006,
2828,
1007,
1063,
2292,
5549,
1025,
2065,
1006,
2828,
1027,
1027,
1027,
10988,
13874,
1012,
2391,
1064,
1064,
2828,
1027,
1027,
1027,
10988,
13874,
1012,
4800,
1035,
2391,
1007,
1063,
5549,
1027,
5549,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
TryGhost/Ghost | core/server/models/plugins/pagination.js | addLimitAndOffset | function addLimitAndOffset(model, options) {
if (_.isNumber(options.limit)) {
model
.query('limit', options.limit)
.query('offset', options.limit * (options.page - 1));
}
} | javascript | function addLimitAndOffset(model, options) {
if (_.isNumber(options.limit)) {
model
.query('limit', options.limit)
.query('offset', options.limit * (options.page - 1));
}
} | [
"function",
"addLimitAndOffset",
"(",
"model",
",",
"options",
")",
"{",
"if",
"(",
"_",
".",
"isNumber",
"(",
"options",
".",
"limit",
")",
")",
"{",
"model",
".",
"query",
"(",
"'limit'",
",",
"options",
".",
"limit",
")",
".",
"query",
"(",
"'offs... | ### Query
Apply the necessary parameters to paginate the query
@param {bookshelf.Model} model
@param {options} options | [
"###",
"Query",
"Apply",
"the",
"necessary",
"parameters",
"to",
"paginate",
"the",
"query"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/plugins/pagination.js#L52-L58 | train | Add limit and offset to the model | [
30522,
3853,
5587,
17960,
25451,
3527,
21807,
3388,
1006,
2944,
1010,
7047,
1007,
1063,
2065,
1006,
1035,
1012,
3475,
29440,
1006,
7047,
1012,
5787,
1007,
1007,
1063,
2944,
1012,
23032,
1006,
1005,
5787,
1005,
1010,
7047,
1012,
5787,
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... |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/chart.js/Chart.js | function(rawValue) {
if (rawValue && rawValue.t !== undefined) {
rawValue = rawValue.t;
}
return core_scale.prototype.getRightValue.call(this, rawValue);
} | javascript | function(rawValue) {
if (rawValue && rawValue.t !== undefined) {
rawValue = rawValue.t;
}
return core_scale.prototype.getRightValue.call(this, rawValue);
} | [
"function",
"(",
"rawValue",
")",
"{",
"if",
"(",
"rawValue",
"&&",
"rawValue",
".",
"t",
"!==",
"undefined",
")",
"{",
"rawValue",
"=",
"rawValue",
".",
"t",
";",
"}",
"return",
"core_scale",
".",
"prototype",
".",
"getRightValue",
".",
"call",
"(",
"... | Allows data to be referenced via 't' attribute | [
"Allows",
"data",
"to",
"be",
"referenced",
"via",
"t",
"attribute"
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L13033-L13038 | train | Get the right value of the scale | [
30522,
3853,
1006,
6315,
10175,
30524,
10175,
5657,
1012,
1056,
999,
1027,
1027,
6151,
28344,
1007,
1063,
6315,
10175,
5657,
1027,
6315,
10175,
5657,
1012,
1056,
1025,
1065,
2709,
4563,
1035,
4094,
1012,
8773,
1012,
2131,
15950,
10175,
5657... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | scripts/utopia.js | function(object, objects) {
for(var i=0; i<arguments.length; i++) {
var o = arguments[i];
for(var j in o) {
if(!(j in object)) {
object[j] = o[j];
}
}
}
return object;
} | javascript | function(object, objects) {
for(var i=0; i<arguments.length; i++) {
var o = arguments[i];
for(var j in o) {
if(!(j in object)) {
object[j] = o[j];
}
}
}
return object;
} | [
"function",
"(",
"object",
",",
"objects",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"o",
"=",
"arguments",
"[",
"i",
"]",
";",
"for",
"(",
"var",
"j",
"in",
"o",
... | Copies the properties of one or more objects onto the first one
When there is a collision, the first object wins | [
"Copies",
"the",
"properties",
"of",
"one",
"or",
"more",
"objects",
"onto",
"the",
"first",
"one",
"When",
"there",
"is",
"a",
"collision",
"the",
"first",
"object",
"wins"
] | acceb3b56f0e8362a7ef274dbd85b17611df2ec4 | https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/scripts/utopia.js#L130-L142 | train | This function is a helper function to merge objects into object | [
30522,
3853,
1006,
4874,
1010,
5200,
1007,
1063,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
9918,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
13075,
1051,
1027,
9918,
1031,
1045,
1033,
1025,
2005,
1006,
13075,
1046,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | genAssignmentCode | function genAssignmentCode (
value,
assignment
) {
var modelRs = parseModel(value);
if (modelRs.idx === null) {
return (value + "=" + assignment)
} else {
return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
"if (!Array.isArray($$exp)){" +
value + "=" + assignment + "}" +
"else{$$exp.splice($$idx, 1, " + assignment + ")}"
}
} | javascript | function genAssignmentCode (
value,
assignment
) {
var modelRs = parseModel(value);
if (modelRs.idx === null) {
return (value + "=" + assignment)
} else {
return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
"if (!Array.isArray($$exp)){" +
value + "=" + assignment + "}" +
"else{$$exp.splice($$idx, 1, " + assignment + ")}"
}
} | [
"function",
"genAssignmentCode",
"(",
"value",
",",
"assignment",
")",
"{",
"var",
"modelRs",
"=",
"parseModel",
"(",
"value",
")",
";",
"if",
"(",
"modelRs",
".",
"idx",
"===",
"null",
")",
"{",
"return",
"(",
"value",
"+",
"\"=\"",
"+",
"assignment",
... | Cross-platform codegen helper for generating v-model value assignment code. | [
"Cross",
"-",
"platform",
"codegen",
"helper",
"for",
"generating",
"v",
"-",
"model",
"value",
"assignment",
"code",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L2676-L2689 | train | Generate code for assignment | [
30522,
3853,
8991,
12054,
24838,
16044,
1006,
3643,
1010,
8775,
1007,
1063,
13075,
2944,
2869,
1027,
11968,
3366,
5302,
9247,
1006,
3643,
1007,
1025,
2065,
1006,
2944,
2869,
1012,
8909,
2595,
1027,
1027,
1027,
19701,
1007,
1063,
2709,
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... |
aframevr/aframe | src/components/animation.js | function () {
var data = this.data;
this.updateConfig();
this.animationIsPlaying = false;
this.animation = anime(this.config);
this.animation.began = true;
this.removeEventListeners();
this.addEventListeners();
// Wait for start events for animation.
if (!data.autoplay || data.startEvents && data.startEvents.length) { return; }
// Delay animation.
if (data.delay) {
setTimeout(this.beginAnimation, data.delay);
return;
}
// Play animation.
this.beginAnimation();
} | javascript | function () {
var data = this.data;
this.updateConfig();
this.animationIsPlaying = false;
this.animation = anime(this.config);
this.animation.began = true;
this.removeEventListeners();
this.addEventListeners();
// Wait for start events for animation.
if (!data.autoplay || data.startEvents && data.startEvents.length) { return; }
// Delay animation.
if (data.delay) {
setTimeout(this.beginAnimation, data.delay);
return;
}
// Play animation.
this.beginAnimation();
} | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
";",
"this",
".",
"updateConfig",
"(",
")",
";",
"this",
".",
"animationIsPlaying",
"=",
"false",
";",
"this",
".",
"animation",
"=",
"anime",
"(",
"this",
".",
"config",
")",
";",
... | Start animation from scratch. | [
"Start",
"animation",
"from",
"scratch",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/animation.js#L162-L184 | train | Start animation. | [
30522,
3853,
1006,
1007,
1063,
13075,
2951,
1027,
2023,
1012,
2951,
1025,
2023,
1012,
10651,
8663,
8873,
2290,
1006,
1007,
1025,
2023,
1012,
7284,
2483,
13068,
2075,
1027,
6270,
1025,
2023,
1012,
7284,
1027,
8750,
1006,
2023,
1012,
9530,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | addNodesToDrag | function addNodesToDrag(nodes, opts) {
opts = opts || {};
var hasCompoundNodes = nodes.cy().hasCompoundNodes();
if (opts.inDragLayer) {
nodes.forEach(setInDragLayer);
nodes.neighborhood().stdFilter(function (ele) {
return !hasCompoundNodes || ele.isEdge();
}).forEach(setInDragLayer);
}
if (opts.addToList) {
nodes.forEach(function (ele) {
addToDragList(ele, opts);
});
}
addDescendantsToDrag(nodes, opts); // always add to drag
// also add nodes and edges related to the topmost ancestor
updateAncestorsInDragLayer(nodes, {
inDragLayer: opts.inDragLayer
});
r.updateCachedGrabbedEles();
} | javascript | function addNodesToDrag(nodes, opts) {
opts = opts || {};
var hasCompoundNodes = nodes.cy().hasCompoundNodes();
if (opts.inDragLayer) {
nodes.forEach(setInDragLayer);
nodes.neighborhood().stdFilter(function (ele) {
return !hasCompoundNodes || ele.isEdge();
}).forEach(setInDragLayer);
}
if (opts.addToList) {
nodes.forEach(function (ele) {
addToDragList(ele, opts);
});
}
addDescendantsToDrag(nodes, opts); // always add to drag
// also add nodes and edges related to the topmost ancestor
updateAncestorsInDragLayer(nodes, {
inDragLayer: opts.inDragLayer
});
r.updateCachedGrabbedEles();
} | [
"function",
"addNodesToDrag",
"(",
"nodes",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"hasCompoundNodes",
"=",
"nodes",
".",
"cy",
"(",
")",
".",
"hasCompoundNodes",
"(",
")",
";",
"if",
"(",
"opts",
".",
"inDragLayer",
... | adds the given nodes and its neighbourhood to the drag layer | [
"adds",
"the",
"given",
"nodes",
"and",
"its",
"neighbourhood",
"to",
"the",
"drag",
"layer"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L23307-L23331 | train | add nodes to drag layer | [
30522,
3853,
5587,
3630,
6155,
3406,
7265,
2290,
1006,
14164,
1010,
23569,
2015,
1007,
1063,
23569,
2015,
1027,
23569,
2015,
1064,
1064,
1063,
1065,
1025,
13075,
2038,
9006,
6873,
8630,
3630,
6155,
1027,
14164,
1012,
22330,
1006,
1007,
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/languageTools/ClientLoader.js | initDomainAndHandleNodeCrash | function initDomainAndHandleNodeCrash() {
clientInfoDomain = new NodeDomain("LanguageClientInfo", _domainPath);
//Initialize LanguageClientInfo once the domain has successfully loaded.
clientInfoDomain.promise().done(function () {
sendLanguageClientInfo();
//This is to handle the node failure. If the node process dies, we get an on close
//event on the websocket connection object. Brackets then spawns another process and
//restablishes the connection. Once the connection is restablished we send reinitialize
//the LanguageClient info.
clientInfoDomain.connection.on("close", function (event, reconnectedPromise) {
reconnectedPromise.done(sendLanguageClientInfo);
});
}).fail(function (err) {
console.error("ClientInfo domain could not be loaded: ", err);
});
} | javascript | function initDomainAndHandleNodeCrash() {
clientInfoDomain = new NodeDomain("LanguageClientInfo", _domainPath);
//Initialize LanguageClientInfo once the domain has successfully loaded.
clientInfoDomain.promise().done(function () {
sendLanguageClientInfo();
//This is to handle the node failure. If the node process dies, we get an on close
//event on the websocket connection object. Brackets then spawns another process and
//restablishes the connection. Once the connection is restablished we send reinitialize
//the LanguageClient info.
clientInfoDomain.connection.on("close", function (event, reconnectedPromise) {
reconnectedPromise.done(sendLanguageClientInfo);
});
}).fail(function (err) {
console.error("ClientInfo domain could not be loaded: ", err);
});
} | [
"function",
"initDomainAndHandleNodeCrash",
"(",
")",
"{",
"clientInfoDomain",
"=",
"new",
"NodeDomain",
"(",
"\"LanguageClientInfo\"",
",",
"_domainPath",
")",
";",
"//Initialize LanguageClientInfo once the domain has successfully loaded.",
"clientInfoDomain",
".",
"promise",
... | This function starts a domain which initializes the LanguageClient node module
required by the Language Server Protocol framework in Brackets. All the LSP clients
can only be successfully initiated once this domain has been successfully loaded and
the LanguageClient info initialized. Refer to sendLanguageClientInfo for more. | [
"This",
"function",
"starts",
"a",
"domain",
"which",
"initializes",
"the",
"LanguageClient",
"node",
"module",
"required",
"by",
"the",
"Language",
"Server",
"Protocol",
"framework",
"in",
"Brackets",
".",
"All",
"the",
"LSP",
"clients",
"can",
"only",
"be",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/languageTools/ClientLoader.js#L158-L173 | train | This function is called by the node module when the node crashes. | [
30522,
3853,
1999,
4183,
9527,
27971,
4859,
11774,
7770,
10244,
26775,
11823,
1006,
1007,
1063,
7396,
2378,
14876,
9527,
8113,
1027,
2047,
13045,
9527,
8113,
1006,
1000,
2653,
20464,
11638,
2378,
14876,
1000,
1010,
1035,
5884,
15069,
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... |
SeleniumHQ/selenium | javascript/webdriver/logging.js | normalizeLevel | function normalizeLevel(level) {
if (level.value <= Logger.Level.ALL.value) { // ALL is 0.
return Logger.Level.ALL;
} else if (level.value === Logger.Level.OFF.value) { // OFF is Infinity
return Logger.Level.OFF;
} else if (level.value < Logger.Level.INFO.value) {
return Logger.Level.DEBUG;
} else if (level.value < Logger.Level.WARNING.value) {
return Logger.Level.INFO;
} else if (level.value < Logger.Level.SEVERE.value) {
return Logger.Level.WARNING;
} else {
return Logger.Level.SEVERE;
}
} | javascript | function normalizeLevel(level) {
if (level.value <= Logger.Level.ALL.value) { // ALL is 0.
return Logger.Level.ALL;
} else if (level.value === Logger.Level.OFF.value) { // OFF is Infinity
return Logger.Level.OFF;
} else if (level.value < Logger.Level.INFO.value) {
return Logger.Level.DEBUG;
} else if (level.value < Logger.Level.WARNING.value) {
return Logger.Level.INFO;
} else if (level.value < Logger.Level.SEVERE.value) {
return Logger.Level.WARNING;
} else {
return Logger.Level.SEVERE;
}
} | [
"function",
"normalizeLevel",
"(",
"level",
")",
"{",
"if",
"(",
"level",
".",
"value",
"<=",
"Logger",
".",
"Level",
".",
"ALL",
".",
"value",
")",
"{",
"// ALL is 0.",
"return",
"Logger",
".",
"Level",
".",
"ALL",
";",
"}",
"else",
"if",
"(",
"leve... | Normalizes a {@link Logger.Level} to one of the distinct values recognized
by WebDriver's wire protocol.
@param {!Logger.Level} level The input level.
@return {!Logger.Level} The normalized level. | [
"Normalizes",
"a",
"{"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/webdriver/logging.js#L208-L227 | train | Normalize the level | [
30522,
3853,
3671,
4697,
20414,
2884,
1006,
2504,
1007,
1063,
2065,
1006,
2504,
1012,
3643,
1026,
1027,
8833,
4590,
1012,
2504,
1012,
2035,
1012,
3643,
1007,
1063,
1013,
1013,
2035,
2003,
1014,
1012,
2709,
8833,
4590,
1012,
2504,
1012,
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... |
eslint/eslint | lib/rules/no-spaced-func.js | detectOpenSpaces | function detectOpenSpaces(node) {
const lastCalleeToken = sourceCode.getLastToken(node.callee);
let prevToken = lastCalleeToken,
parenToken = sourceCode.getTokenAfter(lastCalleeToken);
// advances to an open parenthesis.
while (
parenToken &&
parenToken.range[1] < node.range[1] &&
parenToken.value !== "("
) {
prevToken = parenToken;
parenToken = sourceCode.getTokenAfter(parenToken);
}
// look for a space between the callee and the open paren
if (parenToken &&
parenToken.range[1] < node.range[1] &&
sourceCode.isSpaceBetweenTokens(prevToken, parenToken)
) {
context.report({
node,
loc: lastCalleeToken.loc.start,
message: "Unexpected space between function name and paren.",
fix(fixer) {
return fixer.removeRange([prevToken.range[1], parenToken.range[0]]);
}
});
}
} | javascript | function detectOpenSpaces(node) {
const lastCalleeToken = sourceCode.getLastToken(node.callee);
let prevToken = lastCalleeToken,
parenToken = sourceCode.getTokenAfter(lastCalleeToken);
// advances to an open parenthesis.
while (
parenToken &&
parenToken.range[1] < node.range[1] &&
parenToken.value !== "("
) {
prevToken = parenToken;
parenToken = sourceCode.getTokenAfter(parenToken);
}
// look for a space between the callee and the open paren
if (parenToken &&
parenToken.range[1] < node.range[1] &&
sourceCode.isSpaceBetweenTokens(prevToken, parenToken)
) {
context.report({
node,
loc: lastCalleeToken.loc.start,
message: "Unexpected space between function name and paren.",
fix(fixer) {
return fixer.removeRange([prevToken.range[1], parenToken.range[0]]);
}
});
}
} | [
"function",
"detectOpenSpaces",
"(",
"node",
")",
"{",
"const",
"lastCalleeToken",
"=",
"sourceCode",
".",
"getLastToken",
"(",
"node",
".",
"callee",
")",
";",
"let",
"prevToken",
"=",
"lastCalleeToken",
",",
"parenToken",
"=",
"sourceCode",
".",
"getTokenAfter... | Check if open space is present in a function name
@param {ASTNode} node node to evaluate
@returns {void}
@private | [
"Check",
"if",
"open",
"space",
"is",
"present",
"in",
"a",
"function",
"name"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-spaced-func.js#L42-L71 | train | Detects open spaces between the callee and the open parenthesis. | [
30522,
3853,
11487,
26915,
23058,
2015,
1006,
13045,
1007,
1063,
9530,
3367,
2197,
9289,
10559,
18715,
2368,
1027,
3120,
16044,
1012,
2131,
8523,
9284,
7520,
1006,
13045,
1012,
2655,
4402,
1007,
1025,
2292,
3653,
2615,
18715,
2368,
1027,
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... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (i)
{
var req = this._requests[i];
if (req.dead === null) {
req.dead = new Date();
}
this._processRequest(i);
} | javascript | function (i)
{
var req = this._requests[i];
if (req.dead === null) {
req.dead = new Date();
}
this._processRequest(i);
} | [
"function",
"(",
"i",
")",
"{",
"var",
"req",
"=",
"this",
".",
"_requests",
"[",
"i",
"]",
";",
"if",
"(",
"req",
".",
"dead",
"===",
"null",
")",
"{",
"req",
".",
"dead",
"=",
"new",
"Date",
"(",
")",
";",
"}",
"this",
".",
"_processRequest",... | PrivateFunction: _restartRequest
_Private_ function to restart a request that is presumed dead.
Parameters:
(Integer) i - The index of the request in the queue. | [
"PrivateFunction",
":",
"_restartRequest",
"_Private_",
"function",
"to",
"restart",
"a",
"request",
"that",
"is",
"presumed",
"dead",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L4599-L4607 | train | Called by the client when a new resource is created | [
30522,
3853,
1006,
1045,
1007,
1063,
13075,
2128,
4160,
1027,
2023,
1012,
1035,
11186,
1031,
1045,
1033,
1025,
2065,
1006,
2128,
4160,
1012,
2757,
1027,
1027,
1027,
19701,
1007,
1063,
2128,
4160,
1012,
2757,
1027,
2047,
3058,
1006,
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... | |
adobe/brackets | src/extensibility/ExtensionManager.js | getCompatibilityInfo | function getCompatibilityInfo(entry, apiVersion) {
if (!entry.versions) {
var fallback = getCompatibilityInfoForVersion(entry.metadata, apiVersion);
if (fallback.isCompatible) {
fallback.isLatestVersion = true;
}
return fallback;
}
var i = entry.versions.length - 1,
latestInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);
if (latestInfo.isCompatible) {
latestInfo.isLatestVersion = true;
return latestInfo;
} else {
// Look at earlier versions (skipping very latest version since we already checked it)
for (i--; i >= 0; i--) {
var compatInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);
if (compatInfo.isCompatible) {
compatInfo.isLatestVersion = false;
compatInfo.requiresNewer = latestInfo.requiresNewer;
return compatInfo;
}
}
// No version is compatible, so just return info for the latest version
return latestInfo;
}
} | javascript | function getCompatibilityInfo(entry, apiVersion) {
if (!entry.versions) {
var fallback = getCompatibilityInfoForVersion(entry.metadata, apiVersion);
if (fallback.isCompatible) {
fallback.isLatestVersion = true;
}
return fallback;
}
var i = entry.versions.length - 1,
latestInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);
if (latestInfo.isCompatible) {
latestInfo.isLatestVersion = true;
return latestInfo;
} else {
// Look at earlier versions (skipping very latest version since we already checked it)
for (i--; i >= 0; i--) {
var compatInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);
if (compatInfo.isCompatible) {
compatInfo.isLatestVersion = false;
compatInfo.requiresNewer = latestInfo.requiresNewer;
return compatInfo;
}
}
// No version is compatible, so just return info for the latest version
return latestInfo;
}
} | [
"function",
"getCompatibilityInfo",
"(",
"entry",
",",
"apiVersion",
")",
"{",
"if",
"(",
"!",
"entry",
".",
"versions",
")",
"{",
"var",
"fallback",
"=",
"getCompatibilityInfoForVersion",
"(",
"entry",
".",
"metadata",
",",
"apiVersion",
")",
";",
"if",
"("... | Finds the newest version of the entry that is compatible with the given Brackets API version, if any.
@param {Object} entry The registry entry to check.
@param {string} apiVersion The Brackets API version to check against.
@return {{isCompatible: boolean, requiresNewer: ?boolean, compatibleVersion: ?string, isLatestVersion: boolean}}
Result contains an "isCompatible" member saying whether it's compatible. If compatible, "compatibleVersion"
specifies the newest version that is compatible and "isLatestVersion" indicates if this is the absolute
latest version of the extension or not. If !isCompatible or !isLatestVersion, "requiresNewer" says whether
the latest version is incompatible due to requiring a newer (vs. older) version of Brackets. | [
"Finds",
"the",
"newest",
"version",
"of",
"the",
"entry",
"that",
"is",
"compatible",
"with",
"the",
"given",
"Brackets",
"API",
"version",
"if",
"any",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/ExtensionManager.js#L348-L377 | train | Get compatibility info for a given version | [
30522,
3853,
2131,
9006,
24952,
8553,
2378,
14876,
1006,
4443,
1010,
17928,
27774,
1007,
1063,
2065,
1006,
999,
4443,
1012,
4617,
1007,
1063,
13075,
2991,
5963,
1027,
2131,
9006,
24952,
8553,
2378,
14876,
29278,
27774,
1006,
4443,
1012,
274... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | dist/js/materialize.js | destroy | function destroy() {
this.el.style.top = null;
this._removePinClasses();
this._removeEventHandlers();
// Remove pushpin Inst
var index = Pushpin._pushpins.indexOf(this);
Pushpin._pushpins.splice(index, 1);
} | javascript | function destroy() {
this.el.style.top = null;
this._removePinClasses();
this._removeEventHandlers();
// Remove pushpin Inst
var index = Pushpin._pushpins.indexOf(this);
Pushpin._pushpins.splice(index, 1);
} | [
"function",
"destroy",
"(",
")",
"{",
"this",
".",
"el",
".",
"style",
".",
"top",
"=",
"null",
";",
"this",
".",
"_removePinClasses",
"(",
")",
";",
"this",
".",
"_removeEventHandlers",
"(",
")",
";",
"// Remove pushpin Inst",
"var",
"index",
"=",
"Push... | Teardown component | [
"Teardown",
"component"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L8212-L8220 | train | Destroy the instance | [
30522,
3853,
6033,
1006,
1007,
1063,
2023,
1012,
3449,
1012,
2806,
1012,
2327,
1027,
19701,
1025,
2023,
1012,
1035,
6366,
8091,
26266,
2229,
1006,
1007,
1025,
2023,
1012,
1035,
6366,
18697,
3372,
11774,
12910,
1006,
1007,
1025,
1013,
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... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js | function (oEvent) {
if (this._oView) {
this._oView.destroy();
// If we had a view that means this is a navigation so we need to init the busy state
this._oContainerPage.setBusy(true);
}
var oComponent = this.getOwnerComponent();
this._sTopicid = decodeURIComponent(oEvent.getParameter("arguments").id);
this._sEntityType = oEvent.getParameter("arguments").entityType;
this._sEntityId = decodeURIComponent(oEvent.getParameter("arguments").entityId);
// API Reference lifecycle
oComponent.loadVersionInfo()
.then(function () {
// Cache allowed members
this._aAllowedMembers = this.getModel("versionData").getProperty("/allowedMembers");
}.bind(this))
.then(APIInfo.getIndexJsonPromise)
.then(this._processApiIndexAndLoadApiJson.bind(this))
.then(this._findEntityInApiJsonData.bind(this))
.then(this._buildBorrowedModel.bind(this))
.then(this._createModelAndSubView.bind(this))
.then(this._initSubView.bind(this))
.catch(function (vReason) {
// If the symbol does not exist in the available libs we redirect to the not found page
if (vReason === this.NOT_FOUND) {
this._oContainerPage.setBusy(false);
this.getRouter().myNavToWithoutHash("sap.ui.documentation.sdk.view.NotFound", "XML", false);
} else if (typeof vReason === "string") {
Log.error(vReason);
} else if (vReason.name) {
Log.error(vReason.name, vReason.message);
} else if (vReason.message) {
Log.error(vReason.message);
}
}.bind(this));
} | javascript | function (oEvent) {
if (this._oView) {
this._oView.destroy();
// If we had a view that means this is a navigation so we need to init the busy state
this._oContainerPage.setBusy(true);
}
var oComponent = this.getOwnerComponent();
this._sTopicid = decodeURIComponent(oEvent.getParameter("arguments").id);
this._sEntityType = oEvent.getParameter("arguments").entityType;
this._sEntityId = decodeURIComponent(oEvent.getParameter("arguments").entityId);
// API Reference lifecycle
oComponent.loadVersionInfo()
.then(function () {
// Cache allowed members
this._aAllowedMembers = this.getModel("versionData").getProperty("/allowedMembers");
}.bind(this))
.then(APIInfo.getIndexJsonPromise)
.then(this._processApiIndexAndLoadApiJson.bind(this))
.then(this._findEntityInApiJsonData.bind(this))
.then(this._buildBorrowedModel.bind(this))
.then(this._createModelAndSubView.bind(this))
.then(this._initSubView.bind(this))
.catch(function (vReason) {
// If the symbol does not exist in the available libs we redirect to the not found page
if (vReason === this.NOT_FOUND) {
this._oContainerPage.setBusy(false);
this.getRouter().myNavToWithoutHash("sap.ui.documentation.sdk.view.NotFound", "XML", false);
} else if (typeof vReason === "string") {
Log.error(vReason);
} else if (vReason.name) {
Log.error(vReason.name, vReason.message);
} else if (vReason.message) {
Log.error(vReason.message);
}
}.bind(this));
} | [
"function",
"(",
"oEvent",
")",
"{",
"if",
"(",
"this",
".",
"_oView",
")",
"{",
"this",
".",
"_oView",
".",
"destroy",
"(",
")",
";",
"// If we had a view that means this is a navigation so we need to init the busy state",
"this",
".",
"_oContainerPage",
".",
"setB... | Binds the view to the object path and expands the aggregated line items.
@function
@param {sap.ui.base.Event} oEvent pattern match event in route 'api'
@private | [
"Binds",
"the",
"view",
"to",
"the",
"object",
"path",
"and",
"expands",
"the",
"aggregated",
"line",
"items",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js#L55-L93 | train | This function is called when the navigation event is received from the UI5 controller. It is called when the navigation event is received from the UI5 controller. It is called when the navigation event is received from the UI5 controller. | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
1051,
8584,
1007,
1063,
2023,
1012,
1035,
1051,
8584,
1012,
6033,
1006,
1007,
1025,
1013,
1013,
2065,
2057,
2018,
1037,
3193,
2008,
2965,
2023,
2003,
1037,
91... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | examples/vector-labels.js | polygonStyleFunction | function polygonStyleFunction(feature, resolution) {
return new Style({
stroke: new Stroke({
color: 'blue',
width: 1
}),
fill: new Fill({
color: 'rgba(0, 0, 255, 0.1)'
}),
text: createTextStyle(feature, resolution, myDom.polygons)
});
} | javascript | function polygonStyleFunction(feature, resolution) {
return new Style({
stroke: new Stroke({
color: 'blue',
width: 1
}),
fill: new Fill({
color: 'rgba(0, 0, 255, 0.1)'
}),
text: createTextStyle(feature, resolution, myDom.polygons)
});
} | [
"function",
"polygonStyleFunction",
"(",
"feature",
",",
"resolution",
")",
"{",
"return",
"new",
"Style",
"(",
"{",
"stroke",
":",
"new",
"Stroke",
"(",
"{",
"color",
":",
"'blue'",
",",
"width",
":",
"1",
"}",
")",
",",
"fill",
":",
"new",
"Fill",
... | Polygons | [
"Polygons"
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/vector-labels.js#L128-L139 | train | Creates a style object for a polygon | [
30522,
3853,
26572,
7446,
21756,
2571,
11263,
27989,
1006,
3444,
1010,
5813,
1007,
1063,
2709,
2047,
2806,
1006,
1063,
6909,
1024,
2047,
6909,
1006,
1063,
3609,
1024,
1005,
2630,
1005,
1010,
9381,
1024,
1015,
1065,
1007,
1010,
6039,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/analytics/odata4analytics.js | function(oUI5Filter) {
var sFilterExpression = null,
oProperty = this._oEntityType.findPropertyByName(oUI5Filter.sPath);
if (oProperty == null) {
throw "Cannot add filter condition for unknown property name " + oUI5Filter.sPath; // TODO
}
switch (oUI5Filter.sOperator) {
case FilterOperator.BT:
sFilterExpression = "(" + oUI5Filter.sPath + " ge "
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, oProperty.type)
+ " and " + oUI5Filter.sPath + " le "
+ this._renderPropertyFilterValue(oUI5Filter.oValue2, oProperty.type)
+ ")";
break;
case FilterOperator.NB:
sFilterExpression = "(" + oUI5Filter.sPath + " lt "
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, oProperty.type)
+ " or " + oUI5Filter.sPath + " gt "
+ this._renderPropertyFilterValue(oUI5Filter.oValue2, oProperty.type)
+ ")";
break;
case FilterOperator.Contains:
case FilterOperator.NotContains:
sFilterExpression = (oUI5Filter.sOperator[0] === "N" ? "not " : "") + "substringof("
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, "Edm.String")
+ "," + oUI5Filter.sPath + ")";
break;
case FilterOperator.StartsWith:
case FilterOperator.EndsWith:
case FilterOperator.NotStartsWith:
case FilterOperator.NotEndsWith:
sFilterExpression = oUI5Filter.sOperator.toLowerCase().replace("not", "not ") + "("
+ oUI5Filter.sPath + ","
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, "Edm.String") + ")";
break;
default:
sFilterExpression = oUI5Filter.sPath + " " + oUI5Filter.sOperator.toLowerCase()
+ " " + this._renderPropertyFilterValue(oUI5Filter.oValue1, oProperty.type);
}
return sFilterExpression;
} | javascript | function(oUI5Filter) {
var sFilterExpression = null,
oProperty = this._oEntityType.findPropertyByName(oUI5Filter.sPath);
if (oProperty == null) {
throw "Cannot add filter condition for unknown property name " + oUI5Filter.sPath; // TODO
}
switch (oUI5Filter.sOperator) {
case FilterOperator.BT:
sFilterExpression = "(" + oUI5Filter.sPath + " ge "
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, oProperty.type)
+ " and " + oUI5Filter.sPath + " le "
+ this._renderPropertyFilterValue(oUI5Filter.oValue2, oProperty.type)
+ ")";
break;
case FilterOperator.NB:
sFilterExpression = "(" + oUI5Filter.sPath + " lt "
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, oProperty.type)
+ " or " + oUI5Filter.sPath + " gt "
+ this._renderPropertyFilterValue(oUI5Filter.oValue2, oProperty.type)
+ ")";
break;
case FilterOperator.Contains:
case FilterOperator.NotContains:
sFilterExpression = (oUI5Filter.sOperator[0] === "N" ? "not " : "") + "substringof("
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, "Edm.String")
+ "," + oUI5Filter.sPath + ")";
break;
case FilterOperator.StartsWith:
case FilterOperator.EndsWith:
case FilterOperator.NotStartsWith:
case FilterOperator.NotEndsWith:
sFilterExpression = oUI5Filter.sOperator.toLowerCase().replace("not", "not ") + "("
+ oUI5Filter.sPath + ","
+ this._renderPropertyFilterValue(oUI5Filter.oValue1, "Edm.String") + ")";
break;
default:
sFilterExpression = oUI5Filter.sPath + " " + oUI5Filter.sOperator.toLowerCase()
+ " " + this._renderPropertyFilterValue(oUI5Filter.oValue1, oProperty.type);
}
return sFilterExpression;
} | [
"function",
"(",
"oUI5Filter",
")",
"{",
"var",
"sFilterExpression",
"=",
"null",
",",
"oProperty",
"=",
"this",
".",
"_oEntityType",
".",
"findPropertyByName",
"(",
"oUI5Filter",
".",
"sPath",
")",
";",
"if",
"(",
"oProperty",
"==",
"null",
")",
"{",
"thr... | Render a UI5 Filter as OData condition.
@param {string} oUI5Filter The filter object to render (must not be a multi filter)
@returns {string} The $filter value for the given UI5 filter
@private | [
"Render",
"a",
"UI5",
"Filter",
"as",
"OData",
"condition",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L3333-L3376 | train | Render the filter condition | [
30522,
3853,
1006,
15068,
2072,
2629,
8873,
21928,
1007,
1063,
13075,
16420,
4014,
3334,
10288,
20110,
3258,
1027,
19701,
1010,
6728,
18981,
15010,
1027,
2023,
1012,
1035,
1051,
4765,
3012,
13874,
1012,
2424,
21572,
4842,
3723,
3762,
18442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/WorkingSetView.js | _isOpenAndDirty | function _isOpenAndDirty(file) {
// working set item might never have been opened; if so, then it's definitely not dirty
var docIfOpen = DocumentManager.getOpenDocumentForPath(file.fullPath);
return (docIfOpen && docIfOpen.isDirty);
} | javascript | function _isOpenAndDirty(file) {
// working set item might never have been opened; if so, then it's definitely not dirty
var docIfOpen = DocumentManager.getOpenDocumentForPath(file.fullPath);
return (docIfOpen && docIfOpen.isDirty);
} | [
"function",
"_isOpenAndDirty",
"(",
"file",
")",
"{",
"// working set item might never have been opened; if so, then it's definitely not dirty",
"var",
"docIfOpen",
"=",
"DocumentManager",
".",
"getOpenDocumentForPath",
"(",
"file",
".",
"fullPath",
")",
";",
"return",
"(",
... | Determines if a file is dirty
@private
@param {!File} file - file to test
@return {boolean} true if the file is dirty, false otherwise | [
"Determines",
"if",
"a",
"file",
"is",
"dirty"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetView.js#L158-L162 | train | Check if a file is dirty and if so return true | [
30522,
3853,
1035,
11163,
11837,
5685,
4305,
5339,
2100,
1006,
5371,
1007,
1063,
1013,
1013,
2551,
2275,
8875,
2453,
2196,
2031,
2042,
2441,
1025,
2065,
2061,
1010,
2059,
2009,
1005,
1055,
5791,
2025,
6530,
13075,
9986,
10128,
26915,
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... |
transloadit/uppy | packages/@uppy/companion/src/server/controllers/s3.js | getUploadedParts | function getUploadedParts (req, res, next) {
// @ts-ignore The `uppy` property is added by middleware before reaching here.
const client = req.uppy.s3Client
const { uploadId } = req.params
const { key } = req.query
if (typeof key !== 'string') {
return res.status(400).json({ error: 's3: the object key must be passed as a query parameter. For example: "?key=abc.jpg"' })
}
let parts = []
listPartsPage(0)
function listPartsPage (startAt) {
client.listParts({
Bucket: config.bucket,
Key: key,
UploadId: uploadId,
PartNumberMarker: startAt
}, (err, data) => {
if (err) {
next(err)
return
}
parts = parts.concat(data.Parts)
if (data.IsTruncated) {
// Get the next page.
listPartsPage(data.NextPartNumberMarker)
} else {
done()
}
})
}
function done () {
res.json(parts)
}
} | javascript | function getUploadedParts (req, res, next) {
// @ts-ignore The `uppy` property is added by middleware before reaching here.
const client = req.uppy.s3Client
const { uploadId } = req.params
const { key } = req.query
if (typeof key !== 'string') {
return res.status(400).json({ error: 's3: the object key must be passed as a query parameter. For example: "?key=abc.jpg"' })
}
let parts = []
listPartsPage(0)
function listPartsPage (startAt) {
client.listParts({
Bucket: config.bucket,
Key: key,
UploadId: uploadId,
PartNumberMarker: startAt
}, (err, data) => {
if (err) {
next(err)
return
}
parts = parts.concat(data.Parts)
if (data.IsTruncated) {
// Get the next page.
listPartsPage(data.NextPartNumberMarker)
} else {
done()
}
})
}
function done () {
res.json(parts)
}
} | [
"function",
"getUploadedParts",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"// @ts-ignore The `uppy` property is added by middleware before reaching here.",
"const",
"client",
"=",
"req",
".",
"uppy",
".",
"s3Client",
"const",
"{",
"uploadId",
"}",
"=",
"req",
"... | List parts that have been fully uploaded so far.
Expected URL parameters:
- uploadId - The uploadId returned from `createMultipartUpload`.
Expected query parameters:
- key - The object key in the S3 bucket.
Response JSON:
- An array of objects representing parts:
- PartNumber - the index of this part.
- ETag - a hash of this part's contents, used to refer to it.
- Size - size of this part. | [
"List",
"parts",
"that",
"have",
"been",
"fully",
"uploaded",
"so",
"far",
"."
] | 7ae18bf992d544a64da998f033258ec09a3de275 | https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/packages/@uppy/companion/src/server/controllers/s3.js#L113-L152 | train | Get the uploaded parts | [
30522,
3853,
2131,
6279,
17468,
26950,
1006,
2128,
4160,
1010,
24501,
1010,
2279,
1007,
1063,
1013,
1013,
1030,
24529,
1011,
8568,
1996,
1036,
2039,
7685,
1036,
3200,
2003,
2794,
2011,
2690,
8059,
2077,
4285,
2182,
1012,
9530,
3367,
7396,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/analytics/odata4analytics.js | function() {
if (this._oFilterExpression == null) {
var oEntityType = this._oEntitySet.getEntityType();
var oModel = this._oDimension.getContainingQueryResult().getModel();
this._oFilterExpression = new odata4analytics.FilterExpression(oModel, oEntityType
.getSchema(), oEntityType);
}
return this._oFilterExpression;
} | javascript | function() {
if (this._oFilterExpression == null) {
var oEntityType = this._oEntitySet.getEntityType();
var oModel = this._oDimension.getContainingQueryResult().getModel();
this._oFilterExpression = new odata4analytics.FilterExpression(oModel, oEntityType
.getSchema(), oEntityType);
}
return this._oFilterExpression;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_oFilterExpression",
"==",
"null",
")",
"{",
"var",
"oEntityType",
"=",
"this",
".",
"_oEntitySet",
".",
"getEntityType",
"(",
")",
";",
"var",
"oModel",
"=",
"this",
".",
"_oDimension",
".",
"getContai... | Get the filter expression for this request.
Expressions are represented by separate objects. If none exists so far, a
new expression object gets created.
@returns {sap.ui.model.analytics.odata4analytics.FilterExpression} The filter object
associated to this request.
@public
@function
@name sap.ui.model.analytics.odata4analytics.DimensionMemberSetRequest#getFilterExpression | [
"Get",
"the",
"filter",
"expression",
"for",
"this",
"request",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L5263-L5271 | train | Returns the filter expression for this dimension | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
1997,
4014,
3334,
10288,
20110,
3258,
1027,
1027,
19701,
1007,
1063,
13075,
1051,
4765,
3012,
13874,
1027,
2023,
1012,
1035,
1051,
4765,
3012,
13462,
1012,
2131,
4765,
3012,
13874... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/search/FindReplace.js | _expandWordAndAddNextToSelection | function _expandWordAndAddNextToSelection(editor, removePrimary) {
editor = editor || EditorManager.getActiveEditor();
if (!editor) {
return;
}
var selections = editor.getSelections(),
primarySel,
primaryIndex,
searchText,
added = false;
_.each(selections, function (sel, index) {
var isEmpty = (CodeMirror.cmpPos(sel.start, sel.end) === 0);
if (sel.primary) {
primarySel = sel;
primaryIndex = index;
if (!isEmpty) {
searchText = editor.document.getRange(primarySel.start, primarySel.end);
}
}
if (isEmpty) {
var wordInfo = _getWordAt(editor, sel.start);
sel.start = wordInfo.start;
sel.end = wordInfo.end;
if (sel.primary && removePrimary) {
// Get the expanded text, even though we're going to remove this selection,
// since in this case we still want to select the next match.
searchText = wordInfo.text;
}
}
});
if (searchText && searchText.length) {
// We store this as a query in the state so that if the user next does a "Find Next",
// it will use the same query (but throw away the existing selection).
var state = getSearchState(editor._codeMirror);
setQueryInfo(state, { query: searchText, isCaseSensitive: false, isRegexp: false });
// Skip over matches that are already in the selection.
var searchStart = primarySel.end,
nextMatch,
isInSelection;
do {
nextMatch = _getNextMatch(editor, false, searchStart);
if (nextMatch) {
// This is a little silly, but if we just stick the equivalence test function in here
// JSLint complains about creating a function in a loop, even though it's safe in this case.
isInSelection = _.find(selections, _.partial(_selEq, nextMatch));
searchStart = nextMatch.end;
// If we've gone all the way around, then all instances must have been selected already.
if (CodeMirror.cmpPos(searchStart, primarySel.end) === 0) {
nextMatch = null;
break;
}
}
} while (nextMatch && isInSelection);
if (nextMatch) {
nextMatch.primary = true;
selections.push(nextMatch);
added = true;
}
}
if (removePrimary) {
selections.splice(primaryIndex, 1);
}
if (added) {
// Center the new match, but avoid scrolling to matches that are already on screen.
_selectAndScrollTo(editor, selections, true, true);
} else {
// If all we did was expand some selections, don't center anything.
_selectAndScrollTo(editor, selections, false);
}
} | javascript | function _expandWordAndAddNextToSelection(editor, removePrimary) {
editor = editor || EditorManager.getActiveEditor();
if (!editor) {
return;
}
var selections = editor.getSelections(),
primarySel,
primaryIndex,
searchText,
added = false;
_.each(selections, function (sel, index) {
var isEmpty = (CodeMirror.cmpPos(sel.start, sel.end) === 0);
if (sel.primary) {
primarySel = sel;
primaryIndex = index;
if (!isEmpty) {
searchText = editor.document.getRange(primarySel.start, primarySel.end);
}
}
if (isEmpty) {
var wordInfo = _getWordAt(editor, sel.start);
sel.start = wordInfo.start;
sel.end = wordInfo.end;
if (sel.primary && removePrimary) {
// Get the expanded text, even though we're going to remove this selection,
// since in this case we still want to select the next match.
searchText = wordInfo.text;
}
}
});
if (searchText && searchText.length) {
// We store this as a query in the state so that if the user next does a "Find Next",
// it will use the same query (but throw away the existing selection).
var state = getSearchState(editor._codeMirror);
setQueryInfo(state, { query: searchText, isCaseSensitive: false, isRegexp: false });
// Skip over matches that are already in the selection.
var searchStart = primarySel.end,
nextMatch,
isInSelection;
do {
nextMatch = _getNextMatch(editor, false, searchStart);
if (nextMatch) {
// This is a little silly, but if we just stick the equivalence test function in here
// JSLint complains about creating a function in a loop, even though it's safe in this case.
isInSelection = _.find(selections, _.partial(_selEq, nextMatch));
searchStart = nextMatch.end;
// If we've gone all the way around, then all instances must have been selected already.
if (CodeMirror.cmpPos(searchStart, primarySel.end) === 0) {
nextMatch = null;
break;
}
}
} while (nextMatch && isInSelection);
if (nextMatch) {
nextMatch.primary = true;
selections.push(nextMatch);
added = true;
}
}
if (removePrimary) {
selections.splice(primaryIndex, 1);
}
if (added) {
// Center the new match, but avoid scrolling to matches that are already on screen.
_selectAndScrollTo(editor, selections, true, true);
} else {
// If all we did was expand some selections, don't center anything.
_selectAndScrollTo(editor, selections, false);
}
} | [
"function",
"_expandWordAndAddNextToSelection",
"(",
"editor",
",",
"removePrimary",
")",
"{",
"editor",
"=",
"editor",
"||",
"EditorManager",
".",
"getActiveEditor",
"(",
")",
";",
"if",
"(",
"!",
"editor",
")",
"{",
"return",
";",
"}",
"var",
"selections",
... | Expands each empty range in the selection to the nearest word boundaries. Then, if the primary selection
was already a range (even a non-word range), adds the next instance of the contents of that range as a selection.
@param {!Editor} editor The editor to search in
@param {boolean=} removePrimary Whether to remove the current primary selection in addition to adding the
next one. If true, we add the next match even if the current primary selection is a cursor (we expand it
first to determine what to match). | [
"Expands",
"each",
"empty",
"range",
"in",
"the",
"selection",
"to",
"the",
"nearest",
"word",
"boundaries",
".",
"Then",
"if",
"the",
"primary",
"selection",
"was",
"already",
"a",
"range",
"(",
"even",
"a",
"non",
"-",
"word",
"range",
")",
"adds",
"th... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindReplace.js#L276-L353 | train | Expands the word and adds the next match to the selection. | [
30522,
3853,
1035,
7818,
18351,
13832,
14141,
2638,
18413,
22282,
2571,
7542,
1006,
3559,
1010,
6366,
18098,
9581,
2854,
1007,
1063,
3559,
1027,
3559,
1064,
1064,
3559,
24805,
4590,
1012,
2131,
19620,
2098,
15660,
1006,
1007,
1025,
2065,
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... |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | matches$$1 | function matches$$1(ele) {
var self = this;
for (var j = 0; j < self.length; j++) {
var query = self[j];
if (matches(query, ele)) {
return true;
}
}
return false;
} | javascript | function matches$$1(ele) {
var self = this;
for (var j = 0; j < self.length; j++) {
var query = self[j];
if (matches(query, ele)) {
return true;
}
}
return false;
} | [
"function",
"matches$$1",
"(",
"ele",
")",
"{",
"var",
"self",
"=",
"this",
";",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"self",
".",
"length",
";",
"j",
"++",
")",
"{",
"var",
"query",
"=",
"self",
"[",
"j",
"]",
";",
"if",
"(",
"... | filter does selector match a single element? | [
"filter",
"does",
"selector",
"match",
"a",
"single",
"element?"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L7612-L7624 | train | returns true if ele matches any of the nodes in this node | [
30522,
3853,
3503,
1002,
1002,
1015,
1006,
3449,
2063,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2005,
1006,
13075,
1046,
1027,
1014,
1025,
1046,
1026,
2969,
1012,
3091,
1025,
1046,
1009,
1009,
1007,
1063,
13075,
23032,
1027,
2969,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ui5loader.js | createContextualRequire | function createContextualRequire(sContextName, bAMDCompliance) {
var fnRequire = function(vDependencies, fnCallback, fnErrCallback) {
var sModuleName;
assert(typeof vDependencies === 'string' || Array.isArray(vDependencies), "dependency param either must be a single string or an array of strings");
assert(fnCallback == null || typeof fnCallback === 'function', "callback must be a function or null/undefined");
assert(fnErrCallback == null || typeof fnErrCallback === 'function', "error callback must be a function or null/undefined");
// Probing for existing module
if ( typeof vDependencies === 'string' ) {
sModuleName = getMappedName(vDependencies + '.js', sContextName);
var oModule = Module.get(sModuleName);
// check the modules internal state
// everything from PRELOADED to LOADED (incl. FAILED) is considered erroneous
if (bAMDCompliance && oModule.state !== EXECUTING && oModule.state !== READY) {
throw new Error(
"Module '" + sModuleName + "' has not been loaded yet. " +
"Use require(['" + sModuleName + "']) to load it."
);
}
// Module is in state READY or EXECUTING; or require() was called from sap.ui.require().
// A modules value might be undefined (no return statement) even though the state is READY.
return oModule.value();
}
requireAll(sContextName, vDependencies, function(aModules) {
if ( typeof fnCallback === 'function' ) {
if ( bGlobalAsyncMode ) {
fnCallback.apply(__global, aModules);
} else {
// enforce asynchronous execution of callback even in sync mode
setTimeout(function() {
fnCallback.apply(__global, aModules);
}, 0);
}
}
}, function(oErr) {
if ( typeof fnErrCallback === 'function' ) {
if ( bGlobalAsyncMode ) {
fnErrCallback.call(__global, oErr);
} else {
setTimeout(function() {
fnErrCallback.call(__global, oErr);
}, 0);
}
} else {
throw oErr;
}
}, /* bAsync = */ bGlobalAsyncMode);
// return undefined;
};
fnRequire.toUrl = function(sName) {
var sMappedName = ensureTrailingSlash(getMappedName(sName, sContextName), sName);
return toUrl(sMappedName);
};
return fnRequire;
} | javascript | function createContextualRequire(sContextName, bAMDCompliance) {
var fnRequire = function(vDependencies, fnCallback, fnErrCallback) {
var sModuleName;
assert(typeof vDependencies === 'string' || Array.isArray(vDependencies), "dependency param either must be a single string or an array of strings");
assert(fnCallback == null || typeof fnCallback === 'function', "callback must be a function or null/undefined");
assert(fnErrCallback == null || typeof fnErrCallback === 'function', "error callback must be a function or null/undefined");
// Probing for existing module
if ( typeof vDependencies === 'string' ) {
sModuleName = getMappedName(vDependencies + '.js', sContextName);
var oModule = Module.get(sModuleName);
// check the modules internal state
// everything from PRELOADED to LOADED (incl. FAILED) is considered erroneous
if (bAMDCompliance && oModule.state !== EXECUTING && oModule.state !== READY) {
throw new Error(
"Module '" + sModuleName + "' has not been loaded yet. " +
"Use require(['" + sModuleName + "']) to load it."
);
}
// Module is in state READY or EXECUTING; or require() was called from sap.ui.require().
// A modules value might be undefined (no return statement) even though the state is READY.
return oModule.value();
}
requireAll(sContextName, vDependencies, function(aModules) {
if ( typeof fnCallback === 'function' ) {
if ( bGlobalAsyncMode ) {
fnCallback.apply(__global, aModules);
} else {
// enforce asynchronous execution of callback even in sync mode
setTimeout(function() {
fnCallback.apply(__global, aModules);
}, 0);
}
}
}, function(oErr) {
if ( typeof fnErrCallback === 'function' ) {
if ( bGlobalAsyncMode ) {
fnErrCallback.call(__global, oErr);
} else {
setTimeout(function() {
fnErrCallback.call(__global, oErr);
}, 0);
}
} else {
throw oErr;
}
}, /* bAsync = */ bGlobalAsyncMode);
// return undefined;
};
fnRequire.toUrl = function(sName) {
var sMappedName = ensureTrailingSlash(getMappedName(sName, sContextName), sName);
return toUrl(sMappedName);
};
return fnRequire;
} | [
"function",
"createContextualRequire",
"(",
"sContextName",
",",
"bAMDCompliance",
")",
"{",
"var",
"fnRequire",
"=",
"function",
"(",
"vDependencies",
",",
"fnCallback",
",",
"fnErrCallback",
")",
"{",
"var",
"sModuleName",
";",
"assert",
"(",
"typeof",
"vDepende... | identify as AMD-spec compliant loader
Create a require() function which acts in the context of the given resource.
@param {string|null} sContextName Name of the context resource (module) in URN syntax, incl. extension
@param {boolean} bAMDCompliance If set to true, the behavior of the require() function is closer to the AMD specification.
@returns {function} Require function. | [
"identify",
"as",
"AMD",
"-",
"spec",
"compliant",
"loader",
"Create",
"a",
"require",
"()",
"function",
"which",
"acts",
"in",
"the",
"context",
"of",
"the",
"given",
"resource",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L1828-L1887 | train | Creates a function that will execute a module with the given dependencies. | [
30522,
3853,
3443,
8663,
18209,
8787,
2890,
15549,
2890,
1006,
8040,
28040,
18413,
18442,
1010,
25307,
16409,
25377,
15204,
3401,
1007,
1063,
13075,
1042,
16118,
2063,
15549,
2890,
1027,
3853,
1006,
1058,
3207,
11837,
4181,
9243,
1010,
1042,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/InstallExtensionDialog.js | InstallExtensionDialog | function InstallExtensionDialog(installer, _isUpdate) {
this._installer = installer;
this._state = STATE_CLOSED;
this._installResult = null;
this._isUpdate = _isUpdate;
// Timeout before we allow user to leave STATE_INSTALL_CANCELING without waiting for a resolution
// (per-instance so we can poke it for unit testing)
this._cancelTimeout = 10 * 1000;
} | javascript | function InstallExtensionDialog(installer, _isUpdate) {
this._installer = installer;
this._state = STATE_CLOSED;
this._installResult = null;
this._isUpdate = _isUpdate;
// Timeout before we allow user to leave STATE_INSTALL_CANCELING without waiting for a resolution
// (per-instance so we can poke it for unit testing)
this._cancelTimeout = 10 * 1000;
} | [
"function",
"InstallExtensionDialog",
"(",
"installer",
",",
"_isUpdate",
")",
"{",
"this",
".",
"_installer",
"=",
"installer",
";",
"this",
".",
"_state",
"=",
"STATE_CLOSED",
";",
"this",
".",
"_installResult",
"=",
"null",
";",
"this",
".",
"_isUpdate",
... | Creates a new extension installer dialog.
@constructor
@param {{install: function(url), cancel: function()}} installer The installer backend to use. | [
"Creates",
"a",
"new",
"extension",
"installer",
"dialog",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/InstallExtensionDialog.js#L58-L67 | train | A dialog that will be used to install extensions | [
30522,
3853,
16500,
10288,
29048,
27184,
8649,
1006,
16500,
2121,
1010,
1035,
2003,
6279,
13701,
1007,
1063,
2023,
1012,
1035,
16500,
2121,
1027,
16500,
2121,
1025,
2023,
1012,
1035,
2110,
1027,
2110,
1035,
2701,
1025,
2023,
1012,
1035,
165... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/TableUtils.js | invokeDebounced | function invokeDebounced(vContext, vArguments) {
cancelTimer();
/**
* Executes a trailing invocation if it is enabled in the options.
*
* @param {boolean} [bFinal=true] Whether this is the final invocation.
*/
function _invoke(bFinal) {
bFinal = bFinal !== false;
if (bFinal) {
cancel();
}
if (mOptions.trailing) {
invoke(vContext, vArguments, null, bFinal);
}
}
if (mOptions.requestAnimationFrame) {
iTimerId = window.requestAnimationFrame(function() {
_invoke();
});
} else {
var iNow = Date.now();
var iTimeSinceLastInvocation = iLastInvocationTime == null ? 0 : iNow - iLastInvocationTime;
var iRemainingWaitTime = Math.max(0, bMaxWait ?
Math.min(mOptions.maxWait - iTimeSinceLastInvocation, mOptions.wait) :
mOptions.wait);
var bMaxWaitInvocation = iRemainingWaitTime < mOptions.wait;
iTimerId = setTimeout(function() {
if (bMaxWaitInvocation) {
var iTimerOvertime = Math.max(0, (Date.now() - iNow) - iRemainingWaitTime);
var iCancelWaitTime = mOptions.wait - iRemainingWaitTime;
if (iTimerOvertime > iCancelWaitTime) {
// The timer took longer, maybe because of a long-running synchronous execution. No need to wait more.
_invoke();
} else {
// Because there is some time left, the timer is restarted for cleanup. This is necessary for correct scheduling if
// the debounced method is called again during this time.
iTimerId = setTimeout(cancel, iCancelWaitTime - iTimerOvertime);
_invoke(false);
}
} else {
_invoke();
}
}, iRemainingWaitTime);
}
} | javascript | function invokeDebounced(vContext, vArguments) {
cancelTimer();
/**
* Executes a trailing invocation if it is enabled in the options.
*
* @param {boolean} [bFinal=true] Whether this is the final invocation.
*/
function _invoke(bFinal) {
bFinal = bFinal !== false;
if (bFinal) {
cancel();
}
if (mOptions.trailing) {
invoke(vContext, vArguments, null, bFinal);
}
}
if (mOptions.requestAnimationFrame) {
iTimerId = window.requestAnimationFrame(function() {
_invoke();
});
} else {
var iNow = Date.now();
var iTimeSinceLastInvocation = iLastInvocationTime == null ? 0 : iNow - iLastInvocationTime;
var iRemainingWaitTime = Math.max(0, bMaxWait ?
Math.min(mOptions.maxWait - iTimeSinceLastInvocation, mOptions.wait) :
mOptions.wait);
var bMaxWaitInvocation = iRemainingWaitTime < mOptions.wait;
iTimerId = setTimeout(function() {
if (bMaxWaitInvocation) {
var iTimerOvertime = Math.max(0, (Date.now() - iNow) - iRemainingWaitTime);
var iCancelWaitTime = mOptions.wait - iRemainingWaitTime;
if (iTimerOvertime > iCancelWaitTime) {
// The timer took longer, maybe because of a long-running synchronous execution. No need to wait more.
_invoke();
} else {
// Because there is some time left, the timer is restarted for cleanup. This is necessary for correct scheduling if
// the debounced method is called again during this time.
iTimerId = setTimeout(cancel, iCancelWaitTime - iTimerOvertime);
_invoke(false);
}
} else {
_invoke();
}
}, iRemainingWaitTime);
}
} | [
"function",
"invokeDebounced",
"(",
"vContext",
",",
"vArguments",
")",
"{",
"cancelTimer",
"(",
")",
";",
"/**\n\t\t\t\t * Executes a trailing invocation if it is enabled in the options.\n\t\t\t\t *\n\t\t\t\t * @param {boolean} [bFinal=true] Whether this is the final invocation.\n\t\t\t\t *... | Calls the method debounced. Multiple calls within a certain time will be reduced to one call.
@param {any} [vContext] The context of the call.
@param {Object} [vArguments] The arguments object. | [
"Calls",
"the",
"method",
"debounced",
".",
"Multiple",
"calls",
"within",
"a",
"certain",
"time",
"will",
"be",
"reduced",
"to",
"one",
"call",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1328-L1376 | train | This function is called when a method is invoked. | [
30522,
3853,
24959,
15878,
23709,
11788,
1006,
18315,
28040,
18413,
1010,
13075,
22850,
11187,
1007,
1063,
17542,
7292,
2099,
1006,
1007,
1025,
1013,
1008,
1008,
1008,
15389,
2015,
1037,
12542,
1999,
19152,
2065,
2009,
2003,
9124,
1999,
1996,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/json.js | JSONReporter | function JSONReporter(runner, options) {
Base.call(this, runner, options);
var self = this;
var tests = [];
var pending = [];
var failures = [];
var passes = [];
runner.on(EVENT_TEST_END, function(test) {
tests.push(test);
});
runner.on(EVENT_TEST_PASS, function(test) {
passes.push(test);
});
runner.on(EVENT_TEST_FAIL, function(test) {
failures.push(test);
});
runner.on(EVENT_TEST_PENDING, function(test) {
pending.push(test);
});
runner.once(EVENT_RUN_END, function() {
var obj = {
stats: self.stats,
tests: tests.map(clean),
pending: pending.map(clean),
failures: failures.map(clean),
passes: passes.map(clean)
};
runner.testResults = obj;
process.stdout.write(JSON.stringify(obj, null, 2));
});
} | javascript | function JSONReporter(runner, options) {
Base.call(this, runner, options);
var self = this;
var tests = [];
var pending = [];
var failures = [];
var passes = [];
runner.on(EVENT_TEST_END, function(test) {
tests.push(test);
});
runner.on(EVENT_TEST_PASS, function(test) {
passes.push(test);
});
runner.on(EVENT_TEST_FAIL, function(test) {
failures.push(test);
});
runner.on(EVENT_TEST_PENDING, function(test) {
pending.push(test);
});
runner.once(EVENT_RUN_END, function() {
var obj = {
stats: self.stats,
tests: tests.map(clean),
pending: pending.map(clean),
failures: failures.map(clean),
passes: passes.map(clean)
};
runner.testResults = obj;
process.stdout.write(JSON.stringify(obj, null, 2));
});
} | [
"function",
"JSONReporter",
"(",
"runner",
",",
"options",
")",
"{",
"Base",
".",
"call",
"(",
"this",
",",
"runner",
",",
"options",
")",
";",
"var",
"self",
"=",
"this",
";",
"var",
"tests",
"=",
"[",
"]",
";",
"var",
"pending",
"=",
"[",
"]",
... | Constructs a new `JSON` reporter instance.
@public
@class JSON
@memberof Mocha.reporters
@extends Mocha.reporters.Base
@param {Runner} runner - Instance triggers reporter actions.
@param {Object} [options] - runner options | [
"Constructs",
"a",
"new",
"JSON",
"reporter",
"instance",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/json.js#L33-L71 | train | A JSON reporter that reports results of a test suite. | [
30522,
3853,
1046,
3385,
2890,
6442,
2121,
1006,
5479,
1010,
7047,
1007,
1063,
2918,
1012,
2655,
1006,
2023,
1010,
5479,
1010,
7047,
1007,
1025,
13075,
2969,
1027,
2023,
1025,
13075,
5852,
1027,
1031,
1033,
1025,
13075,
14223,
1027,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | getPageOffset | function getPageOffset ( ) {
var supportPageOffset = window.pageXOffset !== undefined,
isCSS1Compat = ((document.compatMode || "") === "CSS1Compat"),
x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft,
y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
return {
x: x,
y: y
};
} | javascript | function getPageOffset ( ) {
var supportPageOffset = window.pageXOffset !== undefined,
isCSS1Compat = ((document.compatMode || "") === "CSS1Compat"),
x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft,
y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
return {
x: x,
y: y
};
} | [
"function",
"getPageOffset",
"(",
")",
"{",
"var",
"supportPageOffset",
"=",
"window",
".",
"pageXOffset",
"!==",
"undefined",
",",
"isCSS1Compat",
"=",
"(",
"(",
"document",
".",
"compatMode",
"||",
"\"\"",
")",
"===",
"\"CSS1Compat\"",
")",
",",
"x",
"=",
... | https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes | [
"https",
":",
"//",
"developer",
".",
"mozilla",
".",
"org",
"/",
"en",
"-",
"US",
"/",
"docs",
"/",
"Web",
"/",
"API",
"/",
"Window",
"/",
"scrollY#Notes"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L133-L144 | train | Get page offset | [
30522,
3853,
2131,
13704,
27475,
3388,
1006,
1007,
1063,
13075,
2490,
13704,
27475,
3388,
1027,
3332,
1012,
3931,
2595,
27475,
3388,
999,
1027,
1027,
6151,
28344,
1010,
2003,
6169,
2015,
2487,
9006,
4502,
2102,
1027,
1006,
1006,
6254,
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/core/support/ToolsAPI.js | _getLibraries | function _getLibraries() {
var libraries = Global.versioninfo ? Global.versioninfo.libraries : undefined;
var formattedLibraries = Object.create(null);
if (libraries !== undefined) {
libraries.forEach(function (element, index, array) {
formattedLibraries[element.name] = element.version;
});
}
return formattedLibraries;
} | javascript | function _getLibraries() {
var libraries = Global.versioninfo ? Global.versioninfo.libraries : undefined;
var formattedLibraries = Object.create(null);
if (libraries !== undefined) {
libraries.forEach(function (element, index, array) {
formattedLibraries[element.name] = element.version;
});
}
return formattedLibraries;
} | [
"function",
"_getLibraries",
"(",
")",
"{",
"var",
"libraries",
"=",
"Global",
".",
"versioninfo",
"?",
"Global",
".",
"versioninfo",
".",
"libraries",
":",
"undefined",
";",
"var",
"formattedLibraries",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
... | Creates an object with the libraries and their version from the version info file.
@returns {Object}
@private | [
"Creates",
"an",
"object",
"with",
"the",
"libraries",
"and",
"their",
"version",
"from",
"the",
"version",
"info",
"file",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L59-L70 | train | Get the libraries from the global versioninfo | [
30522,
3853,
1035,
2131,
29521,
19848,
3111,
1006,
1007,
1063,
13075,
8860,
1027,
3795,
1012,
2544,
2378,
14876,
1029,
3795,
1012,
2544,
2378,
14876,
1012,
8860,
1024,
6151,
28344,
1025,
13075,
4289,
3064,
29521,
19848,
3111,
1027,
4874,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/_AnnotationHelperExpression.js | function (oPathValue, sType, mConstraints) {
var sCompositeType = "sap.ui.model.odata.type.Unit",
sComputedAnnotation = "@@requestUnitsOfMeasure",
oModel = oPathValue.model,
sPath = oPathValue.path + "@Org.OData.Measures.V1.Unit/$Path",
sPrefix = oPathValue.prefix,
sTargetPath = oModel.getObject(sPath);
function getBinding(mConstraints0, sType0, sPath0) {
return Basics.resultToString({
constraints : mConstraints0,
result : "binding",
type : sType0,
value : sPrefix + sPath0
}, false, true);
}
if (!sTargetPath) {
sCompositeType = "sap.ui.model.odata.type.Currency";
sComputedAnnotation = "@@requestCurrencyCodes";
sPath = oPathValue.path + "@Org.OData.Measures.V1.ISOCurrency/$Path";
sTargetPath = oModel.getObject(sPath);
}
if (!sTargetPath) {
return undefined;
}
return oModel.fetchObject(sPath + "/$").then(function (oTarget) {
return {
result : "composite",
type : sCompositeType,
value : (mType2Category[sType] === "number"
? "{formatOptions:{parseAsString:false},"
: "{")
+ "mode:'TwoWay',parts:["
+ getBinding(mConstraints, sType, oPathValue.value)
+ ","
+ getBinding(oModel.getConstraints(oTarget, sPath), oTarget.$Type,
sTargetPath)
+ ",{mode:'OneTime',path:'/##" + sComputedAnnotation + "',targetType:'any'}"
+ "],type:'" + sCompositeType + "'}"
};
});
} | javascript | function (oPathValue, sType, mConstraints) {
var sCompositeType = "sap.ui.model.odata.type.Unit",
sComputedAnnotation = "@@requestUnitsOfMeasure",
oModel = oPathValue.model,
sPath = oPathValue.path + "@Org.OData.Measures.V1.Unit/$Path",
sPrefix = oPathValue.prefix,
sTargetPath = oModel.getObject(sPath);
function getBinding(mConstraints0, sType0, sPath0) {
return Basics.resultToString({
constraints : mConstraints0,
result : "binding",
type : sType0,
value : sPrefix + sPath0
}, false, true);
}
if (!sTargetPath) {
sCompositeType = "sap.ui.model.odata.type.Currency";
sComputedAnnotation = "@@requestCurrencyCodes";
sPath = oPathValue.path + "@Org.OData.Measures.V1.ISOCurrency/$Path";
sTargetPath = oModel.getObject(sPath);
}
if (!sTargetPath) {
return undefined;
}
return oModel.fetchObject(sPath + "/$").then(function (oTarget) {
return {
result : "composite",
type : sCompositeType,
value : (mType2Category[sType] === "number"
? "{formatOptions:{parseAsString:false},"
: "{")
+ "mode:'TwoWay',parts:["
+ getBinding(mConstraints, sType, oPathValue.value)
+ ","
+ getBinding(oModel.getConstraints(oTarget, sPath), oTarget.$Type,
sTargetPath)
+ ",{mode:'OneTime',path:'/##" + sComputedAnnotation + "',targetType:'any'}"
+ "],type:'" + sCompositeType + "'}"
};
});
} | [
"function",
"(",
"oPathValue",
",",
"sType",
",",
"mConstraints",
")",
"{",
"var",
"sCompositeType",
"=",
"\"sap.ui.model.odata.type.Unit\"",
",",
"sComputedAnnotation",
"=",
"\"@@requestUnitsOfMeasure\"",
",",
"oModel",
"=",
"oPathValue",
".",
"model",
",",
"sPath",
... | Fetch the result object for a currency or a unit.
If <code>oPathValue.path</code> references a property which has an
<code>Org.OData.Measures.V1.ISOCurrency</code> annotation, a composite result object for
a <code>sap.ui.model.odata.type.Currency</code> type with the currency, the currency code
and the currency customizing as parts is returned.
If <code>oPathValue.path</code> references a property which has an
<code>Org.OData.Measures.V1.Unit</code> annotation, a composite result object for a
<code>sap.ui.model.odata.type.Unit</code> type with the measures, the unit and the unit
customizing as parts is returned.
@param {object} oPathValue
model, path and value information pointing to the path (see Expression object)
@param {string} sType
the type of the property referenced by <code>oPathValue.path</code>
@param {object} mConstraints
the type constraints for the property referenced by <code>oPathValue.path</code>
@returns {sap.ui.base.SyncPromise}
a sync promise which resolves with a result object for the currency or unit;
returns <code>undefined</code> if there are no unit and currency annotations for the
property referenced by <code>oPathValue.path</code>; or it is rejected with an error | [
"Fetch",
"the",
"result",
"object",
"for",
"a",
"currency",
"or",
"a",
"unit",
".",
"If",
"<code",
">",
"oPathValue",
".",
"path<",
"/",
"code",
">",
"references",
"a",
"property",
"which",
"has",
"an",
"<code",
">",
"Org",
".",
"OData",
".",
"Measures... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/_AnnotationHelperExpression.js#L438-L480 | train | Returns the binding of the given type and constraints | [
30522,
3853,
1006,
6728,
8988,
10175,
5657,
1010,
2358,
18863,
1010,
11338,
5644,
23654,
3215,
1007,
1063,
13075,
8040,
25377,
20049,
22513,
18863,
1027,
1000,
20066,
1012,
21318,
1012,
2944,
1012,
1051,
2850,
2696,
1012,
2828,
1012,
3131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
apache/incubator-echarts | src/component/dataZoom/history.js | giveStore | function giveStore(ecModel) {
var store = ecModel[ATTR];
if (!store) {
store = ecModel[ATTR] = [{}];
}
return store;
} | javascript | function giveStore(ecModel) {
var store = ecModel[ATTR];
if (!store) {
store = ecModel[ATTR] = [{}];
}
return store;
} | [
"function",
"giveStore",
"(",
"ecModel",
")",
"{",
"var",
"store",
"=",
"ecModel",
"[",
"ATTR",
"]",
";",
"if",
"(",
"!",
"store",
")",
"{",
"store",
"=",
"ecModel",
"[",
"ATTR",
"]",
"=",
"[",
"{",
"}",
"]",
";",
"}",
"return",
"store",
";",
"... | [{key: dataZoomId, value: {dataZoomId, range}}, ...]
History length of each dataZoom may be different.
this._history[0] is used to store origin range.
@type {Array.<Object>} | [
"[",
"{",
"key",
":",
"dataZoomId",
"value",
":",
"{",
"dataZoomId",
"range",
"}}",
"...",
"]",
"History",
"length",
"of",
"each",
"dataZoom",
"may",
"be",
"different",
".",
"this",
".",
"_history",
"[",
"0",
"]",
"is",
"used",
"to",
"store",
"origin",... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/dataZoom/history.js#L107-L113 | train | Get the store for the given ECModel | [
30522,
3853,
3957,
19277,
1006,
14925,
5302,
9247,
1007,
1063,
13075,
3573,
1027,
14925,
5302,
9247,
1031,
2012,
16344,
1033,
1025,
2065,
1006,
999,
3573,
1007,
1063,
3573,
1027,
14925,
5302,
9247,
1031,
2012,
16344,
1033,
1027,
1031,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/qunit/utils/ControlIterator.js | getAllLibraries | function getAllLibraries(aExcludedLibraries, bIncludeDistLayer) {
var mLibraries = sap.ui.getCore().getLoadedLibraries(),
sInfoLibName,
bNewLibrary,
oInfo,
i;
// discover what is available in order to also test other libraries than those loaded in bootstrap
oInfo = sap.ui.getVersionInfo();
for (i = 0; i < oInfo.libraries.length; i++) {
sInfoLibName = oInfo.libraries[i].name;
if (jQuery.inArray(sInfoLibName, aExcludedLibraries) === -1 && !mLibraries[sInfoLibName]) {
Log.info("Libary '" + sInfoLibName + "' is not loaded!");
try {
sap.ui.getCore().loadLibrary(sInfoLibName);
bNewLibrary = true;
} catch (e) {
// not a control lib? This happens for e.g. "themelib_sap_bluecrystal"...
}
}
}
// Renew the libraries object if new libraries are added
if (bNewLibrary) {
mLibraries = sap.ui.getCore().getLoadedLibraries();
}
// excluded libraries should even be excluded when already loaded initially
aExcludedLibraries.forEach(function(sLibraryName) {
mLibraries[sLibraryName] = undefined;
});
// ignore dist-layer libraries if requested
if (!bIncludeDistLayer) {
for (var sLibName in mLibraries) {
if (!ControlIterator.isKnownRuntimeLayerLibrary(sLibName)) {
mLibraries[sLibName] = undefined;
}
}
}
return mLibraries;
} | javascript | function getAllLibraries(aExcludedLibraries, bIncludeDistLayer) {
var mLibraries = sap.ui.getCore().getLoadedLibraries(),
sInfoLibName,
bNewLibrary,
oInfo,
i;
// discover what is available in order to also test other libraries than those loaded in bootstrap
oInfo = sap.ui.getVersionInfo();
for (i = 0; i < oInfo.libraries.length; i++) {
sInfoLibName = oInfo.libraries[i].name;
if (jQuery.inArray(sInfoLibName, aExcludedLibraries) === -1 && !mLibraries[sInfoLibName]) {
Log.info("Libary '" + sInfoLibName + "' is not loaded!");
try {
sap.ui.getCore().loadLibrary(sInfoLibName);
bNewLibrary = true;
} catch (e) {
// not a control lib? This happens for e.g. "themelib_sap_bluecrystal"...
}
}
}
// Renew the libraries object if new libraries are added
if (bNewLibrary) {
mLibraries = sap.ui.getCore().getLoadedLibraries();
}
// excluded libraries should even be excluded when already loaded initially
aExcludedLibraries.forEach(function(sLibraryName) {
mLibraries[sLibraryName] = undefined;
});
// ignore dist-layer libraries if requested
if (!bIncludeDistLayer) {
for (var sLibName in mLibraries) {
if (!ControlIterator.isKnownRuntimeLayerLibrary(sLibName)) {
mLibraries[sLibName] = undefined;
}
}
}
return mLibraries;
} | [
"function",
"getAllLibraries",
"(",
"aExcludedLibraries",
",",
"bIncludeDistLayer",
")",
"{",
"var",
"mLibraries",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getLoadedLibraries",
"(",
")",
",",
"sInfoLibName",
",",
"bNewLibrary",
",",
"oInfo",
",",... | Returns a map with all libraries found, depending on the given arguments
@param {Array} aExcludedLibraries the list of libraries to exclude
@param {boolean} bIncludeDistLayer whether the list of libraries should be restricted to known runtime-layer libraries (superset of the OpenUI5 libraries) or include any dist-layer libraries
@returns a map of library infos | [
"Returns",
"a",
"map",
"with",
"all",
"libraries",
"found",
"depending",
"on",
"the",
"given",
"arguments"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/utils/ControlIterator.js#L239-L281 | train | Returns an object containing all libraries that are not loaded yet. | [
30522,
3853,
2131,
8095,
29521,
19848,
3111,
1006,
29347,
2595,
20464,
13936,
29521,
19848,
3111,
1010,
8026,
20464,
13936,
2923,
24314,
1007,
1063,
13075,
19875,
12322,
19848,
3111,
1027,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.