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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
openlayers/openlayers | src/ol/pointer/MsSource.js | msPointerUp | function msPointerUp(inEvent) {
const e = this.prepareEvent_(inEvent);
this.dispatcher.up(e, inEvent);
this.cleanup(inEvent.pointerId);
} | javascript | function msPointerUp(inEvent) {
const e = this.prepareEvent_(inEvent);
this.dispatcher.up(e, inEvent);
this.cleanup(inEvent.pointerId);
} | [
"function",
"msPointerUp",
"(",
"inEvent",
")",
"{",
"const",
"e",
"=",
"this",
".",
"prepareEvent_",
"(",
"inEvent",
")",
";",
"this",
".",
"dispatcher",
".",
"up",
"(",
"e",
",",
"inEvent",
")",
";",
"this",
".",
"cleanup",
"(",
"inEvent",
".",
"po... | Handler for `msPointerUp`.
@this {MsSource}
@param {MSPointerEvent} inEvent The in event. | [
"Handler",
"for",
"msPointerUp",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/pointer/MsSource.js#L78-L82 | train | Handler for msPointerUp. | [
30522,
3853,
5796,
8400,
2121,
6279,
1006,
1999,
18697,
3372,
1007,
1063,
9530,
3367,
1041,
1027,
2023,
1012,
7374,
18697,
3372,
1035,
1006,
1999,
18697,
3372,
1007,
1025,
2023,
1012,
18365,
2121,
1012,
2039,
1006,
1041,
1010,
1999,
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... |
chartjs/Chart.js | src/helpers/helpers.core.js | function(source) {
if (helpers.isArray(source)) {
return source.map(helpers.clone);
}
if (helpers.isObject(source)) {
var target = {};
var keys = Object.keys(source);
var klen = keys.length;
var k = 0;
for (; k < klen; ++k) {
target[keys[k]] = helpers.clone(source[keys[k]]);
}
return target;
}
return source;
} | javascript | function(source) {
if (helpers.isArray(source)) {
return source.map(helpers.clone);
}
if (helpers.isObject(source)) {
var target = {};
var keys = Object.keys(source);
var klen = keys.length;
var k = 0;
for (; k < klen; ++k) {
target[keys[k]] = helpers.clone(source[keys[k]]);
}
return target;
}
return source;
} | [
"function",
"(",
"source",
")",
"{",
"if",
"(",
"helpers",
".",
"isArray",
"(",
"source",
")",
")",
"{",
"return",
"source",
".",
"map",
"(",
"helpers",
".",
"clone",
")",
";",
"}",
"if",
"(",
"helpers",
".",
"isObject",
"(",
"source",
")",
")",
... | Returns a deep copy of `source` without keeping references on objects and arrays.
@param {*} source - The value to clone.
@returns {*} | [
"Returns",
"a",
"deep",
"copy",
"of",
"source",
"without",
"keeping",
"references",
"on",
"objects",
"and",
"arrays",
"."
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/helpers/helpers.core.js#L172-L191 | train | Returns a clone of the source object. | [
30522,
3853,
1006,
3120,
1007,
1063,
2065,
1006,
2393,
2545,
1012,
18061,
11335,
2100,
1006,
3120,
1007,
1007,
1063,
2709,
3120,
1012,
4949,
1006,
2393,
2545,
1012,
17598,
1007,
1025,
1065,
2065,
1006,
2393,
2545,
1012,
11163,
2497,
20614,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/vkbeautify.js | isSubquery | function isSubquery(str, parenthesisLevel) {
return parenthesisLevel - (str.replace(/\(/g,'').length - str.replace(/\)/g,'').length )
} | javascript | function isSubquery(str, parenthesisLevel) {
return parenthesisLevel - (str.replace(/\(/g,'').length - str.replace(/\)/g,'').length )
} | [
"function",
"isSubquery",
"(",
"str",
",",
"parenthesisLevel",
")",
"{",
"return",
"parenthesisLevel",
"-",
"(",
"str",
".",
"replace",
"(",
"/",
"\\(",
"/",
"g",
",",
"''",
")",
".",
"length",
"-",
"str",
".",
"replace",
"(",
"/",
"\\)",
"/",
"g",
... | ---------------------------------------------------------------------------- | [
"----------------------------------------------------------------------------"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/vkbeautify.js#L201-L203 | train | Returns true if str is a subquery of parenthesisLevel | [
30522,
3853,
26354,
12083,
4226,
2854,
1006,
2358,
2099,
1010,
6687,
24124,
20414,
2884,
1007,
1063,
2709,
6687,
24124,
20414,
2884,
1011,
1006,
2358,
2099,
1012,
5672,
1006,
1013,
1032,
1006,
1013,
1043,
1010,
1005,
1005,
1007,
1012,
3091,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | onCopyActiveUser | function onCopyActiveUser() {
tempAuth.updateCurrentUser(activeUser()).then(function() {
alertSuccess('Copied active user to temp Auth');
}, function(error) {
alertError('Error: ' + error.code);
});
} | javascript | function onCopyActiveUser() {
tempAuth.updateCurrentUser(activeUser()).then(function() {
alertSuccess('Copied active user to temp Auth');
}, function(error) {
alertError('Error: ' + error.code);
});
} | [
"function",
"onCopyActiveUser",
"(",
")",
"{",
"tempAuth",
".",
"updateCurrentUser",
"(",
"activeUser",
"(",
")",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"alertSuccess",
"(",
"'Copied active user to temp Auth'",
")",
";",
"}",
",",
"function",
"(",
... | Copy current user of auth to tempAuth. | [
"Copy",
"current",
"user",
"of",
"auth",
"to",
"tempAuth",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L1279-L1285 | train | Copy active user to temp Auth | [
30522,
3853,
2006,
3597,
7685,
19620,
20330,
1006,
1007,
1063,
8915,
8737,
4887,
2705,
1012,
10651,
10841,
14343,
3372,
20330,
1006,
3161,
20330,
1006,
1007,
1007,
1012,
2059,
1006,
3853,
1006,
1007,
1063,
9499,
6342,
9468,
7971,
1006,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Agents/HighlightAgent.js | rule | function rule(name) {
if (_highlight.ref === name) {
return;
}
hide();
_highlight = {type: "css", ref: name};
RemoteAgent.call("highlightRule", name);
} | javascript | function rule(name) {
if (_highlight.ref === name) {
return;
}
hide();
_highlight = {type: "css", ref: name};
RemoteAgent.call("highlightRule", name);
} | [
"function",
"rule",
"(",
"name",
")",
"{",
"if",
"(",
"_highlight",
".",
"ref",
"===",
"name",
")",
"{",
"return",
";",
"}",
"hide",
"(",
")",
";",
"_highlight",
"=",
"{",
"type",
":",
"\"css\"",
",",
"ref",
":",
"name",
"}",
";",
"RemoteAgent",
... | Highlight all nodes affected by a CSS rule
@param {string} rule selector | [
"Highlight",
"all",
"nodes",
"affected",
"by",
"a",
"CSS",
"rule"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/HighlightAgent.js#L99-L106 | train | Highlight a CSS rule | [
30522,
3853,
3627,
1006,
2171,
1007,
1063,
2065,
1006,
1035,
12944,
1012,
25416,
1027,
1027,
1027,
2171,
1007,
1063,
2709,
1025,
1065,
5342,
1006,
1007,
1025,
1035,
12944,
1027,
1063,
2828,
1024,
1000,
20116,
2015,
1000,
1010,
25416,
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... |
fengyuanchen/cropper | dist/cropper.common.js | setData$$1 | function setData$$1(data) {
var options = this.options,
imageData = this.imageData,
canvasData = this.canvasData;
var cropBoxData = {};
if (this.ready && !this.disabled && isPlainObject(data)) {
var transformed = false;
if (options.rotatable) {
if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
imageData.rotate = data.rotate;
transformed = true;
}
}
if (options.scalable) {
if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
imageData.scaleX = data.scaleX;
transformed = true;
}
if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
imageData.scaleY = data.scaleY;
transformed = true;
}
}
if (transformed) {
this.renderCanvas(true, true);
}
var ratio = imageData.width / imageData.naturalWidth;
if (isNumber(data.x)) {
cropBoxData.left = data.x * ratio + canvasData.left;
}
if (isNumber(data.y)) {
cropBoxData.top = data.y * ratio + canvasData.top;
}
if (isNumber(data.width)) {
cropBoxData.width = data.width * ratio;
}
if (isNumber(data.height)) {
cropBoxData.height = data.height * ratio;
}
this.setCropBoxData(cropBoxData);
}
return this;
} | javascript | function setData$$1(data) {
var options = this.options,
imageData = this.imageData,
canvasData = this.canvasData;
var cropBoxData = {};
if (this.ready && !this.disabled && isPlainObject(data)) {
var transformed = false;
if (options.rotatable) {
if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
imageData.rotate = data.rotate;
transformed = true;
}
}
if (options.scalable) {
if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
imageData.scaleX = data.scaleX;
transformed = true;
}
if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
imageData.scaleY = data.scaleY;
transformed = true;
}
}
if (transformed) {
this.renderCanvas(true, true);
}
var ratio = imageData.width / imageData.naturalWidth;
if (isNumber(data.x)) {
cropBoxData.left = data.x * ratio + canvasData.left;
}
if (isNumber(data.y)) {
cropBoxData.top = data.y * ratio + canvasData.top;
}
if (isNumber(data.width)) {
cropBoxData.width = data.width * ratio;
}
if (isNumber(data.height)) {
cropBoxData.height = data.height * ratio;
}
this.setCropBoxData(cropBoxData);
}
return this;
} | [
"function",
"setData$$1",
"(",
"data",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"imageData",
"=",
"this",
".",
"imageData",
",",
"canvasData",
"=",
"this",
".",
"canvasData",
";",
"var",
"cropBoxData",
"=",
"{",
"}",
";",
"if",
"("... | Set the cropped area position and size with new data
@param {Object} data - The new data.
@returns {Cropper} this | [
"Set",
"the",
"cropped",
"area",
"position",
"and",
"size",
"with",
"new",
"data"
] | 6677332a6a375b647f58808dfc24ea09f5804041 | https://github.com/fengyuanchen/cropper/blob/6677332a6a375b647f58808dfc24ea09f5804041/dist/cropper.common.js#L2855-L2910 | train | set data to the image | [
30522,
3853,
2275,
2850,
2696,
1002,
1002,
1015,
1006,
2951,
1007,
1063,
13075,
7047,
1027,
2023,
1012,
7047,
1010,
3746,
2850,
2696,
1027,
2023,
1012,
3746,
2850,
2696,
1010,
10683,
2850,
2696,
1027,
2023,
1012,
10683,
2850,
2696,
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/core/util/MockServer.js | function(aUrlParams) {
var aUrlParamsNormalized = [];
var fnStartsWith = function(sValue) {
var apostLocation = sValue.indexOf("'");
var doubleQuotesLocation = sValue.indexOf("\"");
if (apostLocation === -1 && doubleQuotesLocation === -1) {
return null;
} else {
if (apostLocation > -1 && doubleQuotesLocation === -1) {
return "appost";
}
if (doubleQuotesLocation > -1 && apostLocation === -1) {
return "doublequotes";
}
if (apostLocation > -1 && doubleQuotesLocation > -1 && apostLocation < doubleQuotesLocation) {
return "appost";
}
if (apostLocation > -1 && doubleQuotesLocation > -1 && doubleQuotesLocation < apostLocation) {
return "doublequotes";
}
}
};
var fnAmpersandHandler = function(aParams, aParamsNorm, index, apostType) {
var stringAmpersand = aParams[index];
var j = index + 1;
while (j < aParams.length && aParams[j].indexOf(apostType) === -1) {
stringAmpersand = stringAmpersand + "&" + aParams[j];
j++;
}
stringAmpersand = stringAmpersand + "&" + aParams[j];
aParamsNorm.push(stringAmpersand);
index = j;
return index;
};
for (var i = 0; i < aUrlParams.length; i++) {
// there is no ' and no " in param values
if (!fnStartsWith(aUrlParams[i])) {
aUrlParamsNormalized.push(aUrlParams[i]);
}
// there is ' in param value
if (fnStartsWith(aUrlParams[i]) === "appost") {
var firstLocation = aUrlParams[i].indexOf("'");
if (aUrlParams[i].indexOf("'", firstLocation + 1) === -1) {
i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "'");
} else {
aUrlParamsNormalized.push(aUrlParams[i]);
}
}
// there is " in param value
if (fnStartsWith(aUrlParams[i]) === "doublequotes") {
var firstQuotesLocation = aUrlParams[i].indexOf("\"");
if (aUrlParams[i].indexOf("\"", firstQuotesLocation + 1) === -1) {
i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "\"");
} else {
aUrlParamsNormalized.push(aUrlParams[i]);
}
}
}
return aUrlParamsNormalized;
} | javascript | function(aUrlParams) {
var aUrlParamsNormalized = [];
var fnStartsWith = function(sValue) {
var apostLocation = sValue.indexOf("'");
var doubleQuotesLocation = sValue.indexOf("\"");
if (apostLocation === -1 && doubleQuotesLocation === -1) {
return null;
} else {
if (apostLocation > -1 && doubleQuotesLocation === -1) {
return "appost";
}
if (doubleQuotesLocation > -1 && apostLocation === -1) {
return "doublequotes";
}
if (apostLocation > -1 && doubleQuotesLocation > -1 && apostLocation < doubleQuotesLocation) {
return "appost";
}
if (apostLocation > -1 && doubleQuotesLocation > -1 && doubleQuotesLocation < apostLocation) {
return "doublequotes";
}
}
};
var fnAmpersandHandler = function(aParams, aParamsNorm, index, apostType) {
var stringAmpersand = aParams[index];
var j = index + 1;
while (j < aParams.length && aParams[j].indexOf(apostType) === -1) {
stringAmpersand = stringAmpersand + "&" + aParams[j];
j++;
}
stringAmpersand = stringAmpersand + "&" + aParams[j];
aParamsNorm.push(stringAmpersand);
index = j;
return index;
};
for (var i = 0; i < aUrlParams.length; i++) {
// there is no ' and no " in param values
if (!fnStartsWith(aUrlParams[i])) {
aUrlParamsNormalized.push(aUrlParams[i]);
}
// there is ' in param value
if (fnStartsWith(aUrlParams[i]) === "appost") {
var firstLocation = aUrlParams[i].indexOf("'");
if (aUrlParams[i].indexOf("'", firstLocation + 1) === -1) {
i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "'");
} else {
aUrlParamsNormalized.push(aUrlParams[i]);
}
}
// there is " in param value
if (fnStartsWith(aUrlParams[i]) === "doublequotes") {
var firstQuotesLocation = aUrlParams[i].indexOf("\"");
if (aUrlParams[i].indexOf("\"", firstQuotesLocation + 1) === -1) {
i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "\"");
} else {
aUrlParamsNormalized.push(aUrlParams[i]);
}
}
}
return aUrlParamsNormalized;
} | [
"function",
"(",
"aUrlParams",
")",
"{",
"var",
"aUrlParamsNormalized",
"=",
"[",
"]",
";",
"var",
"fnStartsWith",
"=",
"function",
"(",
"sValue",
")",
"{",
"var",
"apostLocation",
"=",
"sValue",
".",
"indexOf",
"(",
"\"'\"",
")",
";",
"var",
"doubleQuotes... | helper to handle url param value with '&' | [
"helper",
"to",
"handle",
"url",
"param",
"value",
"with",
"&"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/MockServer.js#L2083-L2150 | train | This function is used to normalize a url params | [
30522,
3853,
1006,
8740,
12190,
28689,
5244,
1007,
1063,
13075,
8740,
12190,
28689,
5244,
12131,
9067,
3550,
1027,
1031,
1033,
1025,
13075,
1042,
23808,
20591,
24415,
1027,
3853,
1006,
17917,
2389,
5657,
1007,
1063,
13075,
9706,
14122,
4135,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/util/RuleValidator.js | function(aEnum, oEnumComparison) {
if (aEnum && Array.isArray(aEnum) && aEnum.length) {
for (var i = 0; i < aEnum.length; i++) {
if (oEnumComparison.hasOwnProperty(aEnum[i])) {
continue;
} else {
return false;
}
}
return true;
}
return false;
} | javascript | function(aEnum, oEnumComparison) {
if (aEnum && Array.isArray(aEnum) && aEnum.length) {
for (var i = 0; i < aEnum.length; i++) {
if (oEnumComparison.hasOwnProperty(aEnum[i])) {
continue;
} else {
return false;
}
}
return true;
}
return false;
} | [
"function",
"(",
"aEnum",
",",
"oEnumComparison",
")",
"{",
"if",
"(",
"aEnum",
"&&",
"Array",
".",
"isArray",
"(",
"aEnum",
")",
"&&",
"aEnum",
".",
"length",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aEnum",
".",
"length",
";"... | Validates any given collection.
Basically you can validate Audiences, Categories, Severity etc - everything that meets the criteria
Positive cases :
- "Capitalcase"
@private
@param {array} aEnum Enum to be validated.
@param {array} oEnumComparison Enum comparison.
@returns {boolean} Boolean response if the provided collection is valid. | [
"Validates",
"any",
"given",
"collection",
".",
"Basically",
"you",
"can",
"validate",
"Audiences",
"Categories",
"Severity",
"etc",
"-",
"everything",
"that",
"meets",
"the",
"criteria"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/util/RuleValidator.js#L64-L82 | train | Returns true if the given array of values is equal to the given comparison object | [
30522,
3853,
1006,
29347,
19172,
1010,
1051,
2368,
2819,
9006,
19362,
10929,
1007,
1063,
2065,
1006,
29347,
19172,
1004,
1004,
9140,
1012,
18061,
11335,
2100,
1006,
29347,
19172,
1007,
1004,
1004,
29347,
19172,
1012,
3091,
1007,
1063,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | lib/jsdoc/ui5/template/publish.js | createAPIXML | function createAPIXML(symbols, filename, options) {
options = options || {};
var roots = options.roots || null;
var legacyContent = !!options.legacyContent;
var omitDefaults = !!options.omitDefaults;
var addRedundancy = !!options.resolveInheritance;
var indent = 0;
var output = [];
var sIndent = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
var tags = [];
var ENUM = legacyContent ? "namespace" : "enum";
var BASETYPE = legacyContent ? "baseType" : "extends";
var PROPERTY = legacyContent ? "parameter" : "property";
var unclosedStartTag = false;
function getAPIJSON(name) {
var symbol = lookup(name);
if ( symbol && !symbol.synthetic ) {
return createAPIJSON4Symbol(symbol, false);
}
if ( addRedundancy && externalSymbols[name] ) {
debug(" using " + name + " from external dependency");
return externalSymbols[name];
}
return symbol;
}
function encode(s) {
return s ? s.replace(/&/g, "&").replace(/</g, "<") : s;
}
function write(args) {
if ( arguments.length ) {
for (var i = 0; i < arguments.length; i++) {
output.push(arguments[i]);
}
}
}
function writeln(args) {
if ( indent > 0 ) {
output.push(sIndent.slice(0,indent));
}
if ( arguments.length ) {
for (var i = 0; i < arguments.length; i++) {
output.push(arguments[i]);
}
}
output.push("\n");
}
function rootTag(name) {
tags = [];
unclosedStartTag = false;
tag(name);
}
function closeRootTag(name) {
closeTag(name);
}
function namespace(alias, namespace) {
attrib(alias, namespace);
}
function tag(name, value, omitEmpty) {
if ( omitEmpty && !value ) {
return;
}
if ( unclosedStartTag ) {
unclosedStartTag = false;
write('>\n');
}
if ( arguments.length === 1 ) { // opening tag
if ( indent > 0 ) {
output.push(sIndent.slice(0,indent));
}
write("<", name);
unclosedStartTag = true;
if ( legacyContent ) {
unclosedStartTag = false;
write(">\n");
}
tags.push(name);
indent++;
return;
}
if ( value == null ) {
writeln("<", name, "/>");
} else {
writeln("<", name, ">", encode(String(value)), "</", name, ">");
}
}
function attrib(name, value, defaultValue) {
var emptyTag = arguments.length === 1;
if ( omitDefaults && arguments.length === 3 && value === defaultValue ) {
return;
}
if ( !legacyContent ) {
write(" " + name + "=\"");
write(emptyTag ? "true" : encode(String(value)).replace(/"/g, """));
write("\"");
} else if ( emptyTag ) {
writeln("<", name, "/>");
} else {
writeln("<", name, ">", encode(String(value)), "</", name, ">");
}
}
function closeTag(name, noIndent) {
indent--;
var top = tags.pop();
if ( top != name ) {
// ERROR?
}
if ( unclosedStartTag ) {
unclosedStartTag = false;
write("/>\n");
} else if ( noIndent ) {
write("</", name, ">\n");
} else {
writeln("</", name, ">");
}
}
function textContent(text) {
if ( unclosedStartTag ) {
unclosedStartTag = false;
write('>');
}
write(encode(text));
}
function tagWithSince(tagName, prop) {
if ( prop ) {
tag(tagName);
if ( prop.since ) {
attrib("since", prop.since);
}
if ( prop.text && prop.text.trim() ) {
textContent(prop.text);
}
closeTag(tagName, true);
}
}
function getAsString() {
return output.join("");
}
function writeMetadata(symbolAPI, inherited) {
var ui5Metadata = symbolAPI["ui5-metadata"];
if ( !ui5Metadata ) {
return;
}
if ( addRedundancy && symbolAPI["extends"] ) {
var baseSymbolAPI = getAPIJSON(symbolAPI["extends"]);
if ( baseSymbolAPI ) {
writeMetadata(baseSymbolAPI, true);
}
}
if ( ui5Metadata.specialSettings ) {
ui5Metadata.specialSettings.forEach(function(special) {
tag("specialSetting");
attrib("name", special.name);
attrib("type", special.type);
attrib("visibility", special.visibility, 'public');
if ( special.since ) {
attrib("since", special.since);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", special.description, true);
tagWithSince("experimental", special.experimental);
tagWithSince("deprecated", special.deprecated);
tag("methods", special.methods);
closeTag("specialSetting");
});
}
if ( ui5Metadata.properties ) {
ui5Metadata.properties.forEach(function(prop) {
tag("property");
attrib("name", prop.name);
attrib("type", prop.type, 'string');
if ( prop.defaultValue !== null ) {
attrib("defaultValue", prop.defaultValue, null);
}
attrib("visibility", prop.visibility, 'public');
if ( prop.since ) {
attrib("since", prop.since);
}
if ( prop.bindable ) {
attrib("bindable", prop.bindable);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", prop.description, true);
tagWithSince("experimental", prop.experimental);
tagWithSince("deprecated", prop.deprecated);
tag("methods", prop.methods);
closeTag("property");
});
}
if ( ui5Metadata.defaultProperty ) {
tag("defaultProperty", ui5Metadata.defaultProperty);
}
if ( ui5Metadata.aggregations ) {
ui5Metadata.aggregations.forEach(function(aggr) {
tag("aggregation");
attrib("name", aggr.name);
attrib("singularName", aggr.singularName); // TODO omit default?
attrib("type", aggr.type, 'sap.ui.core.Control');
if ( aggr.altTypes ) {
attrib("altTypes", aggr.altTypes.join(","));
}
attrib("cardinality", aggr.cardinality, '0..n');
attrib("visibility", aggr.visibility, 'public');
if ( aggr.since ) {
attrib("since", aggr.since);
}
if ( aggr.bindable ) {
attrib("bindable", aggr.bindable);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", aggr.description, true);
tagWithSince("experimental", aggr.experimental);
tagWithSince("deprecated", aggr.deprecated);
tag("methods", aggr.methods);
closeTag("aggregation");
});
}
if ( ui5Metadata.defaultAggregation ) {
tag("defaultAggregation", ui5Metadata.defaultAggregation);
}
if ( ui5Metadata.associations ) {
ui5Metadata.associations.forEach(function(assoc) {
tag("association");
attrib("name", assoc.name);
attrib("singularName", assoc.singularName); // TODO omit default?
attrib("type", assoc.type, 'sap.ui.core.Control');
attrib("cardinality", assoc.cardinality, '0..1');
attrib("visibility", assoc.visibility, 'public');
if ( assoc.since ) {
attrib("since", assoc.since);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", assoc.description, true);
tagWithSince("experimental", assoc.experimental);
tagWithSince("deprecated", assoc.deprecated);
tag("methods", assoc.methods);
closeTag("association");
});
}
if ( ui5Metadata.events ) {
ui5Metadata.events.forEach(function(event) {
tag("event");
attrib("name", event.name);
attrib("visibility", event.visibility, 'public');
if ( event.since ) {
attrib("since", event.since);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", event.description, true);
tagWithSince("experimental", event.experimental);
tagWithSince("deprecated", event.deprecated);
if ( event.parameters ) {
tag("parameters");
for ( var pn in event.parameters ) {
if ( event.parameters.hasOwnProperty(pn) ) {
var param = event.parameters[pn];
tag("parameter");
attrib("name", param.name);
attrib("type", param.type);
if ( param.since ) {
attrib("since", param.since);
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag("parameter");
}
}
closeTag("parameters");
}
tag("methods", event.methods, true);
closeTag("event");
});
}
if ( ui5Metadata.annotations ) {
ui5Metadata.annotations.forEach(function(anno) {
tag("annotation");
attrib("name", anno.name);
attrib("namespace", anno.namespace); // TODO omit default?
attrib("target", anno.target);
attrib("annotation", anno.annotation);
attrib("appliesTo", anno.appliesTo);
if ( anno.since ) {
attrib("since", anno.since);
}
tag("description", anno.description, true);
tagWithSince("deprecated", anno.deprecated);
closeTag("annotation");
});
}
}
function writeParameterPropertiesForMSettings(symbolAPI, inherited) {
var ui5Metadata = symbolAPI["ui5-metadata"];
if ( !ui5Metadata ) {
return;
}
if ( symbolAPI["extends"] ) {
var baseSymbolAPI = getAPIJSON(symbolAPI["extends"]);
writeParameterPropertiesForMSettings(baseSymbolAPI, true);
}
if ( ui5Metadata.specialSettings ) {
ui5Metadata.specialSettings.forEach(function(special) {
if ( special.visibility !== 'hidden' ) {
tag("property");
attrib("name", special.name);
attrib("type", special.type);
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", special.description, true);
closeTag("property");
}
});
}
if ( ui5Metadata.properties ) {
ui5Metadata.properties.forEach(function(prop) {
tag("property");
attrib("name", prop.name);
attrib("type", prop.type);
attrib("group", prop.group, 'Misc');
if ( prop.defaultValue !== null ) {
attrib("defaultValue", typeof prop.defaultValue === 'string' ? "\"" + prop.defaultValue + "\"" : prop.defaultValue);
}
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", prop.description, true);
closeTag("property");
});
}
if ( ui5Metadata.aggregations ) {
ui5Metadata.aggregations.forEach(function(aggr) {
if ( aggr.visibility !== "hidden" ) {
tag("property");
attrib("name", aggr.name);
attrib("type", aggr.type + (aggr.cardinality === '0..1' ? "" : "[]"));
if ( aggr.altTypes ) {
attrib("altTypes", aggr.altTypes.join(","));
}
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", aggr.description, true);
closeTag("property");
}
});
}
if ( ui5Metadata.associations ) {
ui5Metadata.associations.forEach(function(assoc) {
if ( assoc.visibility !== "hidden" ) {
tag("property");
attrib("name", assoc.name);
attrib("type", "(" + assoc.type + "|" + "string)" + (assoc.cardinality === '0..1' ? "" : "[]"));
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", assoc.description, true);
closeTag("property");
}
});
}
if ( ui5Metadata.events ) {
ui5Metadata.events.forEach(function(event) {
tag("property");
attrib("name", event.name);
attrib("type", "function|array");
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", event.description, true);
closeTag("property");
});
}
}
function writeParameterProperties(param, paramName) {
var props = param.parameterProperties,
prefix = paramName + '.',
count = 0;
if ( props ) {
for (var n in props ) {
if ( props.hasOwnProperty(n) ) {
param = props[n];
if ( !legacyContent && count === 0 ) {
tag("parameterProperties");
}
count++;
tag(PROPERTY);
attrib("name", legacyContent ? prefix + n : n);
attrib("type", param.type);
if ( param.since ) {
attrib("since", param.since);
}
if ( param.optional ) {
attrib("optional", param.optional);
}
if ( !legacyContent ) {
writeParameterProperties(param, prefix + n);
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag(PROPERTY);
if ( legacyContent ) {
writeParameterProperties(param, prefix + n);
}
}
}
}
if ( !legacyContent && count > 0 ) {
closeTag("parameterProperties");
}
}
/*
var rSplitSecTag = /^\s*\{([^\}]*)\}/;
function secTags($) {
if ( !legacyContent ) {
return;
}
var aTags = $.tags;
if ( !aTags ) {
return;
}
for (var iTag = 0; iTag < A_SECURITY_TAGS.length; iTag++ ) {
var oTagDef = A_SECURITY_TAGS[iTag];
for (var j = 0; j < aTags.length; j++ ) {
if ( aTags[j].title.toLowerCase() === oTagDef.name.toLowerCase() ) {
tag(oTagDef.name);
var m = rSplitSecTag.exec(aTags[j].text);
if ( m && m[1].trim() ) {
var aParams = m[1].trim().split(/\s*\|\s* /); <-- remove the blank!
for (var iParam = 0; iParam < aParams.length; iParam++ ) {
tag(oTagDef.params[iParam], aParams[iParam]);
}
}
var sDesc = aTags[j].description;
tag("description", sDesc, true);
closeTag(oTagDef.name);
}
}
}
}
*/
function writeSymbol(symbol) {
var kind;
if ( isFirstClassSymbol(symbol) && (roots || !symbol.synthetic) ) { // dump a symbol if it as a class symbol and if either hierarchies are dumped or if it is not a synthetic symbol
// for the hierarchy we use only the local information
var symbolAPI = createAPIJSON4Symbol(symbol);
kind = symbolAPI.kind === 'enum' ? ENUM : symbolAPI.kind;
tag(kind);
attrib("name", symbolAPI.name);
attrib("basename", symbolAPI.basename);
// if ( symbolAPI["resource"] ) {
// attrib("resource");
// }
if ( symbolAPI["module"] ) {
attrib("module", symbolAPI["module"]);
}
if ( symbolAPI["abstract"] ) {
attrib("abstract");
}
if ( symbolAPI["final"] ) {
attrib("final");
}
if ( symbolAPI["static"] ) {
attrib("static");
}
attrib("visibility", symbolAPI.visibility, 'public');
if ( symbolAPI.since ) {
attrib("since", symbolAPI.since);
}
if ( symbolAPI["extends"] ) {
tag(BASETYPE, symbolAPI["extends"]); // TODO what about multiple inheritance?
}
tag("description", symbolAPI.description, true);
tagWithSince("experimental", symbolAPI.experimental);
tagWithSince("deprecated", symbolAPI.deprecated);
if ( kind === 'class' ) {
var hasSettings = symbolAPI["ui5-metadata"];
if ( !legacyContent && symbolAPI["ui5-metadata"] ) {
tag("ui5-metadata");
if ( symbolAPI["ui5-metadata"].stereotype ) {
attrib("stereotype", symbolAPI["ui5-metadata"].stereotype);
}
writeMetadata(symbolAPI);
closeTag("ui5-metadata");
}
tag("constructor");
if ( legacyContent ) {
attrib("name", symbolAPI.basename);
}
attrib("visibility", symbolAPI.visibility, 'public');
if ( symbolAPI.constructor.parameters ) {
symbolAPI.constructor.parameters.forEach(function(param, j) {
tag("parameter");
attrib("name", param.name);
attrib("type", param.type);
attrib("optional", param.optional, false);
if ( param.defaultValue !== undefined ) {
attrib("defaultValue", param.defaultValue);
}
if ( param.since ) {
attrib("since", param.since);
}
if ( !legacyContent ) {
if ( hasSettings && j == 1 && /setting/i.test(param.name) && /object/i.test(param.type) ) {
if ( addRedundancy ) {
tag("parameterProperties");
writeParameterPropertiesForMSettings(symbolAPI);
closeTag("parameterProperties");
}
} else {
writeParameterProperties(param, param.name);
}
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag("parameter");
if ( legacyContent ) {
writeParameterProperties(param, param.name);
}
});
}
tag("description", getConstructorDescription(symbol), true);
// tagWithSince("experimental", symbol.experimental); // TODO repeat from class?
// tagWithSince("deprecated", symbol.deprecated); // TODO repeat from class?
// secTags(symbol); // TODO repeat from class?
closeTag("constructor");
}
/* TODO MIGRATE or remove, if not needed
var ownSubspaces = ( symbol.__ui5.children || [] ).filter(function($) { return $.kind === 'namespace' }).sort(sortByAlias);
for (var i=0; i<ownSubspaces.length; i++) {
var member = ownSubspaces[i];
tag("namespace");
tag("name", member.name);
closeTag("namespace");
}
*/
if ( symbolAPI.properties ) {
symbolAPI.properties.forEach(function(member) {
tag("property");
attrib("name", member.name);
if ( member.module ) {
attrib("module", member.module);
}
attrib("visibility", member.visibility, 'public');
if ( member["static"] ) {
attrib("static");
}
if ( member.since ) {
attrib("since", member.since);
}
attrib("type", member.type);
tag("description", member.description, true);
tagWithSince("experimental", member.experimental);
tagWithSince("deprecated", member.deprecated);
closeTag("property");
});
}
if ( symbolAPI.events ) {
symbolAPI.events.forEach(function(member) {
tag("event");
attrib("name", member.name);
if ( member.module ) {
attrib("module", member.module);
}
attrib("visibility", member.visibility, 'public');
if ( member["static"] ) {
attrib("static");
}
if ( member.since ) {
attrib("since", member.since);
}
if ( member.parameters ) {
member.parameters.forEach(function(param) {
tag("parameter");
attrib("name", param.name);
attrib("type", param.type);
if ( param.since ) {
attrib("since", param.since);
}
if ( !legacyContent ) {
writeParameterProperties(param, param.name);
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag("parameter");
if ( legacyContent ) {
writeParameterProperties(param, param.name);
}
});
}
tag("description", member.description, true);
tagWithSince("experimental", member.experimental);
tagWithSince("deprecated", member.deprecated);
// TODO secTags(member);
closeTag("event");
});
}
if ( symbolAPI.methods ) {
symbolAPI.methods.forEach(function(member) {
tag("method");
attrib("name", member.name);
if ( member.module ) {
attrib("module", member.module);
}
attrib("visibility", member.visibility, 'public');
if ( member["static"] ) {
attrib("static");
}
if ( member.returnValue && member.returnValue.type ) {
attrib("type", member.returnValue.type, 'void');
}
if ( member.since ) {
attrib("since", member.since);
}
if ( member.parameters ) {
member.parameters.forEach(function(param) {
tag("parameter");
attrib("name", param.name);
attrib("type", param.type);
if ( param.optional ) {
attrib("optional", param.optional);
}
if ( param.defaultValue !== undefined ) {
attrib("defaultValue", param.defaultValue);
}
if ( param.since ) {
attrib("since", param.since);
}
if ( !legacyContent ) {
writeParameterProperties(param, param.name);
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag("parameter");
if ( legacyContent ) {
writeParameterProperties(param, param.name);
}
});
}
tag("description", member.description, true);
tagWithSince("experimental", member.experimental);
tagWithSince("deprecated", member.deprecated);
// TODO secTags(member);
closeTag("method");
});
}
if ( roots && symbol.__ui5.children && symbol.__ui5.children.length ) {
tag("children");
symbol.__ui5.children.forEach(writeSymbol);
closeTag("children");
}
closeTag(kind);
}
}
writeln("<?xml version=\"1.0\" ?>");
rootTag("api");
if ( !legacyContent ) {
namespace("xmlns", "http://www.sap.com/sap.ui.library.api.xsd");
attrib("_version", "1.0.0");
if ( templateConf.version ) {
attrib("version", templateConf.version.replace(/-SNAPSHOT$/,""));
}
if ( templateConf.uilib ) {
attrib("library", templateConf.uilib);
}
}
if ( roots ) {
roots.forEach(writeSymbol);
} else {
// sort only a copy(!) of the symbols, otherwise the SymbolSet lookup is broken
symbols.slice(0).sort(sortByAlias).forEach(writeSymbol);
}
closeRootTag("api");
fs.mkPath(path.dirname(filename));
fs.writeFileSync(filename, getAsString(), 'utf8');
} | javascript | function createAPIXML(symbols, filename, options) {
options = options || {};
var roots = options.roots || null;
var legacyContent = !!options.legacyContent;
var omitDefaults = !!options.omitDefaults;
var addRedundancy = !!options.resolveInheritance;
var indent = 0;
var output = [];
var sIndent = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
var tags = [];
var ENUM = legacyContent ? "namespace" : "enum";
var BASETYPE = legacyContent ? "baseType" : "extends";
var PROPERTY = legacyContent ? "parameter" : "property";
var unclosedStartTag = false;
function getAPIJSON(name) {
var symbol = lookup(name);
if ( symbol && !symbol.synthetic ) {
return createAPIJSON4Symbol(symbol, false);
}
if ( addRedundancy && externalSymbols[name] ) {
debug(" using " + name + " from external dependency");
return externalSymbols[name];
}
return symbol;
}
function encode(s) {
return s ? s.replace(/&/g, "&").replace(/</g, "<") : s;
}
function write(args) {
if ( arguments.length ) {
for (var i = 0; i < arguments.length; i++) {
output.push(arguments[i]);
}
}
}
function writeln(args) {
if ( indent > 0 ) {
output.push(sIndent.slice(0,indent));
}
if ( arguments.length ) {
for (var i = 0; i < arguments.length; i++) {
output.push(arguments[i]);
}
}
output.push("\n");
}
function rootTag(name) {
tags = [];
unclosedStartTag = false;
tag(name);
}
function closeRootTag(name) {
closeTag(name);
}
function namespace(alias, namespace) {
attrib(alias, namespace);
}
function tag(name, value, omitEmpty) {
if ( omitEmpty && !value ) {
return;
}
if ( unclosedStartTag ) {
unclosedStartTag = false;
write('>\n');
}
if ( arguments.length === 1 ) { // opening tag
if ( indent > 0 ) {
output.push(sIndent.slice(0,indent));
}
write("<", name);
unclosedStartTag = true;
if ( legacyContent ) {
unclosedStartTag = false;
write(">\n");
}
tags.push(name);
indent++;
return;
}
if ( value == null ) {
writeln("<", name, "/>");
} else {
writeln("<", name, ">", encode(String(value)), "</", name, ">");
}
}
function attrib(name, value, defaultValue) {
var emptyTag = arguments.length === 1;
if ( omitDefaults && arguments.length === 3 && value === defaultValue ) {
return;
}
if ( !legacyContent ) {
write(" " + name + "=\"");
write(emptyTag ? "true" : encode(String(value)).replace(/"/g, """));
write("\"");
} else if ( emptyTag ) {
writeln("<", name, "/>");
} else {
writeln("<", name, ">", encode(String(value)), "</", name, ">");
}
}
function closeTag(name, noIndent) {
indent--;
var top = tags.pop();
if ( top != name ) {
// ERROR?
}
if ( unclosedStartTag ) {
unclosedStartTag = false;
write("/>\n");
} else if ( noIndent ) {
write("</", name, ">\n");
} else {
writeln("</", name, ">");
}
}
function textContent(text) {
if ( unclosedStartTag ) {
unclosedStartTag = false;
write('>');
}
write(encode(text));
}
function tagWithSince(tagName, prop) {
if ( prop ) {
tag(tagName);
if ( prop.since ) {
attrib("since", prop.since);
}
if ( prop.text && prop.text.trim() ) {
textContent(prop.text);
}
closeTag(tagName, true);
}
}
function getAsString() {
return output.join("");
}
function writeMetadata(symbolAPI, inherited) {
var ui5Metadata = symbolAPI["ui5-metadata"];
if ( !ui5Metadata ) {
return;
}
if ( addRedundancy && symbolAPI["extends"] ) {
var baseSymbolAPI = getAPIJSON(symbolAPI["extends"]);
if ( baseSymbolAPI ) {
writeMetadata(baseSymbolAPI, true);
}
}
if ( ui5Metadata.specialSettings ) {
ui5Metadata.specialSettings.forEach(function(special) {
tag("specialSetting");
attrib("name", special.name);
attrib("type", special.type);
attrib("visibility", special.visibility, 'public');
if ( special.since ) {
attrib("since", special.since);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", special.description, true);
tagWithSince("experimental", special.experimental);
tagWithSince("deprecated", special.deprecated);
tag("methods", special.methods);
closeTag("specialSetting");
});
}
if ( ui5Metadata.properties ) {
ui5Metadata.properties.forEach(function(prop) {
tag("property");
attrib("name", prop.name);
attrib("type", prop.type, 'string');
if ( prop.defaultValue !== null ) {
attrib("defaultValue", prop.defaultValue, null);
}
attrib("visibility", prop.visibility, 'public');
if ( prop.since ) {
attrib("since", prop.since);
}
if ( prop.bindable ) {
attrib("bindable", prop.bindable);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", prop.description, true);
tagWithSince("experimental", prop.experimental);
tagWithSince("deprecated", prop.deprecated);
tag("methods", prop.methods);
closeTag("property");
});
}
if ( ui5Metadata.defaultProperty ) {
tag("defaultProperty", ui5Metadata.defaultProperty);
}
if ( ui5Metadata.aggregations ) {
ui5Metadata.aggregations.forEach(function(aggr) {
tag("aggregation");
attrib("name", aggr.name);
attrib("singularName", aggr.singularName); // TODO omit default?
attrib("type", aggr.type, 'sap.ui.core.Control');
if ( aggr.altTypes ) {
attrib("altTypes", aggr.altTypes.join(","));
}
attrib("cardinality", aggr.cardinality, '0..n');
attrib("visibility", aggr.visibility, 'public');
if ( aggr.since ) {
attrib("since", aggr.since);
}
if ( aggr.bindable ) {
attrib("bindable", aggr.bindable);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", aggr.description, true);
tagWithSince("experimental", aggr.experimental);
tagWithSince("deprecated", aggr.deprecated);
tag("methods", aggr.methods);
closeTag("aggregation");
});
}
if ( ui5Metadata.defaultAggregation ) {
tag("defaultAggregation", ui5Metadata.defaultAggregation);
}
if ( ui5Metadata.associations ) {
ui5Metadata.associations.forEach(function(assoc) {
tag("association");
attrib("name", assoc.name);
attrib("singularName", assoc.singularName); // TODO omit default?
attrib("type", assoc.type, 'sap.ui.core.Control');
attrib("cardinality", assoc.cardinality, '0..1');
attrib("visibility", assoc.visibility, 'public');
if ( assoc.since ) {
attrib("since", assoc.since);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", assoc.description, true);
tagWithSince("experimental", assoc.experimental);
tagWithSince("deprecated", assoc.deprecated);
tag("methods", assoc.methods);
closeTag("association");
});
}
if ( ui5Metadata.events ) {
ui5Metadata.events.forEach(function(event) {
tag("event");
attrib("name", event.name);
attrib("visibility", event.visibility, 'public');
if ( event.since ) {
attrib("since", event.since);
}
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", event.description, true);
tagWithSince("experimental", event.experimental);
tagWithSince("deprecated", event.deprecated);
if ( event.parameters ) {
tag("parameters");
for ( var pn in event.parameters ) {
if ( event.parameters.hasOwnProperty(pn) ) {
var param = event.parameters[pn];
tag("parameter");
attrib("name", param.name);
attrib("type", param.type);
if ( param.since ) {
attrib("since", param.since);
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag("parameter");
}
}
closeTag("parameters");
}
tag("methods", event.methods, true);
closeTag("event");
});
}
if ( ui5Metadata.annotations ) {
ui5Metadata.annotations.forEach(function(anno) {
tag("annotation");
attrib("name", anno.name);
attrib("namespace", anno.namespace); // TODO omit default?
attrib("target", anno.target);
attrib("annotation", anno.annotation);
attrib("appliesTo", anno.appliesTo);
if ( anno.since ) {
attrib("since", anno.since);
}
tag("description", anno.description, true);
tagWithSince("deprecated", anno.deprecated);
closeTag("annotation");
});
}
}
function writeParameterPropertiesForMSettings(symbolAPI, inherited) {
var ui5Metadata = symbolAPI["ui5-metadata"];
if ( !ui5Metadata ) {
return;
}
if ( symbolAPI["extends"] ) {
var baseSymbolAPI = getAPIJSON(symbolAPI["extends"]);
writeParameterPropertiesForMSettings(baseSymbolAPI, true);
}
if ( ui5Metadata.specialSettings ) {
ui5Metadata.specialSettings.forEach(function(special) {
if ( special.visibility !== 'hidden' ) {
tag("property");
attrib("name", special.name);
attrib("type", special.type);
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", special.description, true);
closeTag("property");
}
});
}
if ( ui5Metadata.properties ) {
ui5Metadata.properties.forEach(function(prop) {
tag("property");
attrib("name", prop.name);
attrib("type", prop.type);
attrib("group", prop.group, 'Misc');
if ( prop.defaultValue !== null ) {
attrib("defaultValue", typeof prop.defaultValue === 'string' ? "\"" + prop.defaultValue + "\"" : prop.defaultValue);
}
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", prop.description, true);
closeTag("property");
});
}
if ( ui5Metadata.aggregations ) {
ui5Metadata.aggregations.forEach(function(aggr) {
if ( aggr.visibility !== "hidden" ) {
tag("property");
attrib("name", aggr.name);
attrib("type", aggr.type + (aggr.cardinality === '0..1' ? "" : "[]"));
if ( aggr.altTypes ) {
attrib("altTypes", aggr.altTypes.join(","));
}
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", aggr.description, true);
closeTag("property");
}
});
}
if ( ui5Metadata.associations ) {
ui5Metadata.associations.forEach(function(assoc) {
if ( assoc.visibility !== "hidden" ) {
tag("property");
attrib("name", assoc.name);
attrib("type", "(" + assoc.type + "|" + "string)" + (assoc.cardinality === '0..1' ? "" : "[]"));
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", assoc.description, true);
closeTag("property");
}
});
}
if ( ui5Metadata.events ) {
ui5Metadata.events.forEach(function(event) {
tag("property");
attrib("name", event.name);
attrib("type", "function|array");
attrib("optional");
if ( inherited ) {
attrib("origin", symbolAPI.name);
}
tag("description", event.description, true);
closeTag("property");
});
}
}
function writeParameterProperties(param, paramName) {
var props = param.parameterProperties,
prefix = paramName + '.',
count = 0;
if ( props ) {
for (var n in props ) {
if ( props.hasOwnProperty(n) ) {
param = props[n];
if ( !legacyContent && count === 0 ) {
tag("parameterProperties");
}
count++;
tag(PROPERTY);
attrib("name", legacyContent ? prefix + n : n);
attrib("type", param.type);
if ( param.since ) {
attrib("since", param.since);
}
if ( param.optional ) {
attrib("optional", param.optional);
}
if ( !legacyContent ) {
writeParameterProperties(param, prefix + n);
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag(PROPERTY);
if ( legacyContent ) {
writeParameterProperties(param, prefix + n);
}
}
}
}
if ( !legacyContent && count > 0 ) {
closeTag("parameterProperties");
}
}
/*
var rSplitSecTag = /^\s*\{([^\}]*)\}/;
function secTags($) {
if ( !legacyContent ) {
return;
}
var aTags = $.tags;
if ( !aTags ) {
return;
}
for (var iTag = 0; iTag < A_SECURITY_TAGS.length; iTag++ ) {
var oTagDef = A_SECURITY_TAGS[iTag];
for (var j = 0; j < aTags.length; j++ ) {
if ( aTags[j].title.toLowerCase() === oTagDef.name.toLowerCase() ) {
tag(oTagDef.name);
var m = rSplitSecTag.exec(aTags[j].text);
if ( m && m[1].trim() ) {
var aParams = m[1].trim().split(/\s*\|\s* /); <-- remove the blank!
for (var iParam = 0; iParam < aParams.length; iParam++ ) {
tag(oTagDef.params[iParam], aParams[iParam]);
}
}
var sDesc = aTags[j].description;
tag("description", sDesc, true);
closeTag(oTagDef.name);
}
}
}
}
*/
function writeSymbol(symbol) {
var kind;
if ( isFirstClassSymbol(symbol) && (roots || !symbol.synthetic) ) { // dump a symbol if it as a class symbol and if either hierarchies are dumped or if it is not a synthetic symbol
// for the hierarchy we use only the local information
var symbolAPI = createAPIJSON4Symbol(symbol);
kind = symbolAPI.kind === 'enum' ? ENUM : symbolAPI.kind;
tag(kind);
attrib("name", symbolAPI.name);
attrib("basename", symbolAPI.basename);
// if ( symbolAPI["resource"] ) {
// attrib("resource");
// }
if ( symbolAPI["module"] ) {
attrib("module", symbolAPI["module"]);
}
if ( symbolAPI["abstract"] ) {
attrib("abstract");
}
if ( symbolAPI["final"] ) {
attrib("final");
}
if ( symbolAPI["static"] ) {
attrib("static");
}
attrib("visibility", symbolAPI.visibility, 'public');
if ( symbolAPI.since ) {
attrib("since", symbolAPI.since);
}
if ( symbolAPI["extends"] ) {
tag(BASETYPE, symbolAPI["extends"]); // TODO what about multiple inheritance?
}
tag("description", symbolAPI.description, true);
tagWithSince("experimental", symbolAPI.experimental);
tagWithSince("deprecated", symbolAPI.deprecated);
if ( kind === 'class' ) {
var hasSettings = symbolAPI["ui5-metadata"];
if ( !legacyContent && symbolAPI["ui5-metadata"] ) {
tag("ui5-metadata");
if ( symbolAPI["ui5-metadata"].stereotype ) {
attrib("stereotype", symbolAPI["ui5-metadata"].stereotype);
}
writeMetadata(symbolAPI);
closeTag("ui5-metadata");
}
tag("constructor");
if ( legacyContent ) {
attrib("name", symbolAPI.basename);
}
attrib("visibility", symbolAPI.visibility, 'public');
if ( symbolAPI.constructor.parameters ) {
symbolAPI.constructor.parameters.forEach(function(param, j) {
tag("parameter");
attrib("name", param.name);
attrib("type", param.type);
attrib("optional", param.optional, false);
if ( param.defaultValue !== undefined ) {
attrib("defaultValue", param.defaultValue);
}
if ( param.since ) {
attrib("since", param.since);
}
if ( !legacyContent ) {
if ( hasSettings && j == 1 && /setting/i.test(param.name) && /object/i.test(param.type) ) {
if ( addRedundancy ) {
tag("parameterProperties");
writeParameterPropertiesForMSettings(symbolAPI);
closeTag("parameterProperties");
}
} else {
writeParameterProperties(param, param.name);
}
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag("parameter");
if ( legacyContent ) {
writeParameterProperties(param, param.name);
}
});
}
tag("description", getConstructorDescription(symbol), true);
// tagWithSince("experimental", symbol.experimental); // TODO repeat from class?
// tagWithSince("deprecated", symbol.deprecated); // TODO repeat from class?
// secTags(symbol); // TODO repeat from class?
closeTag("constructor");
}
/* TODO MIGRATE or remove, if not needed
var ownSubspaces = ( symbol.__ui5.children || [] ).filter(function($) { return $.kind === 'namespace' }).sort(sortByAlias);
for (var i=0; i<ownSubspaces.length; i++) {
var member = ownSubspaces[i];
tag("namespace");
tag("name", member.name);
closeTag("namespace");
}
*/
if ( symbolAPI.properties ) {
symbolAPI.properties.forEach(function(member) {
tag("property");
attrib("name", member.name);
if ( member.module ) {
attrib("module", member.module);
}
attrib("visibility", member.visibility, 'public');
if ( member["static"] ) {
attrib("static");
}
if ( member.since ) {
attrib("since", member.since);
}
attrib("type", member.type);
tag("description", member.description, true);
tagWithSince("experimental", member.experimental);
tagWithSince("deprecated", member.deprecated);
closeTag("property");
});
}
if ( symbolAPI.events ) {
symbolAPI.events.forEach(function(member) {
tag("event");
attrib("name", member.name);
if ( member.module ) {
attrib("module", member.module);
}
attrib("visibility", member.visibility, 'public');
if ( member["static"] ) {
attrib("static");
}
if ( member.since ) {
attrib("since", member.since);
}
if ( member.parameters ) {
member.parameters.forEach(function(param) {
tag("parameter");
attrib("name", param.name);
attrib("type", param.type);
if ( param.since ) {
attrib("since", param.since);
}
if ( !legacyContent ) {
writeParameterProperties(param, param.name);
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag("parameter");
if ( legacyContent ) {
writeParameterProperties(param, param.name);
}
});
}
tag("description", member.description, true);
tagWithSince("experimental", member.experimental);
tagWithSince("deprecated", member.deprecated);
// TODO secTags(member);
closeTag("event");
});
}
if ( symbolAPI.methods ) {
symbolAPI.methods.forEach(function(member) {
tag("method");
attrib("name", member.name);
if ( member.module ) {
attrib("module", member.module);
}
attrib("visibility", member.visibility, 'public');
if ( member["static"] ) {
attrib("static");
}
if ( member.returnValue && member.returnValue.type ) {
attrib("type", member.returnValue.type, 'void');
}
if ( member.since ) {
attrib("since", member.since);
}
if ( member.parameters ) {
member.parameters.forEach(function(param) {
tag("parameter");
attrib("name", param.name);
attrib("type", param.type);
if ( param.optional ) {
attrib("optional", param.optional);
}
if ( param.defaultValue !== undefined ) {
attrib("defaultValue", param.defaultValue);
}
if ( param.since ) {
attrib("since", param.since);
}
if ( !legacyContent ) {
writeParameterProperties(param, param.name);
}
tag("description", param.description, true);
tagWithSince("experimental", param.experimental);
tagWithSince("deprecated", param.deprecated);
closeTag("parameter");
if ( legacyContent ) {
writeParameterProperties(param, param.name);
}
});
}
tag("description", member.description, true);
tagWithSince("experimental", member.experimental);
tagWithSince("deprecated", member.deprecated);
// TODO secTags(member);
closeTag("method");
});
}
if ( roots && symbol.__ui5.children && symbol.__ui5.children.length ) {
tag("children");
symbol.__ui5.children.forEach(writeSymbol);
closeTag("children");
}
closeTag(kind);
}
}
writeln("<?xml version=\"1.0\" ?>");
rootTag("api");
if ( !legacyContent ) {
namespace("xmlns", "http://www.sap.com/sap.ui.library.api.xsd");
attrib("_version", "1.0.0");
if ( templateConf.version ) {
attrib("version", templateConf.version.replace(/-SNAPSHOT$/,""));
}
if ( templateConf.uilib ) {
attrib("library", templateConf.uilib);
}
}
if ( roots ) {
roots.forEach(writeSymbol);
} else {
// sort only a copy(!) of the symbols, otherwise the SymbolSet lookup is broken
symbols.slice(0).sort(sortByAlias).forEach(writeSymbol);
}
closeRootTag("api");
fs.mkPath(path.dirname(filename));
fs.writeFileSync(filename, getAsString(), 'utf8');
} | [
"function",
"createAPIXML",
"(",
"symbols",
",",
"filename",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"roots",
"=",
"options",
".",
"roots",
"||",
"null",
";",
"var",
"legacyContent",
"=",
"!",
"!",
"options",
".... | ---- add on: API XML ----------------------------------------------------------------- | [
"----",
"add",
"on",
":",
"API",
"XML",
"-----------------------------------------------------------------"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L3088-L3873 | train | Creates an XML string from the given symbols | [
30522,
3853,
3443,
9331,
7646,
19968,
1006,
9255,
1010,
5371,
18442,
1010,
7047,
1007,
1063,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
1025,
13075,
6147,
1027,
7047,
1012,
6147,
1064,
1064,
19701,
1025,
13075,
8027,
8663,
6528,
2102,
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... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js | function(aChanges, oManagedObject) {
if (!(oManagedObject instanceof ManagedObject)) {
var sErrorMessage = "A valid sap.ui.base.ManagedObject instance is required as a parameter";
Utils.log.error(sErrorMessage);
return Promise.reject(sErrorMessage);
}
var mParameters = ControlPersonalizationAPI._determineParameters(oManagedObject);
var aVariantManagementReferences = Object.keys(mParameters.variantManagement).reduce(function (aReferences, sVariantForAssociationId) {
return aReferences.concat([mParameters.variantManagement[sVariantForAssociationId]]);
}, []);
return mParameters.flexController.saveSequenceOfDirtyChanges(aChanges)
.then(function(oResponse) {
mParameters.variantModel.checkDirtyStateForControlModels(aVariantManagementReferences);
return oResponse;
});
} | javascript | function(aChanges, oManagedObject) {
if (!(oManagedObject instanceof ManagedObject)) {
var sErrorMessage = "A valid sap.ui.base.ManagedObject instance is required as a parameter";
Utils.log.error(sErrorMessage);
return Promise.reject(sErrorMessage);
}
var mParameters = ControlPersonalizationAPI._determineParameters(oManagedObject);
var aVariantManagementReferences = Object.keys(mParameters.variantManagement).reduce(function (aReferences, sVariantForAssociationId) {
return aReferences.concat([mParameters.variantManagement[sVariantForAssociationId]]);
}, []);
return mParameters.flexController.saveSequenceOfDirtyChanges(aChanges)
.then(function(oResponse) {
mParameters.variantModel.checkDirtyStateForControlModels(aVariantManagementReferences);
return oResponse;
});
} | [
"function",
"(",
"aChanges",
",",
"oManagedObject",
")",
"{",
"if",
"(",
"!",
"(",
"oManagedObject",
"instanceof",
"ManagedObject",
")",
")",
"{",
"var",
"sErrorMessage",
"=",
"\"A valid sap.ui.base.ManagedObject instance is required as a parameter\"",
";",
"Utils",
"."... | Saves unsaved changes added to {@link sap.ui.fl.ChangePersistence}.
@param {array} aChanges - Array of changes to be saved
@param {sap.ui.base.ManagedObject} oManagedObject - A managed object instance which has an application component responsible, on which changes need to be saved
@returns {Promise} Returns Promise which is resolved when the passed array of changes have been saved
@method sap.ui.fl.ControlPersonalizationAPI.saveChanges
@public | [
"Saves",
"unsaved",
"changes",
"added",
"to",
"{",
"@link",
"sap",
".",
"ui",
".",
"fl",
".",
"ChangePersistence",
"}",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js#L406-L421 | train | Saves the given changes to the control model. | [
30522,
3853,
1006,
9353,
18003,
2229,
1010,
16640,
18655,
16429,
20614,
1007,
1063,
2065,
1006,
999,
1006,
16640,
18655,
16429,
20614,
6013,
11253,
3266,
16429,
20614,
1007,
1007,
1063,
13075,
14262,
29165,
7834,
3736,
3351,
1027,
1000,
1037,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | mxPoint | function mxPoint(x, y)
{
this.x = (x != null) ? x : 0;
this.y = (y != null) ? y : 0;
} | javascript | function mxPoint(x, y)
{
this.x = (x != null) ? x : 0;
this.y = (y != null) ? y : 0;
} | [
"function",
"mxPoint",
"(",
"x",
",",
"y",
")",
"{",
"this",
".",
"x",
"=",
"(",
"x",
"!=",
"null",
")",
"?",
"x",
":",
"0",
";",
"this",
".",
"y",
"=",
"(",
"y",
"!=",
"null",
")",
"?",
"y",
":",
"0",
";",
"}"
] | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxPoint
Implements a 2-dimensional vector with double precision coordinates.
Constructor: mxPoint
Constructs a new point for the optional x and y coordinates. If no
coordinates are given, then the default values for <x> and <y> are used. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxPoint"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L1705-L1709 | train | This function is called by mxRectangle to calculate the location of the polygon | [
30522,
3853,
25630,
8400,
1006,
1060,
1010,
1061,
1007,
1063,
2023,
1012,
1060,
1027,
1006,
1060,
999,
1027,
19701,
1007,
1029,
1060,
1024,
1014,
1025,
2023,
1012,
1061,
1027,
1006,
1061,
999,
1027,
19701,
1007,
1029,
1061,
1024,
1014,
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... |
angular/material | src/components/dialog/dialog.js | showBackdrop | function showBackdrop(scope, element, options) {
if (options.disableParentScroll) {
// !! DO this before creating the backdrop; since disableScrollAround()
// configures the scroll offset; which is used by mdBackDrop postLink()
options.restoreScroll = $mdUtil.disableScrollAround(element, options.parent);
}
if (options.hasBackdrop) {
options.backdrop = $mdUtil.createBackdrop(scope, "md-dialog-backdrop md-opaque");
$animate.enter(options.backdrop, options.parent);
}
/**
* Hide modal backdrop element...
*/
options.hideBackdrop = function hideBackdrop($destroy) {
if (options.backdrop) {
if ($destroy) options.backdrop.remove();
else $animate.leave(options.backdrop);
}
if (options.disableParentScroll) {
options.restoreScroll && options.restoreScroll();
delete options.restoreScroll;
}
options.hideBackdrop = null;
};
} | javascript | function showBackdrop(scope, element, options) {
if (options.disableParentScroll) {
// !! DO this before creating the backdrop; since disableScrollAround()
// configures the scroll offset; which is used by mdBackDrop postLink()
options.restoreScroll = $mdUtil.disableScrollAround(element, options.parent);
}
if (options.hasBackdrop) {
options.backdrop = $mdUtil.createBackdrop(scope, "md-dialog-backdrop md-opaque");
$animate.enter(options.backdrop, options.parent);
}
/**
* Hide modal backdrop element...
*/
options.hideBackdrop = function hideBackdrop($destroy) {
if (options.backdrop) {
if ($destroy) options.backdrop.remove();
else $animate.leave(options.backdrop);
}
if (options.disableParentScroll) {
options.restoreScroll && options.restoreScroll();
delete options.restoreScroll;
}
options.hideBackdrop = null;
};
} | [
"function",
"showBackdrop",
"(",
"scope",
",",
"element",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"disableParentScroll",
")",
"{",
"// !! DO this before creating the backdrop; since disableScrollAround()",
"// configures the scroll offset; which is used by mdBackD... | Show modal backdrop element... | [
"Show",
"modal",
"backdrop",
"element",
"..."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1041-L1071 | train | Show modal backdrop | [
30522,
3853,
2265,
5963,
25711,
1006,
9531,
1010,
5783,
1010,
7047,
1007,
1063,
2065,
1006,
7047,
1012,
4487,
19150,
19362,
11187,
26775,
14511,
1007,
1063,
1013,
1013,
999,
999,
2079,
2023,
2077,
4526,
1996,
18876,
1025,
2144,
4487,
19150,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | dist/extension/dataTool.js | map | function map(obj, cb, context) {
if (!(obj && cb)) {
return;
}
if (obj.map && obj.map === nativeMap) {
return obj.map(cb, context);
}
else {
var result = [];
for (var i = 0, len = obj.length; i < len; i++) {
result.push(cb.call(context, obj[i], i, obj));
}
return result;
}
} | javascript | function map(obj, cb, context) {
if (!(obj && cb)) {
return;
}
if (obj.map && obj.map === nativeMap) {
return obj.map(cb, context);
}
else {
var result = [];
for (var i = 0, len = obj.length; i < len; i++) {
result.push(cb.call(context, obj[i], i, obj));
}
return result;
}
} | [
"function",
"map",
"(",
"obj",
",",
"cb",
",",
"context",
")",
"{",
"if",
"(",
"!",
"(",
"obj",
"&&",
"cb",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"obj",
".",
"map",
"&&",
"obj",
".",
"map",
"===",
"nativeMap",
")",
"{",
"return",
"obj... | 数组或对象遍历
@memberOf module:zrender/core/util
@param {Object|Array} obj
@param {Function} cb
@param {*} [context]
数组映射
@memberOf module:zrender/core/util
@param {Array} obj
@param {Function} cb
@param {*} [context]
@return {Array} | [
"数组或对象遍历"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/dist/extension/dataTool.js#L134-L148 | train | A function that returns an array of the result of calling a callback for each entry in the array. | [
30522,
3853,
4949,
1006,
27885,
3501,
1010,
17324,
1010,
6123,
1007,
1063,
2065,
1006,
999,
1006,
27885,
3501,
1004,
1004,
17324,
1007,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
27885,
3501,
1012,
4949,
1004,
1004,
27885,
3501,
1012,
4949,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/blanket.js | parseWithStatement | function parseWithStatement() {
var object, body;
if (strict) {
// TODO(ikarienator): Should we update the test cases instead?
skipComment();
throwErrorTolerant({}, Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return delegate.createWithStatement(object, body);
} | javascript | function parseWithStatement() {
var object, body;
if (strict) {
// TODO(ikarienator): Should we update the test cases instead?
skipComment();
throwErrorTolerant({}, Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return delegate.createWithStatement(object, body);
} | [
"function",
"parseWithStatement",
"(",
")",
"{",
"var",
"object",
",",
"body",
";",
"if",
"(",
"strict",
")",
"{",
"// TODO(ikarienator): Should we update the test cases instead?",
"skipComment",
"(",
")",
";",
"throwErrorTolerant",
"(",
"{",
"}",
",",
"Messages",
... | 12.10 The with statement | [
"12",
".",
"10",
"The",
"with",
"statement"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/blanket.js#L3019-L3039 | train | ECMA - 262 13. 2 With Statement | [
30522,
3853,
11968,
3366,
24415,
9153,
18532,
4765,
1006,
1007,
1063,
13075,
4874,
1010,
2303,
1025,
2065,
1006,
9384,
1007,
1063,
1013,
1013,
28681,
2080,
1006,
20912,
8486,
8189,
4263,
1007,
1024,
2323,
2057,
10651,
1996,
3231,
3572,
2612... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zloirock/core-js | packages/core-js/modules/web.url-search-params.js | get | function get(name) {
validateArgumentsLength(arguments.length, 1);
var entries = getInternalParamsState(this).entries;
var key = name + '';
var i = 0;
for (; i < entries.length; i++) if (entries[i].key === key) return entries[i].value;
return null;
} | javascript | function get(name) {
validateArgumentsLength(arguments.length, 1);
var entries = getInternalParamsState(this).entries;
var key = name + '';
var i = 0;
for (; i < entries.length; i++) if (entries[i].key === key) return entries[i].value;
return null;
} | [
"function",
"get",
"(",
"name",
")",
"{",
"validateArgumentsLength",
"(",
"arguments",
".",
"length",
",",
"1",
")",
";",
"var",
"entries",
"=",
"getInternalParamsState",
"(",
"this",
")",
".",
"entries",
";",
"var",
"key",
"=",
"name",
"+",
"''",
";",
... | `URLSearchParams.prototype.get` method https://url.spec.whatwg.org/#dom-urlsearchparams-get | [
"URLSearchParams",
".",
"prototype",
".",
"get",
"method",
"https",
":",
"//",
"url",
".",
"spec",
".",
"whatwg",
".",
"org",
"/",
"#dom",
"-",
"urlsearchparams",
"-",
"get"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/web.url-search-params.js#L172-L179 | train | Get parameter value by name | [
30522,
3853,
2131,
1006,
2171,
1007,
1063,
9398,
3686,
2906,
22850,
11187,
7770,
13512,
2232,
1006,
9918,
1012,
3091,
1010,
1015,
1007,
1025,
13075,
10445,
1027,
2131,
18447,
11795,
2389,
28689,
5244,
9153,
2618,
1006,
2023,
1007,
1012,
104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/max-statements-per-line.js | enterStatement | function enterStatement(node) {
const line = node.loc.start.line;
/*
* Skip to allow non-block statements if this is direct child of control statements.
* `if (a) foo();` is counted as 1.
* But `if (a) foo(); else foo();` should be counted as 2.
*/
if (SINGLE_CHILD_ALLOWED.test(node.parent.type) &&
node.parent.alternate !== node
) {
return;
}
// Update state.
if (line === lastStatementLine) {
numberOfStatementsOnThisLine += 1;
} else {
reportFirstExtraStatementAndClear();
numberOfStatementsOnThisLine = 1;
lastStatementLine = line;
}
// Reports if the node violated this rule.
if (numberOfStatementsOnThisLine === maxStatementsPerLine + 1) {
firstExtraStatement = firstExtraStatement || node;
}
} | javascript | function enterStatement(node) {
const line = node.loc.start.line;
/*
* Skip to allow non-block statements if this is direct child of control statements.
* `if (a) foo();` is counted as 1.
* But `if (a) foo(); else foo();` should be counted as 2.
*/
if (SINGLE_CHILD_ALLOWED.test(node.parent.type) &&
node.parent.alternate !== node
) {
return;
}
// Update state.
if (line === lastStatementLine) {
numberOfStatementsOnThisLine += 1;
} else {
reportFirstExtraStatementAndClear();
numberOfStatementsOnThisLine = 1;
lastStatementLine = line;
}
// Reports if the node violated this rule.
if (numberOfStatementsOnThisLine === maxStatementsPerLine + 1) {
firstExtraStatement = firstExtraStatement || node;
}
} | [
"function",
"enterStatement",
"(",
"node",
")",
"{",
"const",
"line",
"=",
"node",
".",
"loc",
".",
"start",
".",
"line",
";",
"/*\n * Skip to allow non-block statements if this is direct child of control statements.\n * `if (a) foo();` is counted as 1.\n ... | Addresses a given node.
It updates the state of this rule, then reports the node if the node violated this rule.
@param {ASTNode} node - A node to check.
@returns {void} | [
"Addresses",
"a",
"given",
"node",
".",
"It",
"updates",
"the",
"state",
"of",
"this",
"rule",
"then",
"reports",
"the",
"node",
"if",
"the",
"node",
"violated",
"this",
"rule",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/max-statements-per-line.js#L99-L126 | train | Enter a statement. | [
30522,
3853,
8039,
12259,
3672,
1006,
13045,
1007,
1063,
9530,
3367,
2240,
1027,
13045,
1012,
8840,
2278,
1012,
2707,
1012,
2240,
1025,
1013,
1008,
1008,
13558,
2000,
3499,
2512,
1011,
3796,
8635,
2065,
2023,
2003,
3622,
2775,
1997,
2491,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NavigationProvider.js | _initNavigationMenuItems | function _initNavigationMenuItems() {
var menu = Menus.getMenu(Menus.AppMenuBar.NAVIGATE_MENU);
menu.addMenuItem(NAVIGATION_JUMP_BACK, "", Menus.AFTER, Commands.NAVIGATE_PREV_DOC);
menu.addMenuItem(NAVIGATION_JUMP_FWD, "", Menus.AFTER, NAVIGATION_JUMP_BACK);
} | javascript | function _initNavigationMenuItems() {
var menu = Menus.getMenu(Menus.AppMenuBar.NAVIGATE_MENU);
menu.addMenuItem(NAVIGATION_JUMP_BACK, "", Menus.AFTER, Commands.NAVIGATE_PREV_DOC);
menu.addMenuItem(NAVIGATION_JUMP_FWD, "", Menus.AFTER, NAVIGATION_JUMP_BACK);
} | [
"function",
"_initNavigationMenuItems",
"(",
")",
"{",
"var",
"menu",
"=",
"Menus",
".",
"getMenu",
"(",
"Menus",
".",
"AppMenuBar",
".",
"NAVIGATE_MENU",
")",
";",
"menu",
".",
"addMenuItem",
"(",
"NAVIGATION_JUMP_BACK",
",",
"\"\"",
",",
"Menus",
".",
"AFT... | Function to initialize navigation menu items.
@private | [
"Function",
"to",
"initialize",
"navigation",
"menu",
"items",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/NavigationProvider.js#L411-L415 | train | Initializes the navigation menu items | [
30522,
3853,
1035,
1999,
4183,
2532,
5737,
12540,
3549,
14663,
6633,
2015,
1006,
1007,
1063,
13075,
12183,
1027,
12183,
2015,
1012,
2131,
3549,
2226,
1006,
12183,
2015,
1012,
10439,
3549,
19761,
2099,
1012,
22149,
1035,
12183,
1007,
1025,
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/search/FindInFiles.js | doSearchInScope | function doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise) {
clearSearch();
searchModel.scope = scope;
if (replaceText !== undefined) {
searchModel.isReplace = true;
searchModel.replaceText = replaceText;
}
candidateFilesPromise = candidateFilesPromise || getCandidateFiles(scope);
return _doSearch(queryInfo, candidateFilesPromise, filter);
} | javascript | function doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise) {
clearSearch();
searchModel.scope = scope;
if (replaceText !== undefined) {
searchModel.isReplace = true;
searchModel.replaceText = replaceText;
}
candidateFilesPromise = candidateFilesPromise || getCandidateFiles(scope);
return _doSearch(queryInfo, candidateFilesPromise, filter);
} | [
"function",
"doSearchInScope",
"(",
"queryInfo",
",",
"scope",
",",
"filter",
",",
"replaceText",
",",
"candidateFilesPromise",
")",
"{",
"clearSearch",
"(",
")",
";",
"searchModel",
".",
"scope",
"=",
"scope",
";",
"if",
"(",
"replaceText",
"!==",
"undefined"... | Does a search in the given scope with the given filter. Used when you want to start a search
programmatically.
@param {{query: string, caseSensitive: boolean, isRegexp: boolean}} queryInfo Query info object
@param {?Entry} scope Project file/subfolder to search within; else searches whole project.
@param {?string} filter A "compiled" filter as returned by FileFilters.compile(), or null for no filter
@param {?string} replaceText If this is a replacement, the text to replace matches with. This is just
stored in the model for later use - the replacement is not actually performed right now.
@param {?$.Promise} candidateFilesPromise If specified, a promise that should resolve with the same set of files that
getCandidateFiles(scope) would return.
@return {$.Promise} A promise that's resolved with the search results or rejected when the find competes. | [
"Does",
"a",
"search",
"in",
"the",
"given",
"scope",
"with",
"the",
"given",
"filter",
".",
"Used",
"when",
"you",
"want",
"to",
"start",
"a",
"search",
"programmatically",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindInFiles.js#L619-L628 | train | Search in scope | [
30522,
3853,
13004,
2906,
17231,
26127,
1006,
23032,
2378,
14876,
1010,
9531,
1010,
11307,
1010,
5672,
18209,
1010,
4018,
8873,
4244,
21572,
28732,
1007,
1063,
28837,
14644,
2818,
1006,
1007,
1025,
3945,
5302,
9247,
1012,
9531,
1027,
9531,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
immerjs/immer | src/proxy.js | peek | function peek(draft, prop) {
const state = draft[DRAFT_STATE]
const desc = Reflect.getOwnPropertyDescriptor(
state ? source(state) : draft,
prop
)
return desc && desc.value
} | javascript | function peek(draft, prop) {
const state = draft[DRAFT_STATE]
const desc = Reflect.getOwnPropertyDescriptor(
state ? source(state) : draft,
prop
)
return desc && desc.value
} | [
"function",
"peek",
"(",
"draft",
",",
"prop",
")",
"{",
"const",
"state",
"=",
"draft",
"[",
"DRAFT_STATE",
"]",
"const",
"desc",
"=",
"Reflect",
".",
"getOwnPropertyDescriptor",
"(",
"state",
"?",
"source",
"(",
"state",
")",
":",
"draft",
",",
"prop",... | Access a property without creating an Immer draft. | [
"Access",
"a",
"property",
"without",
"creating",
"an",
"Immer",
"draft",
"."
] | 4443cace6c23d14536955ce5b2aec92c8c76cacc | https://github.com/immerjs/immer/blob/4443cace6c23d14536955ce5b2aec92c8c76cacc/src/proxy.js#L103-L110 | train | Get the value of a property in a node draft | [
30522,
3853,
19043,
1006,
4433,
1010,
17678,
1007,
1063,
9530,
3367,
2110,
1027,
4433,
1031,
4433,
1035,
2110,
1033,
9530,
3367,
4078,
2278,
1027,
8339,
1012,
2131,
12384,
21572,
4842,
3723,
6155,
23235,
2953,
1006,
2110,
1029,
3120,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/Async.js | withTimeout | function withTimeout(promise, timeout, resolveTimeout) {
var wrapper = new $.Deferred();
var timer = window.setTimeout(function () {
if (resolveTimeout) {
wrapper.resolve();
} else {
wrapper.reject(ERROR_TIMEOUT);
}
}, timeout);
promise.always(function () {
window.clearTimeout(timer);
});
// If the wrapper was already rejected due to timeout, the Promise's calls to resolve/reject
// won't do anything
promise.then(wrapper.resolve, wrapper.reject);
return wrapper.promise();
} | javascript | function withTimeout(promise, timeout, resolveTimeout) {
var wrapper = new $.Deferred();
var timer = window.setTimeout(function () {
if (resolveTimeout) {
wrapper.resolve();
} else {
wrapper.reject(ERROR_TIMEOUT);
}
}, timeout);
promise.always(function () {
window.clearTimeout(timer);
});
// If the wrapper was already rejected due to timeout, the Promise's calls to resolve/reject
// won't do anything
promise.then(wrapper.resolve, wrapper.reject);
return wrapper.promise();
} | [
"function",
"withTimeout",
"(",
"promise",
",",
"timeout",
",",
"resolveTimeout",
")",
"{",
"var",
"wrapper",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
";",
"var",
"timer",
"=",
"window",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"if",
"(",
... | Adds timeout-driven termination to a Promise: returns a new Promise that is resolved/rejected when
the given original Promise is resolved/rejected, OR is resolved/rejected after the given delay -
whichever happens first.
If the original Promise is resolved/rejected first, done()/fail() handlers receive arguments
piped from the original Promise. If the timeout occurs first instead, then resolve() or
fail() (with Async.ERROR_TIMEOUT) is called based on value of resolveTimeout.
@param {$.Promise} promise
@param {number} timeout
@param {boolean=} resolveTimeout If true, then resolve deferred on timeout, otherwise reject. Default is false.
@return {$.Promise} | [
"Adds",
"timeout",
"-",
"driven",
"termination",
"to",
"a",
"Promise",
":",
"returns",
"a",
"new",
"Promise",
"that",
"is",
"resolved",
"/",
"rejected",
"when",
"the",
"given",
"original",
"Promise",
"is",
"resolved",
"/",
"rejected",
"OR",
"is",
"resolved",... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/Async.js#L328-L347 | train | Returns a promise that will be resolved after timeout | [
30522,
3853,
2007,
7292,
5833,
1006,
4872,
1010,
2051,
5833,
1010,
10663,
7292,
5833,
1007,
1063,
13075,
10236,
4842,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
13075,
25309,
1027,
3332,
1012,
2275,
7292,
5833,
1006,
3853... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/ui5loader.js | pathOnly | function pathOnly(href) {
var p = href.search(/[?#]/);
return p < 0 ? href : href.slice(0, p);
} | javascript | function pathOnly(href) {
var p = href.search(/[?#]/);
return p < 0 ? href : href.slice(0, p);
} | [
"function",
"pathOnly",
"(",
"href",
")",
"{",
"var",
"p",
"=",
"href",
".",
"search",
"(",
"/",
"[?#]",
"/",
")",
";",
"return",
"p",
"<",
"0",
"?",
"href",
":",
"href",
".",
"slice",
"(",
"0",
",",
"p",
")",
";",
"}"
] | /*
Helper function that removes any query and/or hash parts from the given URL.
@param {string} href URL to remove query and hash from
@returns {string} | [
"/",
"*",
"Helper",
"function",
"that",
"removes",
"any",
"query",
"and",
"/",
"or",
"hash",
"parts",
"from",
"the",
"given",
"URL",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L25-L28 | train | Returns the path of the given href. | [
30522,
3853,
4130,
2239,
2135,
1006,
17850,
12879,
1007,
1063,
13075,
1052,
1027,
17850,
12879,
1012,
3945,
1006,
1013,
1031,
1029,
1001,
1033,
1013,
1007,
1025,
2709,
1052,
1026,
1014,
1029,
17850,
12879,
1024,
17850,
12879,
1012,
14704,
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... |
mescroll/mescroll | mescroll.js/dist/mescroll.js | function () {
me.downHight = 0;
me.downwarp.style.height = 0;
me.isDownScrolling = false;
if (me.downProgressDom) me.downProgressDom.classList.remove('mescroll-rotate');
} | javascript | function () {
me.downHight = 0;
me.downwarp.style.height = 0;
me.isDownScrolling = false;
if (me.downProgressDom) me.downProgressDom.classList.remove('mescroll-rotate');
} | [
"function",
"(",
")",
"{",
"me",
".",
"downHight",
"=",
"0",
";",
"me",
".",
"downwarp",
".",
"style",
".",
"height",
"=",
"0",
";",
"me",
".",
"isDownScrolling",
"=",
"false",
";",
"if",
"(",
"me",
".",
"downProgressDom",
")",
"me",
".",
"downProg... | 结束下拉刷新的方法 | [
"结束下拉刷新的方法"
] | 43d3dcf3062da0fe95995ddcb5e93f5725792c98 | https://github.com/mescroll/mescroll/blob/43d3dcf3062da0fe95995ddcb5e93f5725792c98/mescroll.js/dist/mescroll.js#L445-L450 | train | reset down height and width | [
30522,
3853,
1006,
1007,
1063,
2033,
1012,
2091,
4048,
13900,
1027,
1014,
1025,
2033,
1012,
2091,
9028,
2361,
1012,
2806,
1012,
4578,
1027,
1014,
1025,
2033,
1012,
2003,
7698,
11020,
28402,
2075,
1027,
6270,
1025,
2065,
1006,
2033,
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... | |
eslint/eslint | lib/util/ast-utils.js | isInLoop | function isInLoop(node) {
for (let currentNode = node; currentNode && !isFunction(currentNode); currentNode = currentNode.parent) {
if (isLoop(currentNode)) {
return true;
}
}
return false;
} | javascript | function isInLoop(node) {
for (let currentNode = node; currentNode && !isFunction(currentNode); currentNode = currentNode.parent) {
if (isLoop(currentNode)) {
return true;
}
}
return false;
} | [
"function",
"isInLoop",
"(",
"node",
")",
"{",
"for",
"(",
"let",
"currentNode",
"=",
"node",
";",
"currentNode",
"&&",
"!",
"isFunction",
"(",
"currentNode",
")",
";",
"currentNode",
"=",
"currentNode",
".",
"parent",
")",
"{",
"if",
"(",
"isLoop",
"(",... | Checks whether the given node is in a loop or not.
@param {ASTNode} node - The node to check.
@returns {boolean} `true` if the node is in a loop. | [
"Checks",
"whether",
"the",
"given",
"node",
"is",
"in",
"a",
"loop",
"or",
"not",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/ast-utils.js#L134-L142 | train | Check if node is in loop | [
30522,
3853,
2003,
2378,
4135,
7361,
1006,
13045,
1007,
1063,
2005,
1006,
2292,
2783,
3630,
3207,
1027,
13045,
1025,
2783,
3630,
3207,
1004,
1004,
999,
2003,
11263,
27989,
1006,
2783,
3630,
3207,
1007,
1025,
2783,
3630,
3207,
1027,
2783,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/gesture/gesture.js | gestureMove | function gestureMove(ev) {
if (!pointer || !typesMatch(ev, pointer)) return;
updatePointerState(ev, pointer);
runHandlers('move', ev);
} | javascript | function gestureMove(ev) {
if (!pointer || !typesMatch(ev, pointer)) return;
updatePointerState(ev, pointer);
runHandlers('move', ev);
} | [
"function",
"gestureMove",
"(",
"ev",
")",
"{",
"if",
"(",
"!",
"pointer",
"||",
"!",
"typesMatch",
"(",
"ev",
",",
"pointer",
")",
")",
"return",
";",
"updatePointerState",
"(",
"ev",
",",
"pointer",
")",
";",
"runHandlers",
"(",
"'move'",
",",
"ev",
... | /*
If a move event happens of the right type, update the pointer and run all the move handlers.
"of the right type": if a mousemove happens but our pointer started with a touch event, do nothing. | [
"/",
"*",
"If",
"a",
"move",
"event",
"happens",
"of",
"the",
"right",
"type",
"update",
"the",
"pointer",
"and",
"run",
"all",
"the",
"move",
"handlers",
".",
"of",
"the",
"right",
"type",
":",
"if",
"a",
"mousemove",
"happens",
"but",
"our",
"pointer... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L672-L677 | train | Handle pointermove events | [
30522,
3853,
9218,
5302,
3726,
1006,
23408,
1007,
1063,
2065,
1006,
999,
20884,
1064,
1064,
999,
4127,
18900,
2818,
1006,
23408,
1010,
20884,
1007,
1007,
2709,
1025,
10651,
8400,
2545,
12259,
1006,
23408,
1010,
20884,
1007,
1025,
2448,
1177... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Inspector/Inspector.js | disconnect | function disconnect() {
var deferred = new $.Deferred(),
promise = deferred.promise();
if (_socket && (_socket.readyState === WebSocket.OPEN)) {
_socket.onclose = function () {
// trigger disconnect event
_onDisconnect();
deferred.resolve();
};
promise = Async.withTimeout(promise, 5000);
_socket.close();
} else {
if (_socket) {
delete _socket.onmessage;
delete _socket.onopen;
delete _socket.onclose;
delete _socket.onerror;
_socket = undefined;
}
deferred.resolve();
}
return promise;
} | javascript | function disconnect() {
var deferred = new $.Deferred(),
promise = deferred.promise();
if (_socket && (_socket.readyState === WebSocket.OPEN)) {
_socket.onclose = function () {
// trigger disconnect event
_onDisconnect();
deferred.resolve();
};
promise = Async.withTimeout(promise, 5000);
_socket.close();
} else {
if (_socket) {
delete _socket.onmessage;
delete _socket.onopen;
delete _socket.onclose;
delete _socket.onerror;
_socket = undefined;
}
deferred.resolve();
}
return promise;
} | [
"function",
"disconnect",
"(",
")",
"{",
"var",
"deferred",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
",",
"promise",
"=",
"deferred",
".",
"promise",
"(",
")",
";",
"if",
"(",
"_socket",
"&&",
"(",
"_socket",
".",
"readyState",
"===",
"WebSocket",
... | Disconnect from the remote debugger WebSocket
@return {jQuery.Promise} Promise that is resolved immediately if not
currently connected or asynchronously when the socket is closed. | [
"Disconnect",
"from",
"the",
"remote",
"debugger",
"WebSocket"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Inspector/Inspector.js#L272-L301 | train | disconnect the connection | [
30522,
3853,
12532,
10087,
6593,
1006,
1007,
1063,
13075,
13366,
28849,
2094,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1010,
4872,
1027,
13366,
28849,
2094,
1012,
4872,
1006,
1007,
1025,
2065,
1006,
1035,
22278,
1004,
1004,
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... |
moment/luxon | src/datetime.js | normalizeUnit | function normalizeUnit(unit) {
const normalized = {
year: "year",
years: "year",
month: "month",
months: "month",
day: "day",
days: "day",
hour: "hour",
hours: "hour",
minute: "minute",
minutes: "minute",
second: "second",
seconds: "second",
millisecond: "millisecond",
milliseconds: "millisecond",
weekday: "weekday",
weekdays: "weekday",
weeknumber: "weekNumber",
weeksnumber: "weekNumber",
weeknumbers: "weekNumber",
weekyear: "weekYear",
weekyears: "weekYear",
ordinal: "ordinal"
}[unit.toLowerCase()];
if (!normalized) throw new InvalidUnitError(unit);
return normalized;
} | javascript | function normalizeUnit(unit) {
const normalized = {
year: "year",
years: "year",
month: "month",
months: "month",
day: "day",
days: "day",
hour: "hour",
hours: "hour",
minute: "minute",
minutes: "minute",
second: "second",
seconds: "second",
millisecond: "millisecond",
milliseconds: "millisecond",
weekday: "weekday",
weekdays: "weekday",
weeknumber: "weekNumber",
weeksnumber: "weekNumber",
weeknumbers: "weekNumber",
weekyear: "weekYear",
weekyears: "weekYear",
ordinal: "ordinal"
}[unit.toLowerCase()];
if (!normalized) throw new InvalidUnitError(unit);
return normalized;
} | [
"function",
"normalizeUnit",
"(",
"unit",
")",
"{",
"const",
"normalized",
"=",
"{",
"year",
":",
"\"year\"",
",",
"years",
":",
"\"year\"",
",",
"month",
":",
"\"month\"",
",",
"months",
":",
"\"month\"",
",",
"day",
":",
"\"day\"",
",",
"days",
":",
... | standardize case and plurality in units | [
"standardize",
"case",
"and",
"plurality",
"in",
"units"
] | 236f2badea297ee73421aa39a83e06177c1be6d0 | https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/datetime.js#L256-L285 | train | Normalizes a unit. | [
30522,
3853,
3671,
4697,
19496,
2102,
1006,
3131,
1007,
1063,
9530,
3367,
3671,
3550,
1027,
1063,
2095,
1024,
1000,
2095,
1000,
1010,
2086,
1024,
1000,
2095,
1000,
1010,
3204,
1024,
1000,
3204,
1000,
1010,
2706,
1024,
1000,
3204,
1000,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dvajs/dva | packages/dva-core/src/getSaga.js | putResolve | function putResolve(action) {
const { type } = action;
assertAction(type, 'sagaEffects.put.resolve');
return sagaEffects.put.resolve({
...action,
type: prefixType(type, model),
});
} | javascript | function putResolve(action) {
const { type } = action;
assertAction(type, 'sagaEffects.put.resolve');
return sagaEffects.put.resolve({
...action,
type: prefixType(type, model),
});
} | [
"function",
"putResolve",
"(",
"action",
")",
"{",
"const",
"{",
"type",
"}",
"=",
"action",
";",
"assertAction",
"(",
"type",
",",
"'sagaEffects.put.resolve'",
")",
";",
"return",
"sagaEffects",
".",
"put",
".",
"resolve",
"(",
"{",
"...",
"action",
",",
... | The operator `put` doesn't block waiting the returned promise to resolve. Using `put.resolve` will wait until the promsie resolve/reject before resuming. It will be helpful to organize multi-effects in order, and increase the reusability by seperate the effect in stand-alone pieces. https://github.com/redux-saga/redux-saga/issues/336 | [
"The",
"operator",
"put",
"doesn",
"t",
"block",
"waiting",
"the",
"returned",
"promise",
"to",
"resolve",
".",
"Using",
"put",
".",
"resolve",
"will",
"wait",
"until",
"the",
"promsie",
"resolve",
"/",
"reject",
"before",
"resuming",
".",
"It",
"will",
"b... | 99ec56cbedbdba7e3e91befe341f109e038363c6 | https://github.com/dvajs/dva/blob/99ec56cbedbdba7e3e91befe341f109e038363c6/packages/dva-core/src/getSaga.js#L108-L115 | train | Resolve the specified action | [
30522,
3853,
2404,
6072,
4747,
3726,
1006,
2895,
1007,
1063,
9530,
3367,
1063,
2828,
1065,
1027,
2895,
1025,
20865,
18908,
3258,
1006,
2828,
1010,
1005,
12312,
12879,
30524,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/type/UnitMixin.js | UnitMixin | function UnitMixin(oFormatOptions, oConstraints) {
if (oFormatOptions && oFormatOptions[sFormatOptionName]) {
throw new Error("Format option " + sFormatOptionName + " is not supported");
}
if (oConstraints) {
throw new Error("Constraints not supported");
}
if (arguments.length > 2) {
throw new Error("Only the parameter oFormatOptions is supported");
}
// Note: The format option 'parseAsString' is always set to true, so that the base type
// always parses to a string and we can check the result.
this.bParseAsString = !oFormatOptions || !("parseAsString" in oFormatOptions)
|| oFormatOptions.parseAsString;
oFormatOptions = Object.assign({unitOptional : true, emptyString: 0}, oFormatOptions,
{parseAsString : true});
fnBaseType.call(this, oFormatOptions, oConstraints);
// initialize mixin members after super c'tor as it overrides several members!
// map custom units as expected by {@link sap.ui.core.format.NumberFormat}
this.mCustomUnits = undefined;
// whether the parse method call includes the current binding values as a 3rd parameter
this.bParseWithValues = true;
// must not overwrite setConstraints and setFormatOptions on prototype as they are
// called in SimpleType constructor
this.setConstraints = function () {
throw new Error("Constraints not supported");
};
this.setFormatOptions = function () {
throw new Error("Format options are immutable");
};
} | javascript | function UnitMixin(oFormatOptions, oConstraints) {
if (oFormatOptions && oFormatOptions[sFormatOptionName]) {
throw new Error("Format option " + sFormatOptionName + " is not supported");
}
if (oConstraints) {
throw new Error("Constraints not supported");
}
if (arguments.length > 2) {
throw new Error("Only the parameter oFormatOptions is supported");
}
// Note: The format option 'parseAsString' is always set to true, so that the base type
// always parses to a string and we can check the result.
this.bParseAsString = !oFormatOptions || !("parseAsString" in oFormatOptions)
|| oFormatOptions.parseAsString;
oFormatOptions = Object.assign({unitOptional : true, emptyString: 0}, oFormatOptions,
{parseAsString : true});
fnBaseType.call(this, oFormatOptions, oConstraints);
// initialize mixin members after super c'tor as it overrides several members!
// map custom units as expected by {@link sap.ui.core.format.NumberFormat}
this.mCustomUnits = undefined;
// whether the parse method call includes the current binding values as a 3rd parameter
this.bParseWithValues = true;
// must not overwrite setConstraints and setFormatOptions on prototype as they are
// called in SimpleType constructor
this.setConstraints = function () {
throw new Error("Constraints not supported");
};
this.setFormatOptions = function () {
throw new Error("Format options are immutable");
};
} | [
"function",
"UnitMixin",
"(",
"oFormatOptions",
",",
"oConstraints",
")",
"{",
"if",
"(",
"oFormatOptions",
"&&",
"oFormatOptions",
"[",
"sFormatOptionName",
"]",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Format option \"",
"+",
"sFormatOptionName",
"+",
"\" is n... | /*
A mixin for sap.ui.model.odata.type.Currency and sap.ui.model.odata.type.Unit.
Note: the format option <code>unitOptional</code> defaults to true.
@param {object} [oFormatOptions]
See parameter <code>oFormatOptions</code> of <code>fnBaseType</code>. Format options
are immutable, that is, they can only be set once on construction. Format options
that are not supported or have a different default are listed below.
@param {object} [oFormatOptions.<sFormatOptionName>]
Not supported; the type derives this from its customizing part.
@param {boolean} [oFormatOptions.parseAsString=true]
Whether the amount or measure is parsed to a string; set to <code>false</code> if the
underlying type is represented as a <code>number</code>, for example
{@link sap.ui.model.odata.type.Int32}
@param {boolean} [oFormatOptions.unitOptional=true]
Whether the amount or measure is parsed if no currency or unit is entered.
@param {any} [oFormatOptions.emptyString=0]
Defines how an empty string is parsed into the amount/measure. With the default value
<code>0</code> the amount/measure becomes <code>0</code> when an empty string is
parsed.
@param {object} [oConstraints] Not supported
@throws {Error} If called with more parameters than <code>oFormatOptions</code> or if the
format option <code>sFormatOptionName</code> is set
@alias sap.ui.model.odata.type.UnitMixin
@mixin | [
"/",
"*",
"A",
"mixin",
"for",
"sap",
".",
"ui",
".",
"model",
".",
"odata",
".",
"type",
".",
"Currency",
"and",
"sap",
".",
"ui",
".",
"model",
".",
"odata",
".",
"type",
".",
"Unit",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/UnitMixin.js#L240-L273 | train | A base class that can be used to create a new instance of a unit. | [
30522,
3853,
3131,
4328,
20303,
1006,
1997,
2953,
18900,
7361,
9285,
1010,
1051,
8663,
20528,
18447,
2015,
1007,
1063,
2065,
1006,
1997,
2953,
18900,
7361,
9285,
1004,
1004,
1997,
2953,
18900,
7361,
9285,
1031,
16420,
2953,
18900,
7361,
350... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
babel/babel | packages/babel-highlight/src/index.js | getTokenType | function getTokenType(match) {
const [offset, text] = match.slice(-2);
const token = matchToToken(match);
if (token.type === "name") {
if (esutils.keyword.isReservedWordES6(token.value)) {
return "keyword";
}
if (
JSX_TAG.test(token.value) &&
(text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")
) {
return "jsx_tag";
}
if (token.value[0] !== token.value[0].toLowerCase()) {
return "capitalized";
}
}
if (token.type === "punctuator" && BRACKET.test(token.value)) {
return "bracket";
}
if (
token.type === "invalid" &&
(token.value === "@" || token.value === "#")
) {
return "punctuator";
}
return token.type;
} | javascript | function getTokenType(match) {
const [offset, text] = match.slice(-2);
const token = matchToToken(match);
if (token.type === "name") {
if (esutils.keyword.isReservedWordES6(token.value)) {
return "keyword";
}
if (
JSX_TAG.test(token.value) &&
(text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")
) {
return "jsx_tag";
}
if (token.value[0] !== token.value[0].toLowerCase()) {
return "capitalized";
}
}
if (token.type === "punctuator" && BRACKET.test(token.value)) {
return "bracket";
}
if (
token.type === "invalid" &&
(token.value === "@" || token.value === "#")
) {
return "punctuator";
}
return token.type;
} | [
"function",
"getTokenType",
"(",
"match",
")",
"{",
"const",
"[",
"offset",
",",
"text",
"]",
"=",
"match",
".",
"slice",
"(",
"-",
"2",
")",
";",
"const",
"token",
"=",
"matchToToken",
"(",
"match",
")",
";",
"if",
"(",
"token",
".",
"type",
"==="... | Get the type of token, specifying punctuator type. | [
"Get",
"the",
"type",
"of",
"token",
"specifying",
"punctuator",
"type",
"."
] | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-highlight/src/index.js#L41-L74 | train | Get the token type from a match | [
30522,
3853,
2131,
18715,
4765,
18863,
1006,
2674,
1007,
1063,
9530,
3367,
1031,
16396,
1010,
3793,
1033,
1027,
2674,
1012,
14704,
1006,
1011,
1016,
1007,
1025,
9530,
3367,
19204,
1027,
2674,
3406,
18715,
2368,
1006,
2674,
1007,
1025,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/ui5/template/publish.js | groupByContributors | function groupByContributors(symbol, aBorrowedMembers) {
var MAX_ORDER = 1000, // a sufficiently large number
mContributors = {},
aSortedContributors = [],
i,order;
aBorrowedMembers.forEach(function($) {
$ = lookup($.inherits);
if ($ && mContributors[$.memberof] == null) {
mContributors[$.memberof] = { order : MAX_ORDER, items : [$] };
} else {
mContributors[$.memberof].items.push($);
}
});
// order contributors according to their distance in the inheritance hierarchy
order = 0;
(function handleAugments(oSymbol) {
var i,oTarget,aParentsToVisit;
if ( oSymbol.augments ) {
aParentsToVisit = [];
// first assign an order
for (i = 0; i < oSymbol.augments.length; i++) {
if ( mContributors[oSymbol.augments[i]] != null && mContributors[oSymbol.augments[i]].order === MAX_ORDER ) {
mContributors[oSymbol.augments[i]].order = ++order;
aParentsToVisit.push(oSymbol.augments[i]);
}
}
// only then dive into parents (breadth first search)
for (i = 0; i < aParentsToVisit.length; i++) {
oTarget = lookup(aParentsToVisit);
if ( oTarget ) {
handleAugments(oTarget);
}
}
}
}(symbol));
// convert to an array and sort by order
for (i in mContributors) {
aSortedContributors.push(mContributors[i]);
}
aSortedContributors.sort(function (a,b) { return a.order - b.order; });
return aSortedContributors;
} | javascript | function groupByContributors(symbol, aBorrowedMembers) {
var MAX_ORDER = 1000, // a sufficiently large number
mContributors = {},
aSortedContributors = [],
i,order;
aBorrowedMembers.forEach(function($) {
$ = lookup($.inherits);
if ($ && mContributors[$.memberof] == null) {
mContributors[$.memberof] = { order : MAX_ORDER, items : [$] };
} else {
mContributors[$.memberof].items.push($);
}
});
// order contributors according to their distance in the inheritance hierarchy
order = 0;
(function handleAugments(oSymbol) {
var i,oTarget,aParentsToVisit;
if ( oSymbol.augments ) {
aParentsToVisit = [];
// first assign an order
for (i = 0; i < oSymbol.augments.length; i++) {
if ( mContributors[oSymbol.augments[i]] != null && mContributors[oSymbol.augments[i]].order === MAX_ORDER ) {
mContributors[oSymbol.augments[i]].order = ++order;
aParentsToVisit.push(oSymbol.augments[i]);
}
}
// only then dive into parents (breadth first search)
for (i = 0; i < aParentsToVisit.length; i++) {
oTarget = lookup(aParentsToVisit);
if ( oTarget ) {
handleAugments(oTarget);
}
}
}
}(symbol));
// convert to an array and sort by order
for (i in mContributors) {
aSortedContributors.push(mContributors[i]);
}
aSortedContributors.sort(function (a,b) { return a.order - b.order; });
return aSortedContributors;
} | [
"function",
"groupByContributors",
"(",
"symbol",
",",
"aBorrowedMembers",
")",
"{",
"var",
"MAX_ORDER",
"=",
"1000",
",",
"// a sufficiently large number",
"mContributors",
"=",
"{",
"}",
",",
"aSortedContributors",
"=",
"[",
"]",
",",
"i",
",",
"order",
";",
... | Determines the set of contributors of the given borrowed members.
The contributors are sorted according to the inheritance hierarchy:
first the base class of symbol, then the base class of the base class etc.
Any contributors that can not be found in the hierarchy are appended
to the set.
@param {Symbol} symbol of which these are the members
@param {array} aBorrowedMembers set of borrowed members to determine the contributors for
@return {array} sorted array of contributors | [
"Determines",
"the",
"set",
"of",
"contributors",
"of",
"the",
"given",
"borrowed",
"members",
".",
"The",
"contributors",
"are",
"sorted",
"according",
"to",
"the",
"inheritance",
"hierarchy",
":",
"first",
"the",
"base",
"class",
"of",
"symbol",
"then",
"the... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L1631-L1678 | train | group by contributors | [
30522,
3853,
2177,
3762,
8663,
18886,
8569,
6591,
1006,
6454,
1010,
11113,
29459,
15557,
4168,
21784,
2015,
1007,
1063,
13075,
4098,
1035,
2344,
1027,
6694,
1010,
1013,
1013,
1037,
12949,
2312,
2193,
11338,
12162,
3089,
8569,
6591,
1027,
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.fl/src/sap/ui/fl/Utils.js | function (oControl) {
var sSiteId = null, oAppComponent = null;
// determine UI5 component out of given control
if (oControl) {
oAppComponent = this.getAppComponentForControl(oControl);
// determine siteId from ComponentData
if (oAppComponent) {
//Workaround for back-end check: isApplicationPermitted
//As long as FLP does not know about appDescriptorId we have to pass siteID and applicationID.
//With startUpParameter hcpApplicationId we will get a concatenation of “siteId:applicationId”
//sSiteId = this._getComponentStartUpParameter(oComponent, "scopeId");
sSiteId = this._getComponentStartUpParameter(oAppComponent, "hcpApplicationId");
}
}
return sSiteId;
} | javascript | function (oControl) {
var sSiteId = null, oAppComponent = null;
// determine UI5 component out of given control
if (oControl) {
oAppComponent = this.getAppComponentForControl(oControl);
// determine siteId from ComponentData
if (oAppComponent) {
//Workaround for back-end check: isApplicationPermitted
//As long as FLP does not know about appDescriptorId we have to pass siteID and applicationID.
//With startUpParameter hcpApplicationId we will get a concatenation of “siteId:applicationId”
//sSiteId = this._getComponentStartUpParameter(oComponent, "scopeId");
sSiteId = this._getComponentStartUpParameter(oAppComponent, "hcpApplicationId");
}
}
return sSiteId;
} | [
"function",
"(",
"oControl",
")",
"{",
"var",
"sSiteId",
"=",
"null",
",",
"oAppComponent",
"=",
"null",
";",
"// determine UI5 component out of given control",
"if",
"(",
"oControl",
")",
"{",
"oAppComponent",
"=",
"this",
".",
"getAppComponentForControl",
"(",
"... | Returns the siteId of a component
@param {sap.ui.core.Control} oControl - SAPUI5 control
@returns {string} siteId - that represent the found siteId
@public
@function
@name sap.ui.fl.Utils.getSiteId | [
"Returns",
"the",
"siteId",
"of",
"a",
"component"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L254-L275 | train | Returns site ID of the given control | [
30522,
3853,
1006,
1051,
8663,
13181,
2140,
1007,
1063,
13075,
7020,
4221,
3593,
1027,
19701,
1010,
1051,
29098,
9006,
29513,
3372,
1027,
19701,
1025,
1013,
1013,
5646,
21318,
2629,
6922,
2041,
1997,
2445,
2491,
2065,
1006,
1051,
8663,
1318... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/posts.js | modelQuery | function modelQuery(options) {
return models.Post.findOne(options.data, omit(options, ['data']))
.then((model) => {
if (!model) {
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.posts.postNotFound')
}));
}
return {
posts: [urlsForPost(model.id, model.toJSON(options), options)]
};
});
} | javascript | function modelQuery(options) {
return models.Post.findOne(options.data, omit(options, ['data']))
.then((model) => {
if (!model) {
return Promise.reject(new common.errors.NotFoundError({
message: common.i18n.t('errors.api.posts.postNotFound')
}));
}
return {
posts: [urlsForPost(model.id, model.toJSON(options), options)]
};
});
} | [
"function",
"modelQuery",
"(",
"options",
")",
"{",
"return",
"models",
".",
"Post",
".",
"findOne",
"(",
"options",
".",
"data",
",",
"omit",
"(",
"options",
",",
"[",
"'data'",
"]",
")",
")",
".",
"then",
"(",
"(",
"model",
")",
"=>",
"{",
"if",
... | ### 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/posts.js#L103-L116 | train | Query for a post | [
30522,
3853,
2944,
4226,
2854,
1006,
7047,
1007,
1063,
2709,
4275,
1012,
2695,
1012,
2424,
5643,
1006,
7047,
1012,
2951,
1010,
18168,
4183,
1006,
7047,
1010,
1031,
1005,
2951,
1005,
1033,
1007,
1007,
1012,
2059,
1006,
1006,
2944,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
radare/radare2 | shlr/www/graph/index.js | resizeCanvas | function resizeCanvas() {
var divElement = document.getElementById("mainCanvas");
var screenHeight = window.innerHeight || document.body.offsetHeight;
divElement.style.height = (screenHeight - 16) + "px";
} | javascript | function resizeCanvas() {
var divElement = document.getElementById("mainCanvas");
var screenHeight = window.innerHeight || document.body.offsetHeight;
divElement.style.height = (screenHeight - 16) + "px";
} | [
"function",
"resizeCanvas",
"(",
")",
"{",
"var",
"divElement",
"=",
"document",
".",
"getElementById",
"(",
"\"mainCanvas\"",
")",
";",
"var",
"screenHeight",
"=",
"window",
".",
"innerHeight",
"||",
"document",
".",
"body",
".",
"offsetHeight",
";",
"divElem... | Resizes the main canvas to the maximum visible height. | [
"Resizes",
"the",
"main",
"canvas",
"to",
"the",
"maximum",
"visible",
"height",
"."
] | bf5e3028810a0ec7c267c6fe4bfad639b4819e35 | https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/index.js#L36-L40 | train | Resizes the canvas | [
30522,
3853,
24501,
4697,
9336,
12044,
1006,
1007,
1063,
13075,
11529,
16930,
4765,
1027,
6254,
1012,
2131,
12260,
3672,
3762,
3593,
1006,
1000,
2364,
9336,
12044,
1000,
1007,
1025,
13075,
3898,
26036,
13900,
1027,
3332,
1012,
5110,
26036,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ControlPersonalizationAPI.js | function(mPropertyBag) {
var aSuccessfulChanges = [];
var sLayer = Utils.getCurrentLayer(true);
var aPromises = [];
mPropertyBag.controlChanges.forEach(function(oChange) {
try {
var mChangeSpecificData = {};
Object.assign(mChangeSpecificData, {
developerMode: false,
layer: sLayer
});
var sCheckResult = this._checkChangeSpecificData(oChange, sLayer);
if (sCheckResult) {
throw new Error(sCheckResult);
}
var mParams = this._determineParameters(oChange.selectorControl);
if (!mPropertyBag.ignoreVariantManagement) {
// check for preset variantReference
if (!oChange.changeSpecificData.variantReference) {
var sVariantManagementReference = this._getVariantManagement(oChange.selectorControl, mParams);
if (sVariantManagementReference) {
var sCurrentVariantReference = mParams.variantModel.oData[sVariantManagementReference].currentVariant;
oChange.changeSpecificData.variantReference = sCurrentVariantReference;
}
}
} else {
// delete preset variantReference
delete oChange.changeSpecificData.variantReference;
}
aPromises.push(
function () {
return mParams.flexController.createAndApplyChange(Object.assign(mChangeSpecificData, oChange.changeSpecificData), oChange.selectorControl)
.then(function (oAppliedChange) {
// FlexController.createAndApplyChanges will only resolve for successfully applied changes
aSuccessfulChanges.push(oAppliedChange);
});
}
);
} catch (oError) {
aPromises.push(function () {
return Promise.reject({
change: oChange,
message: oError.message
});
});
return;
}
}.bind(this));
// For any Promise.reject, an error is logged in console inside Utils.execPromiseQueueSequentially
return Utils.execPromiseQueueSequentially(aPromises)
.then(function() {
return aSuccessfulChanges;
});
} | javascript | function(mPropertyBag) {
var aSuccessfulChanges = [];
var sLayer = Utils.getCurrentLayer(true);
var aPromises = [];
mPropertyBag.controlChanges.forEach(function(oChange) {
try {
var mChangeSpecificData = {};
Object.assign(mChangeSpecificData, {
developerMode: false,
layer: sLayer
});
var sCheckResult = this._checkChangeSpecificData(oChange, sLayer);
if (sCheckResult) {
throw new Error(sCheckResult);
}
var mParams = this._determineParameters(oChange.selectorControl);
if (!mPropertyBag.ignoreVariantManagement) {
// check for preset variantReference
if (!oChange.changeSpecificData.variantReference) {
var sVariantManagementReference = this._getVariantManagement(oChange.selectorControl, mParams);
if (sVariantManagementReference) {
var sCurrentVariantReference = mParams.variantModel.oData[sVariantManagementReference].currentVariant;
oChange.changeSpecificData.variantReference = sCurrentVariantReference;
}
}
} else {
// delete preset variantReference
delete oChange.changeSpecificData.variantReference;
}
aPromises.push(
function () {
return mParams.flexController.createAndApplyChange(Object.assign(mChangeSpecificData, oChange.changeSpecificData), oChange.selectorControl)
.then(function (oAppliedChange) {
// FlexController.createAndApplyChanges will only resolve for successfully applied changes
aSuccessfulChanges.push(oAppliedChange);
});
}
);
} catch (oError) {
aPromises.push(function () {
return Promise.reject({
change: oChange,
message: oError.message
});
});
return;
}
}.bind(this));
// For any Promise.reject, an error is logged in console inside Utils.execPromiseQueueSequentially
return Utils.execPromiseQueueSequentially(aPromises)
.then(function() {
return aSuccessfulChanges;
});
} | [
"function",
"(",
"mPropertyBag",
")",
"{",
"var",
"aSuccessfulChanges",
"=",
"[",
"]",
";",
"var",
"sLayer",
"=",
"Utils",
".",
"getCurrentLayer",
"(",
"true",
")",
";",
"var",
"aPromises",
"=",
"[",
"]",
";",
"mPropertyBag",
".",
"controlChanges",
".",
... | Creates personalization changes, adds them to the flex persistence (not yet saved) and applies them to the control.
@param {object} mPropertyBag - Changes along with other settings that need to be added
@param {array} mPropertyBag.controlChanges - Array of control changes of type {@link sap.ui.fl.ControlPersonalizationAPI.PersonalizationChange}
@param {boolean} [mPropertyBag.ignoreVariantManagement=false] - If flag is set to true then variant management will be ignored
@returns {Promise} Returns Promise resolving to an array of successfully applied changes,
after the changes have been written to the map of dirty changes and applied to the control
@method sap.ui.fl.ControlPersonalizationAPI.addPersonalizationChanges
@public | [
"Creates",
"personalization",
"changes",
"adds",
"them",
"to",
"the",
"flex",
"persistence",
"(",
"not",
"yet",
"saved",
")",
"and",
"applies",
"them",
"to",
"the",
"control",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js#L244-L301 | train | Creates and applies changes to the current layer | [
30522,
3853,
1006,
6131,
18981,
15010,
16078,
1007,
1063,
13075,
2004,
14194,
9623,
22747,
5313,
22305,
2229,
1027,
1031,
1033,
1025,
13075,
20005,
1027,
21183,
12146,
1012,
2131,
10841,
14343,
3372,
24314,
1006,
2995,
1007,
1025,
13075,
1980... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/jszip.js | function(name, data, o) {
if (arguments.length === 1) {
if (utils.isRegExp(name)) {
var regexp = name;
return this.filter(function(relativePath, file) {
return !file.options.dir && regexp.test(relativePath);
});
}
else { // text
return this.filter(function(relativePath, file) {
return !file.options.dir && relativePath === name;
})[0] || null;
}
}
else { // more than one argument : we have data !
name = this.root + name;
fileAdd.call(this, name, data, o);
}
return this;
} | javascript | function(name, data, o) {
if (arguments.length === 1) {
if (utils.isRegExp(name)) {
var regexp = name;
return this.filter(function(relativePath, file) {
return !file.options.dir && regexp.test(relativePath);
});
}
else { // text
return this.filter(function(relativePath, file) {
return !file.options.dir && relativePath === name;
})[0] || null;
}
}
else { // more than one argument : we have data !
name = this.root + name;
fileAdd.call(this, name, data, o);
}
return this;
} | [
"function",
"(",
"name",
",",
"data",
",",
"o",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"1",
")",
"{",
"if",
"(",
"utils",
".",
"isRegExp",
"(",
"name",
")",
")",
"{",
"var",
"regexp",
"=",
"name",
";",
"return",
"this",
".",
"f... | Add a file to the zip file, or search a file.
@param {string|RegExp} name The name of the file to add (if data is defined),
the name of the file to find (if no data) or a regex to match files.
@param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded
@param {Object} o File options
@return {JSZip|Object|Array} this JSZip object (when adding a file),
a file (when searching by string) or an array of files (when searching by regex). | [
"Add",
"a",
"file",
"to",
"the",
"zip",
"file",
"or",
"search",
"a",
"file",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L932-L951 | train | Add a file to the log | [
30522,
3853,
1006,
2171,
1010,
2951,
1010,
1051,
1007,
1063,
2065,
1006,
9918,
1012,
3091,
1027,
1027,
1027,
1015,
1007,
1063,
2065,
1006,
21183,
12146,
1012,
2003,
2890,
3351,
2595,
2361,
1006,
2171,
1007,
1007,
1063,
13075,
19723,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/file/FileUtils.js | convertToNativePath | function convertToNativePath(path) {
path = unescape(path);
if (path.indexOf(":") !== -1 && path[0] === "/") {
return path.substr(1);
}
return path;
} | javascript | function convertToNativePath(path) {
path = unescape(path);
if (path.indexOf(":") !== -1 && path[0] === "/") {
return path.substr(1);
}
return path;
} | [
"function",
"convertToNativePath",
"(",
"path",
")",
"{",
"path",
"=",
"unescape",
"(",
"path",
")",
";",
"if",
"(",
"path",
".",
"indexOf",
"(",
"\":\"",
")",
"!==",
"-",
"1",
"&&",
"path",
"[",
"0",
"]",
"===",
"\"/\"",
")",
"{",
"return",
"path"... | Convert a URI path to a native path.
On both platforms, this unescapes the URI
On windows, URI paths start with a "/", but have a drive letter ("C:"). In this
case, remove the initial "/".
@param {!string} path
@return {string} | [
"Convert",
"a",
"URI",
"path",
"to",
"a",
"native",
"path",
".",
"On",
"both",
"platforms",
"this",
"unescapes",
"the",
"URI",
"On",
"windows",
"URI",
"paths",
"start",
"with",
"a",
"/",
"but",
"have",
"a",
"drive",
"letter",
"(",
"C",
":",
")",
".",... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/file/FileUtils.js#L240-L247 | train | Converts a path to a native path | [
30522,
3853,
10463,
2669,
8082,
15069,
1006,
4130,
1007,
1063,
4130,
1027,
16655,
15782,
5051,
1006,
4130,
1007,
1025,
2065,
1006,
4130,
1012,
5950,
11253,
1006,
1000,
1024,
1000,
1007,
999,
1027,
1027,
1011,
1015,
1004,
1004,
4130,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/WorkingSetView.js | WorkingSetView | function WorkingSetView($container, paneId) {
var id = "working-set-list-" + paneId;
this.$header = null;
this.$openFilesList = null;
this.$container = $container;
this.$el = $container.append(Mustache.render(paneListTemplate, _.extend({id: id}, Strings))).find("#" + id);
this.suppressSortRedraw = false;
this.paneId = paneId;
this.init();
} | javascript | function WorkingSetView($container, paneId) {
var id = "working-set-list-" + paneId;
this.$header = null;
this.$openFilesList = null;
this.$container = $container;
this.$el = $container.append(Mustache.render(paneListTemplate, _.extend({id: id}, Strings))).find("#" + id);
this.suppressSortRedraw = false;
this.paneId = paneId;
this.init();
} | [
"function",
"WorkingSetView",
"(",
"$container",
",",
"paneId",
")",
"{",
"var",
"id",
"=",
"\"working-set-list-\"",
"+",
"paneId",
";",
"this",
".",
"$header",
"=",
"null",
";",
"this",
".",
"$openFilesList",
"=",
"null",
";",
"this",
".",
"$container",
"... | /*
WorkingSetView constructor
@constructor
@param {!jQuery} $container - owning container
@param {!string} paneId - paneId of this view pertains to | [
"/",
"*",
"WorkingSetView",
"constructor"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetView.js#L861-L872 | train | Creates a working set view | [
30522,
3853,
24884,
3388,
8584,
1006,
1002,
11661,
1010,
6090,
7416,
2094,
1007,
1063,
13075,
8909,
1027,
1000,
2551,
1011,
2275,
1011,
2862,
1011,
1000,
1009,
6090,
7416,
2094,
1025,
2023,
1012,
1002,
20346,
1027,
19701,
1025,
2023,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js | function (oEvent) {
var sSource = oEvent.getSource();
sap.ui.require(["sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils"], function (ErrorUtils) {
ErrorUtils.handleMessagePopoverPress(sSource);
});
} | javascript | function (oEvent) {
var sSource = oEvent.getSource();
sap.ui.require(["sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils"], function (ErrorUtils) {
ErrorUtils.handleMessagePopoverPress(sSource);
});
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"sSource",
"=",
"oEvent",
".",
"getSource",
"(",
")",
";",
"sap",
".",
"ui",
".",
"require",
"(",
"[",
"\"sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils\"",
"]",
",",
"function",
"(",
"ErrorUtils",
")",
"{",
... | Handler for displaying errors;
Calls the "ErrorUtils" helper class for error handling.
@param oEvent - press event on the error button
@public | [
"Handler",
"for",
"displaying",
"errors",
";",
"Calls",
"the",
"ErrorUtils",
"helper",
"class",
"for",
"error",
"handling",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L191-L196 | train | Handles the message popover press event. | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
7020,
8162,
3401,
1027,
1051,
18697,
3372,
1012,
4152,
8162,
3401,
1006,
1007,
1025,
20066,
1012,
21318,
1012,
5478,
1006,
1031,
1000,
20066,
1013,
21318,
1013,
13109,
1013,
2490,
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... | |
eslint/eslint | lib/rules/no-unused-vars.js | isUsedVariable | function isUsedVariable(variable) {
const functionNodes = getFunctionDefinitions(variable),
isFunctionDefinition = functionNodes.length > 0;
let rhsNode = null;
return variable.references.some(ref => {
if (isForInRef(ref)) {
return true;
}
const forItself = isReadForItself(ref, rhsNode);
rhsNode = getRhsNode(ref, rhsNode);
return (
isReadRef(ref) &&
!forItself &&
!(isFunctionDefinition && isSelfReference(ref, functionNodes))
);
});
} | javascript | function isUsedVariable(variable) {
const functionNodes = getFunctionDefinitions(variable),
isFunctionDefinition = functionNodes.length > 0;
let rhsNode = null;
return variable.references.some(ref => {
if (isForInRef(ref)) {
return true;
}
const forItself = isReadForItself(ref, rhsNode);
rhsNode = getRhsNode(ref, rhsNode);
return (
isReadRef(ref) &&
!forItself &&
!(isFunctionDefinition && isSelfReference(ref, functionNodes))
);
});
} | [
"function",
"isUsedVariable",
"(",
"variable",
")",
"{",
"const",
"functionNodes",
"=",
"getFunctionDefinitions",
"(",
"variable",
")",
",",
"isFunctionDefinition",
"=",
"functionNodes",
".",
"length",
">",
"0",
";",
"let",
"rhsNode",
"=",
"null",
";",
"return",... | Determines if the variable is used.
@param {Variable} variable - The variable to check.
@returns {boolean} True if the variable is used
@private | [
"Determines",
"if",
"the",
"variable",
"is",
"used",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-unused-vars.js#L460-L480 | train | returns true if variable is used | [
30522,
3853,
2003,
13901,
10755,
19210,
1006,
8023,
1007,
1063,
9530,
3367,
3853,
3630,
6155,
1027,
2131,
11263,
27989,
3207,
16294,
22753,
2015,
1006,
30524,
25416,
1027,
1028,
1063,
2065,
1006,
2003,
29278,
2378,
2890,
2546,
1006,
25416,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | getAllScopes | function getAllScopes(ast, scope, fullText) {
var curScope = scope;
var cnt = 0;
var scopes = [];
while (curScope) {
curScope.id = cnt++;
scopes.push(curScope);
if (curScope.fnType) {
// Check for class scopes surrounding the function
if (curScope.fnType === "FunctionExpression") {
var methodDefinitionNode = findSurroundASTNode(ast, curScope.originNode, ["MethodDefinition"]);
// class scope found
if (methodDefinitionNode && isEqual(methodDefinitionNode.value, curScope.originNode)) {
// Change curScope name and originNode to that of methodDefinitionNode
curScope.name = methodDefinitionNode.key.name;
curScope.originNode = methodDefinitionNode;
var classNode = findSurroundASTNode(ast, methodDefinitionNode, ["ClassDeclaration", "ClassExpression"]);
if (classNode) {
// Class Declaration found add it to scopes
var temp = curScope.prev;
var newScope = {};
newScope.isClass = true;
// if the class is class expression, check if it has a name
if (classNode.type === "ClassExpression") {
var assignmentExpNode = findSurroundASTNode(ast, classNode, ["AssignmentExpression"]);
if (assignmentExpNode && assignmentExpNode.left && assignmentExpNode.left.name) {
newScope.name = "class " + assignmentExpNode.left.name;
} else {
var varDeclaratorNode = findSurroundASTNode(ast, classNode, ["VariableDeclarator"]);
if (varDeclaratorNode && varDeclaratorNode.id && varDeclaratorNode.id.name) {
newScope.name = "class " + varDeclaratorNode.id.name;
} else {
newScope.name = "class null";
}
}
} else {
newScope.name = "class " + (classNode.id && classNode.id.name);
}
newScope.originNode = classNode;
curScope.prev = newScope;
newScope.prev = temp;
}
} else {
// For function expressions, assign name to prefix of the function body
curScope.name = "function starting with " +
fullText.substr(
curScope.originNode.body.start,
Math.min(
FUNCTION_BODY_PREFIX_LENGTH,
curScope.originNode.body.end - curScope.originNode.body.start
)
);
}
} else {
// Acorn parse_dammit marks name with '✖' under erroneous declarations, check it
if (curScope.fnType === "✖") {
curScope.name = "function starting with " +
fullText.substr(
curScope.originNode.body.start,
Math.min(
FUNCTION_BODY_PREFIX_LENGTH,
curScope.originNode.body.end - curScope.originNode.body.start
)
);
} else {
curScope.name = curScope.fnType;
}
}
} else if (!curScope.originNode) {
curScope.name = "global";
}
curScope = curScope.prev;
}
return scopes;
} | javascript | function getAllScopes(ast, scope, fullText) {
var curScope = scope;
var cnt = 0;
var scopes = [];
while (curScope) {
curScope.id = cnt++;
scopes.push(curScope);
if (curScope.fnType) {
// Check for class scopes surrounding the function
if (curScope.fnType === "FunctionExpression") {
var methodDefinitionNode = findSurroundASTNode(ast, curScope.originNode, ["MethodDefinition"]);
// class scope found
if (methodDefinitionNode && isEqual(methodDefinitionNode.value, curScope.originNode)) {
// Change curScope name and originNode to that of methodDefinitionNode
curScope.name = methodDefinitionNode.key.name;
curScope.originNode = methodDefinitionNode;
var classNode = findSurroundASTNode(ast, methodDefinitionNode, ["ClassDeclaration", "ClassExpression"]);
if (classNode) {
// Class Declaration found add it to scopes
var temp = curScope.prev;
var newScope = {};
newScope.isClass = true;
// if the class is class expression, check if it has a name
if (classNode.type === "ClassExpression") {
var assignmentExpNode = findSurroundASTNode(ast, classNode, ["AssignmentExpression"]);
if (assignmentExpNode && assignmentExpNode.left && assignmentExpNode.left.name) {
newScope.name = "class " + assignmentExpNode.left.name;
} else {
var varDeclaratorNode = findSurroundASTNode(ast, classNode, ["VariableDeclarator"]);
if (varDeclaratorNode && varDeclaratorNode.id && varDeclaratorNode.id.name) {
newScope.name = "class " + varDeclaratorNode.id.name;
} else {
newScope.name = "class null";
}
}
} else {
newScope.name = "class " + (classNode.id && classNode.id.name);
}
newScope.originNode = classNode;
curScope.prev = newScope;
newScope.prev = temp;
}
} else {
// For function expressions, assign name to prefix of the function body
curScope.name = "function starting with " +
fullText.substr(
curScope.originNode.body.start,
Math.min(
FUNCTION_BODY_PREFIX_LENGTH,
curScope.originNode.body.end - curScope.originNode.body.start
)
);
}
} else {
// Acorn parse_dammit marks name with '✖' under erroneous declarations, check it
if (curScope.fnType === "✖") {
curScope.name = "function starting with " +
fullText.substr(
curScope.originNode.body.start,
Math.min(
FUNCTION_BODY_PREFIX_LENGTH,
curScope.originNode.body.end - curScope.originNode.body.start
)
);
} else {
curScope.name = curScope.fnType;
}
}
} else if (!curScope.originNode) {
curScope.name = "global";
}
curScope = curScope.prev;
}
return scopes;
} | [
"function",
"getAllScopes",
"(",
"ast",
",",
"scope",
",",
"fullText",
")",
"{",
"var",
"curScope",
"=",
"scope",
";",
"var",
"cnt",
"=",
"0",
";",
"var",
"scopes",
"=",
"[",
"]",
";",
"while",
"(",
"curScope",
")",
"{",
"curScope",
".",
"id",
"=",... | Converts the scopes returned from tern to an array of scopes and adds id and name to the scope
Also checks for class scopes
@param {!ASTNode} ast - ast of the complete file
@param {!Scope} scope - scope returned from tern
@param {!string} fullText - the complete text of a file
@return {!Array.<Scope>} | [
"Converts",
"the",
"scopes",
"returned",
"from",
"tern",
"to",
"an",
"array",
"of",
"scopes",
"and",
"adds",
"id",
"and",
"name",
"to",
"the",
"scope",
"Also",
"checks",
"for",
"class",
"scopes"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js#L341-L421 | train | Get all scopes of the given scope | [
30522,
3853,
2131,
8095,
26127,
2015,
1006,
2004,
2102,
1010,
9531,
1010,
2440,
18209,
1007,
1063,
13075,
12731,
2869,
16186,
1027,
9531,
1025,
13075,
27166,
2102,
1027,
1014,
1025,
13075,
9531,
2015,
1027,
1031,
1033,
1025,
2096,
1006,
127... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/atoms/dom.js | positiveSize | function positiveSize(e) {
var rect = bot.dom.getClientRect(e);
if (rect.height > 0 && rect.width > 0) {
return true;
}
// A vertical or horizontal SVG Path element will report zero width or
// height but is "shown" if it has a positive stroke-width.
if (bot.dom.isElement(e, 'PATH') && (rect.height > 0 || rect.width > 0)) {
var strokeWidth = bot.dom.getEffectiveStyle(e, 'stroke-width');
return !!strokeWidth && (parseInt(strokeWidth, 10) > 0);
}
// Zero-sized elements should still be considered to have positive size
// if they have a child element or text node with positive size, unless
// the element has an 'overflow' style of 'hidden'.
return bot.dom.getEffectiveStyle(e, 'overflow') != 'hidden' &&
goog.array.some(e.childNodes, function(n) {
return n.nodeType == goog.dom.NodeType.TEXT ||
(bot.dom.isElement(n) && positiveSize(n));
});
} | javascript | function positiveSize(e) {
var rect = bot.dom.getClientRect(e);
if (rect.height > 0 && rect.width > 0) {
return true;
}
// A vertical or horizontal SVG Path element will report zero width or
// height but is "shown" if it has a positive stroke-width.
if (bot.dom.isElement(e, 'PATH') && (rect.height > 0 || rect.width > 0)) {
var strokeWidth = bot.dom.getEffectiveStyle(e, 'stroke-width');
return !!strokeWidth && (parseInt(strokeWidth, 10) > 0);
}
// Zero-sized elements should still be considered to have positive size
// if they have a child element or text node with positive size, unless
// the element has an 'overflow' style of 'hidden'.
return bot.dom.getEffectiveStyle(e, 'overflow') != 'hidden' &&
goog.array.some(e.childNodes, function(n) {
return n.nodeType == goog.dom.NodeType.TEXT ||
(bot.dom.isElement(n) && positiveSize(n));
});
} | [
"function",
"positiveSize",
"(",
"e",
")",
"{",
"var",
"rect",
"=",
"bot",
".",
"dom",
".",
"getClientRect",
"(",
"e",
")",
";",
"if",
"(",
"rect",
".",
"height",
">",
"0",
"&&",
"rect",
".",
"width",
">",
"0",
")",
"{",
"return",
"true",
";",
... | Any element without positive size dimensions is not shown. | [
"Any",
"element",
"without",
"positive",
"size",
"dimensions",
"is",
"not",
"shown",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/atoms/dom.js#L527-L546 | train | Returns true if the element is positive size | [
30522,
3853,
3893,
5332,
4371,
1006,
1041,
1007,
1063,
13075,
28667,
2102,
1027,
28516,
1012,
14383,
1012,
2131,
20464,
11638,
2890,
6593,
1006,
1041,
1007,
1025,
2065,
1006,
28667,
2102,
1012,
4578,
1028,
1014,
1004,
1004,
28667,
2102,
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... |
mui-org/material-ui | scripts/sizeSnapshot/create.js | getWebpackSizes | async function getWebpackSizes() {
await fse.mkdirp(path.join(__dirname, 'build'));
const configPath = path.join(__dirname, 'webpack.config.js');
const statsPath = path.join(__dirname, 'build', 'stats.json');
await exec(`webpack --config ${configPath} --json > ${statsPath}`);
const stats = await fse.readJSON(statsPath);
const assets = new Map(stats.assets.map(asset => [asset.name, asset]));
return Object.entries(stats.assetsByChunkName).map(([chunkName, assetName]) => {
const parsedSize = assets.get(assetName).size;
const gzipSize = assets.get(`${assetName}.gz`).size;
return [chunkName, { parsed: parsedSize, gzip: gzipSize }];
});
} | javascript | async function getWebpackSizes() {
await fse.mkdirp(path.join(__dirname, 'build'));
const configPath = path.join(__dirname, 'webpack.config.js');
const statsPath = path.join(__dirname, 'build', 'stats.json');
await exec(`webpack --config ${configPath} --json > ${statsPath}`);
const stats = await fse.readJSON(statsPath);
const assets = new Map(stats.assets.map(asset => [asset.name, asset]));
return Object.entries(stats.assetsByChunkName).map(([chunkName, assetName]) => {
const parsedSize = assets.get(assetName).size;
const gzipSize = assets.get(`${assetName}.gz`).size;
return [chunkName, { parsed: parsedSize, gzip: gzipSize }];
});
} | [
"async",
"function",
"getWebpackSizes",
"(",
")",
"{",
"await",
"fse",
".",
"mkdirp",
"(",
"path",
".",
"join",
"(",
"__dirname",
",",
"'build'",
")",
")",
";",
"const",
"configPath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'webpack.config.js'",
... | creates size snapshot for every bundle that built with webpack | [
"creates",
"size",
"snapshot",
"for",
"every",
"bundle",
"that",
"built",
"with",
"webpack"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/scripts/sizeSnapshot/create.js#L34-L49 | train | Get webpack sizes | [
30522,
2004,
6038,
2278,
3853,
2131,
8545,
2497,
23947,
5332,
11254,
1006,
1007,
1063,
26751,
1042,
3366,
1012,
12395,
4305,
14536,
1006,
4130,
1012,
3693,
1006,
1035,
1035,
16101,
18442,
1010,
1005,
3857,
1005,
1007,
1007,
1025,
9530,
3367... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/index.js | ensureFileDetectorsAreEnabled | function ensureFileDetectorsAreEnabled(ctor) {
const mixin = class extends ctor {
/** @param {input.FileDetector} detector */
setFileDetector(detector) {
webdriver.WebDriver.prototype.setFileDetector.call(this, detector);
}
};
return mixin;
} | javascript | function ensureFileDetectorsAreEnabled(ctor) {
const mixin = class extends ctor {
/** @param {input.FileDetector} detector */
setFileDetector(detector) {
webdriver.WebDriver.prototype.setFileDetector.call(this, detector);
}
};
return mixin;
} | [
"function",
"ensureFileDetectorsAreEnabled",
"(",
"ctor",
")",
"{",
"const",
"mixin",
"=",
"class",
"extends",
"ctor",
"{",
"/** @param {input.FileDetector} detector */",
"setFileDetector",
"(",
"detector",
")",
"{",
"webdriver",
".",
"WebDriver",
".",
"prototype",
".... | {@linkplain webdriver.WebDriver#setFileDetector WebDriver's setFileDetector}
method uses a non-standard command to transfer files from the local client
to the remote end hosting the browser. Many of the WebDriver sub-types, like
the {@link chrome.Driver} and {@link firefox.Driver}, do not support this
command. Thus, these classes override the `setFileDetector` to no-op.
This function uses a mixin to re-enable `setFileDetector` by calling the
original method on the WebDriver prototype directly. This is used only when
the builder creates a Chrome or Firefox instance that communicates with a
remote end (and thus, support for remote file detectors is unknown).
@param {function(new: webdriver.WebDriver, ...?)} ctor
@return {function(new: webdriver.WebDriver, ...?)} | [
"{",
"@linkplain",
"webdriver",
".",
"WebDriver#setFileDetector",
"WebDriver",
"s",
"setFileDetector",
"}",
"method",
"uses",
"a",
"non",
"-",
"standard",
"command",
"to",
"transfer",
"files",
"from",
"the",
"local",
"client",
"to",
"the",
"remote",
"end",
"host... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/index.js#L82-L90 | train | Ensure that the file detectors are enabled | [
30522,
3853,
5676,
8873,
3709,
12870,
24817,
12069,
8189,
23242,
1006,
14931,
2953,
1007,
1063,
9530,
3367,
4666,
2378,
1027,
2465,
8908,
14931,
2953,
1063,
1013,
1008,
1008,
1030,
11498,
2213,
1063,
7953,
1012,
6406,
12870,
16761,
1065,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js | function (oDraggedControl, iDropIndex) {
this.removeAggregation('items', oDraggedControl, true);
this.insertAggregation('items', oDraggedControl, iDropIndex, true);
IconTabBarDragAndDropUtil._updateAccessibilityInfo.call(this);
} | javascript | function (oDraggedControl, iDropIndex) {
this.removeAggregation('items', oDraggedControl, true);
this.insertAggregation('items', oDraggedControl, iDropIndex, true);
IconTabBarDragAndDropUtil._updateAccessibilityInfo.call(this);
} | [
"function",
"(",
"oDraggedControl",
",",
"iDropIndex",
")",
"{",
"this",
".",
"removeAggregation",
"(",
"'items'",
",",
"oDraggedControl",
",",
"true",
")",
";",
"this",
".",
"insertAggregation",
"(",
"'items'",
",",
"oDraggedControl",
",",
"iDropIndex",
",",
... | Handles aggregation of control after drag and drop.
@param {object} oDraggedControl Dragged control
@param {number} iDropIndex Drop index
@private | [
"Handles",
"aggregation",
"of",
"control",
"after",
"drag",
"and",
"drop",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js#L101-L105 | train | Drag and drop the control | [
30522,
3853,
1006,
1051,
7265,
15567,
8663,
13181,
2140,
1010,
8909,
18981,
22254,
10288,
1007,
1063,
2023,
1012,
6366,
8490,
17603,
12540,
1006,
1005,
5167,
1005,
1010,
1051,
7265,
15567,
8663,
13181,
2140,
1010,
2995,
1007,
1025,
2023,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js | function(aControls, aChangeTypes) {
if (!aControls || aControls.length === 0) {
return this._reject("At least one control ID has to be provided as a parameter");
}
var oAppComponent = aControls[0].appComponent || Utils.getAppComponentForControl(aControls[0]);
if (!oAppComponent) {
return this._reject("App Component could not be determined");
}
var aSelectorIds = aControls.map(function (vControl) {
var sControlId = vControl.id || vControl.getId();
var sLocalId = oAppComponent.getLocalId(sControlId);
return sLocalId || sControlId;
});
var oFlexController = FlexControllerFactory.createForControl(oAppComponent);
return oFlexController.resetChanges("USER", undefined, oAppComponent, aSelectorIds, aChangeTypes);
} | javascript | function(aControls, aChangeTypes) {
if (!aControls || aControls.length === 0) {
return this._reject("At least one control ID has to be provided as a parameter");
}
var oAppComponent = aControls[0].appComponent || Utils.getAppComponentForControl(aControls[0]);
if (!oAppComponent) {
return this._reject("App Component could not be determined");
}
var aSelectorIds = aControls.map(function (vControl) {
var sControlId = vControl.id || vControl.getId();
var sLocalId = oAppComponent.getLocalId(sControlId);
return sLocalId || sControlId;
});
var oFlexController = FlexControllerFactory.createForControl(oAppComponent);
return oFlexController.resetChanges("USER", undefined, oAppComponent, aSelectorIds, aChangeTypes);
} | [
"function",
"(",
"aControls",
",",
"aChangeTypes",
")",
"{",
"if",
"(",
"!",
"aControls",
"||",
"aControls",
".",
"length",
"===",
"0",
")",
"{",
"return",
"this",
".",
"_reject",
"(",
"\"At least one control ID has to be provided as a parameter\"",
")",
";",
"}... | Deletes changes recorded for control. Changes to be deleted can be filtered by specification of change type(s).
@param {sap.ui.core.Element[] | map[]} aControls - an array of instances of controls, a map with control IDs including a app component or a mixture for which the reset shall take place
@param {sap.ui.core.Component} aControls.appComponent - Application component of the controls at runtime in case a map has been used
@param {string} aControls.id - ID of the control in case a map has been used to specify the control
@param {String[]} [aChangeTypes] - Types of changes that shall be deleted
@returns {Promise} Promise that resolves after the deletion took place and changes are reverted
@method sap.ui.fl.ControlPersonalizationAPI.resetChanges
@public | [
"Deletes",
"changes",
"recorded",
"for",
"control",
".",
"Changes",
"to",
"be",
"deleted",
"can",
"be",
"filtered",
"by",
"specification",
"of",
"change",
"type",
"(",
"s",
")",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js#L375-L393 | train | Reset changes for a control | [
30522,
3853,
1006,
9353,
12162,
13153,
2015,
1010,
9353,
18003,
27405,
10374,
1007,
1063,
2065,
1006,
999,
9353,
12162,
13153,
2015,
1064,
1064,
9353,
12162,
13153,
2015,
1012,
3091,
1027,
1027,
1027,
1014,
1007,
1063,
2709,
2023,
1012,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | common/src/web/jquery-1.3.2.js | function(gotoEnd){
var t = now();
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
this.options.curAnim[ this.prop ] = true;
var done = true;
for ( var i in this.options.curAnim )
if ( this.options.curAnim[i] !== true )
done = false;
if ( done ) {
if ( this.options.display != null ) {
// Reset the overflow
this.elem.style.overflow = this.options.overflow;
// Reset the display
this.elem.style.display = this.options.display;
if ( jQuery.css(this.elem, "display") == "none" )
this.elem.style.display = "block";
}
// Hide the element if the "hide" operation was done
if ( this.options.hide )
jQuery(this.elem).hide();
// Reset the properties, if the item has been hidden or shown
if ( this.options.hide || this.options.show )
for ( var p in this.options.curAnim )
jQuery.attr(this.elem.style, p, this.options.orig[p]);
// Execute the complete function
this.options.complete.call( this.elem );
}
return false;
} else {
var n = t - this.startTime;
this.state = n / this.options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
this.now = this.start + ((this.end - this.start) * this.pos);
// Perform the next step of the animation
this.update();
}
return true;
} | javascript | function(gotoEnd){
var t = now();
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
this.options.curAnim[ this.prop ] = true;
var done = true;
for ( var i in this.options.curAnim )
if ( this.options.curAnim[i] !== true )
done = false;
if ( done ) {
if ( this.options.display != null ) {
// Reset the overflow
this.elem.style.overflow = this.options.overflow;
// Reset the display
this.elem.style.display = this.options.display;
if ( jQuery.css(this.elem, "display") == "none" )
this.elem.style.display = "block";
}
// Hide the element if the "hide" operation was done
if ( this.options.hide )
jQuery(this.elem).hide();
// Reset the properties, if the item has been hidden or shown
if ( this.options.hide || this.options.show )
for ( var p in this.options.curAnim )
jQuery.attr(this.elem.style, p, this.options.orig[p]);
// Execute the complete function
this.options.complete.call( this.elem );
}
return false;
} else {
var n = t - this.startTime;
this.state = n / this.options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
this.now = this.start + ((this.end - this.start) * this.pos);
// Perform the next step of the animation
this.update();
}
return true;
} | [
"function",
"(",
"gotoEnd",
")",
"{",
"var",
"t",
"=",
"now",
"(",
")",
";",
"if",
"(",
"gotoEnd",
"||",
"t",
">=",
"this",
".",
"options",
".",
"duration",
"+",
"this",
".",
"startTime",
")",
"{",
"this",
".",
"now",
"=",
"this",
".",
"end",
"... | Each step of an animation | [
"Each",
"step",
"of",
"an",
"animation"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L4094-L4147 | train | End animation function | [
30522,
3853,
1006,
2288,
8913,
4859,
1007,
1063,
13075,
1056,
1027,
2085,
1006,
1007,
1025,
2065,
1006,
2288,
8913,
4859,
1064,
1064,
1056,
1028,
1027,
2023,
1012,
7047,
1012,
9367,
1009,
2023,
1012,
2707,
7292,
1007,
1063,
2023,
1012,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensions/default/JavaScriptQuickEdit/main.js | javaScriptFunctionProvider | function javaScriptFunctionProvider(hostEditor, pos) {
// Only provide a JavaScript editor when cursor is in JavaScript content
if (hostEditor.getModeForSelection() !== "javascript") {
return null;
}
//Send analytics data for Quick Edit open
HealthLogger.sendAnalyticsData(
"QuickEditOpen",
"usage",
"quickEdit",
"open"
);
// Only provide JavaScript editor if the selection is within a single line
var sel = hostEditor.getSelection();
if (sel.start.line !== sel.end.line) {
return null;
}
// Always use the selection start for determining the function name. The pos
// parameter is usually the selection end.
var functionResult = _getFunctionName(hostEditor, sel.start);
if (!functionResult.functionName) {
return functionResult.reason || null;
}
return _createInlineEditor(hostEditor, functionResult.functionName);
} | javascript | function javaScriptFunctionProvider(hostEditor, pos) {
// Only provide a JavaScript editor when cursor is in JavaScript content
if (hostEditor.getModeForSelection() !== "javascript") {
return null;
}
//Send analytics data for Quick Edit open
HealthLogger.sendAnalyticsData(
"QuickEditOpen",
"usage",
"quickEdit",
"open"
);
// Only provide JavaScript editor if the selection is within a single line
var sel = hostEditor.getSelection();
if (sel.start.line !== sel.end.line) {
return null;
}
// Always use the selection start for determining the function name. The pos
// parameter is usually the selection end.
var functionResult = _getFunctionName(hostEditor, sel.start);
if (!functionResult.functionName) {
return functionResult.reason || null;
}
return _createInlineEditor(hostEditor, functionResult.functionName);
} | [
"function",
"javaScriptFunctionProvider",
"(",
"hostEditor",
",",
"pos",
")",
"{",
"// Only provide a JavaScript editor when cursor is in JavaScript content",
"if",
"(",
"hostEditor",
".",
"getModeForSelection",
"(",
")",
"!==",
"\"javascript\"",
")",
"{",
"return",
"null",... | This function is registered with EditorManager as an inline editor provider. It creates an inline editor
when the cursor is on a JavaScript function name, finds all functions that match the name
and shows (one/all of them) in an inline editor.
@param {!Editor} editor
@param {!{line:number, ch:number}} pos
@return {$.Promise} a promise that will be resolved with an InlineWidget
or null if we're not ready to provide anything. | [
"This",
"function",
"is",
"registered",
"with",
"EditorManager",
"as",
"an",
"inline",
"editor",
"provider",
".",
"It",
"creates",
"an",
"inline",
"editor",
"when",
"the",
"cursor",
"is",
"on",
"a",
"JavaScript",
"function",
"name",
"finds",
"all",
"functions"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptQuickEdit/main.js#L194-L221 | train | Function provider for JavaScript | [
30522,
3853,
9262,
22483,
11263,
27989,
21572,
17258,
2121,
1006,
4354,
15660,
1010,
13433,
2015,
1007,
1063,
1013,
1013,
2069,
3073,
1037,
30524,
29278,
11246,
18491,
1006,
1007,
999,
1027,
1027,
1000,
9262,
22483,
1000,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/RenderManager.js | finalizeRendering | function finalizeRendering(oStoredFocusInfo){
var i, size = aRenderedControls.length;
for (i = 0; i < size; i++) {
aRenderedControls[i]._sapui_bInAfterRenderingPhase = true;
}
bLocked = true;
try {
// Notify the behavior object that the controls will be attached to DOM
for (i = 0; i < size; i++) {
var oControl = aRenderedControls[i];
if (oControl.bOutput && oControl.bOutput !== "invisible") {
var oEvent = jQuery.Event("AfterRendering");
// store the element on the event (aligned with jQuery syntax)
oEvent.srcControl = oControl;
// start performance measurement
Measurement.start(oControl.getId() + "---AfterRendering","AfterRendering of " + oControl.getMetadata().getName(), ["rendering","after"]);
oControl._handleEvent(oEvent);
// end performance measurement
Measurement.end(oControl.getId() + "---AfterRendering");
}
}
} finally {
for (i = 0; i < size; i++) {
delete aRenderedControls[i]._sapui_bInAfterRenderingPhase;
}
bLocked = false;
}
//finally restore focus
try {
oFocusHandler.restoreFocus(oStoredFocusInfo);
} catch (e) {
Log.warning("Problems while restoring the focus after rendering: " + e, null);
}
// Re-bind any generically bound browser event handlers (must happen after restoring focus to avoid focus event)
for (i = 0; i < size; i++) {
var oControl = aRenderedControls[i],
aBindings = oControl.aBindParameters;
if (aBindings && aBindings.length > 0) { // if we have stored bind calls...
var jDomRef = jQuery(oControl.getDomRef());
if (jDomRef && jDomRef[0]) { // ...and we have a DomRef - TODO: this check should not be required right after rendering...
for (var j = 0; j < aBindings.length; j++) {
var oParams = aBindings[j];
jDomRef.bind(oParams.sEventType, oParams.fnProxy);
}
}
}
}
} | javascript | function finalizeRendering(oStoredFocusInfo){
var i, size = aRenderedControls.length;
for (i = 0; i < size; i++) {
aRenderedControls[i]._sapui_bInAfterRenderingPhase = true;
}
bLocked = true;
try {
// Notify the behavior object that the controls will be attached to DOM
for (i = 0; i < size; i++) {
var oControl = aRenderedControls[i];
if (oControl.bOutput && oControl.bOutput !== "invisible") {
var oEvent = jQuery.Event("AfterRendering");
// store the element on the event (aligned with jQuery syntax)
oEvent.srcControl = oControl;
// start performance measurement
Measurement.start(oControl.getId() + "---AfterRendering","AfterRendering of " + oControl.getMetadata().getName(), ["rendering","after"]);
oControl._handleEvent(oEvent);
// end performance measurement
Measurement.end(oControl.getId() + "---AfterRendering");
}
}
} finally {
for (i = 0; i < size; i++) {
delete aRenderedControls[i]._sapui_bInAfterRenderingPhase;
}
bLocked = false;
}
//finally restore focus
try {
oFocusHandler.restoreFocus(oStoredFocusInfo);
} catch (e) {
Log.warning("Problems while restoring the focus after rendering: " + e, null);
}
// Re-bind any generically bound browser event handlers (must happen after restoring focus to avoid focus event)
for (i = 0; i < size; i++) {
var oControl = aRenderedControls[i],
aBindings = oControl.aBindParameters;
if (aBindings && aBindings.length > 0) { // if we have stored bind calls...
var jDomRef = jQuery(oControl.getDomRef());
if (jDomRef && jDomRef[0]) { // ...and we have a DomRef - TODO: this check should not be required right after rendering...
for (var j = 0; j < aBindings.length; j++) {
var oParams = aBindings[j];
jDomRef.bind(oParams.sEventType, oParams.fnProxy);
}
}
}
}
} | [
"function",
"finalizeRendering",
"(",
"oStoredFocusInfo",
")",
"{",
"var",
"i",
",",
"size",
"=",
"aRenderedControls",
".",
"length",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"aRenderedControls",
"[",
"i",
"]",
... | Does everything needed after the rendering (restore focus, calling "onAfterRendering", initialize event binding) | [
"Does",
"everything",
"needed",
"after",
"the",
"rendering",
"(",
"restore",
"focus",
"calling",
"onAfterRendering",
"initialize",
"event",
"binding",
")"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/RenderManager.js#L806-L861 | train | Finalizes the rendering of the controls | [
30522,
3853,
2345,
17629,
10497,
7999,
1006,
9808,
19277,
20952,
10085,
2271,
2378,
14876,
1007,
1063,
13075,
1045,
1010,
2946,
1027,
4995,
4063,
2098,
8663,
13181,
4877,
1012,
3091,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
294... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | _getPane | function _getPane(paneId) {
paneId = _resolvePaneId(paneId);
if (_panes[paneId]) {
return _panes[paneId];
}
return null;
} | javascript | function _getPane(paneId) {
paneId = _resolvePaneId(paneId);
if (_panes[paneId]) {
return _panes[paneId];
}
return null;
} | [
"function",
"_getPane",
"(",
"paneId",
")",
"{",
"paneId",
"=",
"_resolvePaneId",
"(",
"paneId",
")",
";",
"if",
"(",
"_panes",
"[",
"paneId",
"]",
")",
"{",
"return",
"_panes",
"[",
"paneId",
"]",
";",
"}",
"return",
"null",
";",
"}"
] | Retrieves the Pane object for the given paneId
@param {!string} paneId - id of the pane to retrieve
@return {?Pane} the Pane object or null if a pane object doesn't exist for the pane
@private | [
"Retrieves",
"the",
"Pane",
"object",
"for",
"the",
"given",
"paneId"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L306-L314 | train | Returns the pane object | [
30522,
3853,
1035,
2131,
9739,
2063,
1006,
6090,
7416,
2094,
1007,
1063,
6090,
7416,
2094,
1027,
1035,
10663,
9739,
7416,
2094,
1006,
6090,
7416,
2094,
1007,
1025,
2065,
1006,
1035,
6090,
2229,
1031,
6090,
7416,
2094,
1033,
1007,
1063,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | src/ol/format/TopoJSON.js | transformVertex | function transformVertex(vertex, scale, translate) {
vertex[0] = vertex[0] * scale[0] + translate[0];
vertex[1] = vertex[1] * scale[1] + translate[1];
} | javascript | function transformVertex(vertex, scale, translate) {
vertex[0] = vertex[0] * scale[0] + translate[0];
vertex[1] = vertex[1] * scale[1] + translate[1];
} | [
"function",
"transformVertex",
"(",
"vertex",
",",
"scale",
",",
"translate",
")",
"{",
"vertex",
"[",
"0",
"]",
"=",
"vertex",
"[",
"0",
"]",
"*",
"scale",
"[",
"0",
"]",
"+",
"translate",
"[",
"0",
"]",
";",
"vertex",
"[",
"1",
"]",
"=",
"verte... | Apply a linear transform to a vertex. The provided vertex is modified in
place.
@param {import("../coordinate.js").Coordinate} vertex Vertex.
@param {Array<number>} scale Scale for each dimension.
@param {Array<number>} translate Translation for each dimension. | [
"Apply",
"a",
"linear",
"transform",
"to",
"a",
"vertex",
".",
"The",
"provided",
"vertex",
"is",
"modified",
"in",
"place",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/TopoJSON.js#L403-L406 | train | Transforms a vertex by scaling it by the given scale and translate | [
30522,
3853,
10938,
16874,
10288,
1006,
19449,
1010,
4094,
1010,
17637,
1007,
1063,
19449,
1031,
1014,
1033,
1027,
19449,
1031,
1014,
1033,
1008,
4094,
1031,
1014,
1033,
1009,
17637,
1031,
1014,
1033,
1025,
19449,
1031,
1015,
1033,
1027,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | tools/eslint-fuzzer.js | isolateBadConfig | function isolateBadConfig(text, config, problemType) {
for (const ruleId of Object.keys(config.rules)) {
const reducedConfig = Object.assign({}, config, { rules: { [ruleId]: config.rules[ruleId] } });
let fixResult;
try {
fixResult = linter.verifyAndFix(text, reducedConfig, {});
} catch (err) {
return reducedConfig;
}
if (fixResult.messages.length === 1 && fixResult.messages[0].fatal && problemType === "autofix") {
return reducedConfig;
}
}
return config;
} | javascript | function isolateBadConfig(text, config, problemType) {
for (const ruleId of Object.keys(config.rules)) {
const reducedConfig = Object.assign({}, config, { rules: { [ruleId]: config.rules[ruleId] } });
let fixResult;
try {
fixResult = linter.verifyAndFix(text, reducedConfig, {});
} catch (err) {
return reducedConfig;
}
if (fixResult.messages.length === 1 && fixResult.messages[0].fatal && problemType === "autofix") {
return reducedConfig;
}
}
return config;
} | [
"function",
"isolateBadConfig",
"(",
"text",
",",
"config",
",",
"problemType",
")",
"{",
"for",
"(",
"const",
"ruleId",
"of",
"Object",
".",
"keys",
"(",
"config",
".",
"rules",
")",
")",
"{",
"const",
"reducedConfig",
"=",
"Object",
".",
"assign",
"(",... | Tries to isolate the smallest config that reproduces a problem
@param {string} text The source text to lint
@param {Object} config A config object that causes a crash or autofix error
@param {("crash"|"autofix")} problemType The type of problem that occurred
@returns {Object} A config object with only one rule enabled that produces the same crash or autofix error, if possible.
Otherwise, the same as `config` | [
"Tries",
"to",
"isolate",
"the",
"smallest",
"config",
"that",
"reproduces",
"a",
"problem"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/tools/eslint-fuzzer.js#L59-L75 | train | Isolate bad config | [
30522,
3853,
27152,
9024,
8663,
8873,
2290,
1006,
3793,
1010,
9530,
8873,
2290,
1010,
3291,
13874,
1007,
1063,
2005,
1006,
9530,
3367,
3627,
3593,
1997,
4874,
1012,
6309,
1006,
9530,
8873,
2290,
1012,
3513,
1007,
1007,
1063,
9530,
3367,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
PrismJS/prism | components/prism-javadoclike.js | docCommentSupport | function docCommentSupport(lang, callback) {
var tokenName = 'doc-comment';
var grammar = Prism.languages[lang];
if (!grammar) {
return;
}
var token = grammar[tokenName];
if (!token) {
// add doc comment: /** */
var definition = {};
definition[tokenName] = {
pattern: /(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,
alias: 'comment'
};
grammar = Prism.languages.insertBefore(lang, 'comment', definition);
token = grammar[tokenName];
}
if (token instanceof RegExp) { // convert regex to object
token = grammar[tokenName] = { pattern: token };
}
if (Array.isArray(token)) {
for (var i = 0, l = token.length; i < l; i++) {
if (token[i] instanceof RegExp) {
token[i] = { pattern: token[i] };
}
callback(token[i]);
}
} else {
callback(token);
}
} | javascript | function docCommentSupport(lang, callback) {
var tokenName = 'doc-comment';
var grammar = Prism.languages[lang];
if (!grammar) {
return;
}
var token = grammar[tokenName];
if (!token) {
// add doc comment: /** */
var definition = {};
definition[tokenName] = {
pattern: /(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,
alias: 'comment'
};
grammar = Prism.languages.insertBefore(lang, 'comment', definition);
token = grammar[tokenName];
}
if (token instanceof RegExp) { // convert regex to object
token = grammar[tokenName] = { pattern: token };
}
if (Array.isArray(token)) {
for (var i = 0, l = token.length; i < l; i++) {
if (token[i] instanceof RegExp) {
token[i] = { pattern: token[i] };
}
callback(token[i]);
}
} else {
callback(token);
}
} | [
"function",
"docCommentSupport",
"(",
"lang",
",",
"callback",
")",
"{",
"var",
"tokenName",
"=",
"'doc-comment'",
";",
"var",
"grammar",
"=",
"Prism",
".",
"languages",
"[",
"lang",
"]",
";",
"if",
"(",
"!",
"grammar",
")",
"{",
"return",
";",
"}",
"v... | Adds doc comment support to the given language and calls a given callback on each doc comment pattern.
@param {string} lang the language add doc comment support to.
@param {(pattern: {inside: {rest: undefined}}) => void} callback the function called with each doc comment pattern as argument. | [
"Adds",
"doc",
"comment",
"support",
"to",
"the",
"given",
"language",
"and",
"calls",
"a",
"given",
"callback",
"on",
"each",
"doc",
"comment",
"pattern",
"."
] | acceb3b56f0e8362a7ef274dbd85b17611df2ec4 | https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/components/prism-javadoclike.js#L24-L59 | train | doc comment support | [
30522,
3853,
9986,
9006,
8163,
6279,
6442,
1006,
11374,
1010,
2655,
5963,
1007,
1063,
13075,
19204,
18442,
1027,
1005,
9986,
1011,
7615,
1005,
1025,
13075,
8035,
1027,
26113,
1012,
4155,
1031,
11374,
1033,
1025,
2065,
1006,
999,
8035,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js | function (control, controlProperty) {
var bindingContext = control.getBinding(controlProperty);
var bindingContextModel = bindingContext.getModel();
var bindingInfoParts = (control.getBindingInfo(controlProperty).parts) ? control.getBindingInfo(controlProperty).parts : [];
var modelNames = [];
for (var i = 0; i < bindingInfoParts.length; i++) {
modelNames.push(bindingInfoParts[i].model);
}
var model = {
names: modelNames,
path: bindingContext.getPath()
};
if (bindingContextModel) {
model.mode = bindingContextModel.getDefaultBindingMode();
model.type = bindingContextModel.getMetadata().getName();
model.data = bindingContextModel.getData ? bindingContextModel.getData('/') : undefined;
}
return model;
} | javascript | function (control, controlProperty) {
var bindingContext = control.getBinding(controlProperty);
var bindingContextModel = bindingContext.getModel();
var bindingInfoParts = (control.getBindingInfo(controlProperty).parts) ? control.getBindingInfo(controlProperty).parts : [];
var modelNames = [];
for (var i = 0; i < bindingInfoParts.length; i++) {
modelNames.push(bindingInfoParts[i].model);
}
var model = {
names: modelNames,
path: bindingContext.getPath()
};
if (bindingContextModel) {
model.mode = bindingContextModel.getDefaultBindingMode();
model.type = bindingContextModel.getMetadata().getName();
model.data = bindingContextModel.getData ? bindingContextModel.getData('/') : undefined;
}
return model;
} | [
"function",
"(",
"control",
",",
"controlProperty",
")",
"{",
"var",
"bindingContext",
"=",
"control",
".",
"getBinding",
"(",
"controlProperty",
")",
";",
"var",
"bindingContextModel",
"=",
"bindingContext",
".",
"getModel",
"(",
")",
";",
"var",
"bindingInfoPa... | Binding Info ================================================================================
Creates an object with the context model of a UI5 control.
@param {Object} control
@param {string} controlProperty
@returns {Object}
@private | [
"Binding",
"Info",
"================================================================================",
"Creates",
"an",
"object",
"with",
"the",
"context",
"model",
"of",
"a",
"UI5",
"control",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L287-L309 | train | Returns the model object for a given control property | [
30522,
3853,
1006,
2491,
1010,
2491,
21572,
4842,
3723,
1007,
1063,
13075,
8031,
8663,
18209,
1027,
2491,
1012,
2131,
8428,
4667,
1006,
2491,
21572,
4842,
3723,
1007,
1025,
13075,
8031,
8663,
18209,
5302,
9247,
1027,
8031,
8663,
18209,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js | createOwnerComponentInfo | function createOwnerComponentInfo(oSrcElement) {
var sId, sVersion;
if (oSrcElement) {
var Component, oComponent;
Component = sap.ui.require("sap/ui/core/Component");
while (Component && oSrcElement && oSrcElement.getParent) {
oComponent = Component.getOwnerComponentFor(oSrcElement);
if (oComponent || oSrcElement instanceof Component) {
oComponent = oComponent || oSrcElement;
var oApp = oComponent.getManifestEntry("sap.app");
// get app id or module name for FESR
sId = oApp && oApp.id || oComponent.getMetadata().getName();
sVersion = oApp && oApp.applicationVersion && oApp.applicationVersion.version;
}
oSrcElement = oSrcElement.getParent();
}
}
return {
id: sId ? sId : "undetermined",
version: sVersion ? sVersion : ""
};
} | javascript | function createOwnerComponentInfo(oSrcElement) {
var sId, sVersion;
if (oSrcElement) {
var Component, oComponent;
Component = sap.ui.require("sap/ui/core/Component");
while (Component && oSrcElement && oSrcElement.getParent) {
oComponent = Component.getOwnerComponentFor(oSrcElement);
if (oComponent || oSrcElement instanceof Component) {
oComponent = oComponent || oSrcElement;
var oApp = oComponent.getManifestEntry("sap.app");
// get app id or module name for FESR
sId = oApp && oApp.id || oComponent.getMetadata().getName();
sVersion = oApp && oApp.applicationVersion && oApp.applicationVersion.version;
}
oSrcElement = oSrcElement.getParent();
}
}
return {
id: sId ? sId : "undetermined",
version: sVersion ? sVersion : ""
};
} | [
"function",
"createOwnerComponentInfo",
"(",
"oSrcElement",
")",
"{",
"var",
"sId",
",",
"sVersion",
";",
"if",
"(",
"oSrcElement",
")",
"{",
"var",
"Component",
",",
"oComponent",
";",
"Component",
"=",
"sap",
".",
"ui",
".",
"require",
"(",
"\"sap/ui/core/... | component determination - heuristic | [
"component",
"determination",
"-",
"heuristic"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L173-L194 | train | Creates a component info object for the given source element. | [
30522,
3853,
3443,
12384,
2121,
9006,
29513,
16778,
2078,
14876,
1006,
9808,
19170,
16930,
4765,
1007,
1063,
13075,
15765,
1010,
17917,
2545,
3258,
1025,
2065,
1006,
9808,
19170,
16930,
4765,
1007,
1063,
13075,
6922,
1010,
1051,
9006,
29513,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/model/Series.js | wrapData | function wrapData(data, seriesModel) {
zrUtil.each(data.CHANGABLE_METHODS, function (methodName) {
data.wrapMethod(methodName, zrUtil.curry(onDataSelfChange, seriesModel));
});
} | javascript | function wrapData(data, seriesModel) {
zrUtil.each(data.CHANGABLE_METHODS, function (methodName) {
data.wrapMethod(methodName, zrUtil.curry(onDataSelfChange, seriesModel));
});
} | [
"function",
"wrapData",
"(",
"data",
",",
"seriesModel",
")",
"{",
"zrUtil",
".",
"each",
"(",
"data",
".",
"CHANGABLE_METHODS",
",",
"function",
"(",
"methodName",
")",
"{",
"data",
".",
"wrapMethod",
"(",
"methodName",
",",
"zrUtil",
".",
"curry",
"(",
... | TODO refactor | [
"TODO",
"refactor"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Series.js#L588-L592 | train | wrap data to be used by the seriesModel | [
30522,
3853,
10236,
2850,
2696,
1006,
2951,
1010,
2186,
5302,
9247,
1007,
1063,
1062,
22134,
4014,
1012,
2169,
1006,
2951,
1012,
11132,
3085,
1035,
4725,
1010,
3853,
1006,
4118,
18442,
1007,
1063,
2951,
1012,
10236,
11368,
6806,
2094,
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... |
swimlane/ngx-datatable | release/utils/math.js | forceFillColumnWidths | function forceFillColumnWidths(allColumns, expectedWidth, startIdx, allowBleed, defaultColWidth) {
if (defaultColWidth === void 0) { defaultColWidth = 300; }
var columnsToResize = allColumns
.slice(startIdx + 1, allColumns.length)
.filter(function (c) {
return c.canAutoResize !== false;
});
for (var _i = 0, columnsToResize_1 = columnsToResize; _i < columnsToResize_1.length; _i++) {
var column = columnsToResize_1[_i];
if (!column.$$oldWidth) {
column.$$oldWidth = column.width;
}
}
var additionWidthPerColumn = 0;
var exceedsWindow = false;
var contentWidth = getContentWidth(allColumns, defaultColWidth);
var remainingWidth = expectedWidth - contentWidth;
var columnsProcessed = [];
// This loop takes care of the
do {
additionWidthPerColumn = remainingWidth / columnsToResize.length;
exceedsWindow = contentWidth >= expectedWidth;
for (var _a = 0, columnsToResize_2 = columnsToResize; _a < columnsToResize_2.length; _a++) {
var column = columnsToResize_2[_a];
if (exceedsWindow && allowBleed) {
column.width = column.$$oldWidth || column.width || defaultColWidth;
}
else {
var newSize = (column.width || defaultColWidth) + additionWidthPerColumn;
if (column.minWidth && newSize < column.minWidth) {
column.width = column.minWidth;
columnsProcessed.push(column);
}
else if (column.maxWidth && newSize > column.maxWidth) {
column.width = column.maxWidth;
columnsProcessed.push(column);
}
else {
column.width = newSize;
}
}
column.width = Math.max(0, column.width);
}
contentWidth = getContentWidth(allColumns);
remainingWidth = expectedWidth - contentWidth;
removeProcessedColumns(columnsToResize, columnsProcessed);
} while (remainingWidth > 0 && columnsToResize.length !== 0);
} | javascript | function forceFillColumnWidths(allColumns, expectedWidth, startIdx, allowBleed, defaultColWidth) {
if (defaultColWidth === void 0) { defaultColWidth = 300; }
var columnsToResize = allColumns
.slice(startIdx + 1, allColumns.length)
.filter(function (c) {
return c.canAutoResize !== false;
});
for (var _i = 0, columnsToResize_1 = columnsToResize; _i < columnsToResize_1.length; _i++) {
var column = columnsToResize_1[_i];
if (!column.$$oldWidth) {
column.$$oldWidth = column.width;
}
}
var additionWidthPerColumn = 0;
var exceedsWindow = false;
var contentWidth = getContentWidth(allColumns, defaultColWidth);
var remainingWidth = expectedWidth - contentWidth;
var columnsProcessed = [];
// This loop takes care of the
do {
additionWidthPerColumn = remainingWidth / columnsToResize.length;
exceedsWindow = contentWidth >= expectedWidth;
for (var _a = 0, columnsToResize_2 = columnsToResize; _a < columnsToResize_2.length; _a++) {
var column = columnsToResize_2[_a];
if (exceedsWindow && allowBleed) {
column.width = column.$$oldWidth || column.width || defaultColWidth;
}
else {
var newSize = (column.width || defaultColWidth) + additionWidthPerColumn;
if (column.minWidth && newSize < column.minWidth) {
column.width = column.minWidth;
columnsProcessed.push(column);
}
else if (column.maxWidth && newSize > column.maxWidth) {
column.width = column.maxWidth;
columnsProcessed.push(column);
}
else {
column.width = newSize;
}
}
column.width = Math.max(0, column.width);
}
contentWidth = getContentWidth(allColumns);
remainingWidth = expectedWidth - contentWidth;
removeProcessedColumns(columnsToResize, columnsProcessed);
} while (remainingWidth > 0 && columnsToResize.length !== 0);
} | [
"function",
"forceFillColumnWidths",
"(",
"allColumns",
",",
"expectedWidth",
",",
"startIdx",
",",
"allowBleed",
",",
"defaultColWidth",
")",
"{",
"if",
"(",
"defaultColWidth",
"===",
"void",
"0",
")",
"{",
"defaultColWidth",
"=",
"300",
";",
"}",
"var",
"col... | Forces the width of the columns to
distribute equally but overflowing when necessary
Rules:
- If combined withs are less than the total width of the grid,
proportion the widths given the min / max / normal widths to fill the width.
- If the combined widths, exceed the total width of the grid,
use the standard widths.
- If a column is resized, it should always use that width
- The proportional widths should never fall below min size if specified.
- If the grid starts off small but then becomes greater than the size ( + / - )
the width should use the original width; not the newly proportioned widths. | [
"Forces",
"the",
"width",
"of",
"the",
"columns",
"to",
"distribute",
"equally",
"but",
"overflowing",
"when",
"necessary"
] | d7df15a070282a169524dba51d9572008b74804c | https://github.com/swimlane/ngx-datatable/blob/d7df15a070282a169524dba51d9572008b74804c/release/utils/math.js#L90-L137 | train | Force column widths to fit the expected width | [
30522,
3853,
2486,
8873,
3363,
25778,
2819,
2078,
9148,
11927,
7898,
1006,
2035,
25778,
2819,
3619,
1010,
3517,
9148,
11927,
2232,
1010,
2707,
3593,
2595,
1010,
3499,
3468,
2098,
1010,
12398,
25778,
9148,
11927,
2232,
1007,
1063,
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... |
jgraph/mxgraph | javascript/mxClient.js | function(f)
{
var str = null;
if (f != null)
{
if (f.name != null)
{
str = f.name;
}
else
{
str = mxUtils.trim(f.toString());
if (/^function\s/.test(str))
{
str = mxUtils.ltrim(str.substring(9));
var idx2 = str.indexOf('(');
if (idx2 > 0)
{
str = str.substring(0, idx2);
}
}
}
}
return str;
} | javascript | function(f)
{
var str = null;
if (f != null)
{
if (f.name != null)
{
str = f.name;
}
else
{
str = mxUtils.trim(f.toString());
if (/^function\s/.test(str))
{
str = mxUtils.ltrim(str.substring(9));
var idx2 = str.indexOf('(');
if (idx2 > 0)
{
str = str.substring(0, idx2);
}
}
}
}
return str;
} | [
"function",
"(",
"f",
")",
"{",
"var",
"str",
"=",
"null",
";",
"if",
"(",
"f",
"!=",
"null",
")",
"{",
"if",
"(",
"f",
".",
"name",
"!=",
"null",
")",
"{",
"str",
"=",
"f",
".",
"name",
";",
"}",
"else",
"{",
"str",
"=",
"mxUtils",
".",
... | Function: getFunctionName
Returns the name for the given function.
Parameters:
f - JavaScript object that represents a function. | [
"Function",
":",
"getFunctionName"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L2435-L2463 | train | Returns the name of the function | [
30522,
3853,
1006,
1042,
1007,
1063,
13075,
2358,
2099,
1027,
19701,
1025,
2065,
1006,
1042,
999,
1027,
19701,
1007,
1063,
2065,
1006,
1042,
1012,
2171,
999,
1027,
19701,
1007,
1063,
2358,
2099,
1027,
1042,
1012,
2171,
1025,
1065,
2842,
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... | |
TryGhost/Ghost | core/server/models/base/index.js | onCreating | function onCreating(model, attr, options) {
if (schema.tables[this.tableName].hasOwnProperty('created_by')) {
if (!options.importing || (options.importing && !this.get('created_by'))) {
this.set('created_by', String(this.contextUser(options)));
}
}
if (schema.tables[this.tableName].hasOwnProperty('updated_by')) {
if (!options.importing) {
this.set('updated_by', String(this.contextUser(options)));
}
}
if (schema.tables[this.tableName].hasOwnProperty('created_at')) {
if (!model.get('created_at')) {
model.set('created_at', new Date());
}
}
if (schema.tables[this.tableName].hasOwnProperty('updated_at')) {
if (!model.get('updated_at')) {
model.set('updated_at', new Date());
}
}
return Promise.resolve(this.onValidate(model, attr, options))
.then(() => {
/**
* @NOTE:
*
* The API requires only specific attributes to send. If we don't set the rest explicitly to null,
* we end up in a situation that on "created" events the field set is incomplete, which is super confusing
* and hard to work with if you trigger internal events, which rely on full field set. This ensures consistency.
*
* @NOTE:
*
* Happens after validation to ensure we don't set fields which are not nullable on db level.
*/
_.each(Object.keys(schema.tables[this.tableName]), (columnKey) => {
if (model.get(columnKey) === undefined) {
model.set(columnKey, null);
}
});
model._changed = _.cloneDeep(model.changed);
});
} | javascript | function onCreating(model, attr, options) {
if (schema.tables[this.tableName].hasOwnProperty('created_by')) {
if (!options.importing || (options.importing && !this.get('created_by'))) {
this.set('created_by', String(this.contextUser(options)));
}
}
if (schema.tables[this.tableName].hasOwnProperty('updated_by')) {
if (!options.importing) {
this.set('updated_by', String(this.contextUser(options)));
}
}
if (schema.tables[this.tableName].hasOwnProperty('created_at')) {
if (!model.get('created_at')) {
model.set('created_at', new Date());
}
}
if (schema.tables[this.tableName].hasOwnProperty('updated_at')) {
if (!model.get('updated_at')) {
model.set('updated_at', new Date());
}
}
return Promise.resolve(this.onValidate(model, attr, options))
.then(() => {
/**
* @NOTE:
*
* The API requires only specific attributes to send. If we don't set the rest explicitly to null,
* we end up in a situation that on "created" events the field set is incomplete, which is super confusing
* and hard to work with if you trigger internal events, which rely on full field set. This ensures consistency.
*
* @NOTE:
*
* Happens after validation to ensure we don't set fields which are not nullable on db level.
*/
_.each(Object.keys(schema.tables[this.tableName]), (columnKey) => {
if (model.get(columnKey) === undefined) {
model.set(columnKey, null);
}
});
model._changed = _.cloneDeep(model.changed);
});
} | [
"function",
"onCreating",
"(",
"model",
",",
"attr",
",",
"options",
")",
"{",
"if",
"(",
"schema",
".",
"tables",
"[",
"this",
".",
"tableName",
"]",
".",
"hasOwnProperty",
"(",
"'created_by'",
")",
")",
"{",
"if",
"(",
"!",
"options",
".",
"importing... | Adding resources implies setting these properties on the server side
- set `created_by` based on the context
- set `updated_by` based on the context
- the bookshelf `timestamps` plugin sets `created_at` and `updated_at`
- if plugin is disabled (e.g. import) we have a fallback condition
Exceptions: internal context or importing | [
"Adding",
"resources",
"implies",
"setting",
"these",
"properties",
"on",
"the",
"server",
"side",
"-",
"set",
"created_by",
"based",
"on",
"the",
"context",
"-",
"set",
"updated_by",
"based",
"on",
"the",
"context",
"-",
"the",
"bookshelf",
"timestamps",
"plu... | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/base/index.js#L314-L360 | train | On creating the model | [
30522,
3853,
2006,
16748,
5844,
1006,
2944,
1010,
2012,
16344,
1010,
7047,
1007,
1063,
2065,
1006,
8040,
28433,
1012,
7251,
1031,
2023,
1012,
2795,
18442,
1033,
1012,
2038,
12384,
21572,
4842,
3723,
1006,
1005,
2580,
1035,
2011,
1005,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/FileTreeViewModel.js | _createPlaceholder | function _createPlaceholder(treeData, basedir, name, isFolder, options) {
options = options || {};
var parentPath = _filePathToObjectPath(treeData, basedir);
if (!parentPath) {
return;
}
var newObject = {
};
if (!options.notInCreateMode) {
newObject.creating = true;
}
if (isFolder) {
// If we're creating a folder, then we know it's empty.
// But if we're not in create mode, (we're adding a folder based on an
// FS event), we don't know anything about the new directory's children.
if (options.notInCreateMode) {
newObject.children = null;
} else {
newObject.children = Immutable.Map();
}
}
var newFile = Immutable.Map(newObject);
if (!options.doNotOpen) {
treeData = _openPath(treeData, basedir);
}
if (parentPath.length > 0) {
var childrenPath = _.clone(parentPath);
childrenPath.push("children");
treeData = treeData.updateIn(childrenPath, function (children) {
return children.set(name, newFile);
});
} else {
treeData = treeData.set(name, newFile);
}
return treeData;
} | javascript | function _createPlaceholder(treeData, basedir, name, isFolder, options) {
options = options || {};
var parentPath = _filePathToObjectPath(treeData, basedir);
if (!parentPath) {
return;
}
var newObject = {
};
if (!options.notInCreateMode) {
newObject.creating = true;
}
if (isFolder) {
// If we're creating a folder, then we know it's empty.
// But if we're not in create mode, (we're adding a folder based on an
// FS event), we don't know anything about the new directory's children.
if (options.notInCreateMode) {
newObject.children = null;
} else {
newObject.children = Immutable.Map();
}
}
var newFile = Immutable.Map(newObject);
if (!options.doNotOpen) {
treeData = _openPath(treeData, basedir);
}
if (parentPath.length > 0) {
var childrenPath = _.clone(parentPath);
childrenPath.push("children");
treeData = treeData.updateIn(childrenPath, function (children) {
return children.set(name, newFile);
});
} else {
treeData = treeData.set(name, newFile);
}
return treeData;
} | [
"function",
"_createPlaceholder",
"(",
"treeData",
",",
"basedir",
",",
"name",
",",
"isFolder",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"parentPath",
"=",
"_filePathToObjectPath",
"(",
"treeData",
",",
"basedir",
")"... | @private
See FileTreeViewModel.createPlaceholder | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeViewModel.js#L874-L916 | train | Create a new placeholder | [
30522,
3853,
1035,
3443,
24759,
10732,
14528,
1006,
3392,
2850,
2696,
1010,
2241,
4313,
1010,
2171,
1010,
2003,
10371,
2121,
1010,
7047,
1007,
1063,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
1025,
13075,
6687,
15069,
1027,
1035,
5371,
15069... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AnnotationHelper.js | function (oContext) {
var sEntitySet,
sEntitySetPath,
vRawValue = oContext.getObject(),
oResult;
if (typeof vRawValue === "string") {
sEntitySet = vRawValue;
} else {
oResult = Basics.followPath(oContext, vRawValue);
sEntitySet = oResult
&& oResult.associationSetEnd
&& oResult.associationSetEnd.entitySet;
}
if (sEntitySet) {
sEntitySetPath = oContext.getModel().getODataEntitySet(sEntitySet, true);
}
if (!sEntitySetPath) {
Log.warning(oContext.getPath() + ": found '" + sEntitySet
+ "' which is not a name of an entity set", undefined,
"sap.ui.model.odata.AnnotationHelper");
}
return sEntitySetPath;
} | javascript | function (oContext) {
var sEntitySet,
sEntitySetPath,
vRawValue = oContext.getObject(),
oResult;
if (typeof vRawValue === "string") {
sEntitySet = vRawValue;
} else {
oResult = Basics.followPath(oContext, vRawValue);
sEntitySet = oResult
&& oResult.associationSetEnd
&& oResult.associationSetEnd.entitySet;
}
if (sEntitySet) {
sEntitySetPath = oContext.getModel().getODataEntitySet(sEntitySet, true);
}
if (!sEntitySetPath) {
Log.warning(oContext.getPath() + ": found '" + sEntitySet
+ "' which is not a name of an entity set", undefined,
"sap.ui.model.odata.AnnotationHelper");
}
return sEntitySetPath;
} | [
"function",
"(",
"oContext",
")",
"{",
"var",
"sEntitySet",
",",
"sEntitySetPath",
",",
"vRawValue",
"=",
"oContext",
".",
"getObject",
"(",
")",
",",
"oResult",
";",
"if",
"(",
"typeof",
"vRawValue",
"===",
"\"string\"",
")",
"{",
"sEntitySet",
"=",
"vRaw... | Helper function for a <code>template:with</code> instruction that depending on how
it is called goes to the entity set with the given name or to the one determined
by the last navigation property. Supports the following dynamic expressions:
<ul>
<li>"14.5.2 Expression edm:AnnotationPath"</li>
<li>"14.5.11 Expression edm:NavigationPropertyPath"</li>
<li>"14.5.12 Expression edm:Path"</li>
<li>"14.5.13 Expression edm:PropertyPath"</li>
</ul>
Example:
<pre>
<template:with path="facet>Target" helper="sap.ui.model.odata.AnnotationHelper.gotoEntitySet" var="entitySet"/>
<template:with path="associationSetEnd>entitySet" helper="sap.ui.model.odata.AnnotationHelper.gotoEntitySet" var="entitySet"/>
</pre>
@param {sap.ui.model.Context} oContext
a context which must point to a simple string or to an annotation (or annotation
property) of type <code>Edm.AnnotationPath</code>,
<code>Edm.NavigationPropertyPath</code>, <code>Edm.Path</code>, or
<code>Edm.PropertyPath</code> embedded within an entity set or entity type;
the context's model must be an {@link sap.ui.model.odata.ODataMetaModel}
@returns {string}
the path to the entity set, or <code>undefined</code> if no such set is found. In
this case, a warning is logged to the console.
@public | [
"Helper",
"function",
"for",
"a",
"<code",
">",
"template",
":",
"with<",
"/",
"code",
">",
"instruction",
"that",
"depending",
"on",
"how",
"it",
"is",
"called",
"goes",
"to",
"the",
"entity",
"set",
"with",
"the",
"given",
"name",
"or",
"to",
"the",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationHelper.js#L369-L395 | train | Returns the entity set path of the entity set | [
30522,
3853,
1006,
1051,
8663,
18209,
1007,
1063,
13075,
2741,
3012,
13462,
1010,
2741,
3012,
13462,
15069,
1010,
27830,
10376,
10175,
5657,
1027,
1051,
8663,
18209,
1012,
2131,
16429,
20614,
1006,
1007,
1010,
10848,
23722,
2102,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | getExpression | function getExpression(ast, start, end, fileText) {
var expn = findSurroundExpression(ast, {start: start, end: end});
if (!expn) {
return false;
}
// Class Expression also includes the trailing semicolon
// Add special case for it
if (expn.type === "ClassExpression" && expn.start === start && expn.end - end <= 1) {
expn.end = end;
return expn;
}
else if (expn.start === start && expn.end === end) {
return expn;
}
// Subexpressions are possible only for BinaryExpression, LogicalExpression and SequenceExpression
if (!(["BinaryExpression", "LogicalExpression", "SequenceExpression"].includes(expn.type))) {
return false;
}
// Check subexpression
var parentExpn = expn;
var parentExpStr = fileText.substr(parentExpn.start, parentExpn.end - parentExpn.start);
// Check whether the parentExpn forms a valid expression after replacing the sub expression
var str = parentExpStr.substr(0, start - parentExpn.start) + "placeHolder" + parentExpStr.substr(end - parentExpn.start);
var node = isStandAloneExpression(str);
if (node && node.type === parentExpn.type) {
return parentExpn;
}
return false;
} | javascript | function getExpression(ast, start, end, fileText) {
var expn = findSurroundExpression(ast, {start: start, end: end});
if (!expn) {
return false;
}
// Class Expression also includes the trailing semicolon
// Add special case for it
if (expn.type === "ClassExpression" && expn.start === start && expn.end - end <= 1) {
expn.end = end;
return expn;
}
else if (expn.start === start && expn.end === end) {
return expn;
}
// Subexpressions are possible only for BinaryExpression, LogicalExpression and SequenceExpression
if (!(["BinaryExpression", "LogicalExpression", "SequenceExpression"].includes(expn.type))) {
return false;
}
// Check subexpression
var parentExpn = expn;
var parentExpStr = fileText.substr(parentExpn.start, parentExpn.end - parentExpn.start);
// Check whether the parentExpn forms a valid expression after replacing the sub expression
var str = parentExpStr.substr(0, start - parentExpn.start) + "placeHolder" + parentExpStr.substr(end - parentExpn.start);
var node = isStandAloneExpression(str);
if (node && node.type === parentExpn.type) {
return parentExpn;
}
return false;
} | [
"function",
"getExpression",
"(",
"ast",
",",
"start",
",",
"end",
",",
"fileText",
")",
"{",
"var",
"expn",
"=",
"findSurroundExpression",
"(",
"ast",
",",
"{",
"start",
":",
"start",
",",
"end",
":",
"end",
"}",
")",
";",
"if",
"(",
"!",
"expn",
... | Gets a expression surrounding start and end (if any)
@param {!ASTNode} ast - the ast of the complete file
@param {!number} start - the start offset
@param {!number} end - the end offset
@param {!string} fileText - the entire file text
@return {ASTNode|boolean} | [
"Gets",
"a",
"expression",
"surrounding",
"start",
"and",
"end",
"(",
"if",
"any",
")"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js#L63-L96 | train | Get the expression at the given location | [
30522,
3853,
2131,
10288,
20110,
3258,
1006,
2004,
2102,
1010,
2707,
1010,
2203,
1010,
5371,
18209,
1007,
1063,
13075,
4654,
2361,
2078,
1027,
4858,
3126,
22494,
13629,
2595,
20110,
3258,
1006,
2004,
2102,
1010,
1063,
2707,
1024,
2707,
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... |
angular/material | src/components/dialog/dialog.js | advancedDialogOptions | function advancedDialogOptions() {
return {
template: [
'<md-dialog md-theme="{{ dialog.theme || dialog.defaultTheme }}" aria-label="{{ dialog.ariaLabel }}" ng-class="dialog.css">',
' <md-dialog-content class="md-dialog-content" role="document" tabIndex="-1">',
' <h2 class="md-title">{{ dialog.title }}</h2>',
' <div ng-if="::dialog.mdHtmlContent" class="md-dialog-content-body" ',
' ng-bind-html="::dialog.mdHtmlContent"></div>',
' <div ng-if="::!dialog.mdHtmlContent" class="md-dialog-content-body">',
' <p>{{::dialog.mdTextContent}}</p>',
' </div>',
' <md-input-container md-no-float ng-if="::dialog.$type == \'prompt\'" class="md-prompt-input-container">',
' <input ng-keypress="dialog.keypress($event)" md-autofocus ng-model="dialog.result" ' +
' placeholder="{{::dialog.placeholder}}" ng-required="dialog.required">',
' </md-input-container>',
' </md-dialog-content>',
' <md-dialog-actions>',
' <md-button ng-if="dialog.$type === \'confirm\' || dialog.$type === \'prompt\'"' +
' ng-click="dialog.abort()" class="md-primary md-cancel-button">',
' {{ dialog.cancel }}',
' </md-button>',
' <md-button ng-click="dialog.hide()" class="md-primary md-confirm-button" md-autofocus="dialog.$type===\'alert\'"' +
' ng-disabled="dialog.required && !dialog.result">',
' {{ dialog.ok }}',
' </md-button>',
' </md-dialog-actions>',
'</md-dialog>'
].join('').replace(/\s\s+/g, ''),
controller: MdDialogController,
controllerAs: 'dialog',
bindToController: true,
};
} | javascript | function advancedDialogOptions() {
return {
template: [
'<md-dialog md-theme="{{ dialog.theme || dialog.defaultTheme }}" aria-label="{{ dialog.ariaLabel }}" ng-class="dialog.css">',
' <md-dialog-content class="md-dialog-content" role="document" tabIndex="-1">',
' <h2 class="md-title">{{ dialog.title }}</h2>',
' <div ng-if="::dialog.mdHtmlContent" class="md-dialog-content-body" ',
' ng-bind-html="::dialog.mdHtmlContent"></div>',
' <div ng-if="::!dialog.mdHtmlContent" class="md-dialog-content-body">',
' <p>{{::dialog.mdTextContent}}</p>',
' </div>',
' <md-input-container md-no-float ng-if="::dialog.$type == \'prompt\'" class="md-prompt-input-container">',
' <input ng-keypress="dialog.keypress($event)" md-autofocus ng-model="dialog.result" ' +
' placeholder="{{::dialog.placeholder}}" ng-required="dialog.required">',
' </md-input-container>',
' </md-dialog-content>',
' <md-dialog-actions>',
' <md-button ng-if="dialog.$type === \'confirm\' || dialog.$type === \'prompt\'"' +
' ng-click="dialog.abort()" class="md-primary md-cancel-button">',
' {{ dialog.cancel }}',
' </md-button>',
' <md-button ng-click="dialog.hide()" class="md-primary md-confirm-button" md-autofocus="dialog.$type===\'alert\'"' +
' ng-disabled="dialog.required && !dialog.result">',
' {{ dialog.ok }}',
' </md-button>',
' </md-dialog-actions>',
'</md-dialog>'
].join('').replace(/\s\s+/g, ''),
controller: MdDialogController,
controllerAs: 'dialog',
bindToController: true,
};
} | [
"function",
"advancedDialogOptions",
"(",
")",
"{",
"return",
"{",
"template",
":",
"[",
"'<md-dialog md-theme=\"{{ dialog.theme || dialog.defaultTheme }}\" aria-label=\"{{ dialog.ariaLabel }}\" ng-class=\"dialog.css\">'",
",",
"' <md-dialog-content class=\"md-dialog-content\" role=\"docume... | /* @ngInject | [
"/",
"*"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L609-L641 | train | A simple advanced dialog options | [
30522,
3853,
3935,
27184,
22844,
16790,
2015,
1006,
1007,
1063,
2709,
1063,
23561,
1024,
1031,
1005,
1026,
9108,
1011,
13764,
8649,
9108,
1011,
4323,
1027,
1000,
1063,
1063,
13764,
8649,
1012,
4323,
1064,
1064,
13764,
8649,
1012,
12398,
107... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/vars-on-top.js | looksLikeImport | function looksLikeImport(node) {
return node.type === "ImportDeclaration" || node.type === "ImportSpecifier" ||
node.type === "ImportDefaultSpecifier" || node.type === "ImportNamespaceSpecifier";
} | javascript | function looksLikeImport(node) {
return node.type === "ImportDeclaration" || node.type === "ImportSpecifier" ||
node.type === "ImportDefaultSpecifier" || node.type === "ImportNamespaceSpecifier";
} | [
"function",
"looksLikeImport",
"(",
"node",
")",
"{",
"return",
"node",
".",
"type",
"===",
"\"ImportDeclaration\"",
"||",
"node",
".",
"type",
"===",
"\"ImportSpecifier\"",
"||",
"node",
".",
"type",
"===",
"\"ImportDefaultSpecifier\"",
"||",
"node",
".",
"type... | Check to see if its a ES6 import declaration
@param {ASTNode} node - any node
@returns {boolean} whether the given node represents a import declaration | [
"Check",
"to",
"see",
"if",
"its",
"a",
"ES6",
"import",
"declaration"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/vars-on-top.js#L49-L52 | train | Check if a node looks like an import | [
30522,
3853,
3504,
10359,
5714,
6442,
1006,
13045,
1007,
1063,
2709,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
12324,
3207,
20464,
25879,
3258,
1000,
1064,
1064,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
17589,
5051,
6895,
8873,
2121,
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... |
summernote/summernote | src/js/base/core/lists.js | compact | function compact(array) {
const aResult = [];
for (let idx = 0, len = array.length; idx < len; idx++) {
if (array[idx]) { aResult.push(array[idx]); }
}
return aResult;
} | javascript | function compact(array) {
const aResult = [];
for (let idx = 0, len = array.length; idx < len; idx++) {
if (array[idx]) { aResult.push(array[idx]); }
}
return aResult;
} | [
"function",
"compact",
"(",
"array",
")",
"{",
"const",
"aResult",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"idx",
"=",
"0",
",",
"len",
"=",
"array",
".",
"length",
";",
"idx",
"<",
"len",
";",
"idx",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"... | returns a copy of the array with all false values removed
@param {Array} array - array
@param {Function} fn - predicate function for cluster rule | [
"returns",
"a",
"copy",
"of",
"the",
"array",
"with",
"all",
"false",
"values",
"removed"
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/lists.js#L134-L140 | train | Compacts an array of arrays | [
30522,
3853,
9233,
1006,
9140,
1007,
1063,
9530,
3367,
23631,
11314,
1027,
1031,
1033,
1025,
2005,
1006,
2292,
8909,
2595,
1027,
1014,
1010,
18798,
1027,
9140,
1012,
3091,
1025,
8909,
2595,
1026,
18798,
1025,
8909,
2595,
1009,
1009,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | getPreloadModelConfigsFromManifest | function getPreloadModelConfigsFromManifest(oManifest, oComponentData, mCacheTokens) {
var mModelConfigs = {
afterManifest: {},
afterPreload: {}
};
// deep clone is needed as the mainfest only returns a read-only copy (freezed object)
var oManifestDataSources = jQuery.extend(true, {}, oManifest.getEntry("/sap.app/dataSources"));
var oManifestModels = jQuery.extend(true, {}, oManifest.getEntry("/sap.ui5/models"));
var mAllModelConfigurations = Component._createManifestModelConfigurations({
models: oManifestModels,
dataSources: oManifestDataSources,
manifest: oManifest,
componentData: oComponentData,
cacheTokens: mCacheTokens
});
// Read internal URI parameter to enable model preload for testing purposes
// Specify comma separated list of model names. Use an empty segment for the "default" model
// Examples:
// sap-ui-xx-preload-component-models-<componentName>=, => prelaod default model (empty string key)
// sap-ui-xx-preload-component-models-<componentName>=foo, => prelaod "foo" + default model (empty string key)
// sap-ui-xx-preload-component-models-<componentName>=foo,bar => prelaod "foo" + "bar" models
var sPreloadModels = new UriParameters(window.location.href).get("sap-ui-xx-preload-component-models-" + oManifest.getComponentName());
var aPreloadModels = sPreloadModels && sPreloadModels.split(",");
for (var sModelName in mAllModelConfigurations) {
var mModelConfig = mAllModelConfigurations[sModelName];
// activate "preload" flag in case URI parameter for testing is used (see code above)
if (!mModelConfig.preload && aPreloadModels && aPreloadModels.indexOf(sModelName) > -1 ) {
mModelConfig.preload = true;
Log.warning("FOR TESTING ONLY!!! Activating preload for model \"" + sModelName + "\" (" + mModelConfig.type + ")",
oManifest.getComponentName(), "sap.ui.core.Component");
}
// ResourceModels with async=false should be always loaded beforehand to get rid of sync requests under the hood (regardless of the "preload" flag)
if (mModelConfig.type === "sap.ui.model.resource.ResourceModel" &&
Array.isArray(mModelConfig.settings) &&
mModelConfig.settings.length > 0 &&
mModelConfig.settings[0].async !== true
) {
// Use separate config object for ResourceModels as the resourceBundle might be
// part of the Component-preload which isn't available when the regular "preloaded"-models are created
mModelConfigs.afterPreload[sModelName] = mModelConfig;
} else if (mModelConfig.preload) {
// Only create models:
// - which are flagged for preload (mModelConfig.preload) or activated via internal URI param (see above)
// - in case the model class is already loaded (otherwise log a warning)
if (sap.ui.loader._.getModuleState(mModelConfig.type.replace(/\./g, "/") + ".js")) {
mModelConfigs.afterManifest[sModelName] = mModelConfig;
} else {
Log.warning("Can not preload model \"" + sModelName + "\" as required class has not been loaded: \"" + mModelConfig.type + "\"",
oManifest.getComponentName(), "sap.ui.core.Component");
}
}
}
return mModelConfigs;
} | javascript | function getPreloadModelConfigsFromManifest(oManifest, oComponentData, mCacheTokens) {
var mModelConfigs = {
afterManifest: {},
afterPreload: {}
};
// deep clone is needed as the mainfest only returns a read-only copy (freezed object)
var oManifestDataSources = jQuery.extend(true, {}, oManifest.getEntry("/sap.app/dataSources"));
var oManifestModels = jQuery.extend(true, {}, oManifest.getEntry("/sap.ui5/models"));
var mAllModelConfigurations = Component._createManifestModelConfigurations({
models: oManifestModels,
dataSources: oManifestDataSources,
manifest: oManifest,
componentData: oComponentData,
cacheTokens: mCacheTokens
});
// Read internal URI parameter to enable model preload for testing purposes
// Specify comma separated list of model names. Use an empty segment for the "default" model
// Examples:
// sap-ui-xx-preload-component-models-<componentName>=, => prelaod default model (empty string key)
// sap-ui-xx-preload-component-models-<componentName>=foo, => prelaod "foo" + default model (empty string key)
// sap-ui-xx-preload-component-models-<componentName>=foo,bar => prelaod "foo" + "bar" models
var sPreloadModels = new UriParameters(window.location.href).get("sap-ui-xx-preload-component-models-" + oManifest.getComponentName());
var aPreloadModels = sPreloadModels && sPreloadModels.split(",");
for (var sModelName in mAllModelConfigurations) {
var mModelConfig = mAllModelConfigurations[sModelName];
// activate "preload" flag in case URI parameter for testing is used (see code above)
if (!mModelConfig.preload && aPreloadModels && aPreloadModels.indexOf(sModelName) > -1 ) {
mModelConfig.preload = true;
Log.warning("FOR TESTING ONLY!!! Activating preload for model \"" + sModelName + "\" (" + mModelConfig.type + ")",
oManifest.getComponentName(), "sap.ui.core.Component");
}
// ResourceModels with async=false should be always loaded beforehand to get rid of sync requests under the hood (regardless of the "preload" flag)
if (mModelConfig.type === "sap.ui.model.resource.ResourceModel" &&
Array.isArray(mModelConfig.settings) &&
mModelConfig.settings.length > 0 &&
mModelConfig.settings[0].async !== true
) {
// Use separate config object for ResourceModels as the resourceBundle might be
// part of the Component-preload which isn't available when the regular "preloaded"-models are created
mModelConfigs.afterPreload[sModelName] = mModelConfig;
} else if (mModelConfig.preload) {
// Only create models:
// - which are flagged for preload (mModelConfig.preload) or activated via internal URI param (see above)
// - in case the model class is already loaded (otherwise log a warning)
if (sap.ui.loader._.getModuleState(mModelConfig.type.replace(/\./g, "/") + ".js")) {
mModelConfigs.afterManifest[sModelName] = mModelConfig;
} else {
Log.warning("Can not preload model \"" + sModelName + "\" as required class has not been loaded: \"" + mModelConfig.type + "\"",
oManifest.getComponentName(), "sap.ui.core.Component");
}
}
}
return mModelConfigs;
} | [
"function",
"getPreloadModelConfigsFromManifest",
"(",
"oManifest",
",",
"oComponentData",
",",
"mCacheTokens",
")",
"{",
"var",
"mModelConfigs",
"=",
"{",
"afterManifest",
":",
"{",
"}",
",",
"afterPreload",
":",
"{",
"}",
"}",
";",
"// deep clone is needed as the ... | Returns two maps of model configurations to be used for the model "preload" feature.
Used within loadComponent to create models during component load.
"afterManifest"
Models that are activated for preload via "preload=true" or URI parameter.
They will be created after the manifest is available.
"afterPreload"
Currently only for ResourceModels with async=false (default) to prevent sync requests
by loading the corresponding ResourceBundle in advance.
They will be created after the Component-preload has been loaded, as most apps package
their ResourceBundles within the Component-preload.
@param {sap.ui.core.Manifest} oManifest Manifest instance
@param {object} [oComponentData] optional component data object
@param {object} [mCacheTokens] optional cache tokens for OData models
@returns {object} object with two maps, see above | [
"Returns",
"two",
"maps",
"of",
"model",
"configurations",
"to",
"be",
"used",
"for",
"the",
"model",
"preload",
"feature",
".",
"Used",
"within",
"loadComponent",
"to",
"create",
"models",
"during",
"component",
"load",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L1728-L1789 | train | Creates a list of model configurations from the manifest | [
30522,
3853,
2131,
28139,
11066,
5302,
9247,
8663,
8873,
5620,
19699,
5358,
20799,
14081,
1006,
16640,
29323,
3367,
1010,
1051,
9006,
29513,
3372,
2850,
2696,
1010,
22432,
20318,
11045,
3619,
1007,
1063,
13075,
3461,
10244,
22499,
2078,
8873,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/animation/Animator.js | fillArr | function fillArr(arr0, arr1, arrDim) {
var arr0Len = arr0.length;
var arr1Len = arr1.length;
if (arr0Len !== arr1Len) {
// FIXME Not work for TypedArray
var isPreviousLarger = arr0Len > arr1Len;
if (isPreviousLarger) {
// Cut the previous
arr0.length = arr1Len;
}
else {
// Fill the previous
for (var i = arr0Len; i < arr1Len; i++) {
arr0.push(
arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i])
);
}
}
}
// Handling NaN value
var len2 = arr0[0] && arr0[0].length;
for (var i = 0; i < arr0.length; i++) {
if (arrDim === 1) {
if (isNaN(arr0[i])) {
arr0[i] = arr1[i];
}
}
else {
for (var j = 0; j < len2; j++) {
if (isNaN(arr0[i][j])) {
arr0[i][j] = arr1[i][j];
}
}
}
}
} | javascript | function fillArr(arr0, arr1, arrDim) {
var arr0Len = arr0.length;
var arr1Len = arr1.length;
if (arr0Len !== arr1Len) {
// FIXME Not work for TypedArray
var isPreviousLarger = arr0Len > arr1Len;
if (isPreviousLarger) {
// Cut the previous
arr0.length = arr1Len;
}
else {
// Fill the previous
for (var i = arr0Len; i < arr1Len; i++) {
arr0.push(
arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i])
);
}
}
}
// Handling NaN value
var len2 = arr0[0] && arr0[0].length;
for (var i = 0; i < arr0.length; i++) {
if (arrDim === 1) {
if (isNaN(arr0[i])) {
arr0[i] = arr1[i];
}
}
else {
for (var j = 0; j < len2; j++) {
if (isNaN(arr0[i][j])) {
arr0[i][j] = arr1[i][j];
}
}
}
}
} | [
"function",
"fillArr",
"(",
"arr0",
",",
"arr1",
",",
"arrDim",
")",
"{",
"var",
"arr0Len",
"=",
"arr0",
".",
"length",
";",
"var",
"arr1Len",
"=",
"arr1",
".",
"length",
";",
"if",
"(",
"arr0Len",
"!==",
"arr1Len",
")",
"{",
"// FIXME Not work for Typed... | arr0 is source array, arr1 is target array. Do some preprocess to avoid error happened when interpolating from arr0 to arr1 | [
"arr0",
"is",
"source",
"array",
"arr1",
"is",
"target",
"array",
".",
"Do",
"some",
"preprocess",
"to",
"avoid",
"error",
"happened",
"when",
"interpolating",
"from",
"arr0",
"to",
"arr1"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/animation/Animator.js#L67-L102 | train | Fill the array with the values of the second array | [
30522,
3853,
6039,
2906,
2099,
1006,
12098,
2099,
2692,
1010,
12098,
2099,
2487,
1010,
12098,
17080,
2213,
1007,
1063,
13075,
12098,
2099,
2692,
7770,
1027,
12098,
2099,
2692,
1012,
3091,
1025,
13075,
12098,
2099,
2487,
7770,
1027,
12098,
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... |
laurent22/joplin | Clipper/joplin-webclipper/content_scripts/Readability.js | function(node) {
return node.nodeType === this.TEXT_NODE || this.PHRASING_ELEMS.indexOf(node.tagName) !== -1 ||
((node.tagName === "A" || node.tagName === "DEL" || node.tagName === "INS") &&
this._everyNode(node.childNodes, this._isPhrasingContent));
} | javascript | function(node) {
return node.nodeType === this.TEXT_NODE || this.PHRASING_ELEMS.indexOf(node.tagName) !== -1 ||
((node.tagName === "A" || node.tagName === "DEL" || node.tagName === "INS") &&
this._everyNode(node.childNodes, this._isPhrasingContent));
} | [
"function",
"(",
"node",
")",
"{",
"return",
"node",
".",
"nodeType",
"===",
"this",
".",
"TEXT_NODE",
"||",
"this",
".",
"PHRASING_ELEMS",
".",
"indexOf",
"(",
"node",
".",
"tagName",
")",
"!==",
"-",
"1",
"||",
"(",
"(",
"node",
".",
"tagName",
"==... | *
Determine if a node qualifies as phrasing content.
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content | [
"*",
"Determine",
"if",
"a",
"node",
"qualifies",
"as",
"phrasing",
"content",
".",
"https",
":",
"//",
"developer",
".",
"mozilla",
".",
"org",
"/",
"en",
"-",
"US",
"/",
"docs",
"/",
"Web",
"/",
"Guide",
"/",
"HTML",
"/",
"Content_categories#Phrasing_c... | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L1320-L1324 | train | Returns true if node is a phrasing element | [
30522,
3853,
1006,
13045,
1007,
1063,
2709,
13045,
1012,
13045,
13874,
1027,
1027,
1027,
2023,
1012,
3793,
1035,
13045,
1064,
1064,
2023,
1012,
6887,
8180,
2075,
1035,
3449,
6633,
2015,
1012,
5950,
11253,
1006,
13045,
1012,
6415,
18442,
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... | |
adobe/brackets | src/language/CSSUtils.js | _findMatchingRulesInStyleBlocks | function _findMatchingRulesInStyleBlocks(htmlDocument, selector, resultSelectors) {
// HTMLUtils requires a real CodeMirror instance; make sure we can give it the right Editor
var htmlEditor = EditorManager.getCurrentFullEditor();
if (htmlEditor.document !== htmlDocument) {
console.error("Cannot search for <style> blocks in HTML file other than current editor");
return;
}
// Find all <style> blocks in the HTML file
var styleBlocks = HTMLUtils.findStyleBlocks(htmlEditor);
styleBlocks.forEach(function (styleBlockInfo) {
// Search this one <style> block's content, appending results to 'resultSelectors'
var oneStyleBlockMatches = _findAllMatchingSelectorsInText(styleBlockInfo.text, selector);
_addSelectorsToResults(resultSelectors, oneStyleBlockMatches, htmlDocument, styleBlockInfo.start.line);
});
} | javascript | function _findMatchingRulesInStyleBlocks(htmlDocument, selector, resultSelectors) {
// HTMLUtils requires a real CodeMirror instance; make sure we can give it the right Editor
var htmlEditor = EditorManager.getCurrentFullEditor();
if (htmlEditor.document !== htmlDocument) {
console.error("Cannot search for <style> blocks in HTML file other than current editor");
return;
}
// Find all <style> blocks in the HTML file
var styleBlocks = HTMLUtils.findStyleBlocks(htmlEditor);
styleBlocks.forEach(function (styleBlockInfo) {
// Search this one <style> block's content, appending results to 'resultSelectors'
var oneStyleBlockMatches = _findAllMatchingSelectorsInText(styleBlockInfo.text, selector);
_addSelectorsToResults(resultSelectors, oneStyleBlockMatches, htmlDocument, styleBlockInfo.start.line);
});
} | [
"function",
"_findMatchingRulesInStyleBlocks",
"(",
"htmlDocument",
",",
"selector",
",",
"resultSelectors",
")",
"{",
"// HTMLUtils requires a real CodeMirror instance; make sure we can give it the right Editor",
"var",
"htmlEditor",
"=",
"EditorManager",
".",
"getCurrentFullEditor"... | Finds matching selectors in the <style> block of a single HTML file; adds them to 'resultSelectors' | [
"Finds",
"matching",
"selectors",
"in",
"the",
"<style",
">",
"block",
"of",
"a",
"single",
"HTML",
"file",
";",
"adds",
"them",
"to",
"resultSelectors"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CSSUtils.js#L1461-L1477 | train | Find all matching rules in the given selector in the given HTML document | [
30522,
3853,
1035,
2424,
18900,
8450,
6820,
4244,
7076,
27983,
23467,
2015,
1006,
16129,
3527,
24894,
4765,
1010,
27000,
1010,
3463,
12260,
24817,
1007,
1063,
1013,
1013,
16129,
21823,
4877,
5942,
1037,
2613,
3642,
14503,
29165,
6013,
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.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js | function () {
var that = this;
var oSelectedContentModel = this.getView().getModel("selectedContent");
var oContentData = oSelectedContentModel.getData();
var sLayer;
var sTransportIdFromContent, sPackageFromContent, sTransportId, sPackageName;
oContentData.metadata.some(function (oMetadata) {
if (oMetadata.name === "layer") {
sLayer = oMetadata.value;
return true;
}
});
oContentData.metadata.some(function (mMetadata) {
if (mMetadata.name === "transportId") {
sTransportIdFromContent = mMetadata.value;
return true;
}
});
try {
sPackageFromContent = JSON.parse(oContentData.data).packageName;
} catch (e) {
//when content is not in JSON format (Ex: js or code_ext file), package is undefined but does not break the code.
}
if ((sLayer === "USER") ||
(sLayer === "LOAD") ||
(sLayer === "VENDOR_LOAD") ||
(!sTransportIdFromContent && (!sPackageFromContent || sPackageFromContent === "$TMP"))){
sTransportId = undefined;
this._saveFile(sLayer, oContentData.namespace, oContentData.fileName, oContentData.fileType, oContentData.data, sTransportId, sPackageName);
} else if (sTransportIdFromContent === "ATO_NOTIFICATION") {
sTransportId = sTransportIdFromContent;
this._saveFile(sLayer, oContentData.namespace, oContentData.fileName, oContentData.fileType, oContentData.data, sTransportId, sPackageName);
} else {
var isPackageVisible = (sLayer === "VENDOR" || sLayer === "CUSTOMER_BASE") ? true : false;
var oPackageInput = new Input({visible: isPackageVisible, placeholder: "Package name (Only necessary for cross client content)" });
var oTransportInput = new Input({placeholder: "Transport ID or ATO_NOTIFICATION" });
var oDialog = new Dialog({
title: "{i18n>transportInput}",
type: "Message",
content: [
new Text({text: "{i18n>transportInputDescription}"}),
oPackageInput,
oTransportInput],
beginButton: new Button({
text: "{i18n>confirm}",
type: ButtonType.Reject,
press: function () {
sPackageName = oPackageInput.getValue();
sTransportId = oTransportInput.getValue();
oDialog.close();
that._saveFile(sLayer, oContentData.namespace, oContentData.fileName, oContentData.fileType, oContentData.data, sTransportId, sPackageName);
}
}),
endButton: new Button({
text: "{i18n>cancel}",
press: function () {
oDialog.close();
}
}),
afterClose: function () {
oDialog.destroy();
}
});
this.getView().addDependent(oDialog);
oDialog.open();
}
} | javascript | function () {
var that = this;
var oSelectedContentModel = this.getView().getModel("selectedContent");
var oContentData = oSelectedContentModel.getData();
var sLayer;
var sTransportIdFromContent, sPackageFromContent, sTransportId, sPackageName;
oContentData.metadata.some(function (oMetadata) {
if (oMetadata.name === "layer") {
sLayer = oMetadata.value;
return true;
}
});
oContentData.metadata.some(function (mMetadata) {
if (mMetadata.name === "transportId") {
sTransportIdFromContent = mMetadata.value;
return true;
}
});
try {
sPackageFromContent = JSON.parse(oContentData.data).packageName;
} catch (e) {
//when content is not in JSON format (Ex: js or code_ext file), package is undefined but does not break the code.
}
if ((sLayer === "USER") ||
(sLayer === "LOAD") ||
(sLayer === "VENDOR_LOAD") ||
(!sTransportIdFromContent && (!sPackageFromContent || sPackageFromContent === "$TMP"))){
sTransportId = undefined;
this._saveFile(sLayer, oContentData.namespace, oContentData.fileName, oContentData.fileType, oContentData.data, sTransportId, sPackageName);
} else if (sTransportIdFromContent === "ATO_NOTIFICATION") {
sTransportId = sTransportIdFromContent;
this._saveFile(sLayer, oContentData.namespace, oContentData.fileName, oContentData.fileType, oContentData.data, sTransportId, sPackageName);
} else {
var isPackageVisible = (sLayer === "VENDOR" || sLayer === "CUSTOMER_BASE") ? true : false;
var oPackageInput = new Input({visible: isPackageVisible, placeholder: "Package name (Only necessary for cross client content)" });
var oTransportInput = new Input({placeholder: "Transport ID or ATO_NOTIFICATION" });
var oDialog = new Dialog({
title: "{i18n>transportInput}",
type: "Message",
content: [
new Text({text: "{i18n>transportInputDescription}"}),
oPackageInput,
oTransportInput],
beginButton: new Button({
text: "{i18n>confirm}",
type: ButtonType.Reject,
press: function () {
sPackageName = oPackageInput.getValue();
sTransportId = oTransportInput.getValue();
oDialog.close();
that._saveFile(sLayer, oContentData.namespace, oContentData.fileName, oContentData.fileType, oContentData.data, sTransportId, sPackageName);
}
}),
endButton: new Button({
text: "{i18n>cancel}",
press: function () {
oDialog.close();
}
}),
afterClose: function () {
oDialog.destroy();
}
});
this.getView().addDependent(oDialog);
oDialog.open();
}
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"oSelectedContentModel",
"=",
"this",
".",
"getView",
"(",
")",
".",
"getModel",
"(",
"\"selectedContent\"",
")",
";",
"var",
"oContentData",
"=",
"oSelectedContentModel",
".",
"getData",
"("... | Handler for a "Save" action in "Edit" mode;
Checks the current layer, namespace, filename, and file type and select correct transport id (through a dialog if necessary) and trigger save request of file.
@public | [
"Handler",
"for",
"a",
"Save",
"action",
"in",
"Edit",
"mode",
";",
"Checks",
"the",
"current",
"layer",
"namespace",
"filename",
"and",
"file",
"type",
"and",
"select",
"correct",
"transport",
"id",
"(",
"through",
"a",
"dialog",
"if",
"necessary",
")",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js#L118-L185 | train | Saves the selected content to the file system. | [
30522,
3853,
1006,
1007,
1063,
13075,
2008,
1027,
2023,
1025,
13075,
9808,
12260,
10985,
8663,
6528,
21246,
10244,
2140,
1027,
2023,
1012,
2131,
8584,
1006,
1007,
1012,
2131,
5302,
9247,
1006,
1000,
3479,
8663,
6528,
2102,
1000,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
nhn/tui.editor | src/js/extensions/table/mergedTableRemoveCol.js | _updateMergeStartIndex | function _updateMergeStartIndex(tableData, startColIndex, endColIndex) {
tableData.forEach(rowData => {
rowData.slice(endColIndex + 1).forEach(cellData => {
if (util.isExisty(cellData.colMergeWith) && cellData.colMergeWith >= startColIndex) {
cellData.colMergeWith = endColIndex + 1;
}
});
});
} | javascript | function _updateMergeStartIndex(tableData, startColIndex, endColIndex) {
tableData.forEach(rowData => {
rowData.slice(endColIndex + 1).forEach(cellData => {
if (util.isExisty(cellData.colMergeWith) && cellData.colMergeWith >= startColIndex) {
cellData.colMergeWith = endColIndex + 1;
}
});
});
} | [
"function",
"_updateMergeStartIndex",
"(",
"tableData",
",",
"startColIndex",
",",
"endColIndex",
")",
"{",
"tableData",
".",
"forEach",
"(",
"rowData",
"=>",
"{",
"rowData",
".",
"slice",
"(",
"endColIndex",
"+",
"1",
")",
".",
"forEach",
"(",
"cellData",
"... | Update row merge start index to merged cell.
@param {Array.<Array.<object>>} tableData - table data
@param {number} startColIndex - start col index
@param {number} endColIndex - end col index
@private | [
"Update",
"row",
"merge",
"start",
"index",
"to",
"merged",
"cell",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableRemoveCol.js#L95-L103 | train | Update merge start index | [
30522,
3853,
1035,
10651,
5017,
8449,
7559,
7629,
3207,
2595,
1006,
2795,
2850,
2696,
1010,
2707,
25778,
22254,
10288,
1010,
2203,
25778,
22254,
10288,
1007,
1063,
2795,
2850,
2696,
1012,
18921,
6776,
1006,
5216,
2850,
2696,
1027,
1028,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/Preferences.js | Preferences | function Preferences(prefs) {
var BASE_EXCLUDED_DIRECTORIES = null, /* if the user has settings, we don't exclude anything by default */
// exclude node_modules for performance reasons and because we don't do full hinting for those anyhow.
DEFAULT_EXCLUDED_DIRECTORIES = /node_modules/,
// exclude require and jquery since we have special knowledge of those
BASE_EXCLUDED_FILES = /^require.*\.js$|^jquery.*\.js$/,
DEFAULT_MAX_FILE_COUNT = 100,
DEFAULT_MAX_FILE_SIZE = 512 * 1024;
if (prefs) {
this._excludedDirectories = settingsToRegExp(prefs["excluded-directories"],
BASE_EXCLUDED_DIRECTORIES,
DEFAULT_EXCLUDED_DIRECTORIES);
this._excludedFiles = settingsToRegExp(prefs["excluded-files"],
BASE_EXCLUDED_FILES);
this._maxFileCount = prefs["max-file-count"];
this._maxFileSize = prefs["max-file-size"];
// sanity check values
if (!this._maxFileCount || this._maxFileCount < 0) {
this._maxFileCount = DEFAULT_MAX_FILE_COUNT;
}
if (!this._maxFileSize || this._maxFileSize < 0) {
this._maxFileSize = DEFAULT_MAX_FILE_SIZE;
}
} else {
this._excludedDirectories = DEFAULT_EXCLUDED_DIRECTORIES;
this._excludedFiles = BASE_EXCLUDED_FILES;
this._maxFileCount = DEFAULT_MAX_FILE_COUNT;
this._maxFileSize = DEFAULT_MAX_FILE_SIZE;
}
} | javascript | function Preferences(prefs) {
var BASE_EXCLUDED_DIRECTORIES = null, /* if the user has settings, we don't exclude anything by default */
// exclude node_modules for performance reasons and because we don't do full hinting for those anyhow.
DEFAULT_EXCLUDED_DIRECTORIES = /node_modules/,
// exclude require and jquery since we have special knowledge of those
BASE_EXCLUDED_FILES = /^require.*\.js$|^jquery.*\.js$/,
DEFAULT_MAX_FILE_COUNT = 100,
DEFAULT_MAX_FILE_SIZE = 512 * 1024;
if (prefs) {
this._excludedDirectories = settingsToRegExp(prefs["excluded-directories"],
BASE_EXCLUDED_DIRECTORIES,
DEFAULT_EXCLUDED_DIRECTORIES);
this._excludedFiles = settingsToRegExp(prefs["excluded-files"],
BASE_EXCLUDED_FILES);
this._maxFileCount = prefs["max-file-count"];
this._maxFileSize = prefs["max-file-size"];
// sanity check values
if (!this._maxFileCount || this._maxFileCount < 0) {
this._maxFileCount = DEFAULT_MAX_FILE_COUNT;
}
if (!this._maxFileSize || this._maxFileSize < 0) {
this._maxFileSize = DEFAULT_MAX_FILE_SIZE;
}
} else {
this._excludedDirectories = DEFAULT_EXCLUDED_DIRECTORIES;
this._excludedFiles = BASE_EXCLUDED_FILES;
this._maxFileCount = DEFAULT_MAX_FILE_COUNT;
this._maxFileSize = DEFAULT_MAX_FILE_SIZE;
}
} | [
"function",
"Preferences",
"(",
"prefs",
")",
"{",
"var",
"BASE_EXCLUDED_DIRECTORIES",
"=",
"null",
",",
"/* if the user has settings, we don't exclude anything by default */",
"// exclude node_modules for performance reasons and because we don't do full hinting for those anyhow.",
"DEFAUL... | Constructor to create a default preference object.
@constructor
@param {Object=} prefs - preference object | [
"Constructor",
"to",
"create",
"a",
"default",
"preference",
"object",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/Preferences.js#L146-L179 | train | Constructor for preferences | [
30522,
3853,
18394,
1006,
3653,
10343,
1007,
1063,
13075,
2918,
1035,
12421,
1035,
2472,
3111,
1027,
19701,
1010,
1013,
1008,
2065,
1996,
5310,
2038,
10906,
1010,
2057,
2123,
1005,
1056,
23329,
2505,
2011,
12398,
1008,
1013,
1013,
1013,
233... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc-node | packages/grpc-native-core/src/client_interceptors.js | getCall | function getCall(channel, path, options) {
var deadline;
var host;
var parent;
var propagate_flags;
var credentials;
if (options) {
deadline = options.deadline;
host = options.host;
parent = options.parent ? options.parent.call : undefined;
propagate_flags = options.propagate_flags;
credentials = options.credentials;
}
if (deadline === undefined) {
deadline = Infinity;
}
var call = channel.createCall(path, deadline, host,
parent, propagate_flags);
if (credentials) {
call.setCredentials(credentials);
}
return call;
} | javascript | function getCall(channel, path, options) {
var deadline;
var host;
var parent;
var propagate_flags;
var credentials;
if (options) {
deadline = options.deadline;
host = options.host;
parent = options.parent ? options.parent.call : undefined;
propagate_flags = options.propagate_flags;
credentials = options.credentials;
}
if (deadline === undefined) {
deadline = Infinity;
}
var call = channel.createCall(path, deadline, host,
parent, propagate_flags);
if (credentials) {
call.setCredentials(credentials);
}
return call;
} | [
"function",
"getCall",
"(",
"channel",
",",
"path",
",",
"options",
")",
"{",
"var",
"deadline",
";",
"var",
"host",
";",
"var",
"parent",
";",
"var",
"propagate_flags",
";",
"var",
"credentials",
";",
"if",
"(",
"options",
")",
"{",
"deadline",
"=",
"... | Get a call object built with the provided options.
@param {grpc.Channel} channel
@param {string} path
@param {grpc.Client~CallOptions=} options Options object. | [
"Get",
"a",
"call",
"object",
"built",
"with",
"the",
"provided",
"options",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L639-L661 | train | Get call object | [
30522,
3853,
2131,
9289,
2140,
1006,
3149,
1010,
4130,
1010,
7047,
1007,
1063,
13075,
15117,
1025,
13075,
3677,
1025,
13075,
6687,
1025,
13075,
17678,
16098,
2618,
1035,
9245,
1025,
13075,
22496,
1025,
2065,
1006,
7047,
1007,
1063,
15117,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
catapult-project/catapult | netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js | setScrollLeftForDocument | function setScrollLeftForDocument(doc, value) {
doc.documentElement.scrollLeft = doc.body.scrollLeft = value;
} | javascript | function setScrollLeftForDocument(doc, value) {
doc.documentElement.scrollLeft = doc.body.scrollLeft = value;
} | [
"function",
"setScrollLeftForDocument",
"(",
"doc",
",",
"value",
")",
"{",
"doc",
".",
"documentElement",
".",
"scrollLeft",
"=",
"doc",
".",
"body",
".",
"scrollLeft",
"=",
"value",
";",
"}"
] | Alias for document.scrollLeft setter.
@param {!HTMLDocument} doc The document node where information will be
queried from.
@param {number} value The target X scroll offset. | [
"Alias",
"for",
"document",
".",
"scrollLeft",
"setter",
"."
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L335-L337 | train | Set the scroll left of a document | [
30522,
3853,
4520,
26775,
14511,
2571,
6199,
3877,
10085,
27417,
2102,
1006,
9986,
1010,
3643,
1007,
1063,
9986,
1012,
6254,
12260,
3672,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/firebaseui-web | soy/viewhelper.js | loadRecaptcha | function loadRecaptcha(container) {
var root = goog.dom.getElement(container);
var recaptchaContainer =
goog.dom.getElementByClass('firebaseui-recaptcha-container', root);
recaptchaContainer.style.display = 'block';
var img = goog.dom.createElement('img');
img.src = '../image/test/recaptcha-widget.png';
recaptchaContainer.appendChild(img);
} | javascript | function loadRecaptcha(container) {
var root = goog.dom.getElement(container);
var recaptchaContainer =
goog.dom.getElementByClass('firebaseui-recaptcha-container', root);
recaptchaContainer.style.display = 'block';
var img = goog.dom.createElement('img');
img.src = '../image/test/recaptcha-widget.png';
recaptchaContainer.appendChild(img);
} | [
"function",
"loadRecaptcha",
"(",
"container",
")",
"{",
"var",
"root",
"=",
"goog",
".",
"dom",
".",
"getElement",
"(",
"container",
")",
";",
"var",
"recaptchaContainer",
"=",
"goog",
".",
"dom",
".",
"getElementByClass",
"(",
"'firebaseui-recaptcha-container'... | Simulates a reCAPTCHA being rendered for UI testing. This will just load a
mock visible reCAPTCHA in the reCAPTCHA element.
@param {Element} container The root container that holds the reCAPTCHA. | [
"Simulates",
"a",
"reCAPTCHA",
"being",
"rendered",
"for",
"UI",
"testing",
".",
"This",
"will",
"just",
"load",
"a",
"mock",
"visible",
"reCAPTCHA",
"in",
"the",
"reCAPTCHA",
"element",
"."
] | c10aa51e38aeb38dc63baa22b48cd6690c2be087 | https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/soy/viewhelper.js#L59-L67 | train | Load the recaptcha widget into the DOM. | [
30522,
3853,
7170,
2890,
17695,
10649,
2050,
1006,
11661,
1007,
1063,
13075,
7117,
1027,
27571,
2290,
1012,
14383,
1012,
2131,
12260,
3672,
1006,
11661,
1007,
1025,
13075,
28667,
9331,
10649,
22684,
12380,
26455,
1027,
27571,
2290,
1012,
1438... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Microsoft/vscode | src/main.js | configureCommandlineSwitches | function configureCommandlineSwitches(cliArgs, nodeCachedDataDir) {
// Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791)
app.commandLine.appendSwitch('disable-color-correct-rendering');
// Support JS Flags
const jsFlags = resolveJSFlags(cliArgs, nodeCachedDataDir.jsFlags());
if (jsFlags) {
app.commandLine.appendSwitch('--js-flags', jsFlags);
}
// Disable smooth scrolling for Webviews
if (cliArgs['disable-smooth-scrolling']) {
app.commandLine.appendSwitch('disable-smooth-scrolling');
}
} | javascript | function configureCommandlineSwitches(cliArgs, nodeCachedDataDir) {
// Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791)
app.commandLine.appendSwitch('disable-color-correct-rendering');
// Support JS Flags
const jsFlags = resolveJSFlags(cliArgs, nodeCachedDataDir.jsFlags());
if (jsFlags) {
app.commandLine.appendSwitch('--js-flags', jsFlags);
}
// Disable smooth scrolling for Webviews
if (cliArgs['disable-smooth-scrolling']) {
app.commandLine.appendSwitch('disable-smooth-scrolling');
}
} | [
"function",
"configureCommandlineSwitches",
"(",
"cliArgs",
",",
"nodeCachedDataDir",
")",
"{",
"// Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791)",
"app",
".",
"commandLine",
".",
"appendSwitch",
"(",
"'disable-color-correct-rendering... | @typedef {import('minimist').ParsedArgs} ParsedArgs
@param {ParsedArgs} cliArgs
@param {{ jsFlags: () => string }} nodeCachedDataDir | [
"@typedef",
"{",
"import",
"(",
"minimist",
")",
".",
"ParsedArgs",
"}",
"ParsedArgs"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/main.js#L139-L154 | train | Configure command line switches | [
30522,
3853,
9530,
8873,
27390,
8586,
5358,
2386,
19422,
10586,
9148,
10649,
2229,
1006,
18856,
2401,
10623,
2015,
1010,
13045,
3540,
7690,
2850,
17713,
4313,
1007,
1063,
1013,
1013,
2486,
3653,
1011,
18546,
1011,
3438,
3609,
6337,
8304,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-trailing-spaces.js | report | function report(node, location, fixRange) {
/*
* Passing node is a bit dirty, because message data will contain big
* text in `source`. But... who cares :) ?
* One more kludge will not make worse the bloody wizardry of this
* plugin.
*/
context.report({
node,
loc: location,
message: "Trailing spaces not allowed.",
fix(fixer) {
return fixer.removeRange(fixRange);
}
});
} | javascript | function report(node, location, fixRange) {
/*
* Passing node is a bit dirty, because message data will contain big
* text in `source`. But... who cares :) ?
* One more kludge will not make worse the bloody wizardry of this
* plugin.
*/
context.report({
node,
loc: location,
message: "Trailing spaces not allowed.",
fix(fixer) {
return fixer.removeRange(fixRange);
}
});
} | [
"function",
"report",
"(",
"node",
",",
"location",
",",
"fixRange",
")",
"{",
"/*\n * Passing node is a bit dirty, because message data will contain big\n * text in `source`. But... who cares :) ?\n * One more kludge will not make worse the bloody wizardry of... | Report the error message
@param {ASTNode} node node to report
@param {int[]} location range information
@param {int[]} fixRange Range based on the whole program
@returns {void} | [
"Report",
"the",
"error",
"message"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-trailing-spaces.js#L66-L82 | train | Report an error in the context of a node. | [
30522,
3853,
3189,
1006,
13045,
1010,
3295,
1010,
8081,
24388,
2063,
1007,
1063,
1013,
1008,
1008,
4458,
13045,
2003,
1037,
2978,
6530,
1010,
2138,
4471,
2951,
2097,
5383,
2502,
1008,
3793,
1999,
1036,
3120,
1036,
1012,
2021,
1012,
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... |
electron/electron | lib/browser/guest-view-manager.js | function (embedder, guestInstanceId) {
const guestInstance = guestInstances[guestInstanceId]
if (embedder !== guestInstance.embedder) {
return
}
webViewManager.removeGuest(embedder, guestInstanceId)
delete guestInstances[guestInstanceId]
const key = `${embedder.id}-${guestInstance.elementInstanceId}`
delete embedderElementsMap[key]
} | javascript | function (embedder, guestInstanceId) {
const guestInstance = guestInstances[guestInstanceId]
if (embedder !== guestInstance.embedder) {
return
}
webViewManager.removeGuest(embedder, guestInstanceId)
delete guestInstances[guestInstanceId]
const key = `${embedder.id}-${guestInstance.elementInstanceId}`
delete embedderElementsMap[key]
} | [
"function",
"(",
"embedder",
",",
"guestInstanceId",
")",
"{",
"const",
"guestInstance",
"=",
"guestInstances",
"[",
"guestInstanceId",
"]",
"if",
"(",
"embedder",
"!==",
"guestInstance",
".",
"embedder",
")",
"{",
"return",
"}",
"webViewManager",
".",
"removeGu... | Remove an guest-embedder relationship. | [
"Remove",
"an",
"guest",
"-",
"embedder",
"relationship",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L276-L287 | train | Remove a guest from the cluster | [
30522,
3853,
1006,
7861,
8270,
4063,
1010,
4113,
7076,
26897,
3593,
1007,
1063,
9530,
3367,
4113,
7076,
26897,
1027,
4113,
7076,
26897,
2015,
1031,
4113,
7076,
26897,
3593,
1033,
2065,
1006,
7861,
8270,
4063,
999,
1027,
1027,
4113,
7076,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
aframevr/aframe | src/components/scene/vr-mode-ui.js | createOrientationModal | function createOrientationModal (onClick) {
var modal = document.createElement('div');
modal.className = ORIENTATION_MODAL_CLASS;
modal.classList.add(HIDDEN_CLASS);
modal.setAttribute(constants.AFRAME_INJECTED, '');
var exit = document.createElement('button');
exit.setAttribute(constants.AFRAME_INJECTED, '');
exit.innerHTML = 'Exit VR';
// Exit VR on close.
exit.addEventListener('click', onClick);
modal.appendChild(exit);
return modal;
} | javascript | function createOrientationModal (onClick) {
var modal = document.createElement('div');
modal.className = ORIENTATION_MODAL_CLASS;
modal.classList.add(HIDDEN_CLASS);
modal.setAttribute(constants.AFRAME_INJECTED, '');
var exit = document.createElement('button');
exit.setAttribute(constants.AFRAME_INJECTED, '');
exit.innerHTML = 'Exit VR';
// Exit VR on close.
exit.addEventListener('click', onClick);
modal.appendChild(exit);
return modal;
} | [
"function",
"createOrientationModal",
"(",
"onClick",
")",
"{",
"var",
"modal",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"modal",
".",
"className",
"=",
"ORIENTATION_MODAL_CLASS",
";",
"modal",
".",
"classList",
".",
"add",
"(",
"HIDDEN_C... | Creates a modal dialog to request the user to switch to landscape orientation.
@param {function} onClick - click event handler
@returns {Element} Wrapper <div>. | [
"Creates",
"a",
"modal",
"dialog",
"to",
"request",
"the",
"user",
"to",
"switch",
"to",
"landscape",
"orientation",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/scene/vr-mode-ui.js#L168-L184 | train | Create a modal element for orientation | [
30522,
3853,
3443,
10050,
19304,
5302,
9305,
1006,
2006,
20464,
6799,
1007,
1063,
13075,
16913,
2389,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1005,
4487,
2615,
1005,
1007,
1025,
16913,
2389,
1012,
2465,
18442,
1027,
10296,
1035,
16913,
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... |
jgraph/mxgraph | javascript/mxClient.js | function(parent, text)
{
var doc = parent.ownerDocument;
var node = doc.createTextNode(text);
if (parent != null)
{
parent.appendChild(node);
}
return node;
} | javascript | function(parent, text)
{
var doc = parent.ownerDocument;
var node = doc.createTextNode(text);
if (parent != null)
{
parent.appendChild(node);
}
return node;
} | [
"function",
"(",
"parent",
",",
"text",
")",
"{",
"var",
"doc",
"=",
"parent",
".",
"ownerDocument",
";",
"var",
"node",
"=",
"doc",
".",
"createTextNode",
"(",
"text",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"parent",
".",
"appendChil... | Function: write
Creates a text node for the given string and appends it to the given
parent. Returns the text node.
Parameters:
parent - DOM node to append the text node to.
text - String representing the text to be added. | [
"Function",
":",
"write"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3253-L3264 | train | Creates a node in the specified parent | [
30522,
3853,
1006,
6687,
1010,
3793,
1007,
1063,
13075,
9986,
1027,
6687,
1012,
3954,
3527,
24894,
4765,
1025,
13075,
13045,
1027,
9986,
1012,
3443,
18209,
3630,
3207,
1006,
3793,
1007,
1025,
2065,
1006,
6687,
999,
1027,
19701,
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... | |
openlayers/openlayers | tasks/generate-info.js | getPaths | function getPaths() {
return new Promise((resolve, reject) => {
let paths = [];
const walker = walk(sourceDir);
walker.on('file', (root, stats, next) => {
const sourcePath = path.join(root, stats.name);
if (/\.js$/.test(sourcePath)) {
paths.push(sourcePath);
}
next();
});
walker.on('errors', () => {
reject(new Error(`Trouble walking ${sourceDir}`));
});
walker.on('end', () => {
/**
* Windows has restrictions on length of command line, so passing all the
* changed paths to a task will fail if this limit is exceeded.
* To get round this, if this is Windows and there are newer files, just
* pass the sourceDir to the task so it can do the walking.
*/
if (isWindows) {
paths = [sourceDir];
}
resolve(paths);
});
});
} | javascript | function getPaths() {
return new Promise((resolve, reject) => {
let paths = [];
const walker = walk(sourceDir);
walker.on('file', (root, stats, next) => {
const sourcePath = path.join(root, stats.name);
if (/\.js$/.test(sourcePath)) {
paths.push(sourcePath);
}
next();
});
walker.on('errors', () => {
reject(new Error(`Trouble walking ${sourceDir}`));
});
walker.on('end', () => {
/**
* Windows has restrictions on length of command line, so passing all the
* changed paths to a task will fail if this limit is exceeded.
* To get round this, if this is Windows and there are newer files, just
* pass the sourceDir to the task so it can do the walking.
*/
if (isWindows) {
paths = [sourceDir];
}
resolve(paths);
});
});
} | [
"function",
"getPaths",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"paths",
"=",
"[",
"]",
";",
"const",
"walker",
"=",
"walk",
"(",
"sourceDir",
")",
";",
"walker",
".",
"on",
"(",
"'file'... | Generate a list of all .js paths in the source directory.
@return {Promise<Array>} Resolves to an array of source paths. | [
"Generate",
"a",
"list",
"of",
"all",
".",
"js",
"paths",
"in",
"the",
"source",
"directory",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/tasks/generate-info.js#L46-L76 | train | Get the list of all the paths in the source directory | [
30522,
3853,
2131,
15069,
2015,
1006,
1007,
1063,
2709,
2047,
4872,
1006,
1006,
10663,
1010,
15454,
1007,
1027,
1028,
1063,
2292,
10425,
1027,
1031,
1033,
1025,
9530,
3367,
5232,
1027,
3328,
1006,
23184,
4313,
1007,
1025,
5232,
1012,
2006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/performance-timer.js | function(markName) {
if (window.performance && window.performance.mark !== undefined) {
window.performance.mark(markName);
}
} | javascript | function(markName) {
if (window.performance && window.performance.mark !== undefined) {
window.performance.mark(markName);
}
} | [
"function",
"(",
"markName",
")",
"{",
"if",
"(",
"window",
".",
"performance",
"&&",
"window",
".",
"performance",
".",
"mark",
"!==",
"undefined",
")",
"{",
"window",
".",
"performance",
".",
"mark",
"(",
"markName",
")",
";",
"}",
"}"
] | @member {Function} mark Shims creating a new named time stamp, called a mark
@param {String} markName String name to record how long it took to get there.
A mark that already exists will be overwritten. | [
"@member",
"{",
"Function",
"}",
"mark",
"Shims",
"creating",
"a",
"new",
"named",
"time",
"stamp",
"called",
"a",
"mark",
"@param",
"{",
"String",
"}",
"markName",
"String",
"name",
"to",
"record",
"how",
"long",
"it",
"took",
"to",
"get",
"there",
".",... | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/performance-timer.js#L65-L69 | train | Mark the current performance context | [
30522,
3853,
1006,
2928,
18442,
1007,
1063,
2065,
1006,
3332,
1012,
2836,
1004,
1004,
3332,
1012,
2836,
1012,
2928,
999,
1027,
1027,
6151,
28344,
1007,
1063,
3332,
1012,
2836,
1012,
2928,
1006,
2928,
18442,
1007,
1025,
1065,
1065,
102,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | $ | function $(selector) {
var eles = this._private.elements;
if (selector) {
return eles.filter(selector);
} else {
return eles.spawnSelf();
}
} | javascript | function $(selector) {
var eles = this._private.elements;
if (selector) {
return eles.filter(selector);
} else {
return eles.spawnSelf();
}
} | [
"function",
"$",
"(",
"selector",
")",
"{",
"var",
"eles",
"=",
"this",
".",
"_private",
".",
"elements",
";",
"if",
"(",
"selector",
")",
"{",
"return",
"eles",
".",
"filter",
"(",
"selector",
")",
";",
"}",
"else",
"{",
"return",
"eles",
".",
"sp... | search the graph like jQuery | [
"search",
"the",
"graph",
"like",
"jQuery"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L13739-L13747 | train | Returns an array of elements that match the selector | [
30522,
3853,
1002,
1006,
27000,
1007,
1063,
13075,
3449,
2229,
1027,
2023,
1012,
1035,
2797,
1012,
3787,
1025,
2065,
1006,
27000,
1007,
1063,
2709,
3449,
2229,
1012,
11307,
1006,
27000,
1007,
1025,
1065,
2842,
1063,
2709,
3449,
2229,
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... |
angular/protractor | website/docgen/processors/add-links.js | function(link, doc, code) {
var type, desc;
// Split type and description
var i = link.indexOf(' ');
if (i == -1) {
desc = type = link;
} else {
desc = link.substr(i).trim();
type = link.substr(0, i).trim();
}
if (code) {
desc = '{@code ' + desc + '}'
}
desc = desc.replace(new RegExp('\n', 'g'), ' ');
if (desc in externalTypes) {
type = externalTypes[desc];
}
if (!type.match(/^https?:\/\//)) {
// Remove extra '()' at the end of types
if (type.substr(-2) == '()') {
type = type.substr(0, type.length - 2);
}
// Expand '#' at the start of types
if (type[0] == '#') {
type = doc.name.substr(0, doc.name.lastIndexOf('.') + 1) + type.substr(1);
}
// Replace '#' in the middle of types with '.'
type = type.replace(new RegExp('#', 'g'), '.prototype.');
// Only create a link if it's in the API
if (!typeTable[type]) {
return desc;
}
}
return '[' + desc + '](' + type + ')';
} | javascript | function(link, doc, code) {
var type, desc;
// Split type and description
var i = link.indexOf(' ');
if (i == -1) {
desc = type = link;
} else {
desc = link.substr(i).trim();
type = link.substr(0, i).trim();
}
if (code) {
desc = '{@code ' + desc + '}'
}
desc = desc.replace(new RegExp('\n', 'g'), ' ');
if (desc in externalTypes) {
type = externalTypes[desc];
}
if (!type.match(/^https?:\/\//)) {
// Remove extra '()' at the end of types
if (type.substr(-2) == '()') {
type = type.substr(0, type.length - 2);
}
// Expand '#' at the start of types
if (type[0] == '#') {
type = doc.name.substr(0, doc.name.lastIndexOf('.') + 1) + type.substr(1);
}
// Replace '#' in the middle of types with '.'
type = type.replace(new RegExp('#', 'g'), '.prototype.');
// Only create a link if it's in the API
if (!typeTable[type]) {
return desc;
}
}
return '[' + desc + '](' + type + ')';
} | [
"function",
"(",
"link",
",",
"doc",
",",
"code",
")",
"{",
"var",
"type",
",",
"desc",
";",
"// Split type and description",
"var",
"i",
"=",
"link",
".",
"indexOf",
"(",
"' '",
")",
";",
"if",
"(",
"i",
"==",
"-",
"1",
")",
"{",
"desc",
"=",
"t... | Takes a link of the format 'type' or 'type description' and creates one of
the format '[description](type)'.
Also does some minor reformatting of the type.
@param {string} link The raw link.
@param {!Object} doc Current document.
@return {string} A link for the type. | [
"Takes",
"a",
"link",
"of",
"the",
"format",
"type",
"or",
"type",
"description",
"and",
"creates",
"one",
"of",
"the",
"format",
"[",
"description",
"]",
"(",
"type",
")",
"."
] | 4f74a4ec753c97adfe955fe468a39286a0a55837 | https://github.com/angular/protractor/blob/4f74a4ec753c97adfe955fe468a39286a0a55837/website/docgen/processors/add-links.js#L81-L121 | train | Returns the link | [
30522,
3853,
1006,
4957,
1010,
9986,
1010,
3642,
1007,
1063,
13075,
2828,
1010,
4078,
2278,
1025,
1013,
1013,
3975,
2828,
1998,
6412,
13075,
1045,
1027,
4957,
1012,
5950,
11253,
1006,
1005,
1005,
1007,
1025,
2065,
1006,
1045,
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... | |
GeekyAnts/vue-native-core | dist/vue.runtime.common.js | query | function query (el) {
if (typeof el === 'string') {
var selected = document.querySelector(el);
if (!selected) {
process.env.NODE_ENV !== 'production' && warn(
'Cannot find element: ' + el
);
return document.createElement('div')
}
return selected
} else {
return el
}
} | javascript | function query (el) {
if (typeof el === 'string') {
var selected = document.querySelector(el);
if (!selected) {
process.env.NODE_ENV !== 'production' && warn(
'Cannot find element: ' + el
);
return document.createElement('div')
}
return selected
} else {
return el
}
} | [
"function",
"query",
"(",
"el",
")",
"{",
"if",
"(",
"typeof",
"el",
"===",
"'string'",
")",
"{",
"var",
"selected",
"=",
"document",
".",
"querySelector",
"(",
"el",
")",
";",
"if",
"(",
"!",
"selected",
")",
"{",
"process",
".",
"env",
".",
"NODE... | /*
Query an element selector if it's not an element already. | [
"/",
"*",
"Query",
"an",
"element",
"selector",
"if",
"it",
"s",
"not",
"an",
"element",
"already",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L4143-L4156 | train | Query an element | [
30522,
3853,
23032,
1006,
3449,
1007,
1063,
2065,
1006,
2828,
11253,
3449,
1027,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
13075,
3479,
1027,
6254,
1012,
23032,
11246,
22471,
2953,
1006,
3449,
1007,
1025,
2065,
1006,
999,
3479,
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... |
openlayers/openlayers | config/jsdoc/api/template/publish.js | buildNav | function buildNav(members) {
const nav = [];
// merge namespaces and classes, then sort
const merged = members.modules.concat(members.classes);
merged.sort(function(a, b) {
if (a.longname > b.longname) {
return 1;
}
if (a.longname < b.longname) {
return -1;
}
return 0;
});
_.each(merged, function(v) {
// exclude interfaces from sidebar
if (v.interface !== true) {
if (v.kind == 'module') {
nav.push({
type: 'module',
longname: v.longname,
name: v.name,
members: find({
kind: 'member',
memberof: v.longname
}),
methods: find({
kind: 'function',
memberof: v.longname
}),
typedefs: find({
kind: 'typedef',
memberof: v.longname
}),
events: find({
kind: 'event',
memberof: v.longname
})
});
}
if (v.kind == 'class') {
nav.push({
type: 'class',
longname: v.longname,
name: v.name,
members: find({
kind: 'member',
memberof: v.longname
}),
methods: find({
kind: 'function',
memberof: v.longname
}),
typedefs: find({
kind: 'typedef',
memberof: v.longname
}),
fires: v.fires,
events: find({
kind: 'event',
memberof: v.longname
})
});
}
}
});
return nav;
} | javascript | function buildNav(members) {
const nav = [];
// merge namespaces and classes, then sort
const merged = members.modules.concat(members.classes);
merged.sort(function(a, b) {
if (a.longname > b.longname) {
return 1;
}
if (a.longname < b.longname) {
return -1;
}
return 0;
});
_.each(merged, function(v) {
// exclude interfaces from sidebar
if (v.interface !== true) {
if (v.kind == 'module') {
nav.push({
type: 'module',
longname: v.longname,
name: v.name,
members: find({
kind: 'member',
memberof: v.longname
}),
methods: find({
kind: 'function',
memberof: v.longname
}),
typedefs: find({
kind: 'typedef',
memberof: v.longname
}),
events: find({
kind: 'event',
memberof: v.longname
})
});
}
if (v.kind == 'class') {
nav.push({
type: 'class',
longname: v.longname,
name: v.name,
members: find({
kind: 'member',
memberof: v.longname
}),
methods: find({
kind: 'function',
memberof: v.longname
}),
typedefs: find({
kind: 'typedef',
memberof: v.longname
}),
fires: v.fires,
events: find({
kind: 'event',
memberof: v.longname
})
});
}
}
});
return nav;
} | [
"function",
"buildNav",
"(",
"members",
")",
"{",
"const",
"nav",
"=",
"[",
"]",
";",
"// merge namespaces and classes, then sort",
"const",
"merged",
"=",
"members",
".",
"modules",
".",
"concat",
"(",
"members",
".",
"classes",
")",
";",
"merged",
".",
"so... | Create the navigation sidebar.
@param {object} members The members that will be used to create the sidebar.
@param {Array<Object>} members.classes Classes.
@param {Array<Object>} members.externals Externals.
@param {Array<Object>} members.globals Globals.
@param {Array<Object>} members.mixins Mixins.
@param {Array<Object>} members.modules Modules.
@param {Array<Object>} members.namespaces Namespaces.
@param {Array<Object>} members.tutorials Tutorials.
@param {Array<Object>} members.events Events.
@return {string} The HTML for the navigation sidebar. | [
"Create",
"the",
"navigation",
"sidebar",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/config/jsdoc/api/template/publish.js#L204-L270 | train | Build the nav array from members | [
30522,
3853,
3857,
2532,
2615,
1006,
2372,
1007,
1063,
9530,
3367,
6583,
2615,
1027,
1031,
1033,
1025,
1013,
1013,
13590,
3415,
15327,
2015,
1998,
4280,
1010,
2059,
4066,
9530,
3367,
5314,
1027,
2372,
1012,
14184,
1012,
9530,
11266,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/LiveDevelopment.js | _onFrameNavigated | function _onFrameNavigated(event, res) {
// res = {frame}
var url = res.frame.url,
baseUrl,
baseUrlRegExp;
// Only check domain of root frame (with undefined parentId)
if (res.frame.parentId) {
return;
}
// Any local file is OK
if (url.match(/^file:\/\//i) || !_server) {
return;
}
// Need base url to build reg exp
baseUrl = _server.getBaseUrl();
if (!baseUrl) {
return;
}
// Test that url is within site
baseUrlRegExp = new RegExp("^" + StringUtils.regexEscape(baseUrl), "i");
if (!url.match(baseUrlRegExp)) {
// No longer in site, so terminate live dev, but don't close browser window
_close(false, "navigated_away");
}
} | javascript | function _onFrameNavigated(event, res) {
// res = {frame}
var url = res.frame.url,
baseUrl,
baseUrlRegExp;
// Only check domain of root frame (with undefined parentId)
if (res.frame.parentId) {
return;
}
// Any local file is OK
if (url.match(/^file:\/\//i) || !_server) {
return;
}
// Need base url to build reg exp
baseUrl = _server.getBaseUrl();
if (!baseUrl) {
return;
}
// Test that url is within site
baseUrlRegExp = new RegExp("^" + StringUtils.regexEscape(baseUrl), "i");
if (!url.match(baseUrlRegExp)) {
// No longer in site, so terminate live dev, but don't close browser window
_close(false, "navigated_away");
}
} | [
"function",
"_onFrameNavigated",
"(",
"event",
",",
"res",
")",
"{",
"// res = {frame}",
"var",
"url",
"=",
"res",
".",
"frame",
".",
"url",
",",
"baseUrl",
",",
"baseUrlRegExp",
";",
"// Only check domain of root frame (with undefined parentId)",
"if",
"(",
"res",
... | WebInspector Event: Page.frameNavigated | [
"WebInspector",
"Event",
":",
"Page",
".",
"frameNavigated"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopment.js#L916-L944 | train | Navigates to the frame | [
30522,
3853,
1035,
2006,
15643,
2532,
5737,
11644,
1006,
2724,
1010,
24501,
1007,
1063,
1013,
1013,
24501,
1027,
1063,
4853,
1065,
13075,
24471,
2140,
1027,
24501,
1012,
4853,
1012,
24471,
2140,
1010,
2918,
3126,
2140,
1010,
2918,
3126,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeekyAnts/vue-native-core | packages/weex-vue-framework/index.js | callFunction | function callFunction (globalObjects, body) {
var globalKeys = [];
var globalValues = [];
for (var key in globalObjects) {
globalKeys.push(key);
globalValues.push(globalObjects[key]);
}
globalKeys.push(body);
var result = new (Function.prototype.bind.apply( Function, [ null ].concat( globalKeys) ));
return result.apply(void 0, globalValues)
} | javascript | function callFunction (globalObjects, body) {
var globalKeys = [];
var globalValues = [];
for (var key in globalObjects) {
globalKeys.push(key);
globalValues.push(globalObjects[key]);
}
globalKeys.push(body);
var result = new (Function.prototype.bind.apply( Function, [ null ].concat( globalKeys) ));
return result.apply(void 0, globalValues)
} | [
"function",
"callFunction",
"(",
"globalObjects",
",",
"body",
")",
"{",
"var",
"globalKeys",
"=",
"[",
"]",
";",
"var",
"globalValues",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"globalObjects",
")",
"{",
"globalKeys",
".",
"push",
"(",
"key... | Call a new function body with some global objects.
@param {object} globalObjects
@param {string} code
@return {any} | [
"Call",
"a",
"new",
"function",
"body",
"with",
"some",
"global",
"objects",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-vue-framework/index.js#L394-L405 | train | Call a function on a set of objects | [
30522,
3853,
2655,
11263,
27989,
1006,
3795,
16429,
20614,
2015,
1010,
2303,
1007,
1063,
13075,
3795,
14839,
2015,
1027,
1031,
1033,
1025,
13075,
3795,
10175,
15808,
1027,
1031,
1033,
1025,
2005,
1006,
13075,
3145,
1999,
3795,
16429,
20614,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ControlPersonalizationAPI.js | function(oControl, mParams) {
mParams = mParams || this._determineParameters(oControl);
var fnCheckForControl = function (oControl) {
if (!mParams.variantManagement[oControl.getId()] && oControl.getParent() && oControl.getId() !== mParams.rootControl.getId()) {
return fnCheckForControl(oControl.getParent());
} else if (!oControl.getParent() || oControl.getId() === mParams.rootControl.getId()) {
return mParams.variantManagement[oControl.getId()] || "";
} else {
return mParams.variantManagement[oControl.getId()];
}
};
return fnCheckForControl(oControl);
} | javascript | function(oControl, mParams) {
mParams = mParams || this._determineParameters(oControl);
var fnCheckForControl = function (oControl) {
if (!mParams.variantManagement[oControl.getId()] && oControl.getParent() && oControl.getId() !== mParams.rootControl.getId()) {
return fnCheckForControl(oControl.getParent());
} else if (!oControl.getParent() || oControl.getId() === mParams.rootControl.getId()) {
return mParams.variantManagement[oControl.getId()] || "";
} else {
return mParams.variantManagement[oControl.getId()];
}
};
return fnCheckForControl(oControl);
} | [
"function",
"(",
"oControl",
",",
"mParams",
")",
"{",
"mParams",
"=",
"mParams",
"||",
"this",
".",
"_determineParameters",
"(",
"oControl",
")",
";",
"var",
"fnCheckForControl",
"=",
"function",
"(",
"oControl",
")",
"{",
"if",
"(",
"!",
"mParams",
".",
... | Returns the local ID of the encompassing variant management control.
@param {sap.ui.core.Element} oControl - The control for which a variant management control has to be evaluated
@returns {object} Returns a map with needed parameters
@private | [
"Returns",
"the",
"local",
"ID",
"of",
"the",
"encompassing",
"variant",
"management",
"control",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js#L103-L116 | train | Returns the variantManagement parameters for the control. | [
30522,
3853,
1006,
1051,
8663,
13181,
2140,
1010,
6131,
5400,
5244,
1007,
1063,
6131,
5400,
5244,
1027,
6131,
5400,
5244,
1064,
1064,
2023,
1012,
1035,
5646,
28689,
22828,
2015,
1006,
1051,
8663,
13181,
2140,
1007,
1025,
13075,
1042,
26091,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
benweet/stackedit | src/libs/htmlSanitizer.js | decodeEntities | function decodeEntities(value) {
if (!value) {
return '';
}
hiddenPre.innerHTML = value.replace(/</g, "<");
// innerText depends on styling as it doesn't display hidden elements.
// Therefore, it's better to use textContent not to cause unnecessary reflows.
return hiddenPre.textContent;
} | javascript | function decodeEntities(value) {
if (!value) {
return '';
}
hiddenPre.innerHTML = value.replace(/</g, "<");
// innerText depends on styling as it doesn't display hidden elements.
// Therefore, it's better to use textContent not to cause unnecessary reflows.
return hiddenPre.textContent;
} | [
"function",
"decodeEntities",
"(",
"value",
")",
"{",
"if",
"(",
"!",
"value",
")",
"{",
"return",
"''",
";",
"}",
"hiddenPre",
".",
"innerHTML",
"=",
"value",
".",
"replace",
"(",
"/",
"<",
"/",
"g",
",",
"\"<\"",
")",
";",
"// innerText depends on... | decodes all entities into regular string
@param value
@returns {string} A string with decoded entities. | [
"decodes",
"all",
"entities",
"into",
"regular",
"string"
] | 91f8cf3c10b75df65b69f9181cee8151d65a788d | https://github.com/benweet/stackedit/blob/91f8cf3c10b75df65b69f9181cee8151d65a788d/src/libs/htmlSanitizer.js#L315-L324 | train | Decode the given value of the key. | [
30522,
3853,
21933,
26095,
16778,
7368,
1006,
3643,
1007,
1063,
2065,
1006,
999,
3643,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
5023,
28139,
1012,
5110,
11039,
19968,
1027,
3643,
1012,
5672,
1006,
1013,
1026,
1013,
1043,
1010,
1000,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | extras/noUiSlider/nouislider.js | getCurrentStep | function getCurrentStep ( ) {
// Check all locations, map them to their stepping point.
// Get the step point, then find it in the input list.
return scope_Locations.map(function( location, index ){
var nearbySteps = scope_Spectrum.getNearbySteps( location );
var value = scope_Values[index];
var increment = nearbySteps.thisStep.step;
var decrement = null;
// If the next value in this step moves into the next step,
// the increment is the start of the next step - the current value
if ( increment !== false ) {
if ( value + increment > nearbySteps.stepAfter.startValue ) {
increment = nearbySteps.stepAfter.startValue - value;
}
}
// If the value is beyond the starting point
if ( value > nearbySteps.thisStep.startValue ) {
decrement = nearbySteps.thisStep.step;
}
else if ( nearbySteps.stepBefore.step === false ) {
decrement = false;
}
// If a handle is at the start of a step, it always steps back into the previous step first
else {
decrement = value - nearbySteps.stepBefore.highestStep;
}
// Now, if at the slider edges, there is not in/decrement
if ( location === 100 ) {
increment = null;
}
else if ( location === 0 ) {
decrement = null;
}
// As per #391, the comparison for the decrement step can have some rounding issues.
var stepDecimals = scope_Spectrum.countStepDecimals();
// Round per #391
if ( increment !== null && increment !== false ) {
increment = Number(increment.toFixed(stepDecimals));
}
if ( decrement !== null && decrement !== false ) {
decrement = Number(decrement.toFixed(stepDecimals));
}
return [decrement, increment];
});
} | javascript | function getCurrentStep ( ) {
// Check all locations, map them to their stepping point.
// Get the step point, then find it in the input list.
return scope_Locations.map(function( location, index ){
var nearbySteps = scope_Spectrum.getNearbySteps( location );
var value = scope_Values[index];
var increment = nearbySteps.thisStep.step;
var decrement = null;
// If the next value in this step moves into the next step,
// the increment is the start of the next step - the current value
if ( increment !== false ) {
if ( value + increment > nearbySteps.stepAfter.startValue ) {
increment = nearbySteps.stepAfter.startValue - value;
}
}
// If the value is beyond the starting point
if ( value > nearbySteps.thisStep.startValue ) {
decrement = nearbySteps.thisStep.step;
}
else if ( nearbySteps.stepBefore.step === false ) {
decrement = false;
}
// If a handle is at the start of a step, it always steps back into the previous step first
else {
decrement = value - nearbySteps.stepBefore.highestStep;
}
// Now, if at the slider edges, there is not in/decrement
if ( location === 100 ) {
increment = null;
}
else if ( location === 0 ) {
decrement = null;
}
// As per #391, the comparison for the decrement step can have some rounding issues.
var stepDecimals = scope_Spectrum.countStepDecimals();
// Round per #391
if ( increment !== null && increment !== false ) {
increment = Number(increment.toFixed(stepDecimals));
}
if ( decrement !== null && decrement !== false ) {
decrement = Number(decrement.toFixed(stepDecimals));
}
return [decrement, increment];
});
} | [
"function",
"getCurrentStep",
"(",
")",
"{",
"// Check all locations, map them to their stepping point.",
"// Get the step point, then find it in the input list.",
"return",
"scope_Locations",
".",
"map",
"(",
"function",
"(",
"location",
",",
"index",
")",
"{",
"var",
"nearb... | Get the current step size for the slider. | [
"Get",
"the",
"current",
"step",
"size",
"for",
"the",
"slider",
"."
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L1946-L2004 | train | Get the current step point | [
30522,
3853,
2131,
10841,
14343,
7666,
2618,
2361,
1006,
1007,
1063,
1013,
1013,
4638,
2035,
5269,
1010,
4949,
2068,
2000,
2037,
9085,
2391,
1012,
1013,
1013,
2131,
1996,
3357,
2391,
1010,
2059,
2424,
2009,
1999,
1996,
7953,
2862,
1012,
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/pkg | prelude/bootstrap.js | readdirRoot | function readdirRoot (path, cb) {
if (cb) {
ancestor.readdir(path, function (error, entries) {
if (error) return cb(error);
entries.push('snapshot');
cb(null, entries);
});
} else {
var entries = ancestor.readdirSync(path);
entries.push('snapshot');
return entries;
}
} | javascript | function readdirRoot (path, cb) {
if (cb) {
ancestor.readdir(path, function (error, entries) {
if (error) return cb(error);
entries.push('snapshot');
cb(null, entries);
});
} else {
var entries = ancestor.readdirSync(path);
entries.push('snapshot');
return entries;
}
} | [
"function",
"readdirRoot",
"(",
"path",
",",
"cb",
")",
"{",
"if",
"(",
"cb",
")",
"{",
"ancestor",
".",
"readdir",
"(",
"path",
",",
"function",
"(",
"error",
",",
"entries",
")",
"{",
"if",
"(",
"error",
")",
"return",
"cb",
"(",
"error",
")",
... | /////////////////////////////////////////////////////////////// readdir /////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// | [
"///////////////////////////////////////////////////////////////",
"readdir",
"///////////////////////////////////////////////////////",
"///////////////////////////////////////////////////////////////"
] | 3775ab6decc2f8f013142e1282934c12fbd1881e | https://github.com/zeit/pkg/blob/3775ab6decc2f8f013142e1282934c12fbd1881e/prelude/bootstrap.js#L739-L751 | train | readdir root | [
30522,
3853,
3191,
4305,
18933,
4140,
1006,
4130,
1010,
17324,
1007,
1063,
2065,
1006,
17324,
1007,
1063,
13032,
1012,
3191,
4305,
2099,
1006,
4130,
1010,
3853,
1006,
7561,
1010,
10445,
1007,
1063,
2065,
1006,
7561,
1007,
2709,
17324,
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... |
mochajs/mocha | lib/interfaces/common.js | create | function create(opts) {
var suite = Suite.create(suites[0], opts.title);
suite.pending = Boolean(opts.pending);
suite.file = opts.file;
suites.unshift(suite);
if (opts.isOnly) {
if (mocha.options.forbidOnly && shouldBeTested(suite)) {
throw new Error('`.only` forbidden');
}
suite.parent.appendOnlySuite(suite);
}
if (suite.pending) {
if (mocha.options.forbidPending && shouldBeTested(suite)) {
throw new Error('Pending test forbidden');
}
}
if (typeof opts.fn === 'function') {
opts.fn.call(suite);
suites.shift();
} else if (typeof opts.fn === 'undefined' && !suite.pending) {
throw createMissingArgumentError(
'Suite "' +
suite.fullTitle() +
'" was defined but no callback was supplied. ' +
'Supply a callback or explicitly skip the suite.',
'callback',
'function'
);
} else if (!opts.fn && suite.pending) {
suites.shift();
}
return suite;
} | javascript | function create(opts) {
var suite = Suite.create(suites[0], opts.title);
suite.pending = Boolean(opts.pending);
suite.file = opts.file;
suites.unshift(suite);
if (opts.isOnly) {
if (mocha.options.forbidOnly && shouldBeTested(suite)) {
throw new Error('`.only` forbidden');
}
suite.parent.appendOnlySuite(suite);
}
if (suite.pending) {
if (mocha.options.forbidPending && shouldBeTested(suite)) {
throw new Error('Pending test forbidden');
}
}
if (typeof opts.fn === 'function') {
opts.fn.call(suite);
suites.shift();
} else if (typeof opts.fn === 'undefined' && !suite.pending) {
throw createMissingArgumentError(
'Suite "' +
suite.fullTitle() +
'" was defined but no callback was supplied. ' +
'Supply a callback or explicitly skip the suite.',
'callback',
'function'
);
} else if (!opts.fn && suite.pending) {
suites.shift();
}
return suite;
} | [
"function",
"create",
"(",
"opts",
")",
"{",
"var",
"suite",
"=",
"Suite",
".",
"create",
"(",
"suites",
"[",
"0",
"]",
",",
"opts",
".",
"title",
")",
";",
"suite",
".",
"pending",
"=",
"Boolean",
"(",
"opts",
".",
"pending",
")",
";",
"suite",
... | Creates a suite.
@param {Object} opts Options
@param {string} opts.title Title of Suite
@param {Function} [opts.fn] Suite Function (not always applicable)
@param {boolean} [opts.pending] Is Suite pending?
@param {string} [opts.file] Filepath where this Suite resides
@param {boolean} [opts.isOnly] Is Suite exclusive?
@returns {Suite} | [
"Creates",
"a",
"suite",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/interfaces/common.js#L122-L156 | train | Create a new suite | [
30522,
3853,
3443,
1006,
23569,
2015,
1007,
1063,
13075,
7621,
1027,
7621,
1012,
3443,
1006,
19796,
1031,
1014,
1033,
1010,
23569,
2015,
1012,
2516,
1007,
1025,
7621,
1012,
14223,
1027,
22017,
20898,
1006,
23569,
2015,
1012,
14223,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ipfs/js-ipfs | src/core/utils.js | follow | function follow (cid, links, err, obj) {
if (err) {
return cb(err)
}
if (!links.length) {
// done tracing, obj is the target node
return cb(null, cid.buffer)
}
const linkName = links[0]
const nextObj = obj.links.find(link => link.name === linkName)
if (!nextObj) {
return cb(new Error(
`no link named "${linkName}" under ${cid.toBaseEncodedString()}`
))
}
objectAPI.get(nextObj.cid, follow.bind(null, nextObj.cid, links.slice(1)))
} | javascript | function follow (cid, links, err, obj) {
if (err) {
return cb(err)
}
if (!links.length) {
// done tracing, obj is the target node
return cb(null, cid.buffer)
}
const linkName = links[0]
const nextObj = obj.links.find(link => link.name === linkName)
if (!nextObj) {
return cb(new Error(
`no link named "${linkName}" under ${cid.toBaseEncodedString()}`
))
}
objectAPI.get(nextObj.cid, follow.bind(null, nextObj.cid, links.slice(1)))
} | [
"function",
"follow",
"(",
"cid",
",",
"links",
",",
"err",
",",
"obj",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"cb",
"(",
"err",
")",
"}",
"if",
"(",
"!",
"links",
".",
"length",
")",
"{",
"// done tracing, obj is the target node",
"return",
... | recursively follow named links to the target node | [
"recursively",
"follow",
"named",
"links",
"to",
"the",
"target",
"node"
] | 97e67601094acda3906549ecb0248fd09f1a8cc3 | https://github.com/ipfs/js-ipfs/blob/97e67601094acda3906549ecb0248fd09f1a8cc3/src/core/utils.js#L116-L135 | train | follows the target node | [
30522,
3853,
3582,
1006,
28744,
1010,
6971,
1010,
9413,
2099,
1010,
27885,
3501,
1007,
1063,
2065,
1006,
9413,
2099,
1007,
1063,
2709,
17324,
1006,
9413,
2099,
1007,
1065,
2065,
1006,
999,
6971,
1012,
3091,
1007,
1063,
1013,
1013,
2589,
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... |
google/material-design-lite | src/mdlComponentHandler.js | upgradeElementsInternal | function upgradeElementsInternal(elements) {
if (!Array.isArray(elements)) {
if (elements instanceof Element) {
elements = [elements];
} else {
elements = Array.prototype.slice.call(elements);
}
}
for (var i = 0, n = elements.length, element; i < n; i++) {
element = elements[i];
if (element instanceof HTMLElement) {
upgradeElementInternal(element);
if (element.children.length > 0) {
upgradeElementsInternal(element.children);
}
}
}
} | javascript | function upgradeElementsInternal(elements) {
if (!Array.isArray(elements)) {
if (elements instanceof Element) {
elements = [elements];
} else {
elements = Array.prototype.slice.call(elements);
}
}
for (var i = 0, n = elements.length, element; i < n; i++) {
element = elements[i];
if (element instanceof HTMLElement) {
upgradeElementInternal(element);
if (element.children.length > 0) {
upgradeElementsInternal(element.children);
}
}
}
} | [
"function",
"upgradeElementsInternal",
"(",
"elements",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"elements",
")",
")",
"{",
"if",
"(",
"elements",
"instanceof",
"Element",
")",
"{",
"elements",
"=",
"[",
"elements",
"]",
";",
"}",
"else",
... | Upgrades a specific list of elements rather than all in the DOM.
@param {!Element|!Array<!Element>|!NodeList|!HTMLCollection} elements
The elements we wish to upgrade. | [
"Upgrades",
"a",
"specific",
"list",
"of",
"elements",
"rather",
"than",
"all",
"in",
"the",
"DOM",
"."
] | 60f441a22ed98ed2c03f6179adf460d888bf459f | https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/src/mdlComponentHandler.js#L268-L285 | train | This function is called by the upgradeElements function to upgrade the elements | [
30522,
3853,
12200,
12260,
8163,
18447,
11795,
2389,
1006,
3787,
1007,
1063,
2065,
1006,
999,
9140,
1012,
18061,
11335,
2100,
1006,
3787,
1007,
1007,
1063,
2065,
1006,
3787,
6013,
11253,
5783,
1007,
1063,
3787,
1027,
1031,
3787,
1033,
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/core/LocaleData.js | function(sWidth, sCalendarType) {
assert(sWidth == "wide" || sWidth == "abbreviated" || sWidth == "narrow" , "sWidth must be wide, abbreviate or narrow");
//TODO Adapt generation so that eras are an array instead of object
var oEras = this._get(getCLDRCalendarName(sCalendarType), "era-" + sWidth),
aEras = [];
for (var i in oEras) {
aEras[parseInt(i)] = oEras[i];
}
return aEras;
} | javascript | function(sWidth, sCalendarType) {
assert(sWidth == "wide" || sWidth == "abbreviated" || sWidth == "narrow" , "sWidth must be wide, abbreviate or narrow");
//TODO Adapt generation so that eras are an array instead of object
var oEras = this._get(getCLDRCalendarName(sCalendarType), "era-" + sWidth),
aEras = [];
for (var i in oEras) {
aEras[parseInt(i)] = oEras[i];
}
return aEras;
} | [
"function",
"(",
"sWidth",
",",
"sCalendarType",
")",
"{",
"assert",
"(",
"sWidth",
"==",
"\"wide\"",
"||",
"sWidth",
"==",
"\"abbreviated\"",
"||",
"sWidth",
"==",
"\"narrow\"",
",",
"\"sWidth must be wide, abbreviate or narrow\"",
")",
";",
"//TODO Adapt generation ... | Returns array of eras.
@param {string} sWidth the style of the era name. It can be 'wide', 'abbreviated' or 'narrow'
@param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar
@return {array} the array of eras
@public
@since 1.32.0 | [
"Returns",
"array",
"of",
"eras",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L1466-L1476 | train | Returns an array of eras of the specified width. | [
30522,
3853,
1006,
25430,
3593,
2705,
1010,
4094,
8943,
5339,
18863,
1007,
1063,
20865,
1006,
25430,
3593,
2705,
1027,
1027,
1000,
2898,
1000,
1064,
1064,
25430,
3593,
2705,
1027,
1027,
1000,
12066,
1000,
1064,
1064,
25430,
3593,
2705,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js | function (aFlatTree, iServerIndexOffset, oIgnoreRemoveForNode, iSubtreeBaseLevel, iNewParentBaseLevel) {
//count the nodes until we find the correct index
for (var i = 0; i < aFlatTree.length; i++) {
var oNode = aFlatTree[i];
// If the node is removed -> ignore it
// BEWARE:
// If a removed range is reinserted again, we will deliver it instead of jumping over it.
// This is denoted by the "oIgnoreRemoveForNode", this is a node which will be served but only if it was traversed by fnTraverseAddedSubtree
if (oNode && oNode.nodeState && oNode.nodeState.removed && oNode != oIgnoreRemoveForNode) {
// only jump over the magnitude range if the node was not initially collapsed/server-expanded
if (!oNode.initiallyCollapsed) {
i += oNode.magnitude;
}
continue;
}
// calculate level shift if necessary (added subtrees are differently indented than before removal)
if (oNode && iSubtreeBaseLevel >= 0 && iNewParentBaseLevel >= 0) {
oNode.level = oNode.originalLevel || 0;
var iLevelDifNormalized = (oNode.level - iSubtreeBaseLevel) || 0;
oNode.level = iNewParentBaseLevel + iLevelDifNormalized || 0;
}
if (iServerIndexOffset === null) {
fnMap(oNode, oRecursionBreaker, "newNode");
} else {
// call map for the node itself, before traversing to any children/siblings
// the server-index position is used to calculate the $skip/$top values for loading the missing entries
fnMap(oNode, oRecursionBreaker, "serverIndex", iServerIndexOffset + i);
}
if (oRecursionBreaker.broken) {
return;
}
// if we have a node, lets see if we have to dig deeper or jump over some entries
if (oNode && oNode.nodeState) {
// jump over collapsed nodes by the enclosing magnitude
if (!oNode.initiallyCollapsed && oNode.nodeState.collapsed) {
i += oNode.magnitude;
} else {
// look into expanded nodes deeper than the initial expand level
if (oNode.initiallyCollapsed && oNode.nodeState.expanded) {
// the node itself will be ignored, since its fnMap was already called
fnTraverseDeepSubtree(oNode, true);
if (oRecursionBreaker.broken) {
return;
}
} else if (!oNode.initiallyCollapsed && oNode.nodeState.expanded) {
// before going to the next flat node (children|sibling), we look at the added subtrees in between
// this is only necessary for expanded server-indexed nodes
fnCheckNodeForAddedSubtrees(oNode);
}
}
}
// break recursion after fnMap or traversal function calls
if (oRecursionBreaker.broken) {
return;
}
}
} | javascript | function (aFlatTree, iServerIndexOffset, oIgnoreRemoveForNode, iSubtreeBaseLevel, iNewParentBaseLevel) {
//count the nodes until we find the correct index
for (var i = 0; i < aFlatTree.length; i++) {
var oNode = aFlatTree[i];
// If the node is removed -> ignore it
// BEWARE:
// If a removed range is reinserted again, we will deliver it instead of jumping over it.
// This is denoted by the "oIgnoreRemoveForNode", this is a node which will be served but only if it was traversed by fnTraverseAddedSubtree
if (oNode && oNode.nodeState && oNode.nodeState.removed && oNode != oIgnoreRemoveForNode) {
// only jump over the magnitude range if the node was not initially collapsed/server-expanded
if (!oNode.initiallyCollapsed) {
i += oNode.magnitude;
}
continue;
}
// calculate level shift if necessary (added subtrees are differently indented than before removal)
if (oNode && iSubtreeBaseLevel >= 0 && iNewParentBaseLevel >= 0) {
oNode.level = oNode.originalLevel || 0;
var iLevelDifNormalized = (oNode.level - iSubtreeBaseLevel) || 0;
oNode.level = iNewParentBaseLevel + iLevelDifNormalized || 0;
}
if (iServerIndexOffset === null) {
fnMap(oNode, oRecursionBreaker, "newNode");
} else {
// call map for the node itself, before traversing to any children/siblings
// the server-index position is used to calculate the $skip/$top values for loading the missing entries
fnMap(oNode, oRecursionBreaker, "serverIndex", iServerIndexOffset + i);
}
if (oRecursionBreaker.broken) {
return;
}
// if we have a node, lets see if we have to dig deeper or jump over some entries
if (oNode && oNode.nodeState) {
// jump over collapsed nodes by the enclosing magnitude
if (!oNode.initiallyCollapsed && oNode.nodeState.collapsed) {
i += oNode.magnitude;
} else {
// look into expanded nodes deeper than the initial expand level
if (oNode.initiallyCollapsed && oNode.nodeState.expanded) {
// the node itself will be ignored, since its fnMap was already called
fnTraverseDeepSubtree(oNode, true);
if (oRecursionBreaker.broken) {
return;
}
} else if (!oNode.initiallyCollapsed && oNode.nodeState.expanded) {
// before going to the next flat node (children|sibling), we look at the added subtrees in between
// this is only necessary for expanded server-indexed nodes
fnCheckNodeForAddedSubtrees(oNode);
}
}
}
// break recursion after fnMap or traversal function calls
if (oRecursionBreaker.broken) {
return;
}
}
} | [
"function",
"(",
"aFlatTree",
",",
"iServerIndexOffset",
",",
"oIgnoreRemoveForNode",
",",
"iSubtreeBaseLevel",
",",
"iNewParentBaseLevel",
")",
"{",
"//count the nodes until we find the correct index",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aFlatTree",
"."... | Traverses a flat portion of the tree (or rather the given array). | [
"Traverses",
"a",
"flat",
"portion",
"of",
"the",
"tree",
"(",
"or",
"rather",
"the",
"given",
"array",
")",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js#L396-L458 | train | This function is called by the traversal function to find the correct index of the nodes in the flat tree. | [
30522,
3853,
1006,
10028,
19321,
9910,
1010,
2003,
2121,
6299,
22254,
10288,
27475,
3388,
1010,
1051,
23773,
5686,
28578,
21818,
29278,
3630,
3207,
1010,
2003,
12083,
13334,
15058,
20414,
2884,
1010,
1999,
7974,
19362,
4765,
15058,
20414,
288... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | circuitClose | function circuitClose(item) {
item.state = C.CIRCUIT_CLOSE;
item.ep.state = true;
item.failures = 0;
item.count = 0;
logger.debug(`Circuit breaker has been closed on '${item.ep.name}' endpoint.`, { nodeID: item.ep.id, action: item.ep.action.name });
broker.broadcast("$circuit-breaker.closed", { nodeID: item.ep.id, action: item.ep.action.name });
if (item.cbTimer) {
clearTimeout(item.cbTimer);
item.cbTimer = null;
}
} | javascript | function circuitClose(item) {
item.state = C.CIRCUIT_CLOSE;
item.ep.state = true;
item.failures = 0;
item.count = 0;
logger.debug(`Circuit breaker has been closed on '${item.ep.name}' endpoint.`, { nodeID: item.ep.id, action: item.ep.action.name });
broker.broadcast("$circuit-breaker.closed", { nodeID: item.ep.id, action: item.ep.action.name });
if (item.cbTimer) {
clearTimeout(item.cbTimer);
item.cbTimer = null;
}
} | [
"function",
"circuitClose",
"(",
"item",
")",
"{",
"item",
".",
"state",
"=",
"C",
".",
"CIRCUIT_CLOSE",
";",
"item",
".",
"ep",
".",
"state",
"=",
"true",
";",
"item",
".",
"failures",
"=",
"0",
";",
"item",
".",
"count",
"=",
"0",
";",
"logger",
... | Change circuit-breaker status to close
@param {Object} item
@param {Context} ctx | [
"Change",
"circuit",
"-",
"breaker",
"status",
"to",
"close"
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/circuit-breaker.js#L180-L194 | train | Close a circuit breaker | [
30522,
3853,
4984,
20464,
9232,
1006,
8875,
1007,
1063,
8875,
1012,
2110,
1027,
1039,
1012,
4984,
1035,
2485,
1025,
8875,
1012,
4958,
1012,
2110,
1027,
2995,
1025,
8875,
1012,
15428,
1027,
1014,
1025,
8875,
1012,
4175,
1027,
1014,
1025,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js | function (oEvent) {
if (document.activeElement) {
var sId = document.activeElement.id;
switch (oEvent.key) {
case "ArrowRight":
this._changeFocusOnButtons(sId);
break;
case "ArrowLeft":
this._changeFocusOnButtons(sId, true);
break;
case "ArrowUp":
this._changeFocusOnButtons(sId, true);
break;
case "ArrowDown":
this._changeFocusOnButtons(sId);
break;
default:
break;
}
}
} | javascript | function (oEvent) {
if (document.activeElement) {
var sId = document.activeElement.id;
switch (oEvent.key) {
case "ArrowRight":
this._changeFocusOnButtons(sId);
break;
case "ArrowLeft":
this._changeFocusOnButtons(sId, true);
break;
case "ArrowUp":
this._changeFocusOnButtons(sId, true);
break;
case "ArrowDown":
this._changeFocusOnButtons(sId);
break;
default:
break;
}
}
} | [
"function",
"(",
"oEvent",
")",
"{",
"if",
"(",
"document",
".",
"activeElement",
")",
"{",
"var",
"sId",
"=",
"document",
".",
"activeElement",
".",
"id",
";",
"switch",
"(",
"oEvent",
".",
"key",
")",
"{",
"case",
"\"ArrowRight\"",
":",
"this",
".",
... | Changes the focus inside the ContextMenu if an Arrowkey is pressed
Allows Safari users to navigate through the ContextMenu using tab and tab+shift
@param {jQuery.Event} oEvent the keyboard event | [
"Changes",
"the",
"focus",
"inside",
"the",
"ContextMenu",
"if",
"an",
"Arrowkey",
"is",
"pressed",
"Allows",
"Safari",
"users",
"to",
"navigate",
"through",
"the",
"ContextMenu",
"using",
"tab",
"and",
"tab",
"+",
"shift"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L789-L809 | train | Change focus on buttons | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
2065,
1006,
6254,
1012,
3161,
12260,
3672,
1007,
1063,
13075,
15765,
1027,
6254,
1012,
3161,
12260,
3672,
1012,
8909,
1025,
6942,
1006,
1051,
18697,
3372,
1012,
3145,
1007,
1063,
2553,
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... | |
Shopify/draggable | src/Draggable/Plugins/Focusable/Focusable.js | decorateElement | function decorateElement(element) {
const hasMissingTabIndex = Boolean(!element.getAttribute('tabindex') && element.tabIndex === -1);
if (hasMissingTabIndex) {
elementsWithMissingTabIndex.push(element);
element.tabIndex = 0;
}
} | javascript | function decorateElement(element) {
const hasMissingTabIndex = Boolean(!element.getAttribute('tabindex') && element.tabIndex === -1);
if (hasMissingTabIndex) {
elementsWithMissingTabIndex.push(element);
element.tabIndex = 0;
}
} | [
"function",
"decorateElement",
"(",
"element",
")",
"{",
"const",
"hasMissingTabIndex",
"=",
"Boolean",
"(",
"!",
"element",
".",
"getAttribute",
"(",
"'tabindex'",
")",
"&&",
"element",
".",
"tabIndex",
"===",
"-",
"1",
")",
";",
"if",
"(",
"hasMissingTabIn... | Decorates element with tabindex attributes
@param {HTMLElement} element
@return {Object}
@private | [
"Decorates",
"element",
"with",
"tabindex",
"attributes"
] | ecc04b2cdb8b5009664862472ff8cb237c38cfeb | https://github.com/Shopify/draggable/blob/ecc04b2cdb8b5009664862472ff8cb237c38cfeb/src/Draggable/Plugins/Focusable/Focusable.js#L108-L115 | train | Decorates an element with a tabindex attribute. | [
30522,
3853,
29460,
12260,
3672,
1006,
5783,
1007,
1063,
9530,
3367,
2038,
15630,
7741,
2696,
8428,
3207,
2595,
1027,
22017,
20898,
1006,
999,
5783,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
1005,
21628,
22254,
10288,
1005,
1007,
1004,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/xpath/util.js | xmlText | function xmlText(node, opt_cdata) {
var buf = [];
xmlTextR(node, buf, opt_cdata);
return buf.join('');
} | javascript | function xmlText(node, opt_cdata) {
var buf = [];
xmlTextR(node, buf, opt_cdata);
return buf.join('');
} | [
"function",
"xmlText",
"(",
"node",
",",
"opt_cdata",
")",
"{",
"var",
"buf",
"=",
"[",
"]",
";",
"xmlTextR",
"(",
"node",
",",
"buf",
",",
"opt_cdata",
")",
";",
"return",
"buf",
".",
"join",
"(",
"''",
")",
";",
"}"
] | Returns the representation of a node as XML text. | [
"Returns",
"the",
"representation",
"of",
"a",
"node",
"as",
"XML",
"text",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/util.js#L302-L306 | train | Returns the text of a node | [
30522,
3853,
20950,
18209,
1006,
13045,
1010,
23569,
1035,
3729,
6790,
1007,
1063,
13075,
20934,
2546,
1027,
1031,
1033,
1025,
20950,
18209,
2099,
1006,
13045,
1010,
20934,
2546,
1010,
23569,
1035,
3729,
6790,
1007,
1025,
2709,
20934,
2546,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.