repo stringclasses 192 values | path stringlengths 4 115 | func_name stringlengths 0 45 | original_string stringlengths 74 24k | language stringclasses 1 value | code stringlengths 74 24k | code_tokens listlengths 23 4.2k | docstring stringlengths 2 23.7k | docstring_tokens listlengths 1 810 | sha stringclasses 192 values | url stringlengths 90 200 | partition stringclasses 1 value | summary stringlengths 6 313 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jgthms/bulma | docs/lib/main.js | removeFromArray | function removeFromArray(array, value) {
if (array.includes(value)) {
var value_index = array.indexOf(value);
array.splice(value_index, 1);
}
return array;
} | javascript | function removeFromArray(array, value) {
if (array.includes(value)) {
var value_index = array.indexOf(value);
array.splice(value_index, 1);
}
return array;
} | [
"function",
"removeFromArray",
"(",
"array",
",",
"value",
")",
"{",
"if",
"(",
"array",
".",
"includes",
"(",
"value",
")",
")",
"{",
"var",
"value_index",
"=",
"array",
".",
"indexOf",
"(",
"value",
")",
";",
"array",
".",
"splice",
"(",
"value_index... | Utils | [
"Utils"
] | 305d51ccc5afadc4cc66da8f37257c72c0a73500 | https://github.com/jgthms/bulma/blob/305d51ccc5afadc4cc66da8f37257c72c0a73500/docs/lib/main.js#L439-L446 | train | Remove value from array | [
30522,
3853,
6366,
19699,
9626,
11335,
2100,
1006,
9140,
1010,
3643,
1007,
1063,
2065,
1006,
9140,
1012,
2950,
1006,
3643,
1007,
1007,
1063,
13075,
3643,
1035,
5950,
1027,
9140,
1012,
5950,
11253,
1006,
3643,
1007,
1025,
9140,
1012,
11867,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 (oModel) {
var mHeaders;
if (!oModel) {
return "";
}
if (typeof oModel.getHeaders === "function") {
mHeaders = oModel.getHeaders();
if (mHeaders) {
return mHeaders["x-csrf-token"];
}
}
return "";
} | javascript | function (oModel) {
var mHeaders;
if (!oModel) {
return "";
}
if (typeof oModel.getHeaders === "function") {
mHeaders = oModel.getHeaders();
if (mHeaders) {
return mHeaders["x-csrf-token"];
}
}
return "";
} | [
"function",
"(",
"oModel",
")",
"{",
"var",
"mHeaders",
";",
"if",
"(",
"!",
"oModel",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"typeof",
"oModel",
".",
"getHeaders",
"===",
"\"function\"",
")",
"{",
"mHeaders",
"=",
"oModel",
".",
"getHeaders"... | Returns XSRF Token from the Odata Model. Returns empty string if retrieval failed
@param {sap.ui.model.odata.ODataModel} oModel - OData Model
@returns {String} XSRF Token
@private | [
"Returns",
"XSRF",
"Token",
"from",
"the",
"Odata",
"Model",
".",
"Returns",
"empty",
"string",
"if",
"retrieval",
"failed"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L126-L138 | train | Returns the CSRF token from the given model | [
30522,
3853,
1006,
18168,
10244,
2140,
1007,
1063,
13075,
1049,
4974,
2545,
1025,
2065,
1006,
999,
18168,
10244,
2140,
1007,
1063,
2709,
1000,
1000,
1025,
1065,
2065,
1006,
2828,
11253,
18168,
10244,
2140,
1012,
2131,
4974,
2545,
1027,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
expressjs/express | lib/response.js | ondirectory | function ondirectory() {
if (done) return;
done = true;
var err = new Error('EISDIR, read');
err.code = 'EISDIR';
callback(err);
} | javascript | function ondirectory() {
if (done) return;
done = true;
var err = new Error('EISDIR, read');
err.code = 'EISDIR';
callback(err);
} | [
"function",
"ondirectory",
"(",
")",
"{",
"if",
"(",
"done",
")",
"return",
";",
"done",
"=",
"true",
";",
"var",
"err",
"=",
"new",
"Error",
"(",
"'EISDIR, read'",
")",
";",
"err",
".",
"code",
"=",
"'EISDIR'",
";",
"callback",
"(",
"err",
")",
";... | directory | [
"directory"
] | dc538f6e810bd462c98ee7e6aae24c64d4b1da93 | https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/lib/response.js#L1027-L1034 | train | Called when the directory is empty | [
30522,
3853,
2006,
4305,
2890,
16761,
2100,
1006,
1007,
1063,
2065,
1006,
2589,
1007,
2709,
1025,
2589,
1027,
2995,
1025,
13075,
9413,
2099,
1027,
2047,
7561,
1006,
1005,
1041,
2483,
4305,
2099,
1010,
3191,
1005,
1007,
1025,
9413,
2099,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
muaz-khan/RecordRTC | RecordRTC.js | function(config) {
this.audioBlob = config.audioBlob;
this.videoBlob = config.videoBlob;
this.gifBlob = config.gifBlob;
this.init();
return this;
} | javascript | function(config) {
this.audioBlob = config.audioBlob;
this.videoBlob = config.videoBlob;
this.gifBlob = config.gifBlob;
this.init();
return this;
} | [
"function",
"(",
"config",
")",
"{",
"this",
".",
"audioBlob",
"=",
"config",
".",
"audioBlob",
";",
"this",
".",
"videoBlob",
"=",
"config",
".",
"videoBlob",
";",
"this",
".",
"gifBlob",
"=",
"config",
".",
"gifBlob",
";",
"this",
".",
"init",
"(",
... | This method stores blobs in IndexedDB.
@method
@memberof DiskStorage
@internal
@example
DiskStorage.Store({
audioBlob: yourAudioBlob,
videoBlob: yourVideoBlob,
gifBlob : yourGifBlob
}); | [
"This",
"method",
"stores",
"blobs",
"in",
"IndexedDB",
"."
] | 3c6bad427b9da35c1cf617199ed13dda056c38ba | https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/RecordRTC.js#L4487-L4495 | train | The base class for the image | [
30522,
3853,
1006,
9530,
8873,
2290,
1007,
1063,
2023,
1012,
5746,
16558,
16429,
1027,
9530,
8873,
2290,
1012,
5746,
16558,
16429,
1025,
2023,
1012,
2678,
16558,
16429,
1027,
9530,
8873,
2290,
1012,
2678,
16558,
16429,
1025,
2023,
1012,
210... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/DemoApps.controller.js | function (sId, oBindingContext) {
var oBlockLayoutCell;
if (oBindingContext.getObject().teaser) { // teaser cell (loads fragment from demo app)
try {
sap.ui.loader.config({paths:{"test-resources":"test-resources"}});
var sRelativePath = sap.ui.require.toUrl(oBindingContext.getObject().teaser);
var oTeaser = sap.ui.xmlfragment(sId, sRelativePath);
oBlockLayoutCell = sap.ui.xmlfragment(sId, "sap.ui.documentation.sdk.view.BlockLayoutTeaserCell", this);
oBlockLayoutCell.getContent()[0].addContent(oTeaser);
sap.ui.loader.config({paths:{"test-resources":null}});
//sets the teaser to aria-hidden => gets ignored by screen reader
oTeaser.addEventDelegate({"onAfterRendering": function() {
this.getParent().getDomRef().childNodes[1].setAttribute("aria-hidden", "true");
}.bind(oTeaser)});
} catch (oException) {
Log.warning("Teaser for demo app \"" + oBindingContext.getObject().name + "\" could not be loaded: " + oException);
oBlockLayoutCell = sap.ui.xmlfragment(sId, "sap.ui.documentation.sdk.view.BlockLayoutCell", this);
}
} else { // normal cell
oBlockLayoutCell = sap.ui.xmlfragment(sId, "sap.ui.documentation.sdk.view.BlockLayoutCell", this);
}
oBlockLayoutCell.setBindingContext(oBindingContext);
return oBlockLayoutCell;
} | javascript | function (sId, oBindingContext) {
var oBlockLayoutCell;
if (oBindingContext.getObject().teaser) { // teaser cell (loads fragment from demo app)
try {
sap.ui.loader.config({paths:{"test-resources":"test-resources"}});
var sRelativePath = sap.ui.require.toUrl(oBindingContext.getObject().teaser);
var oTeaser = sap.ui.xmlfragment(sId, sRelativePath);
oBlockLayoutCell = sap.ui.xmlfragment(sId, "sap.ui.documentation.sdk.view.BlockLayoutTeaserCell", this);
oBlockLayoutCell.getContent()[0].addContent(oTeaser);
sap.ui.loader.config({paths:{"test-resources":null}});
//sets the teaser to aria-hidden => gets ignored by screen reader
oTeaser.addEventDelegate({"onAfterRendering": function() {
this.getParent().getDomRef().childNodes[1].setAttribute("aria-hidden", "true");
}.bind(oTeaser)});
} catch (oException) {
Log.warning("Teaser for demo app \"" + oBindingContext.getObject().name + "\" could not be loaded: " + oException);
oBlockLayoutCell = sap.ui.xmlfragment(sId, "sap.ui.documentation.sdk.view.BlockLayoutCell", this);
}
} else { // normal cell
oBlockLayoutCell = sap.ui.xmlfragment(sId, "sap.ui.documentation.sdk.view.BlockLayoutCell", this);
}
oBlockLayoutCell.setBindingContext(oBindingContext);
return oBlockLayoutCell;
} | [
"function",
"(",
"sId",
",",
"oBindingContext",
")",
"{",
"var",
"oBlockLayoutCell",
";",
"if",
"(",
"oBindingContext",
".",
"getObject",
"(",
")",
".",
"teaser",
")",
"{",
"// teaser cell (loads fragment from demo app)",
"try",
"{",
"sap",
".",
"ui",
".",
"lo... | /* =========================================================== /* lifecycle methods /* ===========================================================
Factory function for creating the demo app cells
@param {string} sId the id for the current cell
@param {sap.ui.model.Context} oBindingContext the context for the current cell
@return {sap.ui.layout.BlockLayoutCell} either a teaser cell or a demo app cell based on the metadata in the model
@public | [
"/",
"*",
"===========================================================",
"/",
"*",
"lifecycle",
"methods",
"/",
"*",
"===========================================================",
"Factory",
"function",
"for",
"creating",
"the",
"demo",
"app",
"cells"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/DemoApps.controller.js#L273-L297 | train | Creates a cell with the given id and binding context | [
30522,
3853,
1006,
15765,
1010,
27885,
22254,
2075,
8663,
18209,
1007,
1063,
13075,
27885,
7878,
8485,
5833,
29109,
2140,
1025,
2065,
1006,
27885,
22254,
2075,
8663,
18209,
1012,
2131,
16429,
20614,
1006,
1007,
1012,
27071,
1007,
1063,
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... | |
summernote/summernote | src/js/base/core/dom.js | listNext | function listNext(node, pred) {
pred = pred || func.fail;
const nodes = [];
while (node) {
if (pred(node)) { break; }
nodes.push(node);
node = node.nextSibling;
}
return nodes;
} | javascript | function listNext(node, pred) {
pred = pred || func.fail;
const nodes = [];
while (node) {
if (pred(node)) { break; }
nodes.push(node);
node = node.nextSibling;
}
return nodes;
} | [
"function",
"listNext",
"(",
"node",
",",
"pred",
")",
"{",
"pred",
"=",
"pred",
"||",
"func",
".",
"fail",
";",
"const",
"nodes",
"=",
"[",
"]",
";",
"while",
"(",
"node",
")",
"{",
"if",
"(",
"pred",
"(",
"node",
")",
")",
"{",
"break",
";",
... | listing next siblings (until predicate hit).
@param {Node} node
@param {Function} [pred] - predicate function | [
"listing",
"next",
"siblings",
"(",
"until",
"predicate",
"hit",
")",
"."
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L334-L344 | train | List next node in a node list | [
30522,
3853,
2862,
2638,
18413,
1006,
13045,
1010,
3653,
2094,
1007,
1063,
3653,
2094,
1027,
3653,
2094,
1064,
1064,
4569,
2278,
1012,
8246,
1025,
9530,
3367,
14164,
1027,
1031,
1033,
1025,
2096,
1006,
13045,
1007,
1063,
2065,
1006,
3653,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/core/services/aria/aria.js | hasAriaLabel | function hasAriaLabel(element) {
var node = angular.element(element)[0] || element;
/* Check if compatible node type (ie: not HTML Document node) */
if (!node.hasAttribute) {
return false;
}
/* Check label or description attributes */
return node.hasAttribute('aria-label') || node.hasAttribute('aria-labelledby') || node.hasAttribute('aria-describedby');
} | javascript | function hasAriaLabel(element) {
var node = angular.element(element)[0] || element;
/* Check if compatible node type (ie: not HTML Document node) */
if (!node.hasAttribute) {
return false;
}
/* Check label or description attributes */
return node.hasAttribute('aria-label') || node.hasAttribute('aria-labelledby') || node.hasAttribute('aria-describedby');
} | [
"function",
"hasAriaLabel",
"(",
"element",
")",
"{",
"var",
"node",
"=",
"angular",
".",
"element",
"(",
"element",
")",
"[",
"0",
"]",
"||",
"element",
";",
"/* Check if compatible node type (ie: not HTML Document node) */",
"if",
"(",
"!",
"node",
".",
"hasAt... | Check if expected element has aria label attribute
@param element | [
"Check",
"if",
"expected",
"element",
"has",
"aria",
"label",
"attribute"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/aria/aria.js#L181-L191 | train | Check if element has aria label or aria - labelledby or aria - descriptions | [
30522,
3853,
2038,
10980,
20470,
2884,
1006,
5783,
1007,
1063,
13075,
13045,
1027,
16108,
1012,
5783,
1006,
5783,
1007,
1031,
1014,
1033,
1064,
1064,
5783,
1025,
1013,
1008,
4638,
2065,
11892,
13045,
2828,
1006,
29464,
1024,
2025,
16129,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/SidebarView.js | _updateUIStates | function _updateUIStates() {
var spriteIndex,
ICON_CLASSES = ["splitview-icon-none", "splitview-icon-vertical", "splitview-icon-horizontal"],
layoutScheme = MainViewManager.getLayoutScheme();
if (layoutScheme.columns > 1) {
spriteIndex = 1;
} else if (layoutScheme.rows > 1) {
spriteIndex = 2;
} else {
spriteIndex = 0;
}
// SplitView Icon
$splitViewMenu.removeClass(ICON_CLASSES.join(" "))
.addClass(ICON_CLASSES[spriteIndex]);
// SplitView Menu
_cmdSplitNone.setChecked(spriteIndex === 0);
_cmdSplitVertical.setChecked(spriteIndex === 1);
_cmdSplitHorizontal.setChecked(spriteIndex === 2);
// Options icon
_updateWorkingSetState();
} | javascript | function _updateUIStates() {
var spriteIndex,
ICON_CLASSES = ["splitview-icon-none", "splitview-icon-vertical", "splitview-icon-horizontal"],
layoutScheme = MainViewManager.getLayoutScheme();
if (layoutScheme.columns > 1) {
spriteIndex = 1;
} else if (layoutScheme.rows > 1) {
spriteIndex = 2;
} else {
spriteIndex = 0;
}
// SplitView Icon
$splitViewMenu.removeClass(ICON_CLASSES.join(" "))
.addClass(ICON_CLASSES[spriteIndex]);
// SplitView Menu
_cmdSplitNone.setChecked(spriteIndex === 0);
_cmdSplitVertical.setChecked(spriteIndex === 1);
_cmdSplitHorizontal.setChecked(spriteIndex === 2);
// Options icon
_updateWorkingSetState();
} | [
"function",
"_updateUIStates",
"(",
")",
"{",
"var",
"spriteIndex",
",",
"ICON_CLASSES",
"=",
"[",
"\"splitview-icon-none\"",
",",
"\"splitview-icon-vertical\"",
",",
"\"splitview-icon-horizontal\"",
"]",
",",
"layoutScheme",
"=",
"MainViewManager",
".",
"getLayoutScheme"... | Update state of splitview and option elements
@private | [
"Update",
"state",
"of",
"splitview",
"and",
"option",
"elements"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/SidebarView.js#L130-L154 | train | Update UI states | [
30522,
3853,
1035,
10651,
27020,
12259,
2015,
1006,
1007,
1063,
13075,
11867,
17625,
22254,
10288,
1010,
12696,
1035,
4280,
1027,
1031,
1000,
3975,
8584,
1011,
12696,
1011,
3904,
1000,
1010,
1000,
3975,
8584,
1011,
12696,
1011,
7471,
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... |
catapult-project/catapult | netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js | announceAccessibleMessage | function announceAccessibleMessage(msg) {
var element = document.createElement('div');
element.setAttribute('aria-live', 'polite');
element.style.position = 'relative';
element.style.left = '-9999px';
element.style.height = '0px';
element.innerText = msg;
document.body.appendChild(element);
window.setTimeout(function() {
document.body.removeChild(element);
}, 0);
} | javascript | function announceAccessibleMessage(msg) {
var element = document.createElement('div');
element.setAttribute('aria-live', 'polite');
element.style.position = 'relative';
element.style.left = '-9999px';
element.style.height = '0px';
element.innerText = msg;
document.body.appendChild(element);
window.setTimeout(function() {
document.body.removeChild(element);
}, 0);
} | [
"function",
"announceAccessibleMessage",
"(",
"msg",
")",
"{",
"var",
"element",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"element",
".",
"setAttribute",
"(",
"'aria-live'",
",",
"'polite'",
")",
";",
"element",
".",
"style",
".",
"posi... | Add an accessible message to the page that will be announced to
users who have spoken feedback on, but will be invisible to all
other users. It's removed right away so it doesn't clutter the DOM.
@param {string} msg The text to be pronounced. | [
"Add",
"an",
"accessible",
"message",
"to",
"the",
"page",
"that",
"will",
"be",
"announced",
"to",
"users",
"who",
"have",
"spoken",
"feedback",
"on",
"but",
"will",
"be",
"invisible",
"to",
"all",
"other",
"users",
".",
"It",
"s",
"removed",
"right",
"... | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L35-L46 | train | announce a message to the user that is not accessible | [
30522,
3853,
14970,
6305,
9623,
19307,
7834,
3736,
3351,
1006,
5796,
2290,
1007,
1063,
13075,
5783,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1005,
4487,
2615,
1005,
1007,
1025,
5783,
1012,
2275,
19321,
3089,
8569,
2618,
1006,
1005,
9342,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/lines-around-directive.js | reportError | function reportError(node, location, expected) {
context.report({
node,
messageId: expected ? "expected" : "unexpected",
data: {
value: node.expression.value,
location
},
fix(fixer) {
const lastToken = getLastTokenOnLine(node);
if (expected) {
return location === "before" ? fixer.insertTextBefore(node, "\n") : fixer.insertTextAfter(lastToken, "\n");
}
return fixer.removeRange(location === "before" ? [node.range[0] - 1, node.range[0]] : [lastToken.range[1], lastToken.range[1] + 1]);
}
});
} | javascript | function reportError(node, location, expected) {
context.report({
node,
messageId: expected ? "expected" : "unexpected",
data: {
value: node.expression.value,
location
},
fix(fixer) {
const lastToken = getLastTokenOnLine(node);
if (expected) {
return location === "before" ? fixer.insertTextBefore(node, "\n") : fixer.insertTextAfter(lastToken, "\n");
}
return fixer.removeRange(location === "before" ? [node.range[0] - 1, node.range[0]] : [lastToken.range[1], lastToken.range[1] + 1]);
}
});
} | [
"function",
"reportError",
"(",
"node",
",",
"location",
",",
"expected",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
",",
"messageId",
":",
"expected",
"?",
"\"expected\"",
":",
"\"unexpected\"",
",",
"data",
":",
"{",
"value",
":",
"node",
".... | Report errors for newlines around directives.
@param {ASTNode} node Node to check.
@param {string} location Whether the error was found before or after the directive.
@param {boolean} expected Whether or not a newline was expected or unexpected.
@returns {void} | [
"Report",
"errors",
"for",
"newlines",
"around",
"directives",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/lines-around-directive.js#L113-L130 | train | Reports an error in the context of a node. | [
30522,
3853,
6398,
29165,
1006,
13045,
1010,
3295,
1010,
3517,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1010,
4471,
3593,
1024,
3517,
1029,
1000,
3517,
1000,
1024,
1000,
9223,
1000,
1010,
2951,
1024,
1063,
3643,
1024,
13045,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fex-team/webuploader | dist/webuploader.withoutimage.js | function( name, callback, context ) {
var me = this,
set;
if ( !callback ) {
return this;
}
set = this._events || (this._events = []);
eachEvent( name, callback, function( name, callback ) {
var handler = { e: name };
handler.cb = callback;
handler.ctx = context;
handler.ctx2 = context || me;
handler.id = set.length;
set.push( handler );
});
return this;
} | javascript | function( name, callback, context ) {
var me = this,
set;
if ( !callback ) {
return this;
}
set = this._events || (this._events = []);
eachEvent( name, callback, function( name, callback ) {
var handler = { e: name };
handler.cb = callback;
handler.ctx = context;
handler.ctx2 = context || me;
handler.id = set.length;
set.push( handler );
});
return this;
} | [
"function",
"(",
"name",
",",
"callback",
",",
"context",
")",
"{",
"var",
"me",
"=",
"this",
",",
"set",
";",
"if",
"(",
"!",
"callback",
")",
"{",
"return",
"this",
";",
"}",
"set",
"=",
"this",
".",
"_events",
"||",
"(",
"this",
".",
"_events"... | 绑定事件。
`callback`方法在执行时,arguments将会来源于trigger的时候携带的参数。如
```javascript
var obj = {};
// 使得obj有事件行为
Mediator.installTo( obj );
obj.on( 'testa', function( arg1, arg2 ) {
console.log( arg1, arg2 ); // => 'arg1', 'arg2'
});
obj.trigger( 'testa', 'arg1', 'arg2' );
```
如果`callback`中,某一个方法`return false`了,则后续的其他`callback`都不会被执行到。
切会影响到`trigger`方法的返回值,为`false`。
`on`还可以用来添加一个特殊事件`all`, 这样所有的事件触发都会响应到。同时此类`callback`中的arguments有一个不同处,
就是第一个参数为`type`,记录当前是什么事件在触发。此类`callback`的优先级比脚低,会再正常`callback`执行完后触发。
```javascript
obj.on( 'all', function( type, arg1, arg2 ) {
console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2'
});
```
@method on
@grammar on( name, callback[, context] ) => self
@param {String} name 事件名,支持多个事件用空格隔开
@param {Function} callback 事件处理器
@param {Object} [context] 事件处理器的上下文。
@return {self} 返回自身,方便链式
@chainable
@class Mediator | [
"绑定事件。"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L580-L602 | train | Add event handler | [
30522,
3853,
1006,
2171,
1010,
2655,
5963,
1010,
6123,
1007,
1063,
13075,
2033,
1027,
2023,
1010,
2275,
1025,
2065,
1006,
999,
2655,
5963,
1007,
1063,
2709,
2023,
1025,
1065,
2275,
1027,
2023,
1012,
1035,
2824,
1064,
1064,
1006,
2023,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dcloudio/mui | examples/hello-mui/js/mui.imageViewer.js | function() {
var self = this;
//绑定图片 tap 事件
document.addEventListener(enterEventName, function(event) {
if (!self.viewer) return;
var target = event.target;
if (!self.checkImage(target)) return;
self.viewer.style.display = 'block';
setTimeout(function() {
self.viewer.style.opacity = 1;
}, 0);
self.index = self.images.indexOf(target);
self.currentItem = self.createImage(self.index);
}, false);
//关系按钮事件
self.closeButton.addEventListener(tapEventName, function(event) {
self.viewer.style.opacity = 0;
setTimeout(function() {
self.viewer.style.display = 'none';
self.disposeImage(true);
}, 600);
event.preventDefault();
event.cancelBubble = true;
}, false);
//处理左右按钮
self.leftButton.addEventListener(tapEventName, function() {
self.prev();
}, false);
self.rightButton.addEventListener(tapEventName, function() {
self.next();
}, false);
//处理划动
self.mask.addEventListener($.EVENT_MOVE, function(event) {
event.preventDefault();
event.cancelBubble = true;
}, false);
self.viewer.addEventListener('swipeleft', function(event) {
if (self.scaleValue == 1) self.next();
event.preventDefault();
event.cancelBubble = true;
}, false);
self.viewer.addEventListener('swiperight', function(event) {
if (self.scaleValue == 1) self.prev();
event.preventDefault();
event.cancelBubble = true;
}, false);
//处理缩放开始
self.viewer.addEventListener($.EVENT_START, function(event) {
var touches = event.touches;
if (touches.length == 2) {
var p1 = touches[0];
var p2 = touches[1];
var x = p1.pageX - p2.pageX; //x1-x2
var y = p1.pageY - p2.pageY; //y1-y2
self.scaleStart = Math.sqrt(x * x + y * y);
self.isMultiTouch = true;
} else if (touches.length = 1) {
self.dragStart = touches[0];
}
}, false);
self.viewer.addEventListener($.EVENT_MOVE, function(event) {
var img = self.currentItem.querySelector('img');
var touches = event.changedTouches;
if (touches.length == 2) {
event.preventDefault();
event.cancelBubble = true;
var p1 = touches[0];
var p2 = touches[1];
var x = p1.pageX - p2.pageX;
var y = p1.pageY - p2.pageY;
self.scaleEnd = Math.sqrt(x * x + y * y);
self._scaleValue = (self.scaleValue * (self.scaleEnd / self.scaleStart));
//self.state.innerText = self._scaleValue;
img.style.webkitTransform = "scale(" + self._scaleValue + "," + self._scaleValue + ") "; // + " translate(" + self.dragX || 0 + "px," + self.dragY || 0 + "px)";
} else if (!self.isMultiTouch && touches.length == 1 && self.scaleValue != 1) {
event.preventDefault();
event.cancelBubble = true;
self.dragEnd = touches[0];
self._dragX = self.dragX + (self.dragEnd.pageX - self.dragStart.pageX);
self._dragY = self.dragY + (self.dragEnd.pageY - self.dragStart.pageY);
img.style.marginLeft = self._dragX + 'px';
img.style.marginTop = self._dragY + 'px';
//img.style.transform = "translate(" + self._dragX + "px," + self._dragY + "px) " + " scale(" + self.scaleValue || 1 + "," + self.scaleValue || 1 + ")";
}
}, false);
self.viewer.addEventListener($.EVENT_END, function() {
self.scaleValue = self._scaleValue || self.scaleValue;
self._scaleValue = null;
self.dragX = self._dragX;
self.dragY = self._dragY;
self._dragX = null;
self._dragY = null;
var touches = event.touches;
self.isMultiTouch = (touches.length != 0);
});
// doubletap 好像不能用
self.viewer.addEventListener('doubletap', function() {
var img = self.currentItem.querySelector('img');
if (self.scaleValue === 1) {
self.scaleValue = 2;
} else {
self.scaleValue = 1;
}
self.dragX = 0;
self.dragY = 0;
img.style.marginLeft = self.dragX + 'px';
img.style.marginTop = self.dragY + 'px';
img.style.webkitTransform = "scale(" + self.scaleValue + "," + self.scaleValue + ") "; //+ " translate(" + self.dragX || 0 + "px," + self.dragY || 0 + "px)";
self.viewer.__tap_num = 0;
}, false);
//处理缩放结束
} | javascript | function() {
var self = this;
//绑定图片 tap 事件
document.addEventListener(enterEventName, function(event) {
if (!self.viewer) return;
var target = event.target;
if (!self.checkImage(target)) return;
self.viewer.style.display = 'block';
setTimeout(function() {
self.viewer.style.opacity = 1;
}, 0);
self.index = self.images.indexOf(target);
self.currentItem = self.createImage(self.index);
}, false);
//关系按钮事件
self.closeButton.addEventListener(tapEventName, function(event) {
self.viewer.style.opacity = 0;
setTimeout(function() {
self.viewer.style.display = 'none';
self.disposeImage(true);
}, 600);
event.preventDefault();
event.cancelBubble = true;
}, false);
//处理左右按钮
self.leftButton.addEventListener(tapEventName, function() {
self.prev();
}, false);
self.rightButton.addEventListener(tapEventName, function() {
self.next();
}, false);
//处理划动
self.mask.addEventListener($.EVENT_MOVE, function(event) {
event.preventDefault();
event.cancelBubble = true;
}, false);
self.viewer.addEventListener('swipeleft', function(event) {
if (self.scaleValue == 1) self.next();
event.preventDefault();
event.cancelBubble = true;
}, false);
self.viewer.addEventListener('swiperight', function(event) {
if (self.scaleValue == 1) self.prev();
event.preventDefault();
event.cancelBubble = true;
}, false);
//处理缩放开始
self.viewer.addEventListener($.EVENT_START, function(event) {
var touches = event.touches;
if (touches.length == 2) {
var p1 = touches[0];
var p2 = touches[1];
var x = p1.pageX - p2.pageX; //x1-x2
var y = p1.pageY - p2.pageY; //y1-y2
self.scaleStart = Math.sqrt(x * x + y * y);
self.isMultiTouch = true;
} else if (touches.length = 1) {
self.dragStart = touches[0];
}
}, false);
self.viewer.addEventListener($.EVENT_MOVE, function(event) {
var img = self.currentItem.querySelector('img');
var touches = event.changedTouches;
if (touches.length == 2) {
event.preventDefault();
event.cancelBubble = true;
var p1 = touches[0];
var p2 = touches[1];
var x = p1.pageX - p2.pageX;
var y = p1.pageY - p2.pageY;
self.scaleEnd = Math.sqrt(x * x + y * y);
self._scaleValue = (self.scaleValue * (self.scaleEnd / self.scaleStart));
//self.state.innerText = self._scaleValue;
img.style.webkitTransform = "scale(" + self._scaleValue + "," + self._scaleValue + ") "; // + " translate(" + self.dragX || 0 + "px," + self.dragY || 0 + "px)";
} else if (!self.isMultiTouch && touches.length == 1 && self.scaleValue != 1) {
event.preventDefault();
event.cancelBubble = true;
self.dragEnd = touches[0];
self._dragX = self.dragX + (self.dragEnd.pageX - self.dragStart.pageX);
self._dragY = self.dragY + (self.dragEnd.pageY - self.dragStart.pageY);
img.style.marginLeft = self._dragX + 'px';
img.style.marginTop = self._dragY + 'px';
//img.style.transform = "translate(" + self._dragX + "px," + self._dragY + "px) " + " scale(" + self.scaleValue || 1 + "," + self.scaleValue || 1 + ")";
}
}, false);
self.viewer.addEventListener($.EVENT_END, function() {
self.scaleValue = self._scaleValue || self.scaleValue;
self._scaleValue = null;
self.dragX = self._dragX;
self.dragY = self._dragY;
self._dragX = null;
self._dragY = null;
var touches = event.touches;
self.isMultiTouch = (touches.length != 0);
});
// doubletap 好像不能用
self.viewer.addEventListener('doubletap', function() {
var img = self.currentItem.querySelector('img');
if (self.scaleValue === 1) {
self.scaleValue = 2;
} else {
self.scaleValue = 1;
}
self.dragX = 0;
self.dragY = 0;
img.style.marginLeft = self.dragX + 'px';
img.style.marginTop = self.dragY + 'px';
img.style.webkitTransform = "scale(" + self.scaleValue + "," + self.scaleValue + ") "; //+ " translate(" + self.dragX || 0 + "px," + self.dragY || 0 + "px)";
self.viewer.__tap_num = 0;
}, false);
//处理缩放结束
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"//绑定图片 tap 事件",
"document",
".",
"addEventListener",
"(",
"enterEventName",
",",
"function",
"(",
"event",
")",
"{",
"if",
"(",
"!",
"self",
".",
"viewer",
")",
"return",
";",
"var",
"target",
... | 绑定事件 | [
"绑定事件"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.imageViewer.js#L78-L189 | train | Add event listeners | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
100,
1822,
100,
100,
11112,
1751,
100,
6254,
1012,
5587,
18697,
3372,
9863,
24454,
1006,
4607,
18697,
3372,
18442,
1010,
3853,
1006,
2724,
1007,
1063,
2065,
1006,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/core/util/util.js | function(element) {
var parent = $mdUtil.getClosest(element, 'form');
var form = parent ? angular.element(parent).controller('form') : null;
return form ? form.$submitted : false;
} | javascript | function(element) {
var parent = $mdUtil.getClosest(element, 'form');
var form = parent ? angular.element(parent).controller('form') : null;
return form ? form.$submitted : false;
} | [
"function",
"(",
"element",
")",
"{",
"var",
"parent",
"=",
"$mdUtil",
".",
"getClosest",
"(",
"element",
",",
"'form'",
")",
";",
"var",
"form",
"=",
"parent",
"?",
"angular",
".",
"element",
"(",
"parent",
")",
".",
"controller",
"(",
"'form'",
")",
... | Returns true if the parent form of the element has been submitted.
@param element An AngularJS or HTML5 element.
@returns {boolean} | [
"Returns",
"true",
"if",
"the",
"parent",
"form",
"of",
"the",
"element",
"has",
"been",
"submitted",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L803-L808 | train | Returns true if the element is submitted | [
30522,
3853,
1006,
5783,
1007,
1063,
13075,
6687,
1027,
1002,
9108,
21823,
2140,
1012,
2131,
20464,
27465,
2102,
1006,
5783,
1010,
1005,
2433,
1005,
1007,
1025,
13075,
2433,
1027,
6687,
1029,
16108,
1012,
5783,
1006,
6687,
1007,
1012,
11486... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/core/services/ripple/ripple.js | InkRippleDirective | function InkRippleDirective ($mdButtonInkRipple, $mdCheckboxInkRipple) {
return {
controller: angular.noop,
link: function (scope, element, attr) {
attr.hasOwnProperty('mdInkRippleCheckbox')
? $mdCheckboxInkRipple.attach(scope, element)
: $mdButtonInkRipple.attach(scope, element);
}
};
} | javascript | function InkRippleDirective ($mdButtonInkRipple, $mdCheckboxInkRipple) {
return {
controller: angular.noop,
link: function (scope, element, attr) {
attr.hasOwnProperty('mdInkRippleCheckbox')
? $mdCheckboxInkRipple.attach(scope, element)
: $mdButtonInkRipple.attach(scope, element);
}
};
} | [
"function",
"InkRippleDirective",
"(",
"$mdButtonInkRipple",
",",
"$mdCheckboxInkRipple",
")",
"{",
"return",
"{",
"controller",
":",
"angular",
".",
"noop",
",",
"link",
":",
"function",
"(",
"scope",
",",
"element",
",",
"attr",
")",
"{",
"attr",
".",
"has... | @ngdoc directive
@name mdInkRipple
@module material.core.ripple
@description
The `md-ink-ripple` directive allows you to specify the ripple color or if a ripple is allowed.
@param {string|boolean} md-ink-ripple A color string `#FF0000` or boolean (`false` or `0`) for
preventing ripple
@usage
### String values
<hljs lang="html">
<ANY md-ink-ripple="#FF0000">
Ripples in red
</ANY>
<ANY md-ink-ripple="false">
Not rippling
</ANY>
</hljs>
### Interpolated values
<hljs lang="html">
<ANY md-ink-ripple="{{ randomColor() }}">
Ripples with the return value of 'randomColor' function
</ANY>
<ANY md-ink-ripple="{{ canRipple() }}">
Ripples if 'canRipple' function return value is not 'false' or '0'
</ANY>
</hljs> | [
"@ngdoc",
"directive",
"@name",
"mdInkRipple",
"@module",
"material",
".",
"core",
".",
"ripple"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/ripple/ripple.js#L50-L59 | train | Directive to be used to add an ink - ripple icon to the element | [
30522,
3853,
10710,
29443,
21132,
7442,
15277,
1006,
1002,
9108,
8569,
15474,
19839,
29443,
10814,
1010,
1002,
9108,
5403,
3600,
8758,
19839,
29443,
10814,
1007,
1063,
2709,
1063,
11486,
1024,
16108,
1012,
2053,
7361,
1010,
4957,
1024,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/util/source-code-utils.js | getSourceCodeOfFiles | function getSourceCodeOfFiles(patterns, providedOptions, providedCallback) {
const sourceCodes = {};
const globPatternsList = typeof patterns === "string" ? [patterns] : patterns;
let options, callback;
const defaultOptions = Object.assign({}, baseDefaultOptions, { cwd: process.cwd() });
if (typeof providedOptions === "undefined") {
options = defaultOptions;
callback = null;
} else if (typeof providedOptions === "function") {
callback = providedOptions;
options = defaultOptions;
} else if (typeof providedOptions === "object") {
options = Object.assign({}, defaultOptions, providedOptions);
callback = providedCallback;
}
debug("constructed options:", options);
const filenames = globUtils.listFilesToProcess(globPatternsList, options)
.filter(fileInfo => !fileInfo.ignored)
.reduce((files, fileInfo) => files.concat(fileInfo.filename), []);
if (filenames.length === 0) {
debug(`Did not find any files matching pattern(s): ${globPatternsList}`);
}
filenames.forEach(filename => {
const sourceCode = getSourceCodeOfFile(filename, options);
if (sourceCode) {
debug("got sourceCode of", filename);
sourceCodes[filename] = sourceCode;
}
if (callback) {
callback(filenames.length); // eslint-disable-line callback-return
}
});
return sourceCodes;
} | javascript | function getSourceCodeOfFiles(patterns, providedOptions, providedCallback) {
const sourceCodes = {};
const globPatternsList = typeof patterns === "string" ? [patterns] : patterns;
let options, callback;
const defaultOptions = Object.assign({}, baseDefaultOptions, { cwd: process.cwd() });
if (typeof providedOptions === "undefined") {
options = defaultOptions;
callback = null;
} else if (typeof providedOptions === "function") {
callback = providedOptions;
options = defaultOptions;
} else if (typeof providedOptions === "object") {
options = Object.assign({}, defaultOptions, providedOptions);
callback = providedCallback;
}
debug("constructed options:", options);
const filenames = globUtils.listFilesToProcess(globPatternsList, options)
.filter(fileInfo => !fileInfo.ignored)
.reduce((files, fileInfo) => files.concat(fileInfo.filename), []);
if (filenames.length === 0) {
debug(`Did not find any files matching pattern(s): ${globPatternsList}`);
}
filenames.forEach(filename => {
const sourceCode = getSourceCodeOfFile(filename, options);
if (sourceCode) {
debug("got sourceCode of", filename);
sourceCodes[filename] = sourceCode;
}
if (callback) {
callback(filenames.length); // eslint-disable-line callback-return
}
});
return sourceCodes;
} | [
"function",
"getSourceCodeOfFiles",
"(",
"patterns",
",",
"providedOptions",
",",
"providedCallback",
")",
"{",
"const",
"sourceCodes",
"=",
"{",
"}",
";",
"const",
"globPatternsList",
"=",
"typeof",
"patterns",
"===",
"\"string\"",
"?",
"[",
"patterns",
"]",
":... | This callback is used to measure execution status in a progress bar
@callback progressCallback
@param {number} The total number of times the callback will be called.
Gets the SourceCode of a single file, or set of files.
@param {string[]|string} patterns A filename, directory name, or glob, or an array of them
@param {Object} [providedOptions] A CLIEngine options object. If not provided, the default cli options will be used.
@param {progressCallback} [providedCallback] Callback for reporting execution status
@returns {Object} The SourceCode of all processed files. | [
"This",
"callback",
"is",
"used",
"to",
"measure",
"execution",
"status",
"in",
"a",
"progress",
"bar"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/source-code-utils.js#L63-L101 | train | Get sourceCode of files matching a glob pattern | [
30522,
3853,
4152,
8162,
3401,
16044,
7245,
9463,
2015,
1006,
7060,
1010,
3024,
30524,
3367,
3120,
23237,
1027,
1063,
1065,
1025,
9530,
3367,
1043,
4135,
2497,
4502,
12079,
3619,
9863,
1027,
2828,
11253,
7060,
1027,
1027,
1027,
1000,
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... |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/lib/logging.js | consoleHandler | function consoleHandler(entry) {
if (typeof console === 'undefined' || !console) {
return;
}
var timestamp = new Date(entry.timestamp);
var msg =
'[' + timestamp.getUTCFullYear() + '-' +
pad(timestamp.getUTCMonth() + 1) + '-' +
pad(timestamp.getUTCDate()) + 'T' +
pad(timestamp.getUTCHours()) + ':' +
pad(timestamp.getUTCMinutes()) + ':' +
pad(timestamp.getUTCSeconds()) + 'Z] ' +
'[' + entry.level.name + '] ' +
entry.message;
var level = entry.level.value;
if (level >= Level.SEVERE.value) {
console.error(msg);
} else if (level >= Level.WARNING.value) {
console.warn(msg);
} else {
console.log(msg);
}
} | javascript | function consoleHandler(entry) {
if (typeof console === 'undefined' || !console) {
return;
}
var timestamp = new Date(entry.timestamp);
var msg =
'[' + timestamp.getUTCFullYear() + '-' +
pad(timestamp.getUTCMonth() + 1) + '-' +
pad(timestamp.getUTCDate()) + 'T' +
pad(timestamp.getUTCHours()) + ':' +
pad(timestamp.getUTCMinutes()) + ':' +
pad(timestamp.getUTCSeconds()) + 'Z] ' +
'[' + entry.level.name + '] ' +
entry.message;
var level = entry.level.value;
if (level >= Level.SEVERE.value) {
console.error(msg);
} else if (level >= Level.WARNING.value) {
console.warn(msg);
} else {
console.log(msg);
}
} | [
"function",
"consoleHandler",
"(",
"entry",
")",
"{",
"if",
"(",
"typeof",
"console",
"===",
"'undefined'",
"||",
"!",
"console",
")",
"{",
"return",
";",
"}",
"var",
"timestamp",
"=",
"new",
"Date",
"(",
"entry",
".",
"timestamp",
")",
";",
"var",
"ms... | Logs all messages to the Console API.
@param {!Entry} entry the entry to log. | [
"Logs",
"all",
"messages",
"to",
"the",
"Console",
"API",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/logging.js#L539-L563 | train | console handler for console. log | [
30522,
3853,
10122,
11774,
3917,
1006,
4443,
1007,
1063,
2065,
1006,
2828,
11253,
10122,
1027,
1027,
1027,
1005,
6151,
28344,
1005,
1064,
1064,
999,
10122,
1007,
1063,
2709,
1025,
1065,
13075,
2335,
15464,
2361,
1027,
2047,
3058,
1006,
4443... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
exceljs/exceljs | spec/integration/workbook/workbook.spec.js | rangeCheck | function rangeCheck(name, members) {
var ranges = wb2.definedNames.getRanges(name);
expect(ranges.name).to.equal(name);
if (members.length) {
expect(ranges.ranges).to.have.members(members);
} else {
expect(ranges.ranges.length).to.equal(0);
}
} | javascript | function rangeCheck(name, members) {
var ranges = wb2.definedNames.getRanges(name);
expect(ranges.name).to.equal(name);
if (members.length) {
expect(ranges.ranges).to.have.members(members);
} else {
expect(ranges.ranges.length).to.equal(0);
}
} | [
"function",
"rangeCheck",
"(",
"name",
",",
"members",
")",
"{",
"var",
"ranges",
"=",
"wb2",
".",
"definedNames",
".",
"getRanges",
"(",
"name",
")",
";",
"expect",
"(",
"ranges",
".",
"name",
")",
".",
"to",
".",
"equal",
"(",
"name",
")",
";",
"... | ranges | [
"ranges"
] | c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2 | https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/spec/integration/workbook/workbook.spec.js#L445-L453 | train | Check if the name is a valid range | [
30522,
3853,
2846,
5403,
3600,
1006,
2171,
1010,
2372,
1007,
1063,
13075,
8483,
1027,
25610,
2475,
1012,
4225,
18442,
2015,
1012,
2131,
24388,
2229,
1006,
2171,
1007,
1025,
5987,
1006,
8483,
1012,
2171,
1007,
1012,
2000,
1012,
5020,
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.ui.fl/src/sap/ui/fl/context/ContextManager.js | function (oParameter, aRuntimeContext) {
var sSelector = oParameter.selector;
var sOperator = oParameter.operator;
var oValue = oParameter.value;
switch (sOperator) {
case "EQ":
return this._checkEquals(sSelector, oValue, aRuntimeContext);
case "NE":
return !this._checkEquals(sSelector, oValue, aRuntimeContext);
default:
Log.info("A context within a flexibility change with the operator '" + sOperator + "' could not be verified");
return false;
}
} | javascript | function (oParameter, aRuntimeContext) {
var sSelector = oParameter.selector;
var sOperator = oParameter.operator;
var oValue = oParameter.value;
switch (sOperator) {
case "EQ":
return this._checkEquals(sSelector, oValue, aRuntimeContext);
case "NE":
return !this._checkEquals(sSelector, oValue, aRuntimeContext);
default:
Log.info("A context within a flexibility change with the operator '" + sOperator + "' could not be verified");
return false;
}
} | [
"function",
"(",
"oParameter",
",",
"aRuntimeContext",
")",
"{",
"var",
"sSelector",
"=",
"oParameter",
".",
"selector",
";",
"var",
"sOperator",
"=",
"oParameter",
".",
"operator",
";",
"var",
"oValue",
"=",
"oParameter",
".",
"value",
";",
"switch",
"(",
... | Checks a single condition of a context object. Returns true if the condition matches the current runtime context.
@param {Object} oParameter - context within an sap.ui.fl.Change
@param {string} oParameter.selector - key of a runtime context
@param {string} oParameter.operator - determine which comparison has to be executed
@param {string} oParameter.value - value which has to be matched within the key
@param {Object} aRuntimeContext - key value pairs of the current runtime context
@returns {boolean} bContextValid - context of the changes matches
@private | [
"Checks",
"a",
"single",
"condition",
"of",
"a",
"context",
"object",
".",
"Returns",
"true",
"if",
"the",
"condition",
"matches",
"the",
"current",
"runtime",
"context",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L187-L201 | train | Checks if the given parameter is valid. | [
30522,
3853,
1006,
6728,
5400,
22828,
1010,
28217,
7292,
8663,
18209,
1007,
1063,
13075,
7020,
12260,
16761,
1027,
6728,
5400,
22828,
1012,
27000,
1025,
13075,
2061,
4842,
8844,
1027,
6728,
5400,
22828,
1012,
6872,
1025,
13075,
9242,
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... | |
GitbookIO/gitbook | lib/api/encodeGlobal.js | encodeGlobal | function encodeGlobal(output) {
var book = output.getBook();
var bookFS = book.getContentFS();
var logger = output.getLogger();
var outputFolder = output.getRoot();
var plugins = output.getPlugins();
var blocks = Plugins.listBlocks(plugins);
var result = {
log: logger,
config: encodeConfig(output, book.getConfig()),
summary: encodeSummary(output, book.getSummary()),
/**
Check if the book is a multilingual book
@return {Boolean}
*/
isMultilingual: function() {
return book.isMultilingual();
},
/**
Check if the book is a language book for a multilingual book
@return {Boolean}
*/
isLanguageBook: function() {
return book.isLanguageBook();
},
/**
Read a file from the book
@param {String} fileName
@return {Promise<Buffer>}
*/
readFile: function(fileName) {
return bookFS.read(fileName);
},
/**
Read a file from the book as a string
@param {String} fileName
@return {Promise<String>}
*/
readFileAsString: function(fileName) {
return bookFS.readAsString(fileName);
},
/**
Resolve a file from the book root
@param {String} fileName
@return {String}
*/
resolve: function(fileName) {
return path.resolve(book.getContentRoot(), fileName);
},
/**
Resolve a page by it path
@param {String} filePath
@return {String}
*/
getPageByPath: function(filePath) {
var page = output.getPage(filePath);
if (!page) return undefined;
return encodePage(output, page);
},
/**
Render a block of text (markdown/asciidoc)
@param {String} type
@param {String} text
@return {Promise<String>}
*/
renderBlock: function(type, text) {
var parser = parsers.get(type);
return parser.parsePage(text)
.get('content');
},
/**
Render an inline text (markdown/asciidoc)
@param {String} type
@param {String} text
@return {Promise<String>}
*/
renderInline: function(type, text) {
var parser = parsers.get(type);
return parser.parseInline(text)
.get('content');
},
template: {
/**
Apply a templating block and returns its result
@param {String} name
@param {Object} blockData
@return {Promise|Object}
*/
applyBlock: function(name, blockData) {
var block = blocks.get(name) || defaultBlocks.get(name);
return Promise(block.applyBlock(blockData, result));
}
},
output: {
/**
Name of the generator being used
{String}
*/
name: output.getGenerator(),
/**
Return absolute path to the root folder of output
@return {String}
*/
root: function() {
return outputFolder;
},
/**
Resolve a file from the output root
@param {String} fileName
@return {String}
*/
resolve: function(fileName) {
return path.resolve(outputFolder, fileName);
},
/**
Convert a filepath into an url
@return {String}
*/
toURL: function(filePath) {
return fileToURL(output, filePath);
},
/**
Check that a file exists.
@param {String} fileName
@return {Promise}
*/
hasFile: function(fileName, content) {
return Promise()
.then(function() {
var filePath = PathUtils.resolveInRoot(outputFolder, fileName);
return fs.exists(filePath);
});
},
/**
Write a file to the output folder,
It creates the required folder
@param {String} fileName
@param {Buffer} content
@return {Promise}
*/
writeFile: function(fileName, content) {
return Promise()
.then(function() {
var filePath = PathUtils.resolveInRoot(outputFolder, fileName);
return fs.ensureFile(filePath)
.then(function() {
return fs.writeFile(filePath, content);
});
});
},
/**
Copy a file to the output folder
It creates the required folder.
@param {String} inputFile
@param {String} outputFile
@param {Buffer} content
@return {Promise}
*/
copyFile: function(inputFile, outputFile, content) {
return Promise()
.then(function() {
var outputFilePath = PathUtils.resolveInRoot(outputFolder, outputFile);
return fs.ensureFile(outputFilePath)
.then(function() {
return fs.copy(inputFile, outputFilePath);
});
});
}
},
gitbook: {
version: gitbook.version
}
};
// Deprecated properties
deprecate.renamedMethod(output, 'this.isSubBook', result, 'isSubBook', 'isLanguageBook');
deprecate.renamedMethod(output, 'this.contentLink', result, 'contentLink', 'output.toURL');
deprecate.field(output, 'this.generator', result, 'generator',
output.getGenerator(), '"this.generator" property is deprecated, use "this.output.name" instead');
deprecate.field(output, 'this.navigation', result, 'navigation', function() {
return encodeNavigation(output);
}, '"navigation" property is deprecated');
deprecate.field(output, 'this.book', result, 'book',
result, '"book" property is deprecated, use "this" directly instead');
deprecate.field(output, 'this.options', result, 'options',
result.config.values, '"options" property is deprecated, use config.get(key) instead');
return result;
} | javascript | function encodeGlobal(output) {
var book = output.getBook();
var bookFS = book.getContentFS();
var logger = output.getLogger();
var outputFolder = output.getRoot();
var plugins = output.getPlugins();
var blocks = Plugins.listBlocks(plugins);
var result = {
log: logger,
config: encodeConfig(output, book.getConfig()),
summary: encodeSummary(output, book.getSummary()),
/**
Check if the book is a multilingual book
@return {Boolean}
*/
isMultilingual: function() {
return book.isMultilingual();
},
/**
Check if the book is a language book for a multilingual book
@return {Boolean}
*/
isLanguageBook: function() {
return book.isLanguageBook();
},
/**
Read a file from the book
@param {String} fileName
@return {Promise<Buffer>}
*/
readFile: function(fileName) {
return bookFS.read(fileName);
},
/**
Read a file from the book as a string
@param {String} fileName
@return {Promise<String>}
*/
readFileAsString: function(fileName) {
return bookFS.readAsString(fileName);
},
/**
Resolve a file from the book root
@param {String} fileName
@return {String}
*/
resolve: function(fileName) {
return path.resolve(book.getContentRoot(), fileName);
},
/**
Resolve a page by it path
@param {String} filePath
@return {String}
*/
getPageByPath: function(filePath) {
var page = output.getPage(filePath);
if (!page) return undefined;
return encodePage(output, page);
},
/**
Render a block of text (markdown/asciidoc)
@param {String} type
@param {String} text
@return {Promise<String>}
*/
renderBlock: function(type, text) {
var parser = parsers.get(type);
return parser.parsePage(text)
.get('content');
},
/**
Render an inline text (markdown/asciidoc)
@param {String} type
@param {String} text
@return {Promise<String>}
*/
renderInline: function(type, text) {
var parser = parsers.get(type);
return parser.parseInline(text)
.get('content');
},
template: {
/**
Apply a templating block and returns its result
@param {String} name
@param {Object} blockData
@return {Promise|Object}
*/
applyBlock: function(name, blockData) {
var block = blocks.get(name) || defaultBlocks.get(name);
return Promise(block.applyBlock(blockData, result));
}
},
output: {
/**
Name of the generator being used
{String}
*/
name: output.getGenerator(),
/**
Return absolute path to the root folder of output
@return {String}
*/
root: function() {
return outputFolder;
},
/**
Resolve a file from the output root
@param {String} fileName
@return {String}
*/
resolve: function(fileName) {
return path.resolve(outputFolder, fileName);
},
/**
Convert a filepath into an url
@return {String}
*/
toURL: function(filePath) {
return fileToURL(output, filePath);
},
/**
Check that a file exists.
@param {String} fileName
@return {Promise}
*/
hasFile: function(fileName, content) {
return Promise()
.then(function() {
var filePath = PathUtils.resolveInRoot(outputFolder, fileName);
return fs.exists(filePath);
});
},
/**
Write a file to the output folder,
It creates the required folder
@param {String} fileName
@param {Buffer} content
@return {Promise}
*/
writeFile: function(fileName, content) {
return Promise()
.then(function() {
var filePath = PathUtils.resolveInRoot(outputFolder, fileName);
return fs.ensureFile(filePath)
.then(function() {
return fs.writeFile(filePath, content);
});
});
},
/**
Copy a file to the output folder
It creates the required folder.
@param {String} inputFile
@param {String} outputFile
@param {Buffer} content
@return {Promise}
*/
copyFile: function(inputFile, outputFile, content) {
return Promise()
.then(function() {
var outputFilePath = PathUtils.resolveInRoot(outputFolder, outputFile);
return fs.ensureFile(outputFilePath)
.then(function() {
return fs.copy(inputFile, outputFilePath);
});
});
}
},
gitbook: {
version: gitbook.version
}
};
// Deprecated properties
deprecate.renamedMethod(output, 'this.isSubBook', result, 'isSubBook', 'isLanguageBook');
deprecate.renamedMethod(output, 'this.contentLink', result, 'contentLink', 'output.toURL');
deprecate.field(output, 'this.generator', result, 'generator',
output.getGenerator(), '"this.generator" property is deprecated, use "this.output.name" instead');
deprecate.field(output, 'this.navigation', result, 'navigation', function() {
return encodeNavigation(output);
}, '"navigation" property is deprecated');
deprecate.field(output, 'this.book', result, 'book',
result, '"book" property is deprecated, use "this" directly instead');
deprecate.field(output, 'this.options', result, 'options',
result.config.values, '"options" property is deprecated, use config.get(key) instead');
return result;
} | [
"function",
"encodeGlobal",
"(",
"output",
")",
"{",
"var",
"book",
"=",
"output",
".",
"getBook",
"(",
")",
";",
"var",
"bookFS",
"=",
"book",
".",
"getContentFS",
"(",
")",
";",
"var",
"logger",
"=",
"output",
".",
"getLogger",
"(",
")",
";",
"var"... | Encode a global context into a JS object
It's the context for page's hook, etc
@param {Output} output
@return {Object} | [
"Encode",
"a",
"global",
"context",
"into",
"a",
"JS",
"object",
"It",
"s",
"the",
"context",
"for",
"page",
"s",
"hook",
"etc"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/api/encodeGlobal.js#L25-L255 | train | Encode global data | [
30522,
3853,
4372,
16044,
23296,
16429,
2389,
1006,
6434,
1007,
1063,
13075,
2338,
1027,
6434,
1012,
2131,
8654,
1006,
1007,
1025,
13075,
2338,
10343,
1027,
2338,
1012,
2131,
8663,
6528,
24475,
2015,
1006,
1007,
1025,
13075,
8833,
4590,
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... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onLinkWithGenericIdPCredential | function onLinkWithGenericIdPCredential() {
var providerId = $('#link-generic-idp-provider-id').val();
var idToken = $('#link-generic-idp-id-token').val();
var accessToken = $('#link-generic-idp-access-token').val();
var provider = new firebase.auth.OAuthProvider(providerId);
activeUser().linkWithCredential(
provider.credential(idToken, accessToken))
.then(onAuthUserCredentialSuccess, onAuthError);
} | javascript | function onLinkWithGenericIdPCredential() {
var providerId = $('#link-generic-idp-provider-id').val();
var idToken = $('#link-generic-idp-id-token').val();
var accessToken = $('#link-generic-idp-access-token').val();
var provider = new firebase.auth.OAuthProvider(providerId);
activeUser().linkWithCredential(
provider.credential(idToken, accessToken))
.then(onAuthUserCredentialSuccess, onAuthError);
} | [
"function",
"onLinkWithGenericIdPCredential",
"(",
")",
"{",
"var",
"providerId",
"=",
"$",
"(",
"'#link-generic-idp-provider-id'",
")",
".",
"val",
"(",
")",
";",
"var",
"idToken",
"=",
"$",
"(",
"'#link-generic-idp-id-token'",
")",
".",
"val",
"(",
")",
";",... | Links with a generic IdP credential. | [
"Links",
"with",
"a",
"generic",
"IdP",
"credential",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L760-L768 | train | Link with generic IDP credential | [
30522,
3853,
2006,
13767,
24415,
6914,
22420,
3593,
15042,
5596,
24271,
1006,
1007,
1063,
13075,
10802,
3593,
1027,
1002,
1006,
1005,
1001,
4957,
1011,
12391,
1011,
8909,
2361,
1011,
10802,
1011,
8909,
1005,
1007,
1012,
11748,
1006,
1007,
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... |
moleculerjs/moleculer | src/middlewares/circuit-breaker.js | halfOpenWait | function halfOpenWait(item, ctx) {
item.state = C.CIRCUIT_HALF_OPEN_WAIT;
item.ep.state = false;
// Anti-stick protection
item.cbTimer = setTimeout(() => halfOpen(item, ctx), item.opts.halfOpenTime);
item.cbTimer.unref();
} | javascript | function halfOpenWait(item, ctx) {
item.state = C.CIRCUIT_HALF_OPEN_WAIT;
item.ep.state = false;
// Anti-stick protection
item.cbTimer = setTimeout(() => halfOpen(item, ctx), item.opts.halfOpenTime);
item.cbTimer.unref();
} | [
"function",
"halfOpenWait",
"(",
"item",
",",
"ctx",
")",
"{",
"item",
".",
"state",
"=",
"C",
".",
"CIRCUIT_HALF_OPEN_WAIT",
";",
"item",
".",
"ep",
".",
"state",
"=",
"false",
";",
"// Anti-stick protection",
"item",
".",
"cbTimer",
"=",
"setTimeout",
"(... | Change circuit-breaker status to half-open waiting. First request is invoked after half-open.
@param {Object} item
@param {Context} ctx | [
"Change",
"circuit",
"-",
"breaker",
"status",
"to",
"half",
"-",
"open",
"waiting",
".",
"First",
"request",
"is",
"invoked",
"after",
"half",
"-",
"open",
"."
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/circuit-breaker.js#L165-L172 | train | Wait for the half - open process to finish | [
30522,
3853,
2431,
26915,
21547,
2102,
1006,
8875,
1010,
14931,
2595,
1007,
1063,
8875,
1012,
2110,
1027,
1039,
1012,
4984,
1035,
2431,
1035,
2330,
1035,
3524,
1025,
8875,
1012,
4958,
1012,
2110,
1027,
6270,
1025,
1013,
1013,
3424,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
BrainJS/brain.js | dist/recurrent/matrix/row-pluck-b.js | rowPluckB | function rowPluckB(product, left, rowIndex) {
var columns = left.columns;
var rowBase = columns * rowIndex;
for (var column = 0; column < columns; column++) {
left.deltas[rowBase + column] = product.deltas[column];
}
} | javascript | function rowPluckB(product, left, rowIndex) {
var columns = left.columns;
var rowBase = columns * rowIndex;
for (var column = 0; column < columns; column++) {
left.deltas[rowBase + column] = product.deltas[column];
}
} | [
"function",
"rowPluckB",
"(",
"product",
",",
"left",
",",
"rowIndex",
")",
"{",
"var",
"columns",
"=",
"left",
".",
"columns",
";",
"var",
"rowBase",
"=",
"columns",
"*",
"rowIndex",
";",
"for",
"(",
"var",
"column",
"=",
"0",
";",
"column",
"<",
"c... | adds {from} deltas into {m} deltas
@param {Matrix} product
@param {Matrix} left
@param {Number} rowIndex | [
"adds",
"{",
"from",
"}",
"deltas",
"into",
"{",
"m",
"}",
"deltas"
] | ab09bfc74a0d29d4731dcbdebfa17aeba7f7b1ef | https://github.com/BrainJS/brain.js/blob/ab09bfc74a0d29d4731dcbdebfa17aeba7f7b1ef/dist/recurrent/matrix/row-pluck-b.js#L13-L19 | train | rowPluckB - Plucks a row into the left | [
30522,
3853,
5216,
24759,
12722,
2497,
1006,
4031,
1010,
2187,
1010,
5216,
22254,
10288,
1007,
1063,
13075,
7753,
1027,
2187,
1012,
7753,
1025,
13075,
5216,
15058,
1027,
7753,
1008,
5216,
22254,
10288,
1025,
2005,
1006,
13075,
5930,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (mCacheQueryOptions, aPaths, fnFetchMetadata,
sRootMetaPath, mNavigationPropertyPaths, sPrefix) {
var aExpands = [],
mExpands = {},
mResult,
aSelects,
mSelects = {};
/*
* Filter where only structural properties pass through.
*
* @param {boolean} bSkipFirstSegment
* Whether first segment of the path is known to be a structural property
* @param {string} sMetaPath
* A meta path relative to the cache's root
* @returns {boolean}
* Whether the given meta path contains only structural properties
*/
function filterStructural(bSkipFirstSegment, sMetaPath) {
var aSegments = sMetaPath.split("/");
return aSegments.every(function (sSegment, i) {
return i === 0 && bSkipFirstSegment
|| fnFetchMetadata(
sRootMetaPath + "/" + aSegments.slice(0, i + 1).join("/")
).getResult().$kind === "Property";
});
}
if (aPaths.indexOf("") >= 0) {
throw new Error("Unsupported empty navigation property path");
}
if (mCacheQueryOptions.$select && mCacheQueryOptions.$select.indexOf("*") < 0) {
_Helper.addChildrenWithAncestor(aPaths, mCacheQueryOptions.$select, mSelects);
_Helper.addChildrenWithAncestor(mCacheQueryOptions.$select, aPaths, mSelects);
aSelects = Object.keys(mSelects).filter(filterStructural.bind(null, true));
} else {
aSelects = aPaths.filter(filterStructural.bind(null, false));
}
if (mCacheQueryOptions.$expand) {
aExpands = Object.keys(mCacheQueryOptions.$expand);
aExpands.forEach(function (sNavigationPropertyPath) {
var mChildQueryOptions,
sMetaPath = sRootMetaPath + "/" + sNavigationPropertyPath,
sPrefixedNavigationPropertyPath
= _Helper.buildPath(sPrefix, sNavigationPropertyPath),
mSet = {},
aStrippedPaths;
_Helper.addChildrenWithAncestor([sNavigationPropertyPath], aPaths, mSet);
if (!isEmptyObject(mSet)) {
if (fnFetchMetadata(sMetaPath).getResult().$isCollection) {
mNavigationPropertyPaths[sPrefixedNavigationPropertyPath] = true;
}
// complete navigation property may change, same expand as initially
mExpands[sNavigationPropertyPath]
= mCacheQueryOptions.$expand[sNavigationPropertyPath];
return;
}
aStrippedPaths = _Helper.stripPathPrefix(sNavigationPropertyPath, aPaths);
if (aStrippedPaths.length) {
if (fnFetchMetadata(sMetaPath).getResult().$isCollection) {
throw new Error("Unsupported collection-valued navigation property "
+ sMetaPath);
}
// details of the navigation property may change, compute intersection
// recursively
mChildQueryOptions = _Helper.intersectQueryOptions(
mCacheQueryOptions.$expand[sNavigationPropertyPath] || {},
aStrippedPaths, fnFetchMetadata,
sRootMetaPath + "/" + sNavigationPropertyPath,
mNavigationPropertyPaths, sPrefixedNavigationPropertyPath);
if (mChildQueryOptions) {
mExpands[sNavigationPropertyPath] = mChildQueryOptions;
}
}
});
}
if (!aSelects.length && isEmptyObject(mExpands)) {
return null;
}
if (!aSelects.length) { // avoid $select= in URL, use any navigation property
aSelects = Object.keys(mExpands).slice(0, 1);
}
mResult = Object.assign({}, mCacheQueryOptions, {$select : aSelects});
if (isEmptyObject(mExpands)) {
delete mResult.$expand;
} else {
mResult.$expand = mExpands;
}
return mResult;
} | javascript | function (mCacheQueryOptions, aPaths, fnFetchMetadata,
sRootMetaPath, mNavigationPropertyPaths, sPrefix) {
var aExpands = [],
mExpands = {},
mResult,
aSelects,
mSelects = {};
/*
* Filter where only structural properties pass through.
*
* @param {boolean} bSkipFirstSegment
* Whether first segment of the path is known to be a structural property
* @param {string} sMetaPath
* A meta path relative to the cache's root
* @returns {boolean}
* Whether the given meta path contains only structural properties
*/
function filterStructural(bSkipFirstSegment, sMetaPath) {
var aSegments = sMetaPath.split("/");
return aSegments.every(function (sSegment, i) {
return i === 0 && bSkipFirstSegment
|| fnFetchMetadata(
sRootMetaPath + "/" + aSegments.slice(0, i + 1).join("/")
).getResult().$kind === "Property";
});
}
if (aPaths.indexOf("") >= 0) {
throw new Error("Unsupported empty navigation property path");
}
if (mCacheQueryOptions.$select && mCacheQueryOptions.$select.indexOf("*") < 0) {
_Helper.addChildrenWithAncestor(aPaths, mCacheQueryOptions.$select, mSelects);
_Helper.addChildrenWithAncestor(mCacheQueryOptions.$select, aPaths, mSelects);
aSelects = Object.keys(mSelects).filter(filterStructural.bind(null, true));
} else {
aSelects = aPaths.filter(filterStructural.bind(null, false));
}
if (mCacheQueryOptions.$expand) {
aExpands = Object.keys(mCacheQueryOptions.$expand);
aExpands.forEach(function (sNavigationPropertyPath) {
var mChildQueryOptions,
sMetaPath = sRootMetaPath + "/" + sNavigationPropertyPath,
sPrefixedNavigationPropertyPath
= _Helper.buildPath(sPrefix, sNavigationPropertyPath),
mSet = {},
aStrippedPaths;
_Helper.addChildrenWithAncestor([sNavigationPropertyPath], aPaths, mSet);
if (!isEmptyObject(mSet)) {
if (fnFetchMetadata(sMetaPath).getResult().$isCollection) {
mNavigationPropertyPaths[sPrefixedNavigationPropertyPath] = true;
}
// complete navigation property may change, same expand as initially
mExpands[sNavigationPropertyPath]
= mCacheQueryOptions.$expand[sNavigationPropertyPath];
return;
}
aStrippedPaths = _Helper.stripPathPrefix(sNavigationPropertyPath, aPaths);
if (aStrippedPaths.length) {
if (fnFetchMetadata(sMetaPath).getResult().$isCollection) {
throw new Error("Unsupported collection-valued navigation property "
+ sMetaPath);
}
// details of the navigation property may change, compute intersection
// recursively
mChildQueryOptions = _Helper.intersectQueryOptions(
mCacheQueryOptions.$expand[sNavigationPropertyPath] || {},
aStrippedPaths, fnFetchMetadata,
sRootMetaPath + "/" + sNavigationPropertyPath,
mNavigationPropertyPaths, sPrefixedNavigationPropertyPath);
if (mChildQueryOptions) {
mExpands[sNavigationPropertyPath] = mChildQueryOptions;
}
}
});
}
if (!aSelects.length && isEmptyObject(mExpands)) {
return null;
}
if (!aSelects.length) { // avoid $select= in URL, use any navigation property
aSelects = Object.keys(mExpands).slice(0, 1);
}
mResult = Object.assign({}, mCacheQueryOptions, {$select : aSelects});
if (isEmptyObject(mExpands)) {
delete mResult.$expand;
} else {
mResult.$expand = mExpands;
}
return mResult;
} | [
"function",
"(",
"mCacheQueryOptions",
",",
"aPaths",
",",
"fnFetchMetadata",
",",
"sRootMetaPath",
",",
"mNavigationPropertyPaths",
",",
"sPrefix",
")",
"{",
"var",
"aExpands",
"=",
"[",
"]",
",",
"mExpands",
"=",
"{",
"}",
",",
"mResult",
",",
"aSelects",
... | Returns a copy of given query options where "$expand" and "$select" are replaced by the
intersection with the given (navigation) property paths.
@param {object} mCacheQueryOptions
A map of query options as returned by
{@link sap.ui.model.odata.v4.ODataModel#buildQueryOptions}
@param {string[]} aPaths
The "14.5.11 Expression edm:NavigationPropertyPath" or
"14.5.13 Expression edm:PropertyPath" strings describing which properties need to be
loaded because they may have changed due to side effects of a previous update; must not
be empty
@param {function} fnFetchMetadata
Function which fetches metadata for a given meta path
@param {string} sRootMetaPath
The meta path for the cache root's type, for example "/SalesOrderList/SO_2_BP" or
"/Artists/foo.EditAction/@$ui5.overload/0/$ReturnType/$Type", such that an OData simple
identifier may be appended
@param {object} mNavigationPropertyPaths
Hash set of collection-valued navigation property meta paths (relative to the cache's
root, that is without the root meta path prefix) which need to be refreshed, maps
string to <code>true</code>; is modified
@param {boolean} [sPrefix=""]
Optional prefix for navigation property meta paths used during recursion
@returns {object}
The updated query options or <code>null</code> if no request is needed
@throws {Error}
If a path string is empty or the intersection requires a $expand of a collection-valued
navigation property | [
"Returns",
"a",
"copy",
"of",
"given",
"query",
"options",
"where",
"$expand",
"and",
"$select",
"are",
"replaced",
"by",
"the",
"intersection",
"with",
"the",
"given",
"(",
"navigation",
")",
"property",
"paths",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L712-L810 | train | Filter the given meta path and returns the corresponding structural property | [
30522,
3853,
1006,
22432,
5403,
4226,
2854,
7361,
9285,
1010,
9706,
8988,
2015,
1010,
1042,
2078,
7959,
10649,
11368,
8447,
2696,
1010,
5034,
17206,
11368,
22068,
2705,
1010,
24098,
18891,
12540,
21572,
4842,
3723,
15069,
2015,
1010,
11867,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensions/default/NavigationAndHistory/main.js | _createMROFList | function _createMROFList() {
var paneList = MainViewManager.getPaneIdList(),
mrofList = [],
fileList,
index;
var pane, file, mrofEntry, paneCount, fileCount;
// Iterate over the pane ID list
for (paneCount = 0; paneCount < paneList.length; paneCount++) {
pane = paneList[paneCount];
fileList = MainViewManager.getWorkingSet(pane);
// Iterate over the file list for this pane
for (fileCount = 0; fileCount < fileList.length; fileCount++) {
file = fileList[fileCount];
mrofEntry = _makeMROFListEntry(file.fullPath, pane, null);
// Add it in the MRU list order
index = MainViewManager.findInGlobalMRUList(pane, file);
mrofList[index] = mrofEntry;
}
}
return mrofList;
} | javascript | function _createMROFList() {
var paneList = MainViewManager.getPaneIdList(),
mrofList = [],
fileList,
index;
var pane, file, mrofEntry, paneCount, fileCount;
// Iterate over the pane ID list
for (paneCount = 0; paneCount < paneList.length; paneCount++) {
pane = paneList[paneCount];
fileList = MainViewManager.getWorkingSet(pane);
// Iterate over the file list for this pane
for (fileCount = 0; fileCount < fileList.length; fileCount++) {
file = fileList[fileCount];
mrofEntry = _makeMROFListEntry(file.fullPath, pane, null);
// Add it in the MRU list order
index = MainViewManager.findInGlobalMRUList(pane, file);
mrofList[index] = mrofEntry;
}
}
return mrofList;
} | [
"function",
"_createMROFList",
"(",
")",
"{",
"var",
"paneList",
"=",
"MainViewManager",
".",
"getPaneIdList",
"(",
")",
",",
"mrofList",
"=",
"[",
"]",
",",
"fileList",
",",
"index",
";",
"var",
"pane",
",",
"file",
",",
"mrofEntry",
",",
"paneCount",
"... | This function is used to create mrof when a project is opened for the firt time with the recent files feature
This routine acts as a logic to migrate existing viewlist to mrof structure
@private | [
"This",
"function",
"is",
"used",
"to",
"create",
"mrof",
"when",
"a",
"project",
"is",
"opened",
"for",
"the",
"firt",
"time",
"with",
"the",
"recent",
"files",
"feature",
"This",
"routine",
"acts",
"as",
"a",
"logic",
"to",
"migrate",
"existing",
"viewli... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L320-L343 | train | Create the MROF list | [
30522,
3853,
1035,
3443,
2213,
3217,
10258,
2923,
1006,
1007,
1063,
13075,
5997,
2923,
1027,
2364,
8584,
24805,
4590,
1012,
2131,
9739,
7416,
19422,
2923,
1006,
1007,
1010,
2720,
11253,
9863,
1027,
1031,
1033,
1010,
5371,
9863,
1010,
5950,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
dimsemenov/PhotoSwipe | src/js/gestures.js | function(e, isDown) {
_preventObj.prevent = !_closestElement(e.target, _options.isClickableElement);
_shout('preventDragEvent', e, isDown, _preventObj);
return _preventObj.prevent;
} | javascript | function(e, isDown) {
_preventObj.prevent = !_closestElement(e.target, _options.isClickableElement);
_shout('preventDragEvent', e, isDown, _preventObj);
return _preventObj.prevent;
} | [
"function",
"(",
"e",
",",
"isDown",
")",
"{",
"_preventObj",
".",
"prevent",
"=",
"!",
"_closestElement",
"(",
"e",
".",
"target",
",",
"_options",
".",
"isClickableElement",
")",
";",
"_shout",
"(",
"'preventDragEvent'",
",",
"e",
",",
"isDown",
",",
"... | amount of pixels to drag to determine direction of swipe | [
"amount",
"of",
"pixels",
"to",
"drag",
"to",
"determine",
"direction",
"of",
"swipe"
] | 80607e12542a1a54ecefa837649e862b35dffd25 | https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L99-L105 | train | prevent drag event | [
30522,
3853,
1006,
1041,
1010,
2003,
7698,
1007,
1063,
1035,
4652,
16429,
3501,
1012,
4652,
1027,
999,
1035,
7541,
12260,
3672,
1006,
1041,
1012,
4539,
1010,
1035,
7047,
1012,
2003,
20464,
6799,
3085,
12260,
3672,
1007,
1025,
1035,
11245,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/runner.js | extraGlobals | function extraGlobals() {
if (typeof process === 'object' && typeof process.version === 'string') {
var parts = process.version.split('.');
var nodeVersion = parts.reduce(function(a, v) {
return (a << 8) | v;
});
// 'errno' was renamed to process._errno in v0.9.11.
if (nodeVersion < 0x00090b) {
return ['errno'];
}
}
return [];
} | javascript | function extraGlobals() {
if (typeof process === 'object' && typeof process.version === 'string') {
var parts = process.version.split('.');
var nodeVersion = parts.reduce(function(a, v) {
return (a << 8) | v;
});
// 'errno' was renamed to process._errno in v0.9.11.
if (nodeVersion < 0x00090b) {
return ['errno'];
}
}
return [];
} | [
"function",
"extraGlobals",
"(",
")",
"{",
"if",
"(",
"typeof",
"process",
"===",
"'object'",
"&&",
"typeof",
"process",
".",
"version",
"===",
"'string'",
")",
"{",
"var",
"parts",
"=",
"process",
".",
"version",
".",
"split",
"(",
"'.'",
")",
";",
"v... | Array of globals dependent on the environment.
@return {Array}
@deprecated
@todo remove; long since unsupported
@private | [
"Array",
"of",
"globals",
"dependent",
"on",
"the",
"environment",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/runner.js#L1027-L1041 | train | Returns an array of global variables that are needed to pass to the next function | [
30522,
3853,
4469,
23296,
16429,
9777,
1006,
1007,
1063,
2065,
1006,
2828,
11253,
2832,
1027,
1027,
1027,
1005,
4874,
1005,
1004,
1004,
2828,
11253,
2832,
1012,
2544,
1027,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
13075,
3033,
1027,
2832,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/service.js | apiAttemptEvent | function apiAttemptEvent(request) {
var api = request.service.api.operations[request.operation];
var monitoringEvent = {
Type: 'ApiCallAttempt',
Api: api ? api.name : request.operation,
Version: 1,
Service: request.service.api.serviceId || request.service.api.endpointPrefix,
Fqdn: request.httpRequest.endpoint.hostname,
UserAgent: request.httpRequest.getUserAgent(),
};
var response = request.response;
if (response.httpResponse.statusCode) {
monitoringEvent.HttpStatusCode = response.httpResponse.statusCode;
}
if (
!request._unAuthenticated &&
request.service.config.credentials &&
request.service.config.credentials.accessKeyId
) {
monitoringEvent.AccessKey = request.service.config.credentials.accessKeyId;
}
if (!response.httpResponse.headers) return monitoringEvent;
if (request.httpRequest.headers['x-amz-security-token']) {
monitoringEvent.SessionToken = request.httpRequest.headers['x-amz-security-token'];
}
if (response.httpResponse.headers['x-amzn-requestid']) {
monitoringEvent.XAmznRequestId = response.httpResponse.headers['x-amzn-requestid'];
}
if (response.httpResponse.headers['x-amz-request-id']) {
monitoringEvent.XAmzRequestId = response.httpResponse.headers['x-amz-request-id'];
}
if (response.httpResponse.headers['x-amz-id-2']) {
monitoringEvent.XAmzId2 = response.httpResponse.headers['x-amz-id-2'];
}
return monitoringEvent;
} | javascript | function apiAttemptEvent(request) {
var api = request.service.api.operations[request.operation];
var monitoringEvent = {
Type: 'ApiCallAttempt',
Api: api ? api.name : request.operation,
Version: 1,
Service: request.service.api.serviceId || request.service.api.endpointPrefix,
Fqdn: request.httpRequest.endpoint.hostname,
UserAgent: request.httpRequest.getUserAgent(),
};
var response = request.response;
if (response.httpResponse.statusCode) {
monitoringEvent.HttpStatusCode = response.httpResponse.statusCode;
}
if (
!request._unAuthenticated &&
request.service.config.credentials &&
request.service.config.credentials.accessKeyId
) {
monitoringEvent.AccessKey = request.service.config.credentials.accessKeyId;
}
if (!response.httpResponse.headers) return monitoringEvent;
if (request.httpRequest.headers['x-amz-security-token']) {
monitoringEvent.SessionToken = request.httpRequest.headers['x-amz-security-token'];
}
if (response.httpResponse.headers['x-amzn-requestid']) {
monitoringEvent.XAmznRequestId = response.httpResponse.headers['x-amzn-requestid'];
}
if (response.httpResponse.headers['x-amz-request-id']) {
monitoringEvent.XAmzRequestId = response.httpResponse.headers['x-amz-request-id'];
}
if (response.httpResponse.headers['x-amz-id-2']) {
monitoringEvent.XAmzId2 = response.httpResponse.headers['x-amz-id-2'];
}
return monitoringEvent;
} | [
"function",
"apiAttemptEvent",
"(",
"request",
")",
"{",
"var",
"api",
"=",
"request",
".",
"service",
".",
"api",
".",
"operations",
"[",
"request",
".",
"operation",
"]",
";",
"var",
"monitoringEvent",
"=",
"{",
"Type",
":",
"'ApiCallAttempt'",
",",
"Api... | Event recording metrics for an API call attempt.
@returns {object} a subset of api call attempt metrics
@api private | [
"Event",
"recording",
"metrics",
"for",
"an",
"API",
"call",
"attempt",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/service.js#L326-L361 | train | Creates a monitoring event for a given API call | [
30522,
3853,
17928,
19321,
6633,
13876,
18697,
3372,
1006,
5227,
1007,
1063,
13075,
17928,
1027,
5227,
1012,
2326,
1012,
17928,
1012,
3136,
1031,
5227,
1012,
3169,
1033,
1025,
13075,
8822,
18697,
3372,
1027,
1063,
2828,
1024,
1005,
29197,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | AjaxsltEngine | function AjaxsltEngine() {
// private
var ignoreAttributesWithoutValue = false;
function selectLogic(xpath, contextNode, namespaceResolver, firstMatch) {
// DGF set xpathdebug = true (using getEval, if you like) to turn on JS
// XPath debugging
//xpathdebug = true;
var context;
if (contextNode == this.doc) {
context = new ExprContext(this.doc);
}
else {
// provide false values to get the default constructor values
context = new ExprContext(contextNode, false, false,
contextNode.parentNode);
}
context.setCaseInsensitive(true);
context.setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue);
context.setReturnOnFirstMatch(firstMatch);
try {
var xpathObj = xpathParse(xpath);
}
catch (e) {
var msg = extractExceptionMessage(e);
throw new SeleniumError("Invalid xpath [3]: " + msg);
}
var nodes = []
var xpathResult = xpathObj.evaluate(context);
if (xpathResult && xpathResult.value) {
for (var i = 0; i < xpathResult.value.length; ++i) {
nodes.push(xpathResult.value[i]);
}
}
return nodes;
}
// public
// Override
this.isAvailable = function() { return true; };
// Override
this.selectNodes = function(xpath, contextNode, namespaceResolver) {
return selectLogic(xpath, contextNode, namespaceResolver, false);
};
// Override
this.selectSingleNode = function(xpath, contextNode, namespaceResolver) {
var nodes = selectLogic(xpath, contextNode, namespaceResolver, true);
return (nodes.length > 0 ? nodes[0] : null);
};
// Override
this.setIgnoreAttributesWithoutValue = function(ignore) {
ignoreAttributesWithoutValue = ignore;
return this;
};
} | javascript | function AjaxsltEngine() {
// private
var ignoreAttributesWithoutValue = false;
function selectLogic(xpath, contextNode, namespaceResolver, firstMatch) {
// DGF set xpathdebug = true (using getEval, if you like) to turn on JS
// XPath debugging
//xpathdebug = true;
var context;
if (contextNode == this.doc) {
context = new ExprContext(this.doc);
}
else {
// provide false values to get the default constructor values
context = new ExprContext(contextNode, false, false,
contextNode.parentNode);
}
context.setCaseInsensitive(true);
context.setIgnoreAttributesWithoutValue(ignoreAttributesWithoutValue);
context.setReturnOnFirstMatch(firstMatch);
try {
var xpathObj = xpathParse(xpath);
}
catch (e) {
var msg = extractExceptionMessage(e);
throw new SeleniumError("Invalid xpath [3]: " + msg);
}
var nodes = []
var xpathResult = xpathObj.evaluate(context);
if (xpathResult && xpathResult.value) {
for (var i = 0; i < xpathResult.value.length; ++i) {
nodes.push(xpathResult.value[i]);
}
}
return nodes;
}
// public
// Override
this.isAvailable = function() { return true; };
// Override
this.selectNodes = function(xpath, contextNode, namespaceResolver) {
return selectLogic(xpath, contextNode, namespaceResolver, false);
};
// Override
this.selectSingleNode = function(xpath, contextNode, namespaceResolver) {
var nodes = selectLogic(xpath, contextNode, namespaceResolver, true);
return (nodes.length > 0 ? nodes[0] : null);
};
// Override
this.setIgnoreAttributesWithoutValue = function(ignore) {
ignoreAttributesWithoutValue = ignore;
return this;
};
} | [
"function",
"AjaxsltEngine",
"(",
")",
"{",
"// private",
"var",
"ignoreAttributesWithoutValue",
"=",
"false",
";",
"function",
"selectLogic",
"(",
"xpath",
",",
"contextNode",
",",
"namespaceResolver",
",",
"firstMatch",
")",
"{",
"// DGF set xpathdebug = true (using g... | Implements XPathEngine. | [
"Implements",
"XPathEngine",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1167-L1230 | train | AJAX SLIDEE engine | [
30522,
3853,
18176,
14540,
6528,
11528,
2063,
1006,
1007,
1063,
1013,
1013,
2797,
13075,
8568,
19321,
3089,
8569,
4570,
24415,
5833,
10175,
5657,
1027,
6270,
1025,
3853,
7276,
27179,
1006,
26726,
8988,
1010,
6123,
3630,
3207,
1010,
3415,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
caolan/async | lib/whilst.js | whilst | function whilst(test, iteratee, callback) {
callback = onlyOnce(callback);
var _fn = wrapAsync(iteratee);
var _test = wrapAsync(test);
var results = [];
function next(err, ...rest) {
if (err) return callback(err);
results = rest;
if (err === false) return;
_test(check);
}
function check(err, truth) {
if (err) return callback(err);
if (err === false) return;
if (!truth) return callback(null, ...results);
_fn(next);
}
return _test(check);
} | javascript | function whilst(test, iteratee, callback) {
callback = onlyOnce(callback);
var _fn = wrapAsync(iteratee);
var _test = wrapAsync(test);
var results = [];
function next(err, ...rest) {
if (err) return callback(err);
results = rest;
if (err === false) return;
_test(check);
}
function check(err, truth) {
if (err) return callback(err);
if (err === false) return;
if (!truth) return callback(null, ...results);
_fn(next);
}
return _test(check);
} | [
"function",
"whilst",
"(",
"test",
",",
"iteratee",
",",
"callback",
")",
"{",
"callback",
"=",
"onlyOnce",
"(",
"callback",
")",
";",
"var",
"_fn",
"=",
"wrapAsync",
"(",
"iteratee",
")",
";",
"var",
"_test",
"=",
"wrapAsync",
"(",
"test",
")",
";",
... | Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
stopped, or an error occurs.
@name whilst
@static
@memberOf module:ControlFlow
@method
@category Control Flow
@param {AsyncFunction} test - asynchronous truth test to perform before each
execution of `iteratee`. Invoked with ().
@param {AsyncFunction} iteratee - An async function which is called each time
`test` passes. Invoked with (callback).
@param {Function} [callback] - A callback which is called after the test
function has failed and repeated execution of `iteratee` has stopped. `callback`
will be passed an error and any arguments passed to the final `iteratee`'s
callback. Invoked with (err, [results]);
@returns {Promise} a promise, if no callback is passed
@example
var count = 0;
async.whilst(
function test(cb) { cb(null, count < 5;) },
function iter(callback) {
count++;
setTimeout(function() {
callback(null, count);
}, 1000);
},
function (err, n) {
// 5 seconds have passed, n = 5
}
); | [
"Repeatedly",
"call",
"iteratee",
"while",
"test",
"returns",
"true",
".",
"Calls",
"callback",
"when",
"stopped",
"or",
"an",
"error",
"occurs",
"."
] | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/whilst.js#L39-L60 | train | Whilst test the cache | [
30522,
3853,
5819,
1006,
3231,
1010,
2009,
22139,
2063,
1010,
2655,
5963,
1007,
1063,
2655,
5963,
1027,
2069,
2239,
3401,
1006,
2655,
5963,
1007,
1025,
13075,
1035,
1042,
2078,
1027,
10236,
3022,
6038,
2278,
1006,
2009,
22139,
2063,
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... |
eslint/eslint | lib/rules/capitalized-comments.js | processComment | function processComment(comment) {
const options = normalizedOptions[comment.type],
commentValid = isCommentValid(comment, options);
if (!commentValid) {
const messageId = capitalize === "always"
? "unexpectedLowercaseComment"
: "unexpectedUppercaseComment";
context.report({
node: null, // Intentionally using loc instead
loc: comment.loc,
messageId,
fix(fixer) {
const match = comment.value.match(LETTER_PATTERN);
return fixer.replaceTextRange(
// Offset match.index by 2 to account for the first 2 characters that start the comment (// or /*)
[comment.range[0] + match.index + 2, comment.range[0] + match.index + 3],
capitalize === "always" ? match[0].toLocaleUpperCase() : match[0].toLocaleLowerCase()
);
}
});
}
} | javascript | function processComment(comment) {
const options = normalizedOptions[comment.type],
commentValid = isCommentValid(comment, options);
if (!commentValid) {
const messageId = capitalize === "always"
? "unexpectedLowercaseComment"
: "unexpectedUppercaseComment";
context.report({
node: null, // Intentionally using loc instead
loc: comment.loc,
messageId,
fix(fixer) {
const match = comment.value.match(LETTER_PATTERN);
return fixer.replaceTextRange(
// Offset match.index by 2 to account for the first 2 characters that start the comment (// or /*)
[comment.range[0] + match.index + 2, comment.range[0] + match.index + 3],
capitalize === "always" ? match[0].toLocaleUpperCase() : match[0].toLocaleLowerCase()
);
}
});
}
} | [
"function",
"processComment",
"(",
"comment",
")",
"{",
"const",
"options",
"=",
"normalizedOptions",
"[",
"comment",
".",
"type",
"]",
",",
"commentValid",
"=",
"isCommentValid",
"(",
"comment",
",",
"options",
")",
";",
"if",
"(",
"!",
"commentValid",
")",... | Process a comment to determine if it needs to be reported.
@param {ASTNode} comment The comment node to process.
@returns {void} | [
"Process",
"a",
"comment",
"to",
"determine",
"if",
"it",
"needs",
"to",
"be",
"reported",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/capitalized-comments.js#L268-L293 | train | Process a comment | [
30522,
3853,
2832,
9006,
3672,
1006,
7615,
1007,
1063,
9530,
3367,
7047,
1027,
3671,
3550,
7361,
9285,
1031,
7615,
1012,
2828,
1033,
1010,
7615,
10175,
3593,
1027,
2003,
9006,
3672,
10175,
3593,
1006,
7615,
1010,
7047,
1007,
1025,
2065,
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... |
spencermountain/compromise | src/index.js | function(str, lex) {
if (lex) {
w.plugin({
words: lex
});
}
let doc = buildText(str, w);
doc.tagger();
return doc;
} | javascript | function(str, lex) {
if (lex) {
w.plugin({
words: lex
});
}
let doc = buildText(str, w);
doc.tagger();
return doc;
} | [
"function",
"(",
"str",
",",
"lex",
")",
"{",
"if",
"(",
"lex",
")",
"{",
"w",
".",
"plugin",
"(",
"{",
"words",
":",
"lex",
"}",
")",
";",
"}",
"let",
"doc",
"=",
"buildText",
"(",
"str",
",",
"w",
")",
";",
"doc",
".",
"tagger",
"(",
")",... | the main function | [
"the",
"main",
"function"
] | 526b1cab28a45ccbb430fbf2824db420acd587cf | https://github.com/spencermountain/compromise/blob/526b1cab28a45ccbb430fbf2824db420acd587cf/src/index.js#L10-L19 | train | Build a text document | [
30522,
3853,
1006,
2358,
2099,
1010,
17244,
1007,
1063,
2065,
1006,
17244,
1007,
1063,
1059,
1012,
13354,
2378,
1006,
1063,
2616,
1024,
17244,
1065,
1007,
1025,
1065,
2292,
9986,
1027,
3857,
18209,
1006,
2358,
2099,
1010,
1059,
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/language/CSSUtils.js | getCompleteSelectors | function getCompleteSelectors(info, useGroup) {
if (info.parentSelectors) {
// Show parents with / separators.
var completeSelectors = info.parentSelectors + " / ";
if (useGroup && info.selectorGroup) {
completeSelectors += info.selectorGroup;
} else {
completeSelectors += info.selector;
}
return completeSelectors;
} else if (useGroup && info.selectorGroup) {
return info.selectorGroup;
}
return info.selector;
} | javascript | function getCompleteSelectors(info, useGroup) {
if (info.parentSelectors) {
// Show parents with / separators.
var completeSelectors = info.parentSelectors + " / ";
if (useGroup && info.selectorGroup) {
completeSelectors += info.selectorGroup;
} else {
completeSelectors += info.selector;
}
return completeSelectors;
} else if (useGroup && info.selectorGroup) {
return info.selectorGroup;
}
return info.selector;
} | [
"function",
"getCompleteSelectors",
"(",
"info",
",",
"useGroup",
")",
"{",
"if",
"(",
"info",
".",
"parentSelectors",
")",
"{",
"// Show parents with / separators.",
"var",
"completeSelectors",
"=",
"info",
".",
"parentSelectors",
"+",
"\" / \"",
";",
"if",
"(",
... | Return a string that shows the literal parent hierarchy of the selector
in info.
@param {!SelectorInfo} info
@param {boolean=} useGroup true to append selectorGroup instead of selector
@return {string} the literal parent hierarchy of the selector | [
"Return",
"a",
"string",
"that",
"shows",
"the",
"literal",
"parent",
"hierarchy",
"of",
"the",
"selector",
"in",
"info",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CSSUtils.js#L668-L683 | train | Get complete selectors | [
30522,
3853,
2131,
9006,
10814,
4570,
12260,
24817,
1006,
18558,
1010,
2224,
17058,
1007,
1063,
2065,
1006,
18558,
1012,
3008,
12260,
24817,
1007,
1063,
1013,
1013,
2265,
3008,
2007,
1013,
19802,
25879,
5668,
1012,
13075,
28123,
12260,
24817,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
catapult-project/catapult | tracing/third_party/oboe/src/instanceApi.js | addMultipleNodeOrPathListeners | function addMultipleNodeOrPathListeners(eventId, listenerMap) {
for( var pattern in listenerMap ) {
addSingleNodeOrPathListener(eventId, pattern, listenerMap[pattern]);
}
} | javascript | function addMultipleNodeOrPathListeners(eventId, listenerMap) {
for( var pattern in listenerMap ) {
addSingleNodeOrPathListener(eventId, pattern, listenerMap[pattern]);
}
} | [
"function",
"addMultipleNodeOrPathListeners",
"(",
"eventId",
",",
"listenerMap",
")",
"{",
"for",
"(",
"var",
"pattern",
"in",
"listenerMap",
")",
"{",
"addSingleNodeOrPathListener",
"(",
"eventId",
",",
"pattern",
",",
"listenerMap",
"[",
"pattern",
"]",
")",
... | Add several listeners at a time, from a map | [
"Add",
"several",
"listeners",
"at",
"a",
"time",
"from",
"a",
"map"
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/instanceApi.js#L183-L188 | train | Add multiple node - or - leaf listeners to the event queue | [
30522,
3853,
5587,
12274,
7096,
11514,
7770,
10244,
2953,
15069,
9863,
24454,
2015,
1006,
2724,
3593,
1010,
19373,
2863,
2361,
1007,
1063,
2005,
1006,
13075,
5418,
1999,
19373,
2863,
2361,
1007,
1063,
9909,
2075,
7770,
10244,
2953,
15069,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/core/services/layout/layout.js | translateWithValueToCssClass | function translateWithValueToCssClass(scope, element, attrs) {
var updateFn = updateClassWithValue(element, className, attrs);
var unwatch = attrs.$observe(attrs.$normalize(className), updateFn);
updateFn(getNormalizedAttrValue(className, attrs, ""));
scope.$on("$destroy", function() { unwatch(); });
} | javascript | function translateWithValueToCssClass(scope, element, attrs) {
var updateFn = updateClassWithValue(element, className, attrs);
var unwatch = attrs.$observe(attrs.$normalize(className), updateFn);
updateFn(getNormalizedAttrValue(className, attrs, ""));
scope.$on("$destroy", function() { unwatch(); });
} | [
"function",
"translateWithValueToCssClass",
"(",
"scope",
",",
"element",
",",
"attrs",
")",
"{",
"var",
"updateFn",
"=",
"updateClassWithValue",
"(",
"element",
",",
"className",
",",
"attrs",
")",
";",
"var",
"unwatch",
"=",
"attrs",
".",
"$observe",
"(",
... | Add as transformed class selector(s), then
remove the deprecated attribute selector | [
"Add",
"as",
"transformed",
"class",
"selector",
"(",
"s",
")",
"then",
"remove",
"the",
"deprecated",
"attribute",
"selector"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L288-L294 | train | translate the value of the class attribute to the correct value | [
30522,
3853,
17637,
24415,
10175,
23361,
10085,
4757,
26266,
1006,
9531,
1010,
5783,
1010,
2012,
16344,
2015,
1007,
1063,
13075,
10651,
2546,
2078,
1027,
10651,
26266,
24415,
10175,
5657,
1006,
5783,
1010,
2465,
18442,
1010,
2012,
16344,
2015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/codemirror/continuelist.js | incrementRemainingMarkdownListNumbers | function incrementRemainingMarkdownListNumbers(cm, pos) {
var startLine = pos.line, lookAhead = 0, skipCount = 0;
var startItem = listRE.exec(cm.getLine(startLine)), startIndent = startItem[1];
do {
lookAhead += 1;
var nextLineNumber = startLine + lookAhead;
var nextLine = cm.getLine(nextLineNumber), nextItem = listRE.exec(nextLine);
if (nextItem) {
var nextIndent = nextItem[1];
var newNumber = (parseInt(startItem[3], 10) + lookAhead - skipCount);
var nextNumber = (parseInt(nextItem[3], 10)), itemNumber = nextNumber;
if (startIndent === nextIndent && !isNaN(nextNumber)) {
if (newNumber === nextNumber) itemNumber = nextNumber + 1;
if (newNumber > nextNumber) itemNumber = newNumber + 1;
cm.replaceRange(
nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]),
{
line: nextLineNumber, ch: 0
}, {
line: nextLineNumber, ch: nextLine.length
});
} else {
if (startIndent.length > nextIndent.length) return;
// This doesn't run if the next line immediatley indents, as it is
// not clear of the users intention (new indented item or same level)
if ((startIndent.length < nextIndent.length) && (lookAhead === 1)) return;
skipCount += 1;
}
}
} while (nextItem);
} | javascript | function incrementRemainingMarkdownListNumbers(cm, pos) {
var startLine = pos.line, lookAhead = 0, skipCount = 0;
var startItem = listRE.exec(cm.getLine(startLine)), startIndent = startItem[1];
do {
lookAhead += 1;
var nextLineNumber = startLine + lookAhead;
var nextLine = cm.getLine(nextLineNumber), nextItem = listRE.exec(nextLine);
if (nextItem) {
var nextIndent = nextItem[1];
var newNumber = (parseInt(startItem[3], 10) + lookAhead - skipCount);
var nextNumber = (parseInt(nextItem[3], 10)), itemNumber = nextNumber;
if (startIndent === nextIndent && !isNaN(nextNumber)) {
if (newNumber === nextNumber) itemNumber = nextNumber + 1;
if (newNumber > nextNumber) itemNumber = newNumber + 1;
cm.replaceRange(
nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]),
{
line: nextLineNumber, ch: 0
}, {
line: nextLineNumber, ch: nextLine.length
});
} else {
if (startIndent.length > nextIndent.length) return;
// This doesn't run if the next line immediatley indents, as it is
// not clear of the users intention (new indented item or same level)
if ((startIndent.length < nextIndent.length) && (lookAhead === 1)) return;
skipCount += 1;
}
}
} while (nextItem);
} | [
"function",
"incrementRemainingMarkdownListNumbers",
"(",
"cm",
",",
"pos",
")",
"{",
"var",
"startLine",
"=",
"pos",
".",
"line",
",",
"lookAhead",
"=",
"0",
",",
"skipCount",
"=",
"0",
";",
"var",
"startItem",
"=",
"listRE",
".",
"exec",
"(",
"cm",
"."... | Auto-updating Markdown list numbers when a new item is added to the middle of a list | [
"Auto",
"-",
"updating",
"Markdown",
"list",
"numbers",
"when",
"a",
"new",
"item",
"is",
"added",
"to",
"the",
"middle",
"of",
"a",
"list"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/codemirror/continuelist.js#L67-L100 | train | Increment remaining markdown list numbers | [
30522,
3853,
4297,
28578,
4765,
28578,
8113,
2075,
10665,
7698,
9863,
19172,
17198,
1006,
4642,
1010,
13433,
2015,
1007,
1063,
13075,
2707,
4179,
1027,
13433,
2015,
1012,
2240,
1010,
2298,
4430,
13775,
1027,
1014,
1010,
13558,
3597,
16671,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/lifecycle/create-props.js | checkDeprecatedProps | function checkDeprecatedProps(layerName, propsInstance, deprecatedProps) {
if (!propsInstance) {
return;
}
for (const name in deprecatedProps) {
if (hasOwnProperty(propsInstance, name)) {
const nameStr = `${layerName || 'Layer'}: ${name}`;
for (const newPropName of deprecatedProps[name]) {
if (!hasOwnProperty(propsInstance, newPropName)) {
propsInstance[newPropName] = propsInstance[name];
}
}
log.deprecated(nameStr, deprecatedProps[name].join('/'))();
}
}
} | javascript | function checkDeprecatedProps(layerName, propsInstance, deprecatedProps) {
if (!propsInstance) {
return;
}
for (const name in deprecatedProps) {
if (hasOwnProperty(propsInstance, name)) {
const nameStr = `${layerName || 'Layer'}: ${name}`;
for (const newPropName of deprecatedProps[name]) {
if (!hasOwnProperty(propsInstance, newPropName)) {
propsInstance[newPropName] = propsInstance[name];
}
}
log.deprecated(nameStr, deprecatedProps[name].join('/'))();
}
}
} | [
"function",
"checkDeprecatedProps",
"(",
"layerName",
",",
"propsInstance",
",",
"deprecatedProps",
")",
"{",
"if",
"(",
"!",
"propsInstance",
")",
"{",
"return",
";",
"}",
"for",
"(",
"const",
"name",
"in",
"deprecatedProps",
")",
"{",
"if",
"(",
"hasOwnPro... | /* eslint-disable max-depth | [
"/",
"*",
"eslint",
"-",
"disable",
"max",
"-",
"depth"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/core/src/lifecycle/create-props.js#L55-L73 | train | Check deprecated properties | [
30522,
3853,
4638,
3207,
28139,
12921,
21572,
4523,
1006,
6741,
18442,
1010,
24387,
7076,
26897,
1010,
2139,
28139,
12921,
21572,
4523,
1007,
1063,
2065,
1006,
999,
24387,
7076,
26897,
1007,
1063,
2709,
1025,
1065,
2005,
1006,
9530,
3367,
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... |
zeit/now-cli | src/util/is-zeit-world.js | isZeitWorld | function isZeitWorld(ns) {
if (!ns.length) {
return false;
}
return ns.every(host => host.endsWith('.zeit.world'));
} | javascript | function isZeitWorld(ns) {
if (!ns.length) {
return false;
}
return ns.every(host => host.endsWith('.zeit.world'));
} | [
"function",
"isZeitWorld",
"(",
"ns",
")",
"{",
"if",
"(",
"!",
"ns",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"return",
"ns",
".",
"every",
"(",
"host",
"=>",
"host",
".",
"endsWith",
"(",
"'.zeit.world'",
")",
")",
";",
"}"
] | Given an array of nameservers (ie: as returned
by `resolveNs` from Node, assert that they're
zeit.world's. | [
"Given",
"an",
"array",
"of",
"nameservers",
"(",
"ie",
":",
"as",
"returned",
"by",
"resolveNs",
"from",
"Node",
"assert",
"that",
"they",
"re",
"zeit",
".",
"world",
"s",
"."
] | b53d907b745126113bc3e251ac2451088026a363 | https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/util/is-zeit-world.js#L6-L11 | train | Check if the network is a zeit world | [
30522,
3853,
2003,
4371,
4183,
11108,
1006,
24978,
1007,
1063,
2065,
1006,
999,
24978,
1012,
3091,
1007,
1063,
2709,
6270,
1025,
1065,
2709,
24978,
1012,
2296,
1006,
3677,
1027,
1028,
3677,
1012,
4515,
24415,
1006,
1005,
1012,
27838,
4183,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netlify/netlify-cms | packages/netlify-cms-core/src/bootstrap.js | getRoot | function getRoot() {
/**
* Return existing root if found.
*/
const existingRoot = document.getElementById(ROOT_ID);
if (existingRoot) {
return existingRoot;
}
/**
* If no existing root, create and return a new root.
*/
const newRoot = document.createElement('div');
newRoot.id = ROOT_ID;
document.body.appendChild(newRoot);
return newRoot;
} | javascript | function getRoot() {
/**
* Return existing root if found.
*/
const existingRoot = document.getElementById(ROOT_ID);
if (existingRoot) {
return existingRoot;
}
/**
* If no existing root, create and return a new root.
*/
const newRoot = document.createElement('div');
newRoot.id = ROOT_ID;
document.body.appendChild(newRoot);
return newRoot;
} | [
"function",
"getRoot",
"(",
")",
"{",
"/**\n * Return existing root if found.\n */",
"const",
"existingRoot",
"=",
"document",
".",
"getElementById",
"(",
"ROOT_ID",
")",
";",
"if",
"(",
"existingRoot",
")",
"{",
"return",
"existingRoot",
";",
"}",
"/**\n ... | Get DOM element where app will mount. | [
"Get",
"DOM",
"element",
"where",
"app",
"will",
"mount",
"."
] | 2488556590cbfdcefa626f2f2de01e7a160cf6ee | https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-core/src/bootstrap.js#L33-L49 | train | Returns the root element | [
30522,
3853,
2131,
3217,
4140,
1006,
1007,
1063,
1013,
1008,
1008,
1008,
2709,
4493,
7117,
2065,
2179,
1012,
1008,
1013,
9530,
3367,
4493,
3217,
4140,
1027,
6254,
1012,
2131,
12260,
3672,
3762,
3593,
1006,
7117,
1035,
8909,
1007,
1025,
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... |
adobe/brackets | src/utils/StringMatch.js | addMatch | function addMatch(match) {
// Pull off the character index
var c = match.index;
var newPoints = 0;
// A match means that we need to do some scoring bookkeeping.
// Start with points added for any match
if (DEBUG_SCORES) {
scoreDebug.match += MATCH_POINTS;
}
newPoints += MATCH_POINTS;
if (match.upper) {
if (DEBUG_SCORES) {
scoreDebug.upper += UPPER_CASE_MATCH;
}
newPoints += UPPER_CASE_MATCH;
}
// A bonus is given for characters that match at the beginning
// of the filename
if (c === lastSegmentStart) {
if (DEBUG_SCORES) {
scoreDebug.beginning += BEGINNING_OF_NAME_POINTS;
}
newPoints += BEGINNING_OF_NAME_POINTS;
}
// If the new character immediately follows the last matched character,
// we award the consecutive matches bonus. The check for score > 0
// handles the initial value of lastMatchIndex which is used for
// constructing ranges but we don't yet have a true match.
if (score > 0 && lastMatchIndex + 1 === c) {
// Continue boosting for each additional match at the beginning
// of the name
if (c - numConsecutive === lastSegmentStart) {
if (DEBUG_SCORES) {
scoreDebug.beginning += BEGINNING_OF_NAME_POINTS;
}
newPoints += BEGINNING_OF_NAME_POINTS;
}
numConsecutive++;
var boost = CONSECUTIVE_MATCHES_POINTS * numConsecutive;
// Consecutive matches that started on a special are a
// good indicator of intent, so we award an added bonus there.
if (currentRangeStartedOnSpecial) {
boost = boost * 2;
}
if (DEBUG_SCORES) {
scoreDebug.consecutive += boost;
}
newPoints += boost;
} else {
numConsecutive = 1;
}
// add points for "special" character matches
if (match instanceof SpecialMatch) {
if (DEBUG_SCORES) {
scoreDebug.special += SPECIAL_POINTS;
}
newPoints += SPECIAL_POINTS;
}
score += newPoints;
// points accumulated in the last segment get an extra bonus
if (c >= lastSegmentStart) {
lastSegmentScore += newPoints;
}
// if the last range wasn't a match or there's a gap, we need to close off
// the range to start a new one.
if ((currentRange && !currentRange.matched) || c > lastMatchIndex + 1) {
closeRangeGap(c);
}
lastMatchIndex = c;
// set up a new match range or add to the current one
if (!currentRange) {
currentRange = {
text: str[c],
matched: true
};
// Check to see if this new matched range is starting on a special
// character. We penalize those ranges that don't, because most
// people will search on the logical boundaries of the name
currentRangeStartedOnSpecial = match instanceof SpecialMatch;
} else {
currentRange.text += str[c];
}
} | javascript | function addMatch(match) {
// Pull off the character index
var c = match.index;
var newPoints = 0;
// A match means that we need to do some scoring bookkeeping.
// Start with points added for any match
if (DEBUG_SCORES) {
scoreDebug.match += MATCH_POINTS;
}
newPoints += MATCH_POINTS;
if (match.upper) {
if (DEBUG_SCORES) {
scoreDebug.upper += UPPER_CASE_MATCH;
}
newPoints += UPPER_CASE_MATCH;
}
// A bonus is given for characters that match at the beginning
// of the filename
if (c === lastSegmentStart) {
if (DEBUG_SCORES) {
scoreDebug.beginning += BEGINNING_OF_NAME_POINTS;
}
newPoints += BEGINNING_OF_NAME_POINTS;
}
// If the new character immediately follows the last matched character,
// we award the consecutive matches bonus. The check for score > 0
// handles the initial value of lastMatchIndex which is used for
// constructing ranges but we don't yet have a true match.
if (score > 0 && lastMatchIndex + 1 === c) {
// Continue boosting for each additional match at the beginning
// of the name
if (c - numConsecutive === lastSegmentStart) {
if (DEBUG_SCORES) {
scoreDebug.beginning += BEGINNING_OF_NAME_POINTS;
}
newPoints += BEGINNING_OF_NAME_POINTS;
}
numConsecutive++;
var boost = CONSECUTIVE_MATCHES_POINTS * numConsecutive;
// Consecutive matches that started on a special are a
// good indicator of intent, so we award an added bonus there.
if (currentRangeStartedOnSpecial) {
boost = boost * 2;
}
if (DEBUG_SCORES) {
scoreDebug.consecutive += boost;
}
newPoints += boost;
} else {
numConsecutive = 1;
}
// add points for "special" character matches
if (match instanceof SpecialMatch) {
if (DEBUG_SCORES) {
scoreDebug.special += SPECIAL_POINTS;
}
newPoints += SPECIAL_POINTS;
}
score += newPoints;
// points accumulated in the last segment get an extra bonus
if (c >= lastSegmentStart) {
lastSegmentScore += newPoints;
}
// if the last range wasn't a match or there's a gap, we need to close off
// the range to start a new one.
if ((currentRange && !currentRange.matched) || c > lastMatchIndex + 1) {
closeRangeGap(c);
}
lastMatchIndex = c;
// set up a new match range or add to the current one
if (!currentRange) {
currentRange = {
text: str[c],
matched: true
};
// Check to see if this new matched range is starting on a special
// character. We penalize those ranges that don't, because most
// people will search on the logical boundaries of the name
currentRangeStartedOnSpecial = match instanceof SpecialMatch;
} else {
currentRange.text += str[c];
}
} | [
"function",
"addMatch",
"(",
"match",
")",
"{",
"// Pull off the character index",
"var",
"c",
"=",
"match",
".",
"index",
";",
"var",
"newPoints",
"=",
"0",
";",
"// A match means that we need to do some scoring bookkeeping.",
"// Start with points added for any match",
"i... | Adds a matched character to the appropriate range | [
"Adds",
"a",
"matched",
"character",
"to",
"the",
"appropriate",
"range"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/StringMatch.js#L572-L668 | train | Add a match to the match table. | [
30522,
3853,
5587,
18900,
2818,
1006,
2674,
1007,
1063,
1013,
1013,
4139,
2125,
1996,
2839,
5950,
13075,
1039,
1027,
2674,
1012,
5950,
1025,
13075,
2047,
26521,
1027,
1014,
1025,
1013,
1013,
1037,
2674,
2965,
2008,
2057,
2342,
2000,
2079,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/selenium-core/scripts/htmlutils.js | function( force ) {
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
return this.elem[ this.prop ];
}
var r = parseFloat(jQuery.css(this.elem, this.prop, force));
return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
} | javascript | function( force ) {
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
return this.elem[ this.prop ];
}
var r = parseFloat(jQuery.css(this.elem, this.prop, force));
return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
} | [
"function",
"(",
"force",
")",
"{",
"if",
"(",
"this",
".",
"elem",
"[",
"this",
".",
"prop",
"]",
"!=",
"null",
"&&",
"(",
"!",
"this",
".",
"elem",
".",
"style",
"||",
"this",
".",
"elem",
".",
"style",
"[",
"this",
".",
"prop",
"]",
"==",
... | Get the current size | [
"Get",
"the",
"current",
"size"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L8182-L8189 | train | Get the current value of the property | [
30522,
3853,
1006,
2486,
1007,
1063,
2065,
1006,
2023,
1012,
3449,
6633,
1031,
2023,
1012,
17678,
1033,
999,
1027,
19701,
1004,
1004,
1006,
999,
2023,
1012,
3449,
6633,
1012,
2806,
1064,
1064,
2023,
1012,
3449,
6633,
1012,
2806,
1031,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jgraph/mxgraph | javascript/mxClient.js | mxPartitionLayout | function mxPartitionLayout(graph, horizontal, spacing, border)
{
mxGraphLayout.call(this, graph);
this.horizontal = (horizontal != null) ? horizontal : true;
this.spacing = spacing || 0;
this.border = border || 0;
} | javascript | function mxPartitionLayout(graph, horizontal, spacing, border)
{
mxGraphLayout.call(this, graph);
this.horizontal = (horizontal != null) ? horizontal : true;
this.spacing = spacing || 0;
this.border = border || 0;
} | [
"function",
"mxPartitionLayout",
"(",
"graph",
",",
"horizontal",
",",
"spacing",
",",
"border",
")",
"{",
"mxGraphLayout",
".",
"call",
"(",
"this",
",",
"graph",
")",
";",
"this",
".",
"horizontal",
"=",
"(",
"horizontal",
"!=",
"null",
")",
"?",
"hori... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxPartitionLayout
Extends <mxGraphLayout> for partitioning the parent cell vertically or
horizontally by filling the complete area with the child cells. A horizontal
layout partitions the height of the given parent whereas a a non-horizontal
layout partitions the width. If the parent is a layer (that is, a child of
the root node), then the current graph size is partitioned. The children do
not need to be connected for this layout to work.
Example:
(code)
var layout = new mxPartitionLayout(graph, true, 10, 20);
layout.execute(graph.getDefaultParent());
(end)
Constructor: mxPartitionLayout
Constructs a new stack layout layout for the specified graph,
spacing, orientation and offset. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxPartitionLayout"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L29803-L29809 | train | A partition layout that is used to layout a graph. | [
30522,
3853,
25630,
19362,
3775,
3508,
8485,
5833,
1006,
10629,
1010,
9876,
1010,
12403,
6129,
1010,
3675,
1007,
1063,
30524,
1006,
2023,
1010,
10629,
1007,
1025,
2023,
1012,
9876,
1027,
1006,
9876,
999,
1027,
19701,
1007,
1029,
9876,
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/core/util/XMLPreprocessor.js | templateAlias | function templateAlias(oElement, oWithControl) {
var sName = oElement.getAttribute("name"),
oNewValue,
oOldValue,
sValue = oElement.getAttribute("value");
if (sName && sName[0] === ".") {
sName = sName.slice(1);
}
if (!sName || sName.includes(".")) {
error("Missing proper relative name in ", oElement);
}
oNewValue = getObject(sValue);
if (!oNewValue) {
error("Invalid value in ", oElement);
}
oOldValue = oScope[sName];
oScope[sName] = oNewValue;
return liftChildNodes(oElement, oWithControl).then(function () {
oElement.parentNode.removeChild(oElement);
oScope[sName] = oOldValue; // no try/finally needed
});
} | javascript | function templateAlias(oElement, oWithControl) {
var sName = oElement.getAttribute("name"),
oNewValue,
oOldValue,
sValue = oElement.getAttribute("value");
if (sName && sName[0] === ".") {
sName = sName.slice(1);
}
if (!sName || sName.includes(".")) {
error("Missing proper relative name in ", oElement);
}
oNewValue = getObject(sValue);
if (!oNewValue) {
error("Invalid value in ", oElement);
}
oOldValue = oScope[sName];
oScope[sName] = oNewValue;
return liftChildNodes(oElement, oWithControl).then(function () {
oElement.parentNode.removeChild(oElement);
oScope[sName] = oOldValue; // no try/finally needed
});
} | [
"function",
"templateAlias",
"(",
"oElement",
",",
"oWithControl",
")",
"{",
"var",
"sName",
"=",
"oElement",
".",
"getAttribute",
"(",
"\"name\"",
")",
",",
"oNewValue",
",",
"oOldValue",
",",
"sValue",
"=",
"oElement",
".",
"getAttribute",
"(",
"\"value\"",
... | Processes a <template:alias> instruction.
@param {Element} oElement
the <template:alias> XML DOM element
@param {sap.ui.core.util._with} oWithControl
the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as the
<template:alias> instruction has been fully processed, or is rejected with a
corresponding error if visiting of child nodes fails.
@throws {Error}
If the "name" attribute is not a proper relative name or if the "value" attribute
does not reference an object which is currently in scope | [
"Processes",
"a",
"<template",
":",
"alias",
">",
"instruction",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1380-L1405 | train | Creates an alias for the given element. | [
30522,
3853,
23561,
22786,
2015,
1006,
1051,
12260,
3672,
1010,
27593,
8939,
8663,
13181,
2140,
1007,
1063,
13075,
1055,
18442,
1027,
1051,
12260,
3672,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
1000,
2171,
1000,
1007,
1010,
2028,
2860,
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.table/src/sap/ui/table/TableColumnUtils.js | function(oTable, sColumnId, iLevel) {
var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId);
if (!oColumnMapItem) {
return undefined;
}
var aParents = [];
for (var i = 0; i < oColumnMapItem.parents.length; i++) {
var oParent = oColumnMapItem.parents[i];
if (iLevel === undefined || oParent.level === iLevel) {
aParents.push(oParent);
}
}
return aParents;
} | javascript | function(oTable, sColumnId, iLevel) {
var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId);
if (!oColumnMapItem) {
return undefined;
}
var aParents = [];
for (var i = 0; i < oColumnMapItem.parents.length; i++) {
var oParent = oColumnMapItem.parents[i];
if (iLevel === undefined || oParent.level === iLevel) {
aParents.push(oParent);
}
}
return aParents;
} | [
"function",
"(",
"oTable",
",",
"sColumnId",
",",
"iLevel",
")",
"{",
"var",
"oColumnMapItem",
"=",
"TableColumnUtils",
".",
"getColumnMapItem",
"(",
"oTable",
",",
"sColumnId",
")",
";",
"if",
"(",
"!",
"oColumnMapItem",
")",
"{",
"return",
"undefined",
";"... | Returns an array of the column information about all columns which span the column identified by sColumnId.
If there is no "parent", it returns undefined.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {string} sColumnId ID of the column for which the Span-parent shall be found.
@param {int} [iLevel] Level where the parent is looked up.
@returns {Array.<{column: sap.ui.table.Column, level: int}>|undefined} Array of column information. | [
"Returns",
"an",
"array",
"of",
"the",
"column",
"information",
"about",
"all",
"columns",
"which",
"span",
"the",
"column",
"identified",
"by",
"sColumnId",
".",
"If",
"there",
"is",
"no",
"parent",
"it",
"returns",
"undefined",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L183-L198 | train | Returns an array of the parents of the column with the given id. | [
30522,
3853,
1006,
27178,
3085,
1010,
8040,
4747,
2819,
3490,
2094,
1010,
17869,
15985,
1007,
1063,
13075,
1051,
25778,
2819,
2078,
2863,
23270,
6633,
1027,
2795,
25778,
2819,
24072,
12146,
1012,
2131,
25778,
2819,
2078,
2863,
23270,
6633,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... | |
postmanlabs/newman | npm/server.js | createRedirectServer | function createRedirectServer () {
var server;
server = http.createServer(function (req, res) {
var hops,
data = '';
// path: /{n}
if ((/^\/\d+$/).test(req.url)) {
hops = parseInt(req.url.substring(1), 10) - 1;
// redirect until all hops are covered
res.writeHead(302, {
location: hops > 0 ? `/${hops}` : '/'
});
return res.end();
}
// path: /status/<responseCode>
else if ((/^\/status\/(\d{3})$/).test(req.url)) {
res.writeHead(parseInt(req.url.substr(-3), 10), { location: '/' });
return res.end();
}
req.on('data', function (d) { data += d; });
req.once('end', function () {
res.writeHead(200, { connection: 'close', 'Content-Type': 'application/json' });
res.end(JSON.stringify({
url: req.url,
method: req.method,
headers: req.headers,
data: data
}));
});
});
server.on('listening', function () {
server.port = this.address().port;
});
enableServerDestroy(server);
return server;
} | javascript | function createRedirectServer () {
var server;
server = http.createServer(function (req, res) {
var hops,
data = '';
// path: /{n}
if ((/^\/\d+$/).test(req.url)) {
hops = parseInt(req.url.substring(1), 10) - 1;
// redirect until all hops are covered
res.writeHead(302, {
location: hops > 0 ? `/${hops}` : '/'
});
return res.end();
}
// path: /status/<responseCode>
else if ((/^\/status\/(\d{3})$/).test(req.url)) {
res.writeHead(parseInt(req.url.substr(-3), 10), { location: '/' });
return res.end();
}
req.on('data', function (d) { data += d; });
req.once('end', function () {
res.writeHead(200, { connection: 'close', 'Content-Type': 'application/json' });
res.end(JSON.stringify({
url: req.url,
method: req.method,
headers: req.headers,
data: data
}));
});
});
server.on('listening', function () {
server.port = this.address().port;
});
enableServerDestroy(server);
return server;
} | [
"function",
"createRedirectServer",
"(",
")",
"{",
"var",
"server",
";",
"server",
"=",
"http",
".",
"createServer",
"(",
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"hops",
",",
"data",
"=",
"''",
";",
"// path: /{n}",
"if",
"(",
"(",
"/",
... | Redirect + Echo Server
- Follows specified redirects -> /<redirects-count>
- Redirects with specified response code -> /status/<response-code>
- Echos final request URL, Method, Headers and Body
@example
var s = createRedirectServer();
s.listen(3000, function() {
console.log(s.port);
s.close();
}); | [
"Redirect",
"+",
"Echo",
"Server",
"-",
"Follows",
"specified",
"redirects",
"-",
">",
"/",
"<redirects",
"-",
"count",
">",
"-",
"Redirects",
"with",
"specified",
"response",
"code",
"-",
">",
"/",
"status",
"/",
"<response",
"-",
"code",
">",
"-",
"Ech... | c05a5a1e82aa3c2021e94ba09e627ba4718af69e | https://github.com/postmanlabs/newman/blob/c05a5a1e82aa3c2021e94ba09e627ba4718af69e/npm/server.js#L76-L121 | train | Create a server that redirects to the specified URL | [
30522,
3853,
3443,
5596,
7442,
16649,
2121,
6299,
1006,
1007,
1063,
13075,
8241,
1025,
8241,
1027,
8299,
1012,
9005,
2121,
6299,
1006,
3853,
1006,
2128,
4160,
1010,
24501,
1007,
1063,
13075,
6154,
2015,
1010,
2951,
1027,
1005,
1005,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/less.js | function (env, op, other) {
/*jshint noempty:false */
var value = tree.operate(env, op, this.value, other.value),
unit = this.unit.clone();
if (op === '+' || op === '-') {
if (unit.numerator.length === 0 && unit.denominator.length === 0) {
unit.numerator = other.unit.numerator.slice(0);
unit.denominator = other.unit.denominator.slice(0);
} else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) {
// do nothing
} else {
other = other.convertTo(this.unit.usedUnits());
if(env.strictUnits && other.unit.toString() !== unit.toString()) {
throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '" + unit.toString() +
"' and '" + other.unit.toString() + "'.");
}
value = tree.operate(env, op, this.value, other.value);
}
} else if (op === '*') {
unit.numerator = unit.numerator.concat(other.unit.numerator).sort();
unit.denominator = unit.denominator.concat(other.unit.denominator).sort();
unit.cancel();
} else if (op === '/') {
unit.numerator = unit.numerator.concat(other.unit.denominator).sort();
unit.denominator = unit.denominator.concat(other.unit.numerator).sort();
unit.cancel();
}
return new(tree.Dimension)(value, unit);
} | javascript | function (env, op, other) {
/*jshint noempty:false */
var value = tree.operate(env, op, this.value, other.value),
unit = this.unit.clone();
if (op === '+' || op === '-') {
if (unit.numerator.length === 0 && unit.denominator.length === 0) {
unit.numerator = other.unit.numerator.slice(0);
unit.denominator = other.unit.denominator.slice(0);
} else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) {
// do nothing
} else {
other = other.convertTo(this.unit.usedUnits());
if(env.strictUnits && other.unit.toString() !== unit.toString()) {
throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '" + unit.toString() +
"' and '" + other.unit.toString() + "'.");
}
value = tree.operate(env, op, this.value, other.value);
}
} else if (op === '*') {
unit.numerator = unit.numerator.concat(other.unit.numerator).sort();
unit.denominator = unit.denominator.concat(other.unit.denominator).sort();
unit.cancel();
} else if (op === '/') {
unit.numerator = unit.numerator.concat(other.unit.denominator).sort();
unit.denominator = unit.denominator.concat(other.unit.numerator).sort();
unit.cancel();
}
return new(tree.Dimension)(value, unit);
} | [
"function",
"(",
"env",
",",
"op",
",",
"other",
")",
"{",
"/*jshint noempty:false */",
"var",
"value",
"=",
"tree",
".",
"operate",
"(",
"env",
",",
"op",
",",
"this",
".",
"value",
",",
"other",
".",
"value",
")",
",",
"unit",
"=",
"this",
".",
"... | In an operation between two Dimensions, we default to the first Dimension's unit, so `1px + 2` will yield `3px`. | [
"In",
"an",
"operation",
"between",
"two",
"Dimensions",
"we",
"default",
"to",
"the",
"first",
"Dimension",
"s",
"unit",
"so",
"1px",
"+",
"2",
"will",
"yield",
"3px",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L3480-L3511 | train | returns the result of the operation | [
30522,
3853,
1006,
4372,
2615,
1010,
6728,
1010,
2060,
1007,
1063,
1013,
1008,
1046,
17426,
2102,
2053,
6633,
13876,
2100,
1024,
6270,
1008,
1013,
13075,
3643,
1027,
3392,
1012,
5452,
1006,
4372,
2615,
1010,
6728,
1010,
2023,
1012,
3643,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensibility/ExtensionManager.js | getAvailableUpdates | function getAvailableUpdates() {
var result = [];
Object.keys(extensions).forEach(function (extensionId) {
var extensionInfo = extensions[extensionId];
// skip extensions that are not installed or are not in the registry
if (!extensionInfo.installInfo || !extensionInfo.registryInfo) {
return;
}
if (extensionInfo.registryInfo.updateCompatible) {
result.push({
id: extensionId,
installVersion: extensionInfo.installInfo.metadata.version,
registryVersion: extensionInfo.registryInfo.lastCompatibleVersion
});
}
});
return result;
} | javascript | function getAvailableUpdates() {
var result = [];
Object.keys(extensions).forEach(function (extensionId) {
var extensionInfo = extensions[extensionId];
// skip extensions that are not installed or are not in the registry
if (!extensionInfo.installInfo || !extensionInfo.registryInfo) {
return;
}
if (extensionInfo.registryInfo.updateCompatible) {
result.push({
id: extensionId,
installVersion: extensionInfo.installInfo.metadata.version,
registryVersion: extensionInfo.registryInfo.lastCompatibleVersion
});
}
});
return result;
} | [
"function",
"getAvailableUpdates",
"(",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"extensions",
")",
".",
"forEach",
"(",
"function",
"(",
"extensionId",
")",
"{",
"var",
"extensionInfo",
"=",
"extensions",
"[",
"extensionI... | Gets an array of extensions that are currently installed and can be updated to a new version
@return {Array.<{id: string, installVersion: string, registryVersion: string}>}
where id = extensionId
installVersion = currently installed version of extension
registryVersion = latest version compatible with current Brackets | [
"Gets",
"an",
"array",
"of",
"extensions",
"that",
"are",
"currently",
"installed",
"and",
"can",
"be",
"updated",
"to",
"a",
"new",
"version"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/ExtensionManager.js#L693-L710 | train | get available updates | [
30522,
3853,
2131,
12462,
11733,
3468,
6279,
27122,
1006,
1007,
1063,
13075,
2765,
1027,
1031,
1033,
1025,
4874,
1012,
6309,
1006,
14305,
1007,
1012,
18921,
6776,
1006,
3853,
1006,
5331,
3593,
1007,
1063,
13075,
5331,
2378,
14876,
1027,
143... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/extensions/chart/chart.js | parseURL2ChartData | function parseURL2ChartData(url, callback) {
const success = code => {
const chartData = parseDSV2ChartData(code);
callback(chartData);
};
const fail = () => callback(null);
$.get(url).done(success).fail(fail);
} | javascript | function parseURL2ChartData(url, callback) {
const success = code => {
const chartData = parseDSV2ChartData(code);
callback(chartData);
};
const fail = () => callback(null);
$.get(url).done(success).fail(fail);
} | [
"function",
"parseURL2ChartData",
"(",
"url",
",",
"callback",
")",
"{",
"const",
"success",
"=",
"code",
"=>",
"{",
"const",
"chartData",
"=",
"parseDSV2ChartData",
"(",
"code",
")",
";",
"callback",
"(",
"chartData",
")",
";",
"}",
";",
"const",
"fail",
... | parse code from url
@param {string} url - remote csv/tsv file url
@param {Function} callback - callback function
@ignore | [
"parse",
"code",
"from",
"url"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L224-L233 | train | Parse a chart from a url | [
30522,
3853,
11968,
3366,
3126,
2140,
2475,
7507,
5339,
2850,
2696,
1006,
24471,
2140,
1010,
2655,
5963,
1007,
1063,
9530,
3367,
3112,
1027,
3642,
1027,
1028,
1063,
9530,
3367,
3673,
2850,
2696,
1027,
11968,
6924,
2015,
2615,
2475,
7507,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(options) {
var nextNode = node.nextSibling,
types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes;
if (!nextNode) {
return null;
}
if (
(!wysihtml5.lang.array(types).contains(nextNode.nodeType)) || // nodeTypes check.
(options && options.ignoreBlankTexts && _isBlankText(nextNode)) // blank text nodes bypassed if set
) {
return wysihtml5.dom.domNode(nextNode).next(options);
}
return nextNode;
} | javascript | function(options) {
var nextNode = node.nextSibling,
types = (options && options.nodeTypes) ? options.nodeTypes : defaultNodeTypes;
if (!nextNode) {
return null;
}
if (
(!wysihtml5.lang.array(types).contains(nextNode.nodeType)) || // nodeTypes check.
(options && options.ignoreBlankTexts && _isBlankText(nextNode)) // blank text nodes bypassed if set
) {
return wysihtml5.dom.domNode(nextNode).next(options);
}
return nextNode;
} | [
"function",
"(",
"options",
")",
"{",
"var",
"nextNode",
"=",
"node",
".",
"nextSibling",
",",
"types",
"=",
"(",
"options",
"&&",
"options",
".",
"nodeTypes",
")",
"?",
"options",
".",
"nodeTypes",
":",
"defaultNodeTypes",
";",
"if",
"(",
"!",
"nextNode... | var node = wysihtml5.dom.domNode(element).next({nodeTypes: [1,3], ignoreBlankTexts: true}); | [
"var",
"node",
"=",
"wysihtml5",
".",
"dom",
".",
"domNode",
"(",
"element",
")",
".",
"next",
"(",
"{",
"nodeTypes",
":",
"[",
"1",
"3",
"]",
"ignoreBlankTexts",
":",
"true",
"}",
")",
";"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L5356-L5372 | train | Returns the next sibling of node | [
30522,
3853,
1006,
7047,
1007,
1063,
13075,
2279,
3630,
3207,
1027,
13045,
1012,
2279,
5332,
9709,
1010,
4127,
1027,
1006,
7047,
1004,
1004,
7047,
1012,
13045,
13874,
2015,
1007,
1029,
7047,
1012,
13045,
13874,
2015,
1024,
12398,
3630,
3207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (e) {
if (!this.dragging) {
return;
}
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
this.coords.x_pointer = x - this.coords.x_gap;
this.calc();
} | javascript | function (e) {
if (!this.dragging) {
return;
}
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
this.coords.x_pointer = x - this.coords.x_gap;
this.calc();
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"this",
".",
"dragging",
")",
"{",
"return",
";",
"}",
"var",
"x",
"=",
"e",
".",
"pageX",
"||",
"e",
".",
"originalEvent",
".",
"touches",
"&&",
"e",
".",
"originalEvent",
".",
"touches",
"[",
"0",... | Mousemove or touchmove
only for handlers
@param e {Object} event object | [
"Mousemove",
"or",
"touchmove",
"only",
"for",
"handlers"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L766-L775 | train | ontouchstart event | [
30522,
3853,
1006,
1041,
1007,
1063,
2065,
1006,
999,
2023,
1012,
11920,
1007,
1063,
2709,
1025,
1065,
13075,
1060,
1027,
1041,
1012,
3931,
2595,
1064,
1064,
1041,
1012,
2434,
18697,
3372,
1012,
12817,
1004,
1004,
1041,
1012,
2434,
18697,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/function-paren-newline.js | shouldHaveNewlines | function shouldHaveNewlines(elements, hasLeftNewline) {
if (multilineArgumentsOption && elements.length === 1) {
return hasLeftNewline;
}
if (multilineOption || multilineArgumentsOption) {
return elements.some((element, index) => index !== elements.length - 1 && element.loc.end.line !== elements[index + 1].loc.start.line);
}
if (consistentOption) {
return hasLeftNewline;
}
return elements.length >= minItems;
} | javascript | function shouldHaveNewlines(elements, hasLeftNewline) {
if (multilineArgumentsOption && elements.length === 1) {
return hasLeftNewline;
}
if (multilineOption || multilineArgumentsOption) {
return elements.some((element, index) => index !== elements.length - 1 && element.loc.end.line !== elements[index + 1].loc.start.line);
}
if (consistentOption) {
return hasLeftNewline;
}
return elements.length >= minItems;
} | [
"function",
"shouldHaveNewlines",
"(",
"elements",
",",
"hasLeftNewline",
")",
"{",
"if",
"(",
"multilineArgumentsOption",
"&&",
"elements",
".",
"length",
"===",
"1",
")",
"{",
"return",
"hasLeftNewline",
";",
"}",
"if",
"(",
"multilineOption",
"||",
"multiline... | ---------------------------------------------------------------------- Helpers ----------------------------------------------------------------------
Determines whether there should be newlines inside function parens
@param {ASTNode[]} elements The arguments or parameters in the list
@param {boolean} hasLeftNewline `true` if the left paren has a newline in the current code.
@returns {boolean} `true` if there should be newlines inside the function parens | [
"----------------------------------------------------------------------",
"Helpers",
"----------------------------------------------------------------------",
"Determines",
"whether",
"there",
"should",
"be",
"newlines",
"inside",
"function",
"parens"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/function-paren-newline.js#L87-L98 | train | returns true if there are any new lines | [
30522,
3853,
2323,
14650,
7974,
12735,
1006,
3787,
1010,
2038,
2571,
6199,
2638,
13668,
3170,
1007,
1063,
2065,
1006,
4800,
4179,
2906,
22850,
11187,
7361,
3508,
1004,
1004,
3787,
1012,
3091,
1027,
1027,
1027,
1015,
1007,
1063,
2709,
2038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/mobiscroll/js/mobiscroll-scroller.js | setVal | function setVal(fill, change, time, noscroll, temp, manual) {
if (visible && !noscroll) {
scrollToPos(time, undefined, manual);
}
v = s.formatResult(that.temp);
if (!temp) {
that.values = that.temp.slice(0);
that.val = v;
}
if (fill) {
if (input) {
elm.val(v);
if (change) {
preventChange = true;
elm.change();
}
}
event('onValueFill', [v, change]);
}
} | javascript | function setVal(fill, change, time, noscroll, temp, manual) {
if (visible && !noscroll) {
scrollToPos(time, undefined, manual);
}
v = s.formatResult(that.temp);
if (!temp) {
that.values = that.temp.slice(0);
that.val = v;
}
if (fill) {
if (input) {
elm.val(v);
if (change) {
preventChange = true;
elm.change();
}
}
event('onValueFill', [v, change]);
}
} | [
"function",
"setVal",
"(",
"fill",
",",
"change",
",",
"time",
",",
"noscroll",
",",
"temp",
",",
"manual",
")",
"{",
"if",
"(",
"visible",
"&&",
"!",
"noscroll",
")",
"{",
"scrollToPos",
"(",
"time",
",",
"undefined",
",",
"manual",
")",
";",
"}",
... | ##### END: MODIFIED BY SAP | [
"#####",
"END",
":",
"MODIFIED",
"BY",
"SAP"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/mobiscroll/js/mobiscroll-scroller.js#L469-L492 | train | set val | [
30522,
3853,
2275,
10175,
1006,
6039,
1010,
2689,
1010,
2051,
1010,
16839,
26775,
14511,
1010,
8915,
8737,
1010,
6410,
1007,
1063,
2065,
1006,
5710,
1004,
1004,
999,
16839,
26775,
14511,
1007,
1063,
17186,
14399,
2891,
1006,
2051,
1010,
305... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/key-spacing.js | verifyGroupAlignment | function verifyGroupAlignment(properties) {
const length = properties.length,
widths = properties.map(getKeyWidth), // Width of keys, including quotes
align = alignmentOptions.on; // "value" or "colon"
let targetWidth = Math.max(...widths),
beforeColon, afterColon, mode;
if (alignmentOptions && length > 1) { // When aligning values within a group, use the alignment configuration.
beforeColon = alignmentOptions.beforeColon;
afterColon = alignmentOptions.afterColon;
mode = alignmentOptions.mode;
} else {
beforeColon = multiLineOptions.beforeColon;
afterColon = multiLineOptions.afterColon;
mode = alignmentOptions.mode;
}
// Conditionally include one space before or after colon
targetWidth += (align === "colon" ? beforeColon : afterColon);
for (let i = 0; i < length; i++) {
const property = properties[i];
const whitespace = getPropertyWhitespace(property);
if (whitespace) { // Object literal getters/setters lack a colon
const width = widths[i];
if (align === "value") {
report(property, "key", whitespace.beforeColon, beforeColon, mode);
report(property, "value", whitespace.afterColon, targetWidth - width, mode);
} else { // align = "colon"
report(property, "key", whitespace.beforeColon, targetWidth - width, mode);
report(property, "value", whitespace.afterColon, afterColon, mode);
}
}
}
} | javascript | function verifyGroupAlignment(properties) {
const length = properties.length,
widths = properties.map(getKeyWidth), // Width of keys, including quotes
align = alignmentOptions.on; // "value" or "colon"
let targetWidth = Math.max(...widths),
beforeColon, afterColon, mode;
if (alignmentOptions && length > 1) { // When aligning values within a group, use the alignment configuration.
beforeColon = alignmentOptions.beforeColon;
afterColon = alignmentOptions.afterColon;
mode = alignmentOptions.mode;
} else {
beforeColon = multiLineOptions.beforeColon;
afterColon = multiLineOptions.afterColon;
mode = alignmentOptions.mode;
}
// Conditionally include one space before or after colon
targetWidth += (align === "colon" ? beforeColon : afterColon);
for (let i = 0; i < length; i++) {
const property = properties[i];
const whitespace = getPropertyWhitespace(property);
if (whitespace) { // Object literal getters/setters lack a colon
const width = widths[i];
if (align === "value") {
report(property, "key", whitespace.beforeColon, beforeColon, mode);
report(property, "value", whitespace.afterColon, targetWidth - width, mode);
} else { // align = "colon"
report(property, "key", whitespace.beforeColon, targetWidth - width, mode);
report(property, "value", whitespace.afterColon, afterColon, mode);
}
}
}
} | [
"function",
"verifyGroupAlignment",
"(",
"properties",
")",
"{",
"const",
"length",
"=",
"properties",
".",
"length",
",",
"widths",
"=",
"properties",
".",
"map",
"(",
"getKeyWidth",
")",
",",
"// Width of keys, including quotes",
"align",
"=",
"alignmentOptions",
... | Verifies correct vertical alignment of a group of properties.
@param {ASTNode[]} properties List of Property AST nodes.
@returns {void} | [
"Verifies",
"correct",
"vertical",
"alignment",
"of",
"a",
"group",
"of",
"properties",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/key-spacing.js#L548-L584 | train | Verifies that a group has at least one key - value pair. | [
30522,
3853,
20410,
17058,
11475,
16206,
3672,
1006,
5144,
1007,
1063,
9530,
3367,
3091,
1027,
5144,
1012,
3091,
1010,
9381,
2015,
1027,
5144,
1012,
4949,
1006,
2131,
14839,
9148,
11927,
2232,
1007,
1010,
1013,
1013,
9381,
1997,
6309,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/document/DocumentManager.js | getNextPrevFile | function getNextPrevFile(inc) {
DeprecationWarning.deprecationWarning("Use MainViewManager.traverseToNextViewByMRU() instead of DocumentManager.getNextPrevFile()", true);
var result = MainViewManager.traverseToNextViewByMRU(inc);
if (result) {
return result.file;
}
return null;
} | javascript | function getNextPrevFile(inc) {
DeprecationWarning.deprecationWarning("Use MainViewManager.traverseToNextViewByMRU() instead of DocumentManager.getNextPrevFile()", true);
var result = MainViewManager.traverseToNextViewByMRU(inc);
if (result) {
return result.file;
}
return null;
} | [
"function",
"getNextPrevFile",
"(",
"inc",
")",
"{",
"DeprecationWarning",
".",
"deprecationWarning",
"(",
"\"Use MainViewManager.traverseToNextViewByMRU() instead of DocumentManager.getNextPrevFile()\"",
",",
"true",
")",
";",
"var",
"result",
"=",
"MainViewManager",
".",
"t... | Get the next or previous file in the working set, in MRU order (relative to currentDocument). May
return currentDocument itself if working set is length 1.
@deprecated use MainViewManager.traverseToNextViewByMRU() instead | [
"Get",
"the",
"next",
"or",
"previous",
"file",
"in",
"the",
"working",
"set",
"in",
"MRU",
"order",
"(",
"relative",
"to",
"currentDocument",
")",
".",
"May",
"return",
"currentDocument",
"itself",
"if",
"working",
"set",
"is",
"length",
"1",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L286-L293 | train | Get the next file in the list of views | [
30522,
3853,
2131,
2638,
30524,
5582,
1006,
1000,
2224,
2364,
8584,
24805,
4590,
1012,
20811,
5524,
18413,
8584,
3762,
2213,
6820,
1006,
1007,
2612,
1997,
6254,
24805,
4590,
1012,
2131,
2638,
18413,
28139,
2615,
8873,
2571,
1006,
1007,
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... |
ecomfe/zrender | src/Element.js | function (zr) {
this.__zr = null;
// 移除动画
var animators = this.animators;
if (animators) {
for (var i = 0; i < animators.length; i++) {
zr.animation.removeAnimator(animators[i]);
}
}
if (this.clipPath) {
this.clipPath.removeSelfFromZr(zr);
}
} | javascript | function (zr) {
this.__zr = null;
// 移除动画
var animators = this.animators;
if (animators) {
for (var i = 0; i < animators.length; i++) {
zr.animation.removeAnimator(animators[i]);
}
}
if (this.clipPath) {
this.clipPath.removeSelfFromZr(zr);
}
} | [
"function",
"(",
"zr",
")",
"{",
"this",
".",
"__zr",
"=",
"null",
";",
"// 移除动画",
"var",
"animators",
"=",
"this",
".",
"animators",
";",
"if",
"(",
"animators",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"animators",
".",
"lengt... | Remove self from zrender instance.
Not recursively because it will be invoked when element added to storage.
@param {module:zrender/ZRender} zr | [
"Remove",
"self",
"from",
"zrender",
"instance",
".",
"Not",
"recursively",
"because",
"it",
"will",
"be",
"invoked",
"when",
"element",
"added",
"to",
"storage",
"."
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/Element.js#L242-L255 | train | remove self from zr | [
30522,
3853,
1006,
1062,
2099,
1007,
1063,
2023,
1012,
1035,
1035,
1062,
2099,
1027,
19701,
1025,
1013,
1013,
100,
100,
100,
100,
13075,
25132,
2015,
1027,
2023,
1012,
25132,
2015,
1025,
2065,
1006,
25132,
2015,
1007,
1063,
2005,
1006,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
tensorflow/tfjs-models | posenet/demos/coco.js | drawMultiplePosesResults | function drawMultiplePosesResults(poses) {
const canvas = multiPersonCanvas();
drawResults(
canvas, poses, guiState.multiPoseDetection.minPartConfidence,
guiState.multiPoseDetection.minPoseConfidence);
const {part, showHeatmap, showOffsets, showDisplacements} =
guiState.visualizeOutputs;
const partId = +part;
visualizeOutputs(
partId, showHeatmap, showOffsets, showDisplacements,
canvas.getContext('2d'));
} | javascript | function drawMultiplePosesResults(poses) {
const canvas = multiPersonCanvas();
drawResults(
canvas, poses, guiState.multiPoseDetection.minPartConfidence,
guiState.multiPoseDetection.minPoseConfidence);
const {part, showHeatmap, showOffsets, showDisplacements} =
guiState.visualizeOutputs;
const partId = +part;
visualizeOutputs(
partId, showHeatmap, showOffsets, showDisplacements,
canvas.getContext('2d'));
} | [
"function",
"drawMultiplePosesResults",
"(",
"poses",
")",
"{",
"const",
"canvas",
"=",
"multiPersonCanvas",
"(",
")",
";",
"drawResults",
"(",
"canvas",
",",
"poses",
",",
"guiState",
".",
"multiPoseDetection",
".",
"minPartConfidence",
",",
"guiState",
".",
"m... | Draw the results from the multi-pose estimation on to a canvas | [
"Draw",
"the",
"results",
"from",
"the",
"multi",
"-",
"pose",
"estimation",
"on",
"to",
"a",
"canvas"
] | af194797c90cc5bcac1060d3cd41b0258a34c7dc | https://github.com/tensorflow/tfjs-models/blob/af194797c90cc5bcac1060d3cd41b0258a34c7dc/posenet/demos/coco.js#L134-L147 | train | Draws the results of a multi - pose detection on the canvas | [
30522,
3853,
4009,
12274,
7096,
11514,
2571,
20688,
21338,
2229,
11314,
2015,
1006,
22382,
1007,
1063,
9530,
3367,
10683,
1027,
4800,
27576,
9336,
12044,
1006,
1007,
1025,
4009,
6072,
11314,
2015,
1006,
10683,
1010,
22382,
1010,
26458,
9153,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/WorkingSetSort.js | get | function get(command) {
var commandID;
if (!command) {
console.error("Attempting to get a Sort method with a missing required parameter: command");
return;
}
if (typeof command === "string") {
commandID = command;
} else {
commandID = command.getID();
}
return _sorts[commandID];
} | javascript | function get(command) {
var commandID;
if (!command) {
console.error("Attempting to get a Sort method with a missing required parameter: command");
return;
}
if (typeof command === "string") {
commandID = command;
} else {
commandID = command.getID();
}
return _sorts[commandID];
} | [
"function",
"get",
"(",
"command",
")",
"{",
"var",
"commandID",
";",
"if",
"(",
"!",
"command",
")",
"{",
"console",
".",
"error",
"(",
"\"Attempting to get a Sort method with a missing required parameter: command\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"t... | Retrieves a Sort object by id
@param {(string|Command)} command A command ID or a command object.
@return {?Sort} | [
"Retrieves",
"a",
"Sort",
"object",
"by",
"id"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetSort.js#L98-L111 | train | Get a Sort method from the cache | [
30522,
3853,
2131,
1006,
3094,
1007,
1063,
13075,
3094,
3593,
1025,
2065,
1006,
999,
3094,
1007,
1063,
10122,
1012,
7561,
1006,
1000,
7161,
2000,
2131,
1037,
4066,
4118,
2007,
1037,
4394,
3223,
16381,
1024,
3094,
1000,
1007,
30524,
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... |
angular/material | src/core/util/animation/animate.js | finished | function finished(ev) {
if (ev && ev.target !== element[0]) return;
if (ev) $timeout.cancel(timer);
element.off($mdConstant.CSS.TRANSITIONEND, finished);
// Never reject since ngAnimate may cause timeouts due missed transitionEnd events
resolve();
} | javascript | function finished(ev) {
if (ev && ev.target !== element[0]) return;
if (ev) $timeout.cancel(timer);
element.off($mdConstant.CSS.TRANSITIONEND, finished);
// Never reject since ngAnimate may cause timeouts due missed transitionEnd events
resolve();
} | [
"function",
"finished",
"(",
"ev",
")",
"{",
"if",
"(",
"ev",
"&&",
"ev",
".",
"target",
"!==",
"element",
"[",
"0",
"]",
")",
"return",
";",
"if",
"(",
"ev",
")",
"$timeout",
".",
"cancel",
"(",
"timer",
")",
";",
"element",
".",
"off",
"(",
"... | Upon timeout or transitionEnd, reject or resolve (respectively) this promise.
NOTE: Make sure this transitionEnd didn't bubble up from a child | [
"Upon",
"timeout",
"or",
"transitionEnd",
"reject",
"or",
"resolve",
"(",
"respectively",
")",
"this",
"promise",
".",
"NOTE",
":",
"Make",
"sure",
"this",
"transitionEnd",
"didn",
"t",
"bubble",
"up",
"from",
"a",
"child"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L75-L84 | train | Called when the transition is finished | [
30522,
3853,
2736,
1006,
23408,
1007,
1063,
2065,
1006,
23408,
1004,
1004,
23408,
1012,
4539,
999,
1027,
1027,
5783,
1031,
1014,
1033,
1007,
2709,
1025,
2065,
1006,
23408,
1007,
1002,
2051,
5833,
1012,
17542,
1006,
25309,
1007,
1025,
5783,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | mxLine | function mxLine(bounds, stroke, strokewidth)
{
mxShape.call(this);
this.bounds = bounds;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
} | javascript | function mxLine(bounds, stroke, strokewidth)
{
mxShape.call(this);
this.bounds = bounds;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
} | [
"function",
"mxLine",
"(",
"bounds",
",",
"stroke",
",",
"strokewidth",
")",
"{",
"mxShape",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"bounds",
"=",
"bounds",
";",
"this",
".",
"stroke",
"=",
"stroke",
";",
"this",
".",
"strokewidth",
"=",
"(... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxLine
Extends <mxShape> to implement a horizontal line shape.
This shape is registered under <mxConstants.SHAPE_LINE> in
<mxCellRenderer>.
Constructor: mxLine
Constructs a new line shape.
Parameters:
bounds - <mxRectangle> that defines the bounds. This is stored in
<mxShape.bounds>.
stroke - String that defines the stroke color. Default is 'black'. This is
stored in <stroke>.
strokewidth - Optional integer that defines the stroke width. Default is
1. This is stored in <strokewidth>. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxLine"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L27402-L27408 | train | A line is a wrapper around the mxShape | [
30522,
3853,
25630,
4179,
1006,
19202,
1010,
6909,
1010,
6909,
9148,
11927,
2232,
1007,
1063,
25630,
7377,
5051,
1012,
2655,
1006,
2023,
1007,
1025,
2023,
1012,
19202,
1027,
19202,
1025,
2023,
1012,
6909,
1027,
6909,
1025,
2023,
1012,
6909,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | examples/3d/js/player.js | function(angle) {
this.dir = (this.dir + angle + circle) % circle;
// Calculate the rotation vector and update the orientation of the listener.
var x = Math.cos(this.dir);
var y = 0;
var z = Math.sin(this.dir);
Howler.orientation(x, y, z, 0, 1, 0);
} | javascript | function(angle) {
this.dir = (this.dir + angle + circle) % circle;
// Calculate the rotation vector and update the orientation of the listener.
var x = Math.cos(this.dir);
var y = 0;
var z = Math.sin(this.dir);
Howler.orientation(x, y, z, 0, 1, 0);
} | [
"function",
"(",
"angle",
")",
"{",
"this",
".",
"dir",
"=",
"(",
"this",
".",
"dir",
"+",
"angle",
"+",
"circle",
")",
"%",
"circle",
";",
"// Calculate the rotation vector and update the orientation of the listener.",
"var",
"x",
"=",
"Math",
".",
"cos",
"("... | Rotate the player's viewing direction.
@param {Number} angle Angle to rotate by. | [
"Rotate",
"the",
"player",
"s",
"viewing",
"direction",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/3d/js/player.js#L39-L47 | train | Update the rotation vector of the listener. | [
30522,
3853,
1006,
6466,
1007,
1063,
2023,
1012,
16101,
1027,
1006,
2023,
1012,
16101,
1009,
6466,
1009,
4418,
1007,
1003,
4418,
1025,
1013,
1013,
18422,
1996,
9963,
9207,
1998,
10651,
1996,
10296,
1997,
1996,
19373,
1012,
13075,
1060,
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... | |
getsentry/sentry-javascript | packages/browser/src/loader.js | function(content) {
// content.e = error
// content.p = promise rejection
// content.f = function call the Sentry
if (
(content.e ||
content.p ||
(content.f && content.f.indexOf('capture') > -1) ||
(content.f && content.f.indexOf('showReportDialog') > -1)) &&
lazy
) {
// We only want to lazy inject/load the sdk bundle if
// an error or promise rejection occured
// OR someone called `capture...` on the SDK
injectSdk(onLoadCallbacks);
}
queue.data.push(content);
} | javascript | function(content) {
// content.e = error
// content.p = promise rejection
// content.f = function call the Sentry
if (
(content.e ||
content.p ||
(content.f && content.f.indexOf('capture') > -1) ||
(content.f && content.f.indexOf('showReportDialog') > -1)) &&
lazy
) {
// We only want to lazy inject/load the sdk bundle if
// an error or promise rejection occured
// OR someone called `capture...` on the SDK
injectSdk(onLoadCallbacks);
}
queue.data.push(content);
} | [
"function",
"(",
"content",
")",
"{",
"// content.e = error",
"// content.p = promise rejection",
"// content.f = function call the Sentry",
"if",
"(",
"(",
"content",
".",
"e",
"||",
"content",
".",
"p",
"||",
"(",
"content",
".",
"f",
"&&",
"content",
".",
"f",
... | Create a namespace and attach function that will store captured exception Because functions are also objects, we can attach the queue itself straight to it and save some bytes | [
"Create",
"a",
"namespace",
"and",
"attach",
"function",
"that",
"will",
"store",
"captured",
"exception",
"Because",
"functions",
"are",
"also",
"objects",
"we",
"can",
"attach",
"the",
"queue",
"itself",
"straight",
"to",
"it",
"and",
"save",
"some",
"bytes"... | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/browser/src/loader.js#L29-L46 | train | Add the content to the data queue | [
30522,
3853,
1006,
4180,
1007,
1063,
1013,
1013,
4180,
1012,
1041,
1027,
7561,
1013,
1013,
4180,
1012,
1052,
1027,
4872,
13893,
1013,
1013,
4180,
1012,
1042,
1027,
3853,
2655,
1996,
2741,
2854,
2065,
1006,
1006,
4180,
1012,
1041,
1064,
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... | |
SheetJS/js-xlsx | xlsx.js | parse_BIFF2STR | function parse_BIFF2STR(blob, length, opts) {
var cell = parse_XLSCell(blob, 6);
++blob.l;
var str = parse_XLUnicodeString2(blob, length-7, opts);
cell.t = 'str';
cell.val = str;
return cell;
} | javascript | function parse_BIFF2STR(blob, length, opts) {
var cell = parse_XLSCell(blob, 6);
++blob.l;
var str = parse_XLUnicodeString2(blob, length-7, opts);
cell.t = 'str';
cell.val = str;
return cell;
} | [
"function",
"parse_BIFF2STR",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"cell",
"=",
"parse_XLSCell",
"(",
"blob",
",",
"6",
")",
";",
"++",
"blob",
".",
"l",
";",
"var",
"str",
"=",
"parse_XLUnicodeString2",
"(",
"blob",
",",
"length",... | /* BIFF2_??? where ??? is the name from [XLS] | [
"/",
"*",
"BIFF2_???",
"where",
"???",
"is",
"the",
"name",
"from",
"[",
"XLS",
"]"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6561-L6568 | train | BIFF2 STR | [
30522,
3853,
11968,
3366,
1035,
12170,
4246,
2475,
3367,
2099,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
3526,
1027,
11968,
3366,
1035,
28712,
11020,
5349,
1006,
1038,
4135,
2497,
1010,
1020,
1007,
1025,
1009... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/editor/EditorStatusBar.js | _updateIndentType | function _updateIndentType(fullPath) {
var indentWithTabs = Editor.getUseTabChar(fullPath);
$indentType.text(indentWithTabs ? Strings.STATUSBAR_TAB_SIZE : Strings.STATUSBAR_SPACES);
$indentType.attr("title", indentWithTabs ? Strings.STATUSBAR_INDENT_TOOLTIP_SPACES : Strings.STATUSBAR_INDENT_TOOLTIP_TABS);
$indentWidthLabel.attr("title", indentWithTabs ? Strings.STATUSBAR_INDENT_SIZE_TOOLTIP_TABS : Strings.STATUSBAR_INDENT_SIZE_TOOLTIP_SPACES);
} | javascript | function _updateIndentType(fullPath) {
var indentWithTabs = Editor.getUseTabChar(fullPath);
$indentType.text(indentWithTabs ? Strings.STATUSBAR_TAB_SIZE : Strings.STATUSBAR_SPACES);
$indentType.attr("title", indentWithTabs ? Strings.STATUSBAR_INDENT_TOOLTIP_SPACES : Strings.STATUSBAR_INDENT_TOOLTIP_TABS);
$indentWidthLabel.attr("title", indentWithTabs ? Strings.STATUSBAR_INDENT_SIZE_TOOLTIP_TABS : Strings.STATUSBAR_INDENT_SIZE_TOOLTIP_SPACES);
} | [
"function",
"_updateIndentType",
"(",
"fullPath",
")",
"{",
"var",
"indentWithTabs",
"=",
"Editor",
".",
"getUseTabChar",
"(",
"fullPath",
")",
";",
"$indentType",
".",
"text",
"(",
"indentWithTabs",
"?",
"Strings",
".",
"STATUSBAR_TAB_SIZE",
":",
"Strings",
"."... | Update indent type and size
@param {string} fullPath Path to file in current editor | [
"Update",
"indent",
"type",
"and",
"size"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorStatusBar.js#L123-L128 | train | Update indent type and width label | [
30522,
3853,
1035,
10651,
22254,
4765,
13874,
1006,
2440,
15069,
1007,
1063,
13075,
27427,
4765,
24415,
2696,
5910,
1027,
3559,
1012,
2131,
8557,
2696,
9818,
8167,
1006,
2440,
15069,
1007,
1025,
1002,
27427,
4765,
13874,
1012,
3793,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ecomfe/zrender | src/graphic/Path.js | function (key, value) {
// FIXME
if (key === 'shape') {
this.setShape(value);
this.__dirtyPath = true;
this._rect = null;
}
else {
Displayable.prototype.attrKV.call(this, key, value);
}
} | javascript | function (key, value) {
// FIXME
if (key === 'shape') {
this.setShape(value);
this.__dirtyPath = true;
this._rect = null;
}
else {
Displayable.prototype.attrKV.call(this, key, value);
}
} | [
"function",
"(",
"key",
",",
"value",
")",
"{",
"// FIXME",
"if",
"(",
"key",
"===",
"'shape'",
")",
"{",
"this",
".",
"setShape",
"(",
"value",
")",
";",
"this",
".",
"__dirtyPath",
"=",
"true",
";",
"this",
".",
"_rect",
"=",
"null",
";",
"}",
... | Overwrite attrKV | [
"Overwrite",
"attrKV"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/graphic/Path.js#L295-L305 | train | Set the attribute value | [
30522,
3853,
1006,
3145,
1010,
3643,
1007,
1063,
1013,
1013,
8081,
4168,
2065,
1006,
3145,
1027,
1027,
1027,
1005,
4338,
1005,
1007,
1063,
2023,
1012,
4520,
3270,
5051,
1006,
3643,
1007,
1025,
2023,
1012,
1035,
1035,
6530,
15069,
1027,
29... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/JavaScriptRefactoring/RefactoringUtils.js | getUniqueIdentifierName | function getUniqueIdentifierName(scopes, prefix, num) {
if (!scopes) {
return prefix;
}
var props = scopes.reduce(function(props, scope) {
return _.union(props, _.keys(scope.props));
}, []);
if (!props) {
return prefix;
}
num = num || "1";
var name;
while (num < 100) { // limit search length
name = prefix + num;
if (props.indexOf(name) === -1) {
break;
}
++num;
}
return name;
} | javascript | function getUniqueIdentifierName(scopes, prefix, num) {
if (!scopes) {
return prefix;
}
var props = scopes.reduce(function(props, scope) {
return _.union(props, _.keys(scope.props));
}, []);
if (!props) {
return prefix;
}
num = num || "1";
var name;
while (num < 100) { // limit search length
name = prefix + num;
if (props.indexOf(name) === -1) {
break;
}
++num;
}
return name;
} | [
"function",
"getUniqueIdentifierName",
"(",
"scopes",
",",
"prefix",
",",
"num",
")",
"{",
"if",
"(",
"!",
"scopes",
")",
"{",
"return",
"prefix",
";",
"}",
"var",
"props",
"=",
"scopes",
".",
"reduce",
"(",
"function",
"(",
"props",
",",
"scope",
")",... | Gets a unique identifier name in the scope that starts with prefix
@param {!Scope} scopes - an array of all scopes returned from tern (each element contains 'props' with identifiers
in that scope)
@param {!string} prefix - prefix of the identifier
@param {number} num - number to start checking for
@return {!string} identifier name | [
"Gets",
"a",
"unique",
"identifier",
"name",
"in",
"the",
"scope",
"that",
"starts",
"with",
"prefix"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js#L148-L171 | train | get unique identifier name | [
30522,
3853,
2131,
19496,
4226,
5178,
16778,
8873,
11795,
14074,
1006,
9531,
2015,
1010,
17576,
1010,
16371,
2213,
1007,
1063,
2065,
1006,
999,
9531,
2015,
1007,
1063,
2709,
17576,
1025,
1065,
13075,
24387,
1027,
9531,
2015,
1012,
5547,
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... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(object, property, value, setter) {
try { object[property] = value; } catch(e) {}
try { object.__defineGetter__(property, function() { return value; }); } catch(e) {}
if (setter) {
try { object.__defineSetter__(property, function() {}); } catch(e) {}
}
if (!wysihtml5.browser.crashesWhenDefineProperty(property)) {
try {
var config = {
get: function() { return value; }
};
if (setter) {
config.set = function() {};
}
Object.defineProperty(object, property, config);
} catch(e) {}
}
} | javascript | function(object, property, value, setter) {
try { object[property] = value; } catch(e) {}
try { object.__defineGetter__(property, function() { return value; }); } catch(e) {}
if (setter) {
try { object.__defineSetter__(property, function() {}); } catch(e) {}
}
if (!wysihtml5.browser.crashesWhenDefineProperty(property)) {
try {
var config = {
get: function() { return value; }
};
if (setter) {
config.set = function() {};
}
Object.defineProperty(object, property, config);
} catch(e) {}
}
} | [
"function",
"(",
"object",
",",
"property",
",",
"value",
",",
"setter",
")",
"{",
"try",
"{",
"object",
"[",
"property",
"]",
"=",
"value",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"try",
"{",
"object",
".",
"__defineGetter__",
"(",
"property",
... | Method to unset/override existing variables
@example
// Make cookie unreadable and unwritable
this._unset(document, "cookie", "", true); | [
"Method",
"to",
"unset",
"/",
"override",
"existing",
"variables"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L7055-L7074 | train | This function is used to set a property on an object | [
30522,
3853,
1006,
4874,
1010,
3200,
1010,
3643,
1010,
2275,
3334,
1007,
1063,
3046,
1063,
4874,
1031,
3200,
1033,
1027,
3643,
1025,
1065,
4608,
1006,
1041,
1007,
1063,
1065,
3046,
1063,
4874,
1012,
1035,
1035,
9375,
18150,
3334,
1035,
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... | |
dimsemenov/PhotoSwipe | src/js/gestures.js | function() {
var yOffset = _panOffset.y - self.currItem.initialPosition.y; // difference between initial and current position
return 1 - Math.abs( yOffset / (_viewportSize.y / 2) );
} | javascript | function() {
var yOffset = _panOffset.y - self.currItem.initialPosition.y; // difference between initial and current position
return 1 - Math.abs( yOffset / (_viewportSize.y / 2) );
} | [
"function",
"(",
")",
"{",
"var",
"yOffset",
"=",
"_panOffset",
".",
"y",
"-",
"self",
".",
"currItem",
".",
"initialPosition",
".",
"y",
";",
"// difference between initial and current position",
"return",
"1",
"-",
"Math",
".",
"abs",
"(",
"yOffset",
"/",
... | amount of pixels to drag to determine direction of swipe | [
"amount",
"of",
"pixels",
"to",
"drag",
"to",
"determine",
"direction",
"of",
"swipe"
] | 80607e12542a1a54ecefa837649e862b35dffd25 | https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L126-L129 | train | Returns the y offset of the last pan | [
30522,
3853,
1006,
1007,
1063,
13075,
10930,
21807,
3388,
1027,
1035,
6090,
27475,
3388,
1012,
1061,
1011,
2969,
1012,
12731,
18752,
18532,
1012,
3988,
26994,
1012,
1061,
1025,
1013,
1013,
4489,
2090,
3988,
1998,
2783,
2597,
2709,
1015,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/search/QuickOpen.js | _getPluginsForCurrentContext | function _getPluginsForCurrentContext() {
var curDoc = DocumentManager.getCurrentDocument();
if (curDoc) {
var languageId = curDoc.getLanguage().getId();
return _providerRegistrationHandler.getProvidersForLanguageId(languageId);
}
return _providerRegistrationHandler.getProvidersForLanguageId(); //plugins registered for all
} | javascript | function _getPluginsForCurrentContext() {
var curDoc = DocumentManager.getCurrentDocument();
if (curDoc) {
var languageId = curDoc.getLanguage().getId();
return _providerRegistrationHandler.getProvidersForLanguageId(languageId);
}
return _providerRegistrationHandler.getProvidersForLanguageId(); //plugins registered for all
} | [
"function",
"_getPluginsForCurrentContext",
"(",
")",
"{",
"var",
"curDoc",
"=",
"DocumentManager",
".",
"getCurrentDocument",
"(",
")",
";",
"if",
"(",
"curDoc",
")",
"{",
"var",
"languageId",
"=",
"curDoc",
".",
"getLanguage",
"(",
")",
".",
"getId",
"(",
... | Helper function to get the plugins based on the type of the current document.
@private
@returns {Array} Returns the plugings based on the languageId of the current document. | [
"Helper",
"function",
"to",
"get",
"the",
"plugins",
"based",
"on",
"the",
"type",
"of",
"the",
"current",
"document",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/QuickOpen.js#L111-L120 | train | Get the plugins registered for the current language | [
30522,
3853,
1035,
2131,
24759,
15916,
7076,
29278,
10841,
14343,
3372,
8663,
18209,
1006,
1007,
1063,
13075,
12731,
20683,
2278,
1027,
6254,
24805,
4590,
1012,
2131,
10841,
14343,
3372,
3527,
24894,
4765,
1006,
1007,
1025,
2065,
1006,
12731,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
getinsomnia/insomnia | packages/insomnia-app/app/ui/redux/modules/entities.js | getReducerName | function getReducerName(type) {
const trailer = type.match(/s$/) ? '' : 's';
return `${type.slice(0, 1).toLowerCase()}${type.slice(1)}${trailer}`;
} | javascript | function getReducerName(type) {
const trailer = type.match(/s$/) ? '' : 's';
return `${type.slice(0, 1).toLowerCase()}${type.slice(1)}${trailer}`;
} | [
"function",
"getReducerName",
"(",
"type",
")",
"{",
"const",
"trailer",
"=",
"type",
".",
"match",
"(",
"/",
"s$",
"/",
")",
"?",
"''",
":",
"'s'",
";",
"return",
"`",
"${",
"type",
".",
"slice",
"(",
"0",
",",
"1",
")",
".",
"toLowerCase",
"(",... | ~~~~~~~~ // Reducers // ~~~~~~~~ // | [
"~~~~~~~~",
"//",
"Reducers",
"//",
"~~~~~~~~",
"//"
] | e24ce7f7b41246e700c4b9bdb6b34b6652ad589b | https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-app/app/ui/redux/modules/entities.js#L10-L13 | train | Get reducer name | [
30522,
3853,
2131,
5596,
18796,
12789,
4168,
1006,
2828,
1007,
1063,
9530,
3367,
9117,
1027,
2828,
1012,
2674,
1006,
1013,
1055,
1002,
1013,
1007,
1029,
1005,
1005,
1024,
1005,
1055,
1005,
1025,
2709,
1036,
1002,
1063,
2828,
1012,
14704,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | src/components/range/lib/matches-selector.js | match | function match (el, selector) {
if (!el || el.nodeType !== 1) return false
if (vendor) return vendor.call(el, selector)
var nodes = all(selector, el.parentNode)
for (var i = 0; i < nodes.length; ++i) {
if (nodes[i] === el) return true
}
return false
} | javascript | function match (el, selector) {
if (!el || el.nodeType !== 1) return false
if (vendor) return vendor.call(el, selector)
var nodes = all(selector, el.parentNode)
for (var i = 0; i < nodes.length; ++i) {
if (nodes[i] === el) return true
}
return false
} | [
"function",
"match",
"(",
"el",
",",
"selector",
")",
"{",
"if",
"(",
"!",
"el",
"||",
"el",
".",
"nodeType",
"!==",
"1",
")",
"return",
"false",
"if",
"(",
"vendor",
")",
"return",
"vendor",
".",
"call",
"(",
"el",
",",
"selector",
")",
"var",
"... | Match `el` to `selector`.
@param {Element} el
@param {String} selector
@return {Boolean}
@api public | [
"Match",
"el",
"to",
"selector",
"."
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/range/lib/matches-selector.js#L38-L46 | train | match el with selector | [
30522,
3853,
2674,
1006,
3449,
1010,
27000,
1007,
1063,
2065,
1006,
999,
3449,
1064,
1064,
3449,
1012,
13045,
13874,
999,
1027,
1027,
1015,
1007,
2709,
6270,
2065,
1006,
21431,
1007,
2709,
21431,
1012,
2655,
1006,
3449,
1010,
27000,
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... |
mui-org/material-ui | docs/src/pages/components/slider/CustomValueReducerSlider.js | valueReducer | function valueReducer(rawValue, props, event) {
const { disabled, max, min, step } = props;
function roundToStep(number) {
return Math.round(number / step) * step;
}
if (!disabled && step) {
if (rawValue > min && rawValue < max) {
if (rawValue === max - step) {
// If moving the Slider using arrow keys and value is formerly an maximum edge value
return roundToStep(rawValue + step / 2);
}
if (rawValue === min + step) {
// Same for minimum edge value
return roundToStep(rawValue - step / 2);
}
return roundToStep(rawValue);
}
return rawValue;
}
return defaultValueReducer(rawValue, props, event);
} | javascript | function valueReducer(rawValue, props, event) {
const { disabled, max, min, step } = props;
function roundToStep(number) {
return Math.round(number / step) * step;
}
if (!disabled && step) {
if (rawValue > min && rawValue < max) {
if (rawValue === max - step) {
// If moving the Slider using arrow keys and value is formerly an maximum edge value
return roundToStep(rawValue + step / 2);
}
if (rawValue === min + step) {
// Same for minimum edge value
return roundToStep(rawValue - step / 2);
}
return roundToStep(rawValue);
}
return rawValue;
}
return defaultValueReducer(rawValue, props, event);
} | [
"function",
"valueReducer",
"(",
"rawValue",
",",
"props",
",",
"event",
")",
"{",
"const",
"{",
"disabled",
",",
"max",
",",
"min",
",",
"step",
"}",
"=",
"props",
";",
"function",
"roundToStep",
"(",
"number",
")",
"{",
"return",
"Math",
".",
"round"... | a value reducer that will snap to multiple of 10 but also to the edge value
Useful here because the max=104 is not a multiple of 10 | [
"a",
"value",
"reducer",
"that",
"will",
"snap",
"to",
"multiple",
"of",
"10",
"but",
"also",
"to",
"the",
"edge",
"value",
"Useful",
"here",
"because",
"the",
"max",
"=",
"104",
"is",
"not",
"a",
"multiple",
"of",
"10"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/pages/components/slider/CustomValueReducerSlider.js#L16-L39 | train | Reducer for value | [
30522,
3853,
3643,
5596,
18796,
2099,
1006,
6315,
10175,
5657,
1010,
24387,
1010,
2724,
1007,
1063,
9530,
3367,
1063,
9776,
1010,
4098,
1010,
8117,
1010,
3357,
1065,
1027,
24387,
1025,
3853,
2461,
13122,
2618,
2361,
1006,
2193,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/util/glob-utils.js | resolveFileGlobPatterns | function resolveFileGlobPatterns(patterns, options) {
if (options.globInputPaths === false) {
return patterns;
}
const processPathExtensions = processPath(options);
return patterns.map(processPathExtensions);
} | javascript | function resolveFileGlobPatterns(patterns, options) {
if (options.globInputPaths === false) {
return patterns;
}
const processPathExtensions = processPath(options);
return patterns.map(processPathExtensions);
} | [
"function",
"resolveFileGlobPatterns",
"(",
"patterns",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"globInputPaths",
"===",
"false",
")",
"{",
"return",
"patterns",
";",
"}",
"const",
"processPathExtensions",
"=",
"processPath",
"(",
"options",
")",
... | ------------------------------------------------------------------------------ Public Interface ------------------------------------------------------------------------------
Resolves any directory patterns into glob-based patterns for easier handling.
@param {string[]} patterns File patterns (such as passed on the command line).
@param {Object} options An options object.
@param {string} [options.globInputPaths] False disables glob resolution.
@returns {string[]} The equivalent glob patterns and filepath strings. | [
"------------------------------------------------------------------------------",
"Public",
"Interface",
"------------------------------------------------------------------------------",
"Resolves",
"any",
"directory",
"patterns",
"into",
"glob",
"-",
"based",
"patterns",
"for",
"easier"... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/glob-utils.js#L166-L174 | train | Resolve glob patterns | [
30522,
3853,
10663,
8873,
23115,
4135,
2497,
4502,
12079,
3619,
1006,
7060,
1010,
7047,
1007,
1063,
2065,
1006,
7047,
1012,
1043,
4135,
8428,
18780,
15069,
2015,
1027,
1027,
1027,
6270,
1007,
1063,
2709,
7060,
1025,
1065,
9530,
3367,
2832,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (percent) {
var min = this.options.min,
max = this.options.max,
min_decimals = min.toString().split(".")[1],
max_decimals = max.toString().split(".")[1],
min_length, max_length,
avg_decimals = 0,
abs = 0;
if (percent === 0) {
return this.options.min;
}
if (percent === 100) {
return this.options.max;
}
if (min_decimals) {
min_length = min_decimals.length;
avg_decimals = min_length;
}
if (max_decimals) {
max_length = max_decimals.length;
avg_decimals = max_length;
}
if (min_length && max_length) {
avg_decimals = (min_length >= max_length) ? min_length : max_length;
}
if (min < 0) {
abs = Math.abs(min);
min = +(min + abs).toFixed(avg_decimals);
max = +(max + abs).toFixed(avg_decimals);
}
var number = ((max - min) / 100 * percent) + min,
string = this.options.step.toString().split(".")[1],
result;
if (string) {
number = +number.toFixed(string.length);
} else {
number = number / this.options.step;
number = number * this.options.step;
number = +number.toFixed(0);
}
if (abs) {
number -= abs;
}
if (string) {
result = +number.toFixed(string.length);
} else {
result = this.toFixed(number);
}
if (result < this.options.min) {
result = this.options.min;
} else if (result > this.options.max) {
result = this.options.max;
}
return result;
} | javascript | function (percent) {
var min = this.options.min,
max = this.options.max,
min_decimals = min.toString().split(".")[1],
max_decimals = max.toString().split(".")[1],
min_length, max_length,
avg_decimals = 0,
abs = 0;
if (percent === 0) {
return this.options.min;
}
if (percent === 100) {
return this.options.max;
}
if (min_decimals) {
min_length = min_decimals.length;
avg_decimals = min_length;
}
if (max_decimals) {
max_length = max_decimals.length;
avg_decimals = max_length;
}
if (min_length && max_length) {
avg_decimals = (min_length >= max_length) ? min_length : max_length;
}
if (min < 0) {
abs = Math.abs(min);
min = +(min + abs).toFixed(avg_decimals);
max = +(max + abs).toFixed(avg_decimals);
}
var number = ((max - min) / 100 * percent) + min,
string = this.options.step.toString().split(".")[1],
result;
if (string) {
number = +number.toFixed(string.length);
} else {
number = number / this.options.step;
number = number * this.options.step;
number = +number.toFixed(0);
}
if (abs) {
number -= abs;
}
if (string) {
result = +number.toFixed(string.length);
} else {
result = this.toFixed(number);
}
if (result < this.options.min) {
result = this.options.min;
} else if (result > this.options.max) {
result = this.options.max;
}
return result;
} | [
"function",
"(",
"percent",
")",
"{",
"var",
"min",
"=",
"this",
".",
"options",
".",
"min",
",",
"max",
"=",
"this",
".",
"options",
".",
"max",
",",
"min_decimals",
"=",
"min",
".",
"toString",
"(",
")",
".",
"split",
"(",
"\".\"",
")",
"[",
"1... | Convert percent to real values
@param percent {Number} X in percent
@returns {Number} X in real | [
"Convert",
"percent",
"to",
"real",
"values"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1770-L1835 | train | get the value of the option | [
30522,
3853,
1006,
3867,
1007,
1063,
13075,
8117,
1027,
2023,
1012,
7047,
1012,
8117,
1010,
4098,
1027,
2023,
1012,
7047,
1012,
4098,
1010,
8117,
1035,
26066,
2015,
1027,
8117,
1012,
2000,
3367,
4892,
1006,
1007,
1012,
3975,
1006,
1000,
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... | |
adobe/brackets | src/view/MainViewManager.js | _makeFirstPaneResizable | function _makeFirstPaneResizable() {
var firstPane = _panes[FIRST_PANE];
Resizer.makeResizable(firstPane.$el,
_orientation === HORIZONTAL ? Resizer.DIRECTION_VERTICAL : Resizer.DIRECTION_HORIZONTAL,
_orientation === HORIZONTAL ? Resizer.POSITION_BOTTOM : Resizer.POSITION_RIGHT,
MIN_PANE_SIZE, false, false, false, true, true);
firstPane.$el.on("panelResizeUpdate", function () {
_updateLayout();
});
} | javascript | function _makeFirstPaneResizable() {
var firstPane = _panes[FIRST_PANE];
Resizer.makeResizable(firstPane.$el,
_orientation === HORIZONTAL ? Resizer.DIRECTION_VERTICAL : Resizer.DIRECTION_HORIZONTAL,
_orientation === HORIZONTAL ? Resizer.POSITION_BOTTOM : Resizer.POSITION_RIGHT,
MIN_PANE_SIZE, false, false, false, true, true);
firstPane.$el.on("panelResizeUpdate", function () {
_updateLayout();
});
} | [
"function",
"_makeFirstPaneResizable",
"(",
")",
"{",
"var",
"firstPane",
"=",
"_panes",
"[",
"FIRST_PANE",
"]",
";",
"Resizer",
".",
"makeResizable",
"(",
"firstPane",
".",
"$el",
",",
"_orientation",
"===",
"HORIZONTAL",
"?",
"Resizer",
".",
"DIRECTION_VERTICA... | Makes the first pane resizable
@private | [
"Makes",
"the",
"first",
"pane",
"resizable"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1136-L1146 | train | Make the first pane resizable | [
30522,
3853,
1035,
2191,
8873,
12096,
9739,
18702,
21335,
3468,
1006,
1007,
1063,
13075,
2034,
9739,
2063,
1027,
1035,
6090,
2229,
1031,
2034,
1035,
6090,
2063,
1033,
1025,
24501,
17629,
1012,
9338,
2229,
21335,
3468,
1006,
2034,
9739,
2063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalVersionInfo.js | function (oODataModelInstance) {
var iVersion;
var sODataModelName;
// check if the given object has metadata and a class name
if (oODataModelInstance && oODataModelInstance.getMetadata) {
sODataModelName = oODataModelInstance.getMetadata().getName();
}
switch (sODataModelName) {
case "sap.ui.model.odata.ODataModel": iVersion = this.V1; break;
case "sap.ui.model.odata.v2.ODataModel": iVersion = this.V2; break;
default: iVersion = this.NONE;
Log.info("AnalyticalVersionInfo.getVersion(...) - The given object is no instance of ODataModel V1 or V2!");
break;
}
return iVersion;
} | javascript | function (oODataModelInstance) {
var iVersion;
var sODataModelName;
// check if the given object has metadata and a class name
if (oODataModelInstance && oODataModelInstance.getMetadata) {
sODataModelName = oODataModelInstance.getMetadata().getName();
}
switch (sODataModelName) {
case "sap.ui.model.odata.ODataModel": iVersion = this.V1; break;
case "sap.ui.model.odata.v2.ODataModel": iVersion = this.V2; break;
default: iVersion = this.NONE;
Log.info("AnalyticalVersionInfo.getVersion(...) - The given object is no instance of ODataModel V1 or V2!");
break;
}
return iVersion;
} | [
"function",
"(",
"oODataModelInstance",
")",
"{",
"var",
"iVersion",
";",
"var",
"sODataModelName",
";",
"// check if the given object has metadata and a class name",
"if",
"(",
"oODataModelInstance",
"&&",
"oODataModelInstance",
".",
"getMetadata",
")",
"{",
"sODataModelNa... | find out which model is used | [
"find",
"out",
"which",
"model",
"is",
"used"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalVersionInfo.js#L21-L38 | train | Returns the version of the given object | [
30522,
3853,
1006,
1051,
13390,
15464,
10244,
24412,
26897,
1007,
1063,
13075,
4921,
2545,
3258,
1025,
13075,
14904,
15464,
10244,
19666,
14074,
1025,
1013,
1013,
4638,
2065,
1996,
2445,
4874,
2038,
27425,
1998,
1037,
2465,
2171,
2065,
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... | |
TryGhost/Ghost | core/server/api/v0.1/tags.js | doQuery | function doQuery(options) {
return models.Tag.add(options.data.tags[0], _.omit(options, ['data']))
.then((model) => {
return {
tags: [urlsForTag(model.id, model.toJSON(options), options)]
};
});
} | javascript | function doQuery(options) {
return models.Tag.add(options.data.tags[0], _.omit(options, ['data']))
.then((model) => {
return {
tags: [urlsForTag(model.id, model.toJSON(options), options)]
};
});
} | [
"function",
"doQuery",
"(",
"options",
")",
"{",
"return",
"models",
".",
"Tag",
".",
"add",
"(",
"options",
".",
"data",
".",
"tags",
"[",
"0",
"]",
",",
"_",
".",
"omit",
"(",
"options",
",",
"[",
"'data'",
"]",
")",
")",
".",
"then",
"(",
"(... | ### Model Query
Make the call to the Model layer
@param {Object} options
@returns {Object} options | [
"###",
"Model",
"Query",
"Make",
"the",
"call",
"to",
"the",
"Model",
"layer"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/tags.js#L115-L122 | train | Query for tags | [
30522,
3853,
2079,
4226,
2854,
1006,
7047,
1007,
1063,
2709,
4275,
1012,
6415,
1012,
5587,
1006,
7047,
1012,
2951,
1012,
22073,
1031,
1014,
1033,
1010,
1035,
1012,
18168,
4183,
1006,
7047,
1010,
1031,
1005,
2951,
1005,
1033,
1007,
1007,
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... |
MoePlayer/DPlayer | demo/modernizr.js | cssToDOM | function cssToDOM(name) {
return name.replace(/([a-z])-([a-z])/g, function(str, m1, m2) {
return m1 + m2.toUpperCase();
}).replace(/^-/, '');
} | javascript | function cssToDOM(name) {
return name.replace(/([a-z])-([a-z])/g, function(str, m1, m2) {
return m1 + m2.toUpperCase();
}).replace(/^-/, '');
} | [
"function",
"cssToDOM",
"(",
"name",
")",
"{",
"return",
"name",
".",
"replace",
"(",
"/",
"([a-z])-([a-z])",
"/",
"g",
",",
"function",
"(",
"str",
",",
"m1",
",",
"m2",
")",
"{",
"return",
"m1",
"+",
"m2",
".",
"toUpperCase",
"(",
")",
";",
"}",
... | cssToDOM takes a kebab-case string and converts it to camelCase
e.g. box-sizing -> boxSizing
@access private
@function cssToDOM
@param {string} name - String name of kebab-case prop we want to convert
@returns {string} The camelCase version of the supplied name | [
"cssToDOM",
"takes",
"a",
"kebab",
"-",
"case",
"string",
"and",
"converts",
"it",
"to",
"camelCase",
"e",
".",
"g",
".",
"box",
"-",
"sizing",
"-",
">",
"boxSizing"
] | f5c53f082634a6e5af56cfc72978ad7bad49b989 | https://github.com/MoePlayer/DPlayer/blob/f5c53f082634a6e5af56cfc72978ad7bad49b989/demo/modernizr.js#L566-L570 | train | Converts a CSS string to a DOM string | [
30522,
3853,
20116,
16033,
9527,
1006,
2171,
1007,
1063,
2709,
2171,
1012,
5672,
1006,
1013,
1006,
1031,
1037,
1011,
1062,
1033,
1007,
1011,
1006,
1031,
1037,
1011,
1062,
1033,
1007,
1013,
1043,
1010,
3853,
1006,
2358,
2099,
1010,
23290,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Freeboard/freeboard | js/freeboard.thirdparty.js | function(target, settings) {
var nodeName, inline, inst;
nodeName = target.nodeName.toLowerCase();
inline = (nodeName === "div" || nodeName === "span");
if (!target.id) {
this.uuid += 1;
target.id = "dp" + this.uuid;
}
inst = this._newInst($(target), inline);
inst.settings = $.extend({}, settings || {});
if (nodeName === "input") {
this._connectDatepicker(target, inst);
} else if (inline) {
this._inlineDatepicker(target, inst);
}
} | javascript | function(target, settings) {
var nodeName, inline, inst;
nodeName = target.nodeName.toLowerCase();
inline = (nodeName === "div" || nodeName === "span");
if (!target.id) {
this.uuid += 1;
target.id = "dp" + this.uuid;
}
inst = this._newInst($(target), inline);
inst.settings = $.extend({}, settings || {});
if (nodeName === "input") {
this._connectDatepicker(target, inst);
} else if (inline) {
this._inlineDatepicker(target, inst);
}
} | [
"function",
"(",
"target",
",",
"settings",
")",
"{",
"var",
"nodeName",
",",
"inline",
",",
"inst",
";",
"nodeName",
"=",
"target",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"inline",
"=",
"(",
"nodeName",
"===",
"\"div\"",
"||",
"nodeName",
... | /* Attach the date picker to a jQuery selection.
@param target element - the target input field or division or span
@param settings object - the new settings to use for this date picker instance (anonymous) | [
"/",
"*",
"Attach",
"the",
"date",
"picker",
"to",
"a",
"jQuery",
"selection",
"."
] | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L7754-L7769 | train | Creates a datepicker instance | [
30522,
3853,
1006,
4539,
1010,
10906,
1007,
1063,
13075,
13045,
18442,
1010,
23881,
1010,
16021,
2102,
1025,
13045,
18442,
1027,
4539,
1012,
13045,
18442,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1025,
23881,
1027,
1006,
13045,
18442,
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... | |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | _changeLinks | function _changeLinks(composer, anchors, attributes) {
var oldAttrs;
for (var a = anchors.length; a--;) {
// Remove all old attributes
oldAttrs = anchors[a].attributes;
for (var oa = oldAttrs.length; oa--;) {
anchors[a].removeAttribute(oldAttrs.item(oa).name);
}
// Set new attributes
for (var j in attributes) {
if (attributes.hasOwnProperty(j)) {
anchors[a].setAttribute(j, attributes[j]);
}
}
}
} | javascript | function _changeLinks(composer, anchors, attributes) {
var oldAttrs;
for (var a = anchors.length; a--;) {
// Remove all old attributes
oldAttrs = anchors[a].attributes;
for (var oa = oldAttrs.length; oa--;) {
anchors[a].removeAttribute(oldAttrs.item(oa).name);
}
// Set new attributes
for (var j in attributes) {
if (attributes.hasOwnProperty(j)) {
anchors[a].setAttribute(j, attributes[j]);
}
}
}
} | [
"function",
"_changeLinks",
"(",
"composer",
",",
"anchors",
",",
"attributes",
")",
"{",
"var",
"oldAttrs",
";",
"for",
"(",
"var",
"a",
"=",
"anchors",
".",
"length",
";",
"a",
"--",
";",
")",
"{",
"// Remove all old attributes",
"oldAttrs",
"=",
"anchor... | Changes attributes of links | [
"Changes",
"attributes",
"of",
"links"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L10351-L10369 | train | Change all links in an array of anchors to the new ones | [
30522,
3853,
1035,
2689,
13767,
2015,
1006,
4543,
1010,
24674,
1010,
12332,
1007,
1063,
13075,
2214,
19321,
2869,
1025,
2005,
1006,
13075,
1037,
1027,
24674,
1012,
3091,
1025,
1037,
1011,
1011,
1025,
1007,
1063,
1013,
1013,
6366,
2035,
2214... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/main.js | _setImplementation | function _setImplementation(multibrowser) {
if (multibrowser) {
// set implemenation
LiveDevImpl = MultiBrowserLiveDev;
// update styles for UI status
_status = [
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_NOT_CONNECTED, style: "warning" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_NOT_CONNECTED, style: "" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS1, style: "info" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_CONNECTED, style: "success" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_OUT_OF_SYNC, style: "out-of-sync" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_SYNC_ERROR, style: "sync-error" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS1, style: "info" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS1, style: "info" }
];
} else {
LiveDevImpl = LiveDevelopment;
_status = [
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_NOT_CONNECTED, style: "warning" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_NOT_CONNECTED, style: "" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS1, style: "info" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS2, style: "info" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_CONNECTED, style: "success" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_OUT_OF_SYNC, style: "out-of-sync" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_SYNC_ERROR, style: "sync-error" }
];
}
// setup status changes listeners for new implementation
_setupGoLiveButton();
_setupGoLiveMenu();
// toggle the menu
_toggleLivePreviewMultiBrowser(multibrowser);
} | javascript | function _setImplementation(multibrowser) {
if (multibrowser) {
// set implemenation
LiveDevImpl = MultiBrowserLiveDev;
// update styles for UI status
_status = [
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_NOT_CONNECTED, style: "warning" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_NOT_CONNECTED, style: "" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS1, style: "info" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_CONNECTED, style: "success" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_OUT_OF_SYNC, style: "out-of-sync" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_SYNC_ERROR, style: "sync-error" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS1, style: "info" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS1, style: "info" }
];
} else {
LiveDevImpl = LiveDevelopment;
_status = [
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_NOT_CONNECTED, style: "warning" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_NOT_CONNECTED, style: "" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS1, style: "info" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_PROGRESS2, style: "info" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_CONNECTED, style: "success" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_OUT_OF_SYNC, style: "out-of-sync" },
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_SYNC_ERROR, style: "sync-error" }
];
}
// setup status changes listeners for new implementation
_setupGoLiveButton();
_setupGoLiveMenu();
// toggle the menu
_toggleLivePreviewMultiBrowser(multibrowser);
} | [
"function",
"_setImplementation",
"(",
"multibrowser",
")",
"{",
"if",
"(",
"multibrowser",
")",
"{",
"// set implemenation",
"LiveDevImpl",
"=",
"MultiBrowserLiveDev",
";",
"// update styles for UI status",
"_status",
"=",
"[",
"{",
"tooltip",
":",
"Strings",
".",
... | Sets the MultiBrowserLiveDev implementation if multibrowser is truthy,
keeps default LiveDevelopment implementation based on CDT otherwise.
It also resets the listeners and UI elements. | [
"Sets",
"the",
"MultiBrowserLiveDev",
"implementation",
"if",
"multibrowser",
"is",
"truthy",
"keeps",
"default",
"LiveDevelopment",
"implementation",
"based",
"on",
"CDT",
"otherwise",
".",
"It",
"also",
"resets",
"the",
"listeners",
"and",
"UI",
"elements",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/main.js#L279-L311 | train | set the implementation of LiveDevelopment | [
30522,
3853,
1035,
2275,
5714,
10814,
3672,
3370,
1006,
4800,
12618,
9333,
2121,
1007,
1063,
2065,
1006,
4800,
12618,
9333,
2121,
1007,
1063,
1013,
1013,
2275,
17727,
16930,
8189,
3508,
2973,
6777,
5714,
24759,
1027,
4800,
12618,
9333,
2121... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
KaTeX/KaTeX | dockers/screenshotter/screenshotter.js | tryConnect | function tryConnect() {
if (!seleniumIP) {
process.nextTick(buildDriver);
return;
}
const sock = net.connect({
host: seleniumIP,
port: +seleniumPort,
});
sock.on("connect", function() {
sock.end();
attempts = 0;
process.nextTick(buildDriver);
}).on("error", function() {
if (++attempts > 50) {
throw new Error("Failed to connect selenium server.");
}
setTimeout(tryConnect, 200);
});
} | javascript | function tryConnect() {
if (!seleniumIP) {
process.nextTick(buildDriver);
return;
}
const sock = net.connect({
host: seleniumIP,
port: +seleniumPort,
});
sock.on("connect", function() {
sock.end();
attempts = 0;
process.nextTick(buildDriver);
}).on("error", function() {
if (++attempts > 50) {
throw new Error("Failed to connect selenium server.");
}
setTimeout(tryConnect, 200);
});
} | [
"function",
"tryConnect",
"(",
")",
"{",
"if",
"(",
"!",
"seleniumIP",
")",
"{",
"process",
".",
"nextTick",
"(",
"buildDriver",
")",
";",
"return",
";",
"}",
"const",
"sock",
"=",
"net",
".",
"connect",
"(",
"{",
"host",
":",
"seleniumIP",
",",
"por... | //////////////////////////////////////////////////////////////////// Wait for container to become ready | [
"////////////////////////////////////////////////////////////////////",
"Wait",
"for",
"container",
"to",
"become",
"ready"
] | 17bfb247b88070267f3e5c7b21fe4a360fdf49d9 | https://github.com/KaTeX/KaTeX/blob/17bfb247b88070267f3e5c7b21fe4a360fdf49d9/dockers/screenshotter/screenshotter.js#L206-L225 | train | Try to connect to the selenium server | [
30522,
3853,
3046,
8663,
2638,
6593,
1006,
1007,
1063,
2065,
1006,
999,
7367,
7770,
5007,
11514,
1007,
1063,
2832,
1012,
2279,
26348,
1006,
3857,
23663,
2099,
1007,
1025,
2709,
1025,
1065,
9530,
3367,
28407,
1027,
5658,
1012,
7532,
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... |
goldfire/howler.js | examples/player/player.js | function() {
var self = this;
// Get the Howl we want to manipulate.
var sound = self.playlist[self.index].howl;
// Puase the sound.
sound.pause();
// Show the play button.
playBtn.style.display = 'block';
pauseBtn.style.display = 'none';
} | javascript | function() {
var self = this;
// Get the Howl we want to manipulate.
var sound = self.playlist[self.index].howl;
// Puase the sound.
sound.pause();
// Show the play button.
playBtn.style.display = 'block';
pauseBtn.style.display = 'none';
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Get the Howl we want to manipulate.",
"var",
"sound",
"=",
"self",
".",
"playlist",
"[",
"self",
".",
"index",
"]",
".",
"howl",
";",
"// Puase the sound.",
"sound",
".",
"pause",
"(",
")",
";... | Pause the currently playing track. | [
"Pause",
"the",
"currently",
"playing",
"track",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/player/player.js#L124-L136 | train | Pause the current item | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
2131,
1996,
22912,
2057,
2215,
2000,
17708,
1012,
13075,
2614,
1027,
2969,
1012,
2377,
9863,
1031,
2969,
1012,
5950,
1033,
1012,
22912,
1025,
1013,
1013,
16405,
11022... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/MessageBox.js | image | function image(oIcon) {
var oImage = new Image({
id: sDialogId + "--icon",
tooltip: rb && rb.getText("MSGBOX_ICON_" + oIcon),
decorative: true
});
oImage.addStyleClass("sapUiMboxIcon");
oImage.addStyleClass(mIconClass[oIcon]);
return oImage;
} | javascript | function image(oIcon) {
var oImage = new Image({
id: sDialogId + "--icon",
tooltip: rb && rb.getText("MSGBOX_ICON_" + oIcon),
decorative: true
});
oImage.addStyleClass("sapUiMboxIcon");
oImage.addStyleClass(mIconClass[oIcon]);
return oImage;
} | [
"function",
"image",
"(",
"oIcon",
")",
"{",
"var",
"oImage",
"=",
"new",
"Image",
"(",
"{",
"id",
":",
"sDialogId",
"+",
"\"--icon\"",
",",
"tooltip",
":",
"rb",
"&&",
"rb",
".",
"getText",
"(",
"\"MSGBOX_ICON_\"",
"+",
"oIcon",
")",
",",
"decorative"... | creates an Image for the given icon type | [
"creates",
"an",
"Image",
"for",
"the",
"given",
"icon",
"type"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MessageBox.js#L243-L252 | train | Creates an Image object for the given icon. | [
30522,
3853,
3746,
1006,
1051,
28524,
1007,
1063,
13075,
1051,
9581,
3351,
1027,
2047,
3746,
1006,
1063,
8909,
1024,
17371,
4818,
8649,
3593,
1009,
1000,
1011,
1011,
12696,
1000,
1010,
6994,
25101,
1024,
21144,
1004,
1004,
21144,
1012,
2131... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util/glob-utils.js | processPath | function processPath(options) {
const cwd = (options && options.cwd) || process.cwd();
let extensions = (options && options.extensions) || [".js"];
extensions = extensions.map(ext => ext.replace(/^\./u, ""));
let suffix = "/**";
if (extensions.length === 1) {
suffix += `/*.${extensions[0]}`;
} else {
suffix += `/*.{${extensions.join(",")}}`;
}
/**
* A function that converts a directory name to a glob pattern
*
* @param {string} pathname The directory path to be modified
* @returns {string} The glob path or the file path itself
* @private
*/
return function(pathname) {
if (pathname === "") {
return "";
}
let newPath = pathname;
const resolvedPath = path.resolve(cwd, pathname);
if (directoryExists(resolvedPath)) {
newPath = pathname.replace(/[/\\]$/u, "") + suffix;
}
return pathUtils.convertPathToPosix(newPath);
};
} | javascript | function processPath(options) {
const cwd = (options && options.cwd) || process.cwd();
let extensions = (options && options.extensions) || [".js"];
extensions = extensions.map(ext => ext.replace(/^\./u, ""));
let suffix = "/**";
if (extensions.length === 1) {
suffix += `/*.${extensions[0]}`;
} else {
suffix += `/*.{${extensions.join(",")}}`;
}
/**
* A function that converts a directory name to a glob pattern
*
* @param {string} pathname The directory path to be modified
* @returns {string} The glob path or the file path itself
* @private
*/
return function(pathname) {
if (pathname === "") {
return "";
}
let newPath = pathname;
const resolvedPath = path.resolve(cwd, pathname);
if (directoryExists(resolvedPath)) {
newPath = pathname.replace(/[/\\]$/u, "") + suffix;
}
return pathUtils.convertPathToPosix(newPath);
};
} | [
"function",
"processPath",
"(",
"options",
")",
"{",
"const",
"cwd",
"=",
"(",
"options",
"&&",
"options",
".",
"cwd",
")",
"||",
"process",
".",
"cwd",
"(",
")",
";",
"let",
"extensions",
"=",
"(",
"options",
"&&",
"options",
".",
"extensions",
")",
... | Checks if a provided path is a directory and returns a glob string matching
all files under that directory if so, the path itself otherwise.
Reason for this is that `glob` needs `/**` to collect all the files under a
directory where as our previous implementation without `glob` simply walked
a directory that is passed. So this is to maintain backwards compatibility.
Also makes sure all path separators are POSIX style for `glob` compatibility.
@param {Object} [options] An options object
@param {string[]} [options.extensions=[".js"]] An array of accepted extensions
@param {string} [options.cwd=process.cwd()] The cwd to use to resolve relative pathnames
@returns {Function} A function that takes a pathname and returns a glob that
matches all files with the provided extensions if
pathname is a directory. | [
"Checks",
"if",
"a",
"provided",
"path",
"is",
"a",
"directory",
"and",
"returns",
"a",
"glob",
"string",
"matching",
"all",
"files",
"under",
"that",
"directory",
"if",
"so",
"the",
"path",
"itself",
"otherwise",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/glob-utils.js#L51-L86 | train | Process a directory path to a glob pattern | [
30522,
3853,
2832,
15069,
1006,
7047,
1007,
1063,
9530,
3367,
19296,
2094,
1027,
1006,
7047,
1004,
1004,
7047,
1012,
19296,
2094,
1007,
1064,
1064,
2832,
1012,
19296,
2094,
1006,
1007,
1025,
2292,
14305,
1027,
1006,
7047,
1004,
1004,
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... |
dequelabs/axe-core | lib/core/utils/preload-cssom.js | processCssomAssets | function processCssomAssets(nestedAssets) {
const result = [];
nestedAssets.forEach(item => {
if (Array.isArray(item)) {
result.push(...processCssomAssets(item));
} else {
result.push(item);
}
});
return result;
} | javascript | function processCssomAssets(nestedAssets) {
const result = [];
nestedAssets.forEach(item => {
if (Array.isArray(item)) {
result.push(...processCssomAssets(item));
} else {
result.push(item);
}
});
return result;
} | [
"function",
"processCssomAssets",
"(",
"nestedAssets",
")",
"{",
"const",
"result",
"=",
"[",
"]",
";",
"nestedAssets",
".",
"forEach",
"(",
"item",
"=>",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"item",
")",
")",
"{",
"result",
".",
"push",
"(",
... | Process results from `loadCssom` queues of all root nodes
NOTE:
using `axe.utils.queue` from various `loadCssom` paths, returns a nested array of arrays at various depths,
hence the need to flatten arrays
@param {Array<Object>} assets CSSOM assets for each root
@returns {Object} CSSOM object | [
"Process",
"results",
"from",
"loadCssom",
"queues",
"of",
"all",
"root",
"nodes",
"NOTE",
":",
"using",
"axe",
".",
"utils",
".",
"queue",
"from",
"various",
"loadCssom",
"paths",
"returns",
"a",
"nested",
"array",
"of",
"arrays",
"at",
"various",
"depths",... | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/preload-cssom.js#L152-L164 | train | Process nested cssom assets | [
30522,
3853,
2832,
6169,
25426,
27241,
3215,
1006,
9089,
11960,
11393,
3215,
1007,
1063,
9530,
3367,
2765,
1027,
1031,
1033,
1025,
9089,
11960,
11393,
3215,
1012,
18921,
6776,
1006,
8875,
1027,
1028,
1063,
2065,
1006,
9140,
1012,
18061,
113... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | mergeScaleConfig | function mergeScaleConfig(/* config objects ... */) {
return helpers$1.merge({}, [].slice.call(arguments), {
merger: function(key, target, source, options) {
if (key === 'xAxes' || key === 'yAxes') {
var slen = source[key].length;
var i, type, scale;
if (!target[key]) {
target[key] = [];
}
for (i = 0; i < slen; ++i) {
scale = source[key][i];
type = valueOrDefault$8(scale.type, key === 'xAxes' ? 'category' : 'linear');
if (i >= target[key].length) {
target[key].push({});
}
if (!target[key][i].type || (scale.type && scale.type !== target[key][i].type)) {
// new/untyped scale or type changed: let's apply the new defaults
// then merge source scale to correctly overwrite the defaults.
helpers$1.merge(target[key][i], [core_scaleService.getScaleDefaults(type), scale]);
} else {
// scales type are the same
helpers$1.merge(target[key][i], scale);
}
}
} else {
helpers$1._merger(key, target, source, options);
}
}
});
} | javascript | function mergeScaleConfig(/* config objects ... */) {
return helpers$1.merge({}, [].slice.call(arguments), {
merger: function(key, target, source, options) {
if (key === 'xAxes' || key === 'yAxes') {
var slen = source[key].length;
var i, type, scale;
if (!target[key]) {
target[key] = [];
}
for (i = 0; i < slen; ++i) {
scale = source[key][i];
type = valueOrDefault$8(scale.type, key === 'xAxes' ? 'category' : 'linear');
if (i >= target[key].length) {
target[key].push({});
}
if (!target[key][i].type || (scale.type && scale.type !== target[key][i].type)) {
// new/untyped scale or type changed: let's apply the new defaults
// then merge source scale to correctly overwrite the defaults.
helpers$1.merge(target[key][i], [core_scaleService.getScaleDefaults(type), scale]);
} else {
// scales type are the same
helpers$1.merge(target[key][i], scale);
}
}
} else {
helpers$1._merger(key, target, source, options);
}
}
});
} | [
"function",
"mergeScaleConfig",
"(",
"/* config objects ... */",
")",
"{",
"return",
"helpers$1",
".",
"merge",
"(",
"{",
"}",
",",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
",",
"{",
"merger",
":",
"function",
"(",
"key",
",",
"target"... | Recursively merge the given config objects representing the `scales` option
by incorporating scale defaults in `xAxes` and `yAxes` array items, then
returns a deep copy of the result, thus doesn't alter inputs. | [
"Recursively",
"merge",
"the",
"given",
"config",
"objects",
"representing",
"the",
"scales",
"option",
"by",
"incorporating",
"scale",
"defaults",
"in",
"xAxes",
"and",
"yAxes",
"array",
"items",
"then",
"returns",
"a",
"deep",
"copy",
"of",
"the",
"result",
... | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L8300-L8333 | train | Merge scale config objects into target config object | [
30522,
3853,
13590,
15782,
2571,
8663,
8873,
2290,
1006,
1013,
1008,
9530,
8873,
2290,
5200,
1012,
1012,
1012,
1008,
1013,
1007,
1063,
2709,
2393,
2545,
1002,
1015,
1012,
13590,
1006,
1063,
1065,
1010,
1031,
1033,
1012,
14704,
1012,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | _migrateDataTojQueryUI110 | function _migrateDataTojQueryUI110(data){
var withinElement = jQuery(window);
data.within = {
element: withinElement,
isWindow: true,
offset: withinElement.offset() || { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
width: withinElement.width(),
height: withinElement.height()
};
data.collisionPosition = {
marginLeft: 0,
marginTop: 0
};
return data;
} | javascript | function _migrateDataTojQueryUI110(data){
var withinElement = jQuery(window);
data.within = {
element: withinElement,
isWindow: true,
offset: withinElement.offset() || { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
width: withinElement.width(),
height: withinElement.height()
};
data.collisionPosition = {
marginLeft: 0,
marginTop: 0
};
return data;
} | [
"function",
"_migrateDataTojQueryUI110",
"(",
"data",
")",
"{",
"var",
"withinElement",
"=",
"jQuery",
"(",
"window",
")",
";",
"data",
".",
"within",
"=",
"{",
"element",
":",
"withinElement",
",",
"isWindow",
":",
"true",
",",
"offset",
":",
"withinElement... | /*!
The following code is taken from
jQuery UI 1.10.3 - 2013-11-18
jquery.ui.position.js
http://jqueryui.com
Copyright 2013 jQuery Foundation and other contributors; Licensed MIT
TODO: Get rid of this coding when jQuery UI 1.8 is no longer supported and the framework was switched to jQuery UI 1.9 ff. | [
"/",
"*",
"!",
"The",
"following",
"code",
"is",
"taken",
"from",
"jQuery",
"UI",
"1",
".",
"10",
".",
"3",
"-",
"2013",
"-",
"11",
"-",
"18",
"jquery",
".",
"ui",
".",
"position",
".",
"js"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/Menu.js#L1242-L1258 | train | Migrate jQuery UI110 data to jQuery UI110 data | [
30522,
3853,
1035,
13447,
6790,
3406,
3501,
4226,
2854,
10179,
14526,
2692,
1006,
2951,
1007,
1063,
13075,
2306,
12260,
3672,
1027,
1046,
4226,
2854,
1006,
3332,
1007,
1025,
2951,
1012,
2306,
1027,
1063,
5783,
1024,
2306,
12260,
3672,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jhipster/generator-jhipster | generators/aws-containers/lib/cloudFormation.js | _getStackLogLine | function _getStackLogLine(stack, indentation = 0) {
const time = chalk.blue(`${stack.Timestamp.toLocaleTimeString()}`);
const spacing = _.repeat('\t', indentation);
const status = _formatStatus(stack.ResourceStatus);
const stackName = chalk.grey(stack.StackName);
const resourceType = chalk.bold(stack.ResourceType);
return `${time} ${spacing}${status} ${resourceType}\t${stackName}`;
} | javascript | function _getStackLogLine(stack, indentation = 0) {
const time = chalk.blue(`${stack.Timestamp.toLocaleTimeString()}`);
const spacing = _.repeat('\t', indentation);
const status = _formatStatus(stack.ResourceStatus);
const stackName = chalk.grey(stack.StackName);
const resourceType = chalk.bold(stack.ResourceType);
return `${time} ${spacing}${status} ${resourceType}\t${stackName}`;
} | [
"function",
"_getStackLogLine",
"(",
"stack",
",",
"indentation",
"=",
"0",
")",
"{",
"const",
"time",
"=",
"chalk",
".",
"blue",
"(",
"`",
"${",
"stack",
".",
"Timestamp",
".",
"toLocaleTimeString",
"(",
")",
"}",
"`",
")",
";",
"const",
"spacing",
"=... | Generate an enriched string to display a CloudFormation Stack creation event.
@param stack Stack event
@param indentation level of indentation to display (between the date and the rest of the log)
@returns {string}
@private | [
"Generate",
"an",
"enriched",
"string",
"to",
"display",
"a",
"CloudFormation",
"Stack",
"creation",
"event",
"."
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/lib/cloudFormation.js#L311-L319 | train | Returns a line that prints the stack log | [
30522,
3853,
1035,
4152,
2696,
3600,
21197,
4179,
1006,
9991,
1010,
27427,
19304,
1027,
1014,
1007,
1063,
9530,
3367,
2051,
1027,
16833,
1012,
2630,
1006,
1036,
1002,
1063,
9991,
1012,
2335,
15464,
2361,
1012,
2000,
4135,
9289,
20624,
7834,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/switch-colon-spacing.js | getColonToken | function getColonToken(node) {
if (node.test) {
return sourceCode.getTokenAfter(node.test, astUtils.isColonToken);
}
return sourceCode.getFirstToken(node, 1);
} | javascript | function getColonToken(node) {
if (node.test) {
return sourceCode.getTokenAfter(node.test, astUtils.isColonToken);
}
return sourceCode.getFirstToken(node, 1);
} | [
"function",
"getColonToken",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"test",
")",
"{",
"return",
"sourceCode",
".",
"getTokenAfter",
"(",
"node",
".",
"test",
",",
"astUtils",
".",
"isColonToken",
")",
";",
"}",
"return",
"sourceCode",
".",
"getFi... | true by default
Get the colon token of the given SwitchCase node.
@param {ASTNode} node The SwitchCase node to get.
@returns {Token} The colon token of the node. | [
"true",
"by",
"default",
"Get",
"the",
"colon",
"token",
"of",
"the",
"given",
"SwitchCase",
"node",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/switch-colon-spacing.js#L59-L64 | train | Get colon token from given node | [
30522,
3853,
2131,
25778,
12162,
11045,
2078,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
3231,
1007,
1063,
2709,
3120,
16044,
1012,
2131,
18715,
8189,
6199,
2121,
1006,
13045,
1012,
3231,
1010,
2004,
8525,
3775,
4877,
1012,
2003,
257... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/Configuration.js | function(sType, sSymbol) {
check(sType == "decimal" || sType == "group" || sType == "plusSign" || sType == "minusSign", "sType must be decimal, group, plusSign or minusSign");
this._set("symbols-latn-" + sType, sSymbol);
return this;
} | javascript | function(sType, sSymbol) {
check(sType == "decimal" || sType == "group" || sType == "plusSign" || sType == "minusSign", "sType must be decimal, group, plusSign or minusSign");
this._set("symbols-latn-" + sType, sSymbol);
return this;
} | [
"function",
"(",
"sType",
",",
"sSymbol",
")",
"{",
"check",
"(",
"sType",
"==",
"\"decimal\"",
"||",
"sType",
"==",
"\"group\"",
"||",
"sType",
"==",
"\"plusSign\"",
"||",
"sType",
"==",
"\"minusSign\"",
",",
"\"sType must be decimal, group, plusSign or minusSign\"... | Defines the string to be used for the given number symbol.
Calling this method with a null or undefined symbol removes a previously set symbol string.
Note that an empty string is explicitly allowed.
If a symbol is defined, it will be preferred over symbols derived from the current locale.
See class {@link sap.ui.core.format.NumberFormat} for details about the symbols.
After changing the number symbol, the framework tries to update localization
specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage}
for details and restrictions.
@param {string} sStyle must be one of decimal, group, plusSign, minusSign.
@param {string} sSymbol will be used to represent the given symbol type
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public | [
"Defines",
"the",
"string",
"to",
"be",
"used",
"for",
"the",
"given",
"number",
"symbol",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1913-L1917 | train | Sets the symbol for the given type | [
30522,
3853,
1006,
2358,
18863,
1010,
7020,
24335,
14956,
1007,
1063,
4638,
1006,
2358,
18863,
1027,
1027,
1000,
26066,
1000,
1064,
1064,
2358,
18863,
1027,
1027,
1000,
2177,
1000,
1064,
1064,
2358,
18863,
1027,
1027,
1000,
4606,
5332,
1620... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | ManagedUpload | function ManagedUpload(options) {
var self = this;
AWS.SequentialExecutor.call(self);
self.body = null;
self.sliceFn = null;
self.callback = null;
self.parts = {};
self.completeInfo = [];
self.fillQueue = function() {
self.callback(new Error('Unsupported body payload ' + typeof self.body));
};
self.configure(options);
} | javascript | function ManagedUpload(options) {
var self = this;
AWS.SequentialExecutor.call(self);
self.body = null;
self.sliceFn = null;
self.callback = null;
self.parts = {};
self.completeInfo = [];
self.fillQueue = function() {
self.callback(new Error('Unsupported body payload ' + typeof self.body));
};
self.configure(options);
} | [
"function",
"ManagedUpload",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"AWS",
".",
"SequentialExecutor",
".",
"call",
"(",
"self",
")",
";",
"self",
".",
"body",
"=",
"null",
";",
"self",
".",
"sliceFn",
"=",
"null",
";",
"self",
"."... | Creates a managed upload object with a set of configuration options.
@note A "Body" parameter is required to be set prior to calling {send}.
@option options params [map] a map of parameters to pass to the upload
requests. The "Body" parameter is required to be specified either on
the service or in the params option.
@note ContentMD5 should not be provided when using the managed upload object.
Instead, setting "computeChecksums" to true will enable automatic ContentMD5 generation
by the managed upload object.
@option options queueSize [Number] (4) the size of the concurrent queue
manager to upload parts in parallel. Set to 1 for synchronous uploading
of parts. Note that the uploader will buffer at most queueSize * partSize
bytes into memory at any given time.
@option options partSize [Number] (5mb) the size in bytes for each
individual part to be uploaded. Adjust the part size to ensure the number
of parts does not exceed {maxTotalParts}. See {minPartSize} for the
minimum allowed part size.
@option options leavePartsOnError [Boolean] (false) whether to abort the
multipart upload if an error occurs. Set to true if you want to handle
failures manually.
@option options service [AWS.S3] an optional S3 service object to use for
requests. This object might have bound parameters used by the uploader.
@option options tags [Array<map>] The tags to apply to the uploaded object.
Each tag should have a `Key` and `Value` keys.
@example Creating a default uploader for a stream object
var upload = new AWS.S3.ManagedUpload({
params: {Bucket: 'bucket', Key: 'key', Body: stream}
});
@example Creating an uploader with concurrency of 1 and partSize of 10mb
var upload = new AWS.S3.ManagedUpload({
partSize: 10 * 1024 * 1024, queueSize: 1,
params: {Bucket: 'bucket', Key: 'key', Body: stream}
});
@example Creating an uploader with tags
var upload = new AWS.S3.ManagedUpload({
params: {Bucket: 'bucket', Key: 'key', Body: stream},
tags: [{Key: 'tag1', Value: 'value1'}, {Key: 'tag2', Value: 'value2'}]
});
@see send | [
"Creates",
"a",
"managed",
"upload",
"object",
"with",
"a",
"set",
"of",
"configuration",
"options",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/s3/managed_upload.js#L81-L94 | train | ManagedUpload constructor. | [
30522,
3853,
3266,
6279,
11066,
1006,
7047,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
22091,
2015,
1012,
25582,
10288,
8586,
16161,
2099,
1012,
2655,
1006,
2969,
1007,
1025,
2969,
1012,
2303,
1027,
19701,
1025,
2969,
1012,
14704,
2546,
207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/toolbars.js | autoCompleteResults_getUnderlinedText | function autoCompleteResults_getUnderlinedText(result, type) {
this._controller.assertJS("subject.resultNode != null",
{resultNode: result.getNode()});
// Get the description element of the given title or url
var description = null;
switch (type) {
case "title":
description = result.getNode().boxObject.firstChild.childNodes[1].childNodes[0];
break;
case "url":
description = result.getNode().boxObject.lastChild.childNodes[2].childNodes[0];
break;
default:
throw new Error(arguments.callee.name + ": Type unknown - " + type);
}
let values = [ ];
for each (node in description.childNodes) {
if (node.nodeName == 'span') {
// Only add underlined text to the results
values.push(node.innerHTML);
}
}
return values;
} | javascript | function autoCompleteResults_getUnderlinedText(result, type) {
this._controller.assertJS("subject.resultNode != null",
{resultNode: result.getNode()});
// Get the description element of the given title or url
var description = null;
switch (type) {
case "title":
description = result.getNode().boxObject.firstChild.childNodes[1].childNodes[0];
break;
case "url":
description = result.getNode().boxObject.lastChild.childNodes[2].childNodes[0];
break;
default:
throw new Error(arguments.callee.name + ": Type unknown - " + type);
}
let values = [ ];
for each (node in description.childNodes) {
if (node.nodeName == 'span') {
// Only add underlined text to the results
values.push(node.innerHTML);
}
}
return values;
} | [
"function",
"autoCompleteResults_getUnderlinedText",
"(",
"result",
",",
"type",
")",
"{",
"this",
".",
"_controller",
".",
"assertJS",
"(",
"\"subject.resultNode != null\"",
",",
"{",
"resultNode",
":",
"result",
".",
"getNode",
"(",
")",
"}",
")",
";",
"// Get... | Returns the underlined text of all results from the text or URL
@param {ElemBase} result
Autocomplete result which has to be checked
@param {string} type
Type of element to check (text or url)
@returns An array of substrings which are underlined
@type {Array of string} | [
"Returns",
"the",
"underlined",
"text",
"of",
"all",
"results",
"from",
"the",
"text",
"or",
"URL"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L155-L181 | train | Get the underlined text of the given result | [
30522,
3853,
8285,
9006,
10814,
3334,
2229,
11314,
2015,
1035,
2131,
20824,
18194,
18209,
1006,
2765,
1010,
2828,
1007,
1063,
2023,
1012,
1035,
11486,
1012,
20865,
22578,
1006,
1000,
3395,
1012,
2765,
3630,
3207,
999,
1027,
19701,
1000,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laurent22/joplin | ElectronClient/app/main.js | profileFromArgs | function profileFromArgs(args) {
if (!args) return null;
const profileIndex = args.indexOf('--profile');
if (profileIndex <= 0 || profileIndex >= args.length - 1) return null;
const profileValue = args[profileIndex + 1];
return profileValue ? profileValue : null;
} | javascript | function profileFromArgs(args) {
if (!args) return null;
const profileIndex = args.indexOf('--profile');
if (profileIndex <= 0 || profileIndex >= args.length - 1) return null;
const profileValue = args[profileIndex + 1];
return profileValue ? profileValue : null;
} | [
"function",
"profileFromArgs",
"(",
"args",
")",
"{",
"if",
"(",
"!",
"args",
")",
"return",
"null",
";",
"const",
"profileIndex",
"=",
"args",
".",
"indexOf",
"(",
"'--profile'",
")",
";",
"if",
"(",
"profileIndex",
"<=",
"0",
"||",
"profileIndex",
">="... | Likewise, we want to know if a profile is specified early, in particular to save the window state data. | [
"Likewise",
"we",
"want",
"to",
"know",
"if",
"a",
"profile",
"is",
"specified",
"early",
"in",
"particular",
"to",
"save",
"the",
"window",
"state",
"data",
"."
] | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/ElectronClient/app/main.js#L29-L35 | train | Get the profile value from the args | [
30522,
3853,
6337,
19699,
9626,
10623,
2015,
1006,
12098,
5620,
1007,
1063,
2065,
1006,
999,
12098,
5620,
1007,
2709,
19701,
1025,
9530,
3367,
6337,
22254,
10288,
1027,
12098,
5620,
1012,
5950,
11253,
1006,
1005,
1011,
1011,
6337,
1005,
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/_ODataMetaModelUtils.js | function (oEntitySet, oNavigationProperty) {
var sCreatable = oNavigationProperty["sap:creatable"],
sCreatablePath = oNavigationProperty["sap:creatable-path"],
oInsertRestrictions,
oNonInsertable = {"NavigationPropertyPath" : oNavigationProperty.name},
aNonInsertableNavigationProperties;
if (sCreatable && sCreatablePath) {
// inconsistent service if both v2 annotations are set
Log.warning("Inconsistent service",
"Use either 'sap:creatable' or 'sap:creatable-path' at navigation property "
+ "'" + oEntitySet.entityType + "/" + oNavigationProperty.name + "'",
sLoggingModule);
sCreatable = "false";
sCreatablePath = undefined;
}
if (sCreatable === "false" || sCreatablePath) {
oInsertRestrictions
= oEntitySet["Org.OData.Capabilities.V1.InsertRestrictions"]
= oEntitySet["Org.OData.Capabilities.V1.InsertRestrictions"] || {};
aNonInsertableNavigationProperties
= oInsertRestrictions["NonInsertableNavigationProperties"]
= oInsertRestrictions["NonInsertableNavigationProperties"] || [];
if (sCreatablePath) {
oNonInsertable = {
"If" : [{
"Not" : {
"Path" : sCreatablePath
}
}, oNonInsertable]
};
}
aNonInsertableNavigationProperties.push(oNonInsertable);
}
} | javascript | function (oEntitySet, oNavigationProperty) {
var sCreatable = oNavigationProperty["sap:creatable"],
sCreatablePath = oNavigationProperty["sap:creatable-path"],
oInsertRestrictions,
oNonInsertable = {"NavigationPropertyPath" : oNavigationProperty.name},
aNonInsertableNavigationProperties;
if (sCreatable && sCreatablePath) {
// inconsistent service if both v2 annotations are set
Log.warning("Inconsistent service",
"Use either 'sap:creatable' or 'sap:creatable-path' at navigation property "
+ "'" + oEntitySet.entityType + "/" + oNavigationProperty.name + "'",
sLoggingModule);
sCreatable = "false";
sCreatablePath = undefined;
}
if (sCreatable === "false" || sCreatablePath) {
oInsertRestrictions
= oEntitySet["Org.OData.Capabilities.V1.InsertRestrictions"]
= oEntitySet["Org.OData.Capabilities.V1.InsertRestrictions"] || {};
aNonInsertableNavigationProperties
= oInsertRestrictions["NonInsertableNavigationProperties"]
= oInsertRestrictions["NonInsertableNavigationProperties"] || [];
if (sCreatablePath) {
oNonInsertable = {
"If" : [{
"Not" : {
"Path" : sCreatablePath
}
}, oNonInsertable]
};
}
aNonInsertableNavigationProperties.push(oNonInsertable);
}
} | [
"function",
"(",
"oEntitySet",
",",
"oNavigationProperty",
")",
"{",
"var",
"sCreatable",
"=",
"oNavigationProperty",
"[",
"\"sap:creatable\"",
"]",
",",
"sCreatablePath",
"=",
"oNavigationProperty",
"[",
"\"sap:creatable-path\"",
"]",
",",
"oInsertRestrictions",
",",
... | Convert sap:creatable and sap:creatable-path at navigation property to V4 annotation
'Org.OData.Capabilities.V1.InsertRestrictions/NonInsertableNavigationProperties' at
the given entity set.
If both V2 annotations 'sap:creatable' and 'sap:creatable-path' are given the service is
broken and the navigation property is added as non-insertable navigation property.
If neither 'sap:creatable' nor 'sap:creatable-path' are given this function does
nothing.
@param {object} oEntitySet
The entity set
@param {object} oNavigationProperty
The navigation property | [
"Convert",
"sap",
":",
"creatable",
"and",
"sap",
":",
"creatable",
"-",
"path",
"at",
"navigation",
"property",
"to",
"V4",
"annotation",
"Org",
".",
"OData",
".",
"Capabilities",
".",
"V1",
".",
"InsertRestrictions",
"/",
"NonInsertableNavigationProperties",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L817-L851 | train | Checks if the navigation property is inconsistent with v2 annotations | [
30522,
3853,
1006,
1051,
4765,
3012,
13462,
1010,
2006,
18891,
12540,
21572,
4842,
3723,
1007,
1063,
13075,
8040,
16416,
10880,
1027,
2006,
18891,
12540,
21572,
4842,
3723,
1031,
1000,
20066,
1024,
13675,
5243,
10880,
1000,
1033,
1010,
8040,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/func-names.js | reportUnexpectedUnnamedFunction | function reportUnexpectedUnnamedFunction(node) {
context.report({
node,
messageId: "unnamed",
data: { name: astUtils.getFunctionNameWithKind(node) }
});
} | javascript | function reportUnexpectedUnnamedFunction(node) {
context.report({
node,
messageId: "unnamed",
data: { name: astUtils.getFunctionNameWithKind(node) }
});
} | [
"function",
"reportUnexpectedUnnamedFunction",
"(",
"node",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
",",
"messageId",
":",
"\"unnamed\"",
",",
"data",
":",
"{",
"name",
":",
"astUtils",
".",
"getFunctionNameWithKind",
"(",
"node",
")",
"}",
"}"... | Reports that an unnamed function should be named
@param {ASTNode} node - The node to report in the event of an error.
@returns {void} | [
"Reports",
"that",
"an",
"unnamed",
"function",
"should",
"be",
"named"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/func-names.js#L129-L135 | train | Reports an unexpected unnamed function. | [
30522,
3853,
3189,
9816,
2595,
5051,
10985,
4609,
18442,
20952,
4609,
7542,
1006,
13045,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1010,
4471,
3593,
1024,
1000,
13294,
1000,
1010,
2951,
1024,
1063,
2171,
1024,
2004,
8525,
3775,
4877,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/lib/_Parser.js | tokenizeDoubleQuotedString | function tokenizeDoubleQuotedString(sNext, sOption, iAt) {
var c,
sEscape,
bEscaping = false,
i;
for (i = 1; i < sNext.length; i += 1) {
if (bEscaping) {
bEscaping = false;
} else {
c = sNext[i];
if (c === "%") {
sEscape = sNext.slice(i + 1, i + 3);
if (rEscapeDigits.test(sEscape)) {
c = unescape(sEscape);
i += 2;
}
}
if (c === '"') {
return sNext.slice(0, i + 1);
}
bEscaping = c === '\\';
}
}
throw new SyntaxError("Unterminated string at " + iAt + ": " + sOption);
} | javascript | function tokenizeDoubleQuotedString(sNext, sOption, iAt) {
var c,
sEscape,
bEscaping = false,
i;
for (i = 1; i < sNext.length; i += 1) {
if (bEscaping) {
bEscaping = false;
} else {
c = sNext[i];
if (c === "%") {
sEscape = sNext.slice(i + 1, i + 3);
if (rEscapeDigits.test(sEscape)) {
c = unescape(sEscape);
i += 2;
}
}
if (c === '"') {
return sNext.slice(0, i + 1);
}
bEscaping = c === '\\';
}
}
throw new SyntaxError("Unterminated string at " + iAt + ": " + sOption);
} | [
"function",
"tokenizeDoubleQuotedString",
"(",
"sNext",
",",
"sOption",
",",
"iAt",
")",
"{",
"var",
"c",
",",
"sEscape",
",",
"bEscaping",
"=",
"false",
",",
"i",
";",
"for",
"(",
"i",
"=",
"1",
";",
"i",
"<",
"sNext",
".",
"length",
";",
"i",
"+=... | Tokenizes a c-like string. It starts and ends with a double quote, backslash is the escape
character. Both characters may be %-encoded.
@param {string} sNext The untokenized input starting with the opening quote
@param {string} sOption The option string (for an error message)
@param {number} iAt The position in the option string (for an error message)
@returns {string} The unconverted string including the quotes. | [
"Tokenizes",
"a",
"c",
"-",
"like",
"string",
".",
"It",
"starts",
"and",
"ends",
"with",
"a",
"double",
"quote",
"backslash",
"is",
"the",
"escape",
"character",
".",
"Both",
"characters",
"may",
"be",
"%",
"-",
"encoded",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L655-L680 | train | Tokenizes a double - quoted string | [
30522,
3853,
19204,
3550,
7140,
3468,
28940,
27428,
3367,
4892,
1006,
1055,
2638,
18413,
1010,
2061,
16790,
1010,
24264,
2102,
1007,
1063,
13075,
1039,
1010,
7367,
15782,
5051,
1010,
2022,
15782,
4691,
1027,
6270,
1010,
1045,
1025,
2005,
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... |
adobe/brackets | src/language/HTMLDOMDiff.js | function () {
var prev = prevNode();
if (prev && !prev.children) {
newEdit = {
type: "textReplace",
content: prev.content
};
} else {
newEdit = {
type: "textDelete"
};
}
// When elements are deleted or moved from the old set of children, you
// can end up with multiple text nodes in a row. A single textReplace edit
// will take care of those (and will contain all of the right content since
// the text nodes between elements in the new DOM are merged together).
// The check below looks to see if we're already in the process of adding
// a textReplace edit following the same element.
var previousEdit = newEdits.length > 0 && newEdits[newEdits.length - 1];
if (previousEdit && previousEdit.type === "textReplace" &&
previousEdit.afterID === textAfterID) {
oldIndex++;
return;
}
newEdit.parentID = oldChild.parent.tagID;
// If there was only one child previously, we just pass along
// textDelete/textReplace with the parentID and the browser will
// clear all of the children
if (oldChild.parent.children.length === 1) {
newEdits.push(newEdit);
} else {
if (textAfterID) {
newEdit.afterID = textAfterID;
}
newEdits.push(newEdit);
}
// This text appeared in the old tree but not the new one, so we
// increment the old children counter.
oldIndex++;
} | javascript | function () {
var prev = prevNode();
if (prev && !prev.children) {
newEdit = {
type: "textReplace",
content: prev.content
};
} else {
newEdit = {
type: "textDelete"
};
}
// When elements are deleted or moved from the old set of children, you
// can end up with multiple text nodes in a row. A single textReplace edit
// will take care of those (and will contain all of the right content since
// the text nodes between elements in the new DOM are merged together).
// The check below looks to see if we're already in the process of adding
// a textReplace edit following the same element.
var previousEdit = newEdits.length > 0 && newEdits[newEdits.length - 1];
if (previousEdit && previousEdit.type === "textReplace" &&
previousEdit.afterID === textAfterID) {
oldIndex++;
return;
}
newEdit.parentID = oldChild.parent.tagID;
// If there was only one child previously, we just pass along
// textDelete/textReplace with the parentID and the browser will
// clear all of the children
if (oldChild.parent.children.length === 1) {
newEdits.push(newEdit);
} else {
if (textAfterID) {
newEdit.afterID = textAfterID;
}
newEdits.push(newEdit);
}
// This text appeared in the old tree but not the new one, so we
// increment the old children counter.
oldIndex++;
} | [
"function",
"(",
")",
"{",
"var",
"prev",
"=",
"prevNode",
"(",
")",
";",
"if",
"(",
"prev",
"&&",
"!",
"prev",
".",
"children",
")",
"{",
"newEdit",
"=",
"{",
"type",
":",
"\"textReplace\"",
",",
"content",
":",
"prev",
".",
"content",
"}",
";",
... | Adds a textDelete edit for text node that is not in the new tree.
Note that we actually create a textReplace rather than a textDelete
if the previous node in current tree was a text node. We do this because
text nodes are not individually addressable and a delete event would
end up clearing out both that previous text node that we want to keep
and this text node that we want to eliminate. Instead, we just log
a textReplace which will result in the deletion of this node and
the maintaining of the old content. | [
"Adds",
"a",
"textDelete",
"edit",
"for",
"text",
"node",
"that",
"is",
"not",
"in",
"the",
"new",
"tree",
".",
"Note",
"that",
"we",
"actually",
"create",
"a",
"textReplace",
"rather",
"than",
"a",
"textDelete",
"if",
"the",
"previous",
"node",
"in",
"c... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/HTMLDOMDiff.js#L266-L309 | train | This function is called when the text is inserted in the new DOM. It will add the textEdit to the new DOM. | [
30522,
3853,
1006,
1007,
1063,
13075,
3653,
2615,
1027,
3653,
16022,
10244,
1006,
1007,
1025,
2065,
1006,
3653,
2615,
1004,
1004,
999,
3653,
2615,
1012,
2336,
1007,
1063,
2047,
2098,
4183,
1027,
1063,
2828,
1024,
1000,
3793,
2890,
24759,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-extra-parens.js | ruleApplies | function ruleApplies(node) {
if (node.type === "JSXElement" || node.type === "JSXFragment") {
const isSingleLine = node.loc.start.line === node.loc.end.line;
switch (IGNORE_JSX) {
// Exclude this JSX element from linting
case "all":
return false;
// Exclude this JSX element if it is multi-line element
case "multi-line":
return isSingleLine;
// Exclude this JSX element if it is single-line element
case "single-line":
return !isSingleLine;
// Nothing special to be done for JSX elements
case "none":
break;
// no default
}
}
return ALL_NODES || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
} | javascript | function ruleApplies(node) {
if (node.type === "JSXElement" || node.type === "JSXFragment") {
const isSingleLine = node.loc.start.line === node.loc.end.line;
switch (IGNORE_JSX) {
// Exclude this JSX element from linting
case "all":
return false;
// Exclude this JSX element if it is multi-line element
case "multi-line":
return isSingleLine;
// Exclude this JSX element if it is single-line element
case "single-line":
return !isSingleLine;
// Nothing special to be done for JSX elements
case "none":
break;
// no default
}
}
return ALL_NODES || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
} | [
"function",
"ruleApplies",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"\"JSXElement\"",
"||",
"node",
".",
"type",
"===",
"\"JSXFragment\"",
")",
"{",
"const",
"isSingleLine",
"=",
"node",
".",
"loc",
".",
"start",
".",
"line",
"===",
... | Determines if this rule should be enforced for a node given the current configuration.
@param {ASTNode} node - The node to be checked.
@returns {boolean} True if the rule should be enforced for this node.
@private | [
"Determines",
"if",
"this",
"rule",
"should",
"be",
"enforced",
"for",
"a",
"node",
"given",
"the",
"current",
"configuration",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-extra-parens.js#L90-L117 | train | Checks if a given node is allowed to be linted | [
30522,
3853,
3627,
29098,
11983,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
1046,
2015,
2595,
12260,
3672,
1000,
1064,
1064,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
1046,
2015,
2595,
27843,
21693,
476... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
ColorlibHQ/AdminLTE | plugins/timepicker/bootstrap-timepicker.js | function() {
if (this.isInline) {
return;
}
var widgetWidth = this.$widget.outerWidth(), widgetHeight = this.$widget.outerHeight(), visualPadding = 10, windowWidth =
$(window).width(), windowHeight = $(window).height(), scrollTop = $(window).scrollTop();
var zIndex = parseInt(this.$element.parents().filter(function() { return $(this).css('z-index') !== 'auto'; }).first().css('z-index'), 10) + 10;
var offset = this.component ? this.component.parent().offset() : this.$element.offset();
var height = this.component ? this.component.outerHeight(true) : this.$element.outerHeight(false);
var width = this.component ? this.component.outerWidth(true) : this.$element.outerWidth(false);
var left = offset.left, top = offset.top;
this.$widget.removeClass('timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left');
if (this.orientation.x !== 'auto') {
this.$widget.addClass('timepicker-orient-' + this.orientation.x);
if (this.orientation.x === 'right') {
left -= widgetWidth - width;
}
} else{
// auto x orientation is best-placement: if it crosses a window edge, fudge it sideways
// Default to left
this.$widget.addClass('timepicker-orient-left');
if (offset.left < 0) {
left -= offset.left - visualPadding;
} else if (offset.left + widgetWidth > windowWidth) {
left = windowWidth - widgetWidth - visualPadding;
}
}
// auto y orientation is best-situation: top or bottom, no fudging, decision based on which shows more of the widget
var yorient = this.orientation.y, topOverflow, bottomOverflow;
if (yorient === 'auto') {
topOverflow = -scrollTop + offset.top - widgetHeight;
bottomOverflow = scrollTop + windowHeight - (offset.top + height + widgetHeight);
if (Math.max(topOverflow, bottomOverflow) === bottomOverflow) {
yorient = 'top';
} else {
yorient = 'bottom';
}
}
this.$widget.addClass('timepicker-orient-' + yorient);
if (yorient === 'top'){
top += height;
} else{
top -= widgetHeight + parseInt(this.$widget.css('padding-top'), 10);
}
this.$widget.css({
top : top,
left : left,
zIndex : zIndex
});
} | javascript | function() {
if (this.isInline) {
return;
}
var widgetWidth = this.$widget.outerWidth(), widgetHeight = this.$widget.outerHeight(), visualPadding = 10, windowWidth =
$(window).width(), windowHeight = $(window).height(), scrollTop = $(window).scrollTop();
var zIndex = parseInt(this.$element.parents().filter(function() { return $(this).css('z-index') !== 'auto'; }).first().css('z-index'), 10) + 10;
var offset = this.component ? this.component.parent().offset() : this.$element.offset();
var height = this.component ? this.component.outerHeight(true) : this.$element.outerHeight(false);
var width = this.component ? this.component.outerWidth(true) : this.$element.outerWidth(false);
var left = offset.left, top = offset.top;
this.$widget.removeClass('timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left');
if (this.orientation.x !== 'auto') {
this.$widget.addClass('timepicker-orient-' + this.orientation.x);
if (this.orientation.x === 'right') {
left -= widgetWidth - width;
}
} else{
// auto x orientation is best-placement: if it crosses a window edge, fudge it sideways
// Default to left
this.$widget.addClass('timepicker-orient-left');
if (offset.left < 0) {
left -= offset.left - visualPadding;
} else if (offset.left + widgetWidth > windowWidth) {
left = windowWidth - widgetWidth - visualPadding;
}
}
// auto y orientation is best-situation: top or bottom, no fudging, decision based on which shows more of the widget
var yorient = this.orientation.y, topOverflow, bottomOverflow;
if (yorient === 'auto') {
topOverflow = -scrollTop + offset.top - widgetHeight;
bottomOverflow = scrollTop + windowHeight - (offset.top + height + widgetHeight);
if (Math.max(topOverflow, bottomOverflow) === bottomOverflow) {
yorient = 'top';
} else {
yorient = 'bottom';
}
}
this.$widget.addClass('timepicker-orient-' + yorient);
if (yorient === 'top'){
top += height;
} else{
top -= widgetHeight + parseInt(this.$widget.css('padding-top'), 10);
}
this.$widget.css({
top : top,
left : left,
zIndex : zIndex
});
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isInline",
")",
"{",
"return",
";",
"}",
"var",
"widgetWidth",
"=",
"this",
".",
"$widget",
".",
"outerWidth",
"(",
")",
",",
"widgetHeight",
"=",
"this",
".",
"$widget",
".",
"outerHeight",
"(",
")... | This method was adapted from bootstrap-datepicker. | [
"This",
"method",
"was",
"adapted",
"from",
"bootstrap",
"-",
"datepicker",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/timepicker/bootstrap-timepicker.js#L659-L712 | train | Calculate the position of the widget | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
2003,
2378,
4179,
1007,
1063,
2709,
1025,
1065,
13075,
15536,
24291,
9148,
11927,
2232,
1027,
2023,
1012,
1002,
15536,
24291,
1012,
6058,
9148,
11927,
2232,
1006,
1007,
1010,
15536,
242... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/service.js | defineMethods | function defineMethods(svc) {
AWS.util.each(svc.prototype.api.operations, function iterator(method) {
if (svc.prototype[method]) return;
var operation = svc.prototype.api.operations[method];
if (operation.authtype === 'none') {
svc.prototype[method] = function (params, callback) {
return this.makeUnauthenticatedRequest(method, params, callback);
};
} else {
svc.prototype[method] = function (params, callback) {
return this.makeRequest(method, params, callback);
};
}
});
} | javascript | function defineMethods(svc) {
AWS.util.each(svc.prototype.api.operations, function iterator(method) {
if (svc.prototype[method]) return;
var operation = svc.prototype.api.operations[method];
if (operation.authtype === 'none') {
svc.prototype[method] = function (params, callback) {
return this.makeUnauthenticatedRequest(method, params, callback);
};
} else {
svc.prototype[method] = function (params, callback) {
return this.makeRequest(method, params, callback);
};
}
});
} | [
"function",
"defineMethods",
"(",
"svc",
")",
"{",
"AWS",
".",
"util",
".",
"each",
"(",
"svc",
".",
"prototype",
".",
"api",
".",
"operations",
",",
"function",
"iterator",
"(",
"method",
")",
"{",
"if",
"(",
"svc",
".",
"prototype",
"[",
"method",
... | Adds one method for each operation described in the api configuration
@api private | [
"Adds",
"one",
"method",
"for",
"each",
"operation",
"described",
"in",
"the",
"api",
"configuration"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/service.js#L663-L677 | train | Define methods for the service | [
30522,
3853,
9375,
11368,
6806,
5104,
1006,
17917,
2278,
1007,
1063,
22091,
2015,
1012,
21183,
4014,
1012,
2169,
1006,
17917,
2278,
1012,
8773,
1012,
17928,
1012,
3136,
1010,
3853,
2009,
6906,
4263,
1006,
4118,
1007,
1063,
2065,
1006,
17917... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | common/src/web/jquery-1.3.2.js | function(isTimeout){
// The request was aborted, clear the interval and decrement jQuery.active
if (xhr.readyState == 0) {
if (ival) {
// clear poll interval
clearInterval(ival);
ival = null;
// Handle the global AJAX counter
if ( s.global && ! --jQuery.active )
jQuery.event.trigger( "ajaxStop" );
}
// The transfer is complete and the data is available, or the request timed out
} else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
requestDone = true;
// clear poll interval
if (ival) {
clearInterval(ival);
ival = null;
}
status = isTimeout == "timeout" ? "timeout" :
!jQuery.httpSuccess( xhr ) ? "error" :
s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
"success";
if ( status == "success" ) {
// Watch for, and catch, XML document parse errors
try {
// process the data (runs the xml through httpData regardless of callback)
data = jQuery.httpData( xhr, s.dataType, s );
} catch(e) {
status = "parsererror";
}
}
// Make sure that the request was successful or notmodified
if ( status == "success" ) {
// Cache Last-Modified header, if ifModified mode.
var modRes;
try {
modRes = xhr.getResponseHeader("Last-Modified");
} catch(e) {} // swallow exception thrown by FF if header is not available
if ( s.ifModified && modRes )
jQuery.lastModified[s.url] = modRes;
// JSONP handles its own success callback
if ( !jsonp )
success();
} else
jQuery.handleError(s, xhr, status);
// Fire the complete handlers
complete();
if ( isTimeout )
xhr.abort();
// Stop memory leaks
if ( s.async )
xhr = null;
}
} | javascript | function(isTimeout){
// The request was aborted, clear the interval and decrement jQuery.active
if (xhr.readyState == 0) {
if (ival) {
// clear poll interval
clearInterval(ival);
ival = null;
// Handle the global AJAX counter
if ( s.global && ! --jQuery.active )
jQuery.event.trigger( "ajaxStop" );
}
// The transfer is complete and the data is available, or the request timed out
} else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
requestDone = true;
// clear poll interval
if (ival) {
clearInterval(ival);
ival = null;
}
status = isTimeout == "timeout" ? "timeout" :
!jQuery.httpSuccess( xhr ) ? "error" :
s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
"success";
if ( status == "success" ) {
// Watch for, and catch, XML document parse errors
try {
// process the data (runs the xml through httpData regardless of callback)
data = jQuery.httpData( xhr, s.dataType, s );
} catch(e) {
status = "parsererror";
}
}
// Make sure that the request was successful or notmodified
if ( status == "success" ) {
// Cache Last-Modified header, if ifModified mode.
var modRes;
try {
modRes = xhr.getResponseHeader("Last-Modified");
} catch(e) {} // swallow exception thrown by FF if header is not available
if ( s.ifModified && modRes )
jQuery.lastModified[s.url] = modRes;
// JSONP handles its own success callback
if ( !jsonp )
success();
} else
jQuery.handleError(s, xhr, status);
// Fire the complete handlers
complete();
if ( isTimeout )
xhr.abort();
// Stop memory leaks
if ( s.async )
xhr = null;
}
} | [
"function",
"(",
"isTimeout",
")",
"{",
"// The request was aborted, clear the interval and decrement jQuery.active",
"if",
"(",
"xhr",
".",
"readyState",
"==",
"0",
")",
"{",
"if",
"(",
"ival",
")",
"{",
"// clear poll interval",
"clearInterval",
"(",
"ival",
")",
... | Wait for a response to come back | [
"Wait",
"for",
"a",
"response",
"to",
"come",
"back"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L3553-L3616 | train | The ajax request is complete | [
30522,
3853,
1006,
21541,
14428,
5833,
1007,
1063,
1013,
1013,
1996,
5227,
2001,
11113,
15613,
1010,
3154,
1996,
13483,
1998,
11703,
28578,
4765,
1046,
4226,
2854,
1012,
3161,
2065,
1006,
1060,
8093,
1012,
3201,
9153,
2618,
1027,
1027,
1014... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.