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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
grpc/grpc | examples/node/dynamic_codegen/route_guide/route_guide_server.js | listFeatures | function listFeatures(call) {
var lo = call.request.lo;
var hi = call.request.hi;
var left = _.min([lo.longitude, hi.longitude]);
var right = _.max([lo.longitude, hi.longitude]);
var top = _.max([lo.latitude, hi.latitude]);
var bottom = _.min([lo.latitude, hi.latitude]);
// For each feature, check if it is in the given bounding box
_.each(feature_list, function(feature) {
if (feature.name === '') {
return;
}
if (feature.location.longitude >= left &&
feature.location.longitude <= right &&
feature.location.latitude >= bottom &&
feature.location.latitude <= top) {
call.write(feature);
}
});
call.end();
} | javascript | function listFeatures(call) {
var lo = call.request.lo;
var hi = call.request.hi;
var left = _.min([lo.longitude, hi.longitude]);
var right = _.max([lo.longitude, hi.longitude]);
var top = _.max([lo.latitude, hi.latitude]);
var bottom = _.min([lo.latitude, hi.latitude]);
// For each feature, check if it is in the given bounding box
_.each(feature_list, function(feature) {
if (feature.name === '') {
return;
}
if (feature.location.longitude >= left &&
feature.location.longitude <= right &&
feature.location.latitude >= bottom &&
feature.location.latitude <= top) {
call.write(feature);
}
});
call.end();
} | [
"function",
"listFeatures",
"(",
"call",
")",
"{",
"var",
"lo",
"=",
"call",
".",
"request",
".",
"lo",
";",
"var",
"hi",
"=",
"call",
".",
"request",
".",
"hi",
";",
"var",
"left",
"=",
"_",
".",
"min",
"(",
"[",
"lo",
".",
"longitude",
",",
"... | listFeatures request handler. Gets a request with two points, and responds
with a stream of all features in the bounding box defined by those points.
@param {Writable} call Writable stream for responses with an additional
request property for the request value. | [
"listFeatures",
"request",
"handler",
".",
"Gets",
"a",
"request",
"with",
"two",
"points",
"and",
"responds",
"with",
"a",
"stream",
"of",
"all",
"features",
"in",
"the",
"bounding",
"box",
"defined",
"by",
"those",
"points",
"."
] | cc75d93818410e2b0edd0fa3009a6def9ac403ca | https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/dynamic_codegen/route_guide/route_guide_server.js#L91-L111 | train | List features in a given region | [
30522,
3853,
2862,
7959,
4017,
14900,
1006,
2655,
1007,
1063,
13075,
8840,
1027,
2655,
1012,
5227,
1012,
8840,
1025,
13075,
7632,
1027,
2655,
1012,
5227,
1012,
7632,
1025,
13075,
2187,
1027,
1035,
1012,
8117,
1006,
1031,
8840,
1012,
20413,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/slider/slider.js | adjustThumbPosition | function adjustThumbPosition(x) {
var exactVal = percentToValue(positionToPercent(x));
var closestVal = minMaxValidator(stepValidator(exactVal));
setSliderPercent(positionToPercent(x));
thumbText.text(closestVal);
} | javascript | function adjustThumbPosition(x) {
var exactVal = percentToValue(positionToPercent(x));
var closestVal = minMaxValidator(stepValidator(exactVal));
setSliderPercent(positionToPercent(x));
thumbText.text(closestVal);
} | [
"function",
"adjustThumbPosition",
"(",
"x",
")",
"{",
"var",
"exactVal",
"=",
"percentToValue",
"(",
"positionToPercent",
"(",
"x",
")",
")",
";",
"var",
"closestVal",
"=",
"minMaxValidator",
"(",
"stepValidator",
"(",
"exactVal",
")",
")",
";",
"setSliderPer... | Slide the UI without changing the model (while dragging/panning)
@param x | [
"Slide",
"the",
"UI",
"without",
"changing",
"the",
"model",
"(",
"while",
"dragging",
"/",
"panning",
")"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/slider/slider.js#L624-L629 | train | adjust thumb position | [
30522,
3853,
14171,
2705,
25438,
26994,
1006,
1060,
1007,
1063,
13075,
6635,
10175,
1027,
3867,
26525,
2389,
5657,
1006,
2597,
14399,
2121,
13013,
1006,
1060,
1007,
1007,
1025,
13075,
7541,
10175,
1027,
8117,
17848,
10175,
8524,
4263,
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... |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | updateStyle | function updateStyle(notifyRenderer) {
var cy = this._private.cy;
if (!cy.styleEnabled()) {
return this;
}
if (cy.batching()) {
var bEles = cy._private.batchStyleEles;
bEles.merge(this);
return this; // chaining and exit early when batching
}
var hasCompounds = cy.hasCompoundNodes();
var style$$1 = cy.style();
var updatedEles = this;
notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false;
if (hasCompounds) {
// then add everything up and down for compound selector checks
updatedEles = this.spawnSelf().merge(this.descendants()).merge(this.parents());
}
var changedEles = style$$1.apply(updatedEles);
if (notifyRenderer) {
changedEles.emitAndNotify('style'); // let renderer know we changed style
} else {
changedEles.emit('style'); // just fire the event
}
return this; // chaining
} | javascript | function updateStyle(notifyRenderer) {
var cy = this._private.cy;
if (!cy.styleEnabled()) {
return this;
}
if (cy.batching()) {
var bEles = cy._private.batchStyleEles;
bEles.merge(this);
return this; // chaining and exit early when batching
}
var hasCompounds = cy.hasCompoundNodes();
var style$$1 = cy.style();
var updatedEles = this;
notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false;
if (hasCompounds) {
// then add everything up and down for compound selector checks
updatedEles = this.spawnSelf().merge(this.descendants()).merge(this.parents());
}
var changedEles = style$$1.apply(updatedEles);
if (notifyRenderer) {
changedEles.emitAndNotify('style'); // let renderer know we changed style
} else {
changedEles.emit('style'); // just fire the event
}
return this; // chaining
} | [
"function",
"updateStyle",
"(",
"notifyRenderer",
")",
"{",
"var",
"cy",
"=",
"this",
".",
"_private",
".",
"cy",
";",
"if",
"(",
"!",
"cy",
".",
"styleEnabled",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"cy",
".",
"batching",
"(",... | fully updates (recalculates) the style for the elements | [
"fully",
"updates",
"(",
"recalculates",
")",
"the",
"style",
"for",
"the",
"elements"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L10869-L10901 | train | update style of the node | [
30522,
3853,
14409,
27983,
1006,
2025,
8757,
7389,
4063,
2121,
1007,
1063,
13075,
22330,
1027,
2023,
1012,
1035,
2797,
1012,
22330,
1025,
2065,
1006,
999,
22330,
1012,
2806,
8189,
23242,
1006,
1007,
1007,
1063,
2709,
2023,
1025,
1065,
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 | src/sap.ui.core/src/jquery.sap.history.js | calculateStepsToHash | function calculateStepsToHash(sCurrentHash, sToHash, bPrefix){
var iCurrentIndex = jQuery.inArray(sCurrentHash, hashHistory),
iToIndex,
i,
tempHash;
if (iCurrentIndex > 0) {
if (bPrefix) {
for (i = iCurrentIndex - 1; i >= 0 ; i--) {
tempHash = hashHistory[i];
if (tempHash.indexOf(sToHash) === 0 && !isVirtualHash(tempHash)) {
return i - iCurrentIndex;
}
}
} else {
iToIndex = jQuery.inArray(sToHash, hashHistory);
//When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable
if ((iToIndex === -1) && sToHash.length === 0) {
return -1 * iCurrentIndex;
}
if ((iToIndex > -1) && (iToIndex < iCurrentIndex)) {
return iToIndex - iCurrentIndex;
}
}
}
return 0;
} | javascript | function calculateStepsToHash(sCurrentHash, sToHash, bPrefix){
var iCurrentIndex = jQuery.inArray(sCurrentHash, hashHistory),
iToIndex,
i,
tempHash;
if (iCurrentIndex > 0) {
if (bPrefix) {
for (i = iCurrentIndex - 1; i >= 0 ; i--) {
tempHash = hashHistory[i];
if (tempHash.indexOf(sToHash) === 0 && !isVirtualHash(tempHash)) {
return i - iCurrentIndex;
}
}
} else {
iToIndex = jQuery.inArray(sToHash, hashHistory);
//When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable
if ((iToIndex === -1) && sToHash.length === 0) {
return -1 * iCurrentIndex;
}
if ((iToIndex > -1) && (iToIndex < iCurrentIndex)) {
return iToIndex - iCurrentIndex;
}
}
}
return 0;
} | [
"function",
"calculateStepsToHash",
"(",
"sCurrentHash",
",",
"sToHash",
",",
"bPrefix",
")",
"{",
"var",
"iCurrentIndex",
"=",
"jQuery",
".",
"inArray",
"(",
"sCurrentHash",
",",
"hashHistory",
")",
",",
"iToIndex",
",",
"i",
",",
"tempHash",
";",
"if",
"("... | This function calculates the number of steps from the sCurrentHash to sToHash. If the sCurrentHash or the sToHash is not in the history stack, it returns 0.
@private | [
"This",
"function",
"calculates",
"the",
"number",
"of",
"steps",
"from",
"the",
"sCurrentHash",
"to",
"sToHash",
".",
"If",
"the",
"sCurrentHash",
"or",
"the",
"sToHash",
"is",
"not",
"in",
"the",
"history",
"stack",
"it",
"returns",
"0",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L385-L413 | train | Calculate the number of steps to hash | [
30522,
3853,
18422,
13473,
4523,
3406,
14949,
2232,
1006,
8040,
29264,
14949,
2232,
1010,
2358,
11631,
11823,
1010,
17531,
2890,
8873,
2595,
1007,
1063,
13075,
24582,
29264,
22254,
10288,
1027,
1046,
4226,
2854,
1012,
27118,
11335,
2100,
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/JSUtils/node/TernNodeDomain.js | init | function init(domainManager) {
if (!domainManager.hasDomain("TernNodeDomain")) {
domainManager.registerDomain("TernNodeDomain", {major: 0, minor: 1});
}
_domainManager = domainManager;
domainManager.registerCommand(
"TernNodeDomain", // domain name
"invokeTernCommand", // command name
invokeTernCommand, // command handler function
false, // this command is synchronous in Node
"Invokes a tern command on node",
[{name: "commandConfig", // parameters
type: "object",
description: "Object containing tern command configuration"}]
);
domainManager.registerCommand(
"TernNodeDomain", // domain name
"setInterface", // command name
setInterface, // command handler function
false, // this command is synchronous in Node
"Sets the shared message interface",
[{name: "msgInterface", // parameters
type: "object",
description: "Object containing messageId enums"}]
);
domainManager.registerCommand(
"TernNodeDomain", // domain name
"resetTernServer", // command name
resetTernServer, // command handler function
true, // this command is synchronous in Node
"Resets an existing tern server"
);
domainManager.registerEvent(
"TernNodeDomain", // domain name
"data", // event name
[
{
name: "data",
type: "Object",
description: "data to be returned to main thread"
}
]
);
setTimeout(checkInterfaceAndReInit, 1000);
} | javascript | function init(domainManager) {
if (!domainManager.hasDomain("TernNodeDomain")) {
domainManager.registerDomain("TernNodeDomain", {major: 0, minor: 1});
}
_domainManager = domainManager;
domainManager.registerCommand(
"TernNodeDomain", // domain name
"invokeTernCommand", // command name
invokeTernCommand, // command handler function
false, // this command is synchronous in Node
"Invokes a tern command on node",
[{name: "commandConfig", // parameters
type: "object",
description: "Object containing tern command configuration"}]
);
domainManager.registerCommand(
"TernNodeDomain", // domain name
"setInterface", // command name
setInterface, // command handler function
false, // this command is synchronous in Node
"Sets the shared message interface",
[{name: "msgInterface", // parameters
type: "object",
description: "Object containing messageId enums"}]
);
domainManager.registerCommand(
"TernNodeDomain", // domain name
"resetTernServer", // command name
resetTernServer, // command handler function
true, // this command is synchronous in Node
"Resets an existing tern server"
);
domainManager.registerEvent(
"TernNodeDomain", // domain name
"data", // event name
[
{
name: "data",
type: "Object",
description: "data to be returned to main thread"
}
]
);
setTimeout(checkInterfaceAndReInit, 1000);
} | [
"function",
"init",
"(",
"domainManager",
")",
"{",
"if",
"(",
"!",
"domainManager",
".",
"hasDomain",
"(",
"\"TernNodeDomain\"",
")",
")",
"{",
"domainManager",
".",
"registerDomain",
"(",
"\"TernNodeDomain\"",
",",
"{",
"major",
":",
"0",
",",
"minor",
":"... | Initialize the test domain with commands and events related to find in files.
@param {DomainManager} domainManager The DomainManager for the TernNodeDomain | [
"Initialize",
"the",
"test",
"domain",
"with",
"commands",
"and",
"events",
"related",
"to",
"find",
"in",
"files",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/node/TernNodeDomain.js#L920-L969 | train | init function init function | [
30522,
3853,
1999,
4183,
1006,
5884,
24805,
4590,
1007,
1063,
2065,
1006,
999,
5884,
24805,
4590,
1012,
2038,
9527,
8113,
1006,
1000,
28774,
10695,
10244,
9527,
8113,
1000,
1007,
1007,
1063,
5884,
24805,
4590,
1012,
4236,
9527,
8113,
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... |
parcel-bundler/parcel | packages/core/parcel-bundler/src/transforms/babel/astConverter.js | babel7toBabel6 | function babel7toBabel6(ast) {
const visitor = {
ArrowFunctionExpression: node => {
node.expression = node.body.type !== 'BlockStatement';
},
ExistsTypeAnnotation: node => {
node.type = 'ExistentialTypeParam';
},
NumberLiteralTypeAnnotation: node => {
node.type = 'NumericLiteralTypeAnnotation';
},
ObjectTypeIndexer: node => {
node.end++;
node.loc.end.column++;
},
ForOfStatement: node => {
node.type = 'ForAwaitStatement';
delete node.await;
},
SpreadElement: (node, path) => {
if (
path.parentPath.isObjectExpression() ||
path.parentPath.isArrayExpression()
) {
node.type = 'SpreadProperty';
}
},
RestElement: (node, path) => {
if (
path.parentPath.isObjectPattern() ||
path.parentPath.isArrayPattern()
) {
node.type = 'RestProperty';
}
}
};
traverse(ast, {
enter(path) {
if (path.node.variance && path.node.variance.type === 'Variance') {
path.node.variance = path.node.variance.kind;
}
let visitorFunc = visitor[path.node.type];
if (visitorFunc) {
visitorFunc(path.node, path);
}
}
});
return ast;
} | javascript | function babel7toBabel6(ast) {
const visitor = {
ArrowFunctionExpression: node => {
node.expression = node.body.type !== 'BlockStatement';
},
ExistsTypeAnnotation: node => {
node.type = 'ExistentialTypeParam';
},
NumberLiteralTypeAnnotation: node => {
node.type = 'NumericLiteralTypeAnnotation';
},
ObjectTypeIndexer: node => {
node.end++;
node.loc.end.column++;
},
ForOfStatement: node => {
node.type = 'ForAwaitStatement';
delete node.await;
},
SpreadElement: (node, path) => {
if (
path.parentPath.isObjectExpression() ||
path.parentPath.isArrayExpression()
) {
node.type = 'SpreadProperty';
}
},
RestElement: (node, path) => {
if (
path.parentPath.isObjectPattern() ||
path.parentPath.isArrayPattern()
) {
node.type = 'RestProperty';
}
}
};
traverse(ast, {
enter(path) {
if (path.node.variance && path.node.variance.type === 'Variance') {
path.node.variance = path.node.variance.kind;
}
let visitorFunc = visitor[path.node.type];
if (visitorFunc) {
visitorFunc(path.node, path);
}
}
});
return ast;
} | [
"function",
"babel7toBabel6",
"(",
"ast",
")",
"{",
"const",
"visitor",
"=",
"{",
"ArrowFunctionExpression",
":",
"node",
"=>",
"{",
"node",
".",
"expression",
"=",
"node",
".",
"body",
".",
"type",
"!==",
"'BlockStatement'",
";",
"}",
",",
"ExistsTypeAnnota... | Convert between babel 7 and babel 6 AST More info on the AST Changes: https://babeljs.io/docs/en/v7-migration-api#ast-changes | [
"Convert",
"between",
"babel",
"7",
"and",
"babel",
"6",
"AST",
"More",
"info",
"on",
"the",
"AST",
"Changes",
":",
"https",
":",
"//",
"babeljs",
".",
"io",
"/",
"docs",
"/",
"en",
"/",
"v7",
"-",
"migration",
"-",
"api#ast",
"-",
"changes"
] | 84b308511f87d4b69da62bcd352f0ff2f7bd4f1b | https://github.com/parcel-bundler/parcel/blob/84b308511f87d4b69da62bcd352f0ff2f7bd4f1b/packages/core/parcel-bundler/src/transforms/babel/astConverter.js#L5-L56 | train | Babel 7 to Babel 6 | [
30522,
3853,
11561,
2140,
2581,
3406,
3676,
8671,
2575,
1006,
2004,
2102,
1007,
1063,
9530,
3367,
10367,
1027,
1063,
8612,
11263,
27989,
10288,
20110,
3258,
1024,
13045,
1027,
1028,
1063,
13045,
1012,
3670,
1027,
13045,
1012,
2303,
1012,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataContextBinding.js | getReturnValueContextPath | function getReturnValueContextPath(sPath, sResponsePredicate) {
var sBoundParameterPath = sPath.slice(0, sPath.lastIndexOf("/")),
i = sBoundParameterPath.indexOf("(");
return (i < 0 ? sBoundParameterPath : sPath.slice(0, i)) + sResponsePredicate;
} | javascript | function getReturnValueContextPath(sPath, sResponsePredicate) {
var sBoundParameterPath = sPath.slice(0, sPath.lastIndexOf("/")),
i = sBoundParameterPath.indexOf("(");
return (i < 0 ? sBoundParameterPath : sPath.slice(0, i)) + sResponsePredicate;
} | [
"function",
"getReturnValueContextPath",
"(",
"sPath",
",",
"sResponsePredicate",
")",
"{",
"var",
"sBoundParameterPath",
"=",
"sPath",
".",
"slice",
"(",
"0",
",",
"sPath",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
")",
",",
"i",
"=",
"sBoundParameterPath",
".",... | Returns the path for the return value context. Supports bound operations on an entity or a
collection.
@param {string} sPath
The bindings's path; either a resolved model path or a resource path; for example:
"Artists(ArtistID='42',IsActiveEntity=true)/special.cases.EditAction(...)" or
"/Artists(ArtistID='42',IsActiveEntity=true)/special.cases.EditAction(...)" or
"Artists/special.cases.Create(...)" or "/Artists/special.cases.Create(...)"
@param {string} sResponsePredicate The key predicate of the response entity
@returns {string} The path for the return value context. | [
"Returns",
"the",
"path",
"for",
"the",
"return",
"value",
"context",
".",
"Supports",
"bound",
"operations",
"on",
"an",
"entity",
"or",
"a",
"collection",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataContextBinding.js#L44-L49 | train | Returns the context path for the given path and response predicate. | [
30522,
3853,
2131,
13465,
14287,
10175,
5657,
8663,
18209,
15069,
1006,
14690,
2232,
1010,
5034,
2229,
26029,
3366,
28139,
16467,
1007,
1063,
13075,
24829,
28819,
28689,
22828,
15069,
1027,
14690,
2232,
1012,
14704,
1006,
1014,
1010,
14690,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/command/KeyBindingManager.js | removeBinding | function removeBinding(key, platform) {
if (!key || ((platform !== null) && (platform !== undefined) && (platform !== brackets.platform))) {
return;
}
var normalizedKey = normalizeKeyDescriptorString(key);
if (!normalizedKey) {
console.log("Failed to normalize " + key);
} else if (_isKeyAssigned(normalizedKey)) {
var binding = _keyMap[normalizedKey],
command = CommandManager.get(binding.commandID),
bindings = _commandMap[binding.commandID];
// delete key binding record
delete _keyMap[normalizedKey];
if (bindings) {
// delete mapping from command to key binding
_commandMap[binding.commandID] = bindings.filter(function (b) {
return (b.key !== normalizedKey);
});
if (command) {
command.trigger("keyBindingRemoved", {key: normalizedKey, displayKey: binding.displayKey});
}
}
}
} | javascript | function removeBinding(key, platform) {
if (!key || ((platform !== null) && (platform !== undefined) && (platform !== brackets.platform))) {
return;
}
var normalizedKey = normalizeKeyDescriptorString(key);
if (!normalizedKey) {
console.log("Failed to normalize " + key);
} else if (_isKeyAssigned(normalizedKey)) {
var binding = _keyMap[normalizedKey],
command = CommandManager.get(binding.commandID),
bindings = _commandMap[binding.commandID];
// delete key binding record
delete _keyMap[normalizedKey];
if (bindings) {
// delete mapping from command to key binding
_commandMap[binding.commandID] = bindings.filter(function (b) {
return (b.key !== normalizedKey);
});
if (command) {
command.trigger("keyBindingRemoved", {key: normalizedKey, displayKey: binding.displayKey});
}
}
}
} | [
"function",
"removeBinding",
"(",
"key",
",",
"platform",
")",
"{",
"if",
"(",
"!",
"key",
"||",
"(",
"(",
"platform",
"!==",
"null",
")",
"&&",
"(",
"platform",
"!==",
"undefined",
")",
"&&",
"(",
"platform",
"!==",
"brackets",
".",
"platform",
")",
... | Remove a key binding from _keymap
@param {!string} key - a key-description string that may or may not be normalized.
@param {?string} platform - OS from which to remove the binding (all platforms if unspecified) | [
"Remove",
"a",
"key",
"binding",
"from",
"_keymap"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L570-L598 | train | Remove a key binding | [
30522,
3853,
6366,
8428,
4667,
1006,
3145,
1010,
4132,
1007,
1063,
2065,
1006,
999,
3145,
1064,
1064,
1006,
1006,
4132,
999,
1027,
1027,
19701,
1007,
1004,
1004,
1006,
4132,
999,
1027,
1027,
6151,
28344,
1007,
1004,
1004,
1006,
4132,
999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js | parseInstallerLog | function parseInstallerLog(filepath, searchstring, encoding, callback) {
var line = "";
var searchFn = function searchFn(str) {
var arr = str.split('\n'),
lineNum,
pos;
for (lineNum = arr.length - 1; lineNum >= 0; lineNum--) {
var searchStrNum;
for (searchStrNum = 0; searchStrNum < searchstring.length; searchStrNum++) {
pos = arr[lineNum].search(searchstring[searchStrNum]);
if (pos !== -1) {
line = arr[lineNum];
break;
}
}
if (pos !== -1) {
break;
}
}
callback(line);
};
fs.readFile(filepath, {"encoding": encoding})
.then(function (str) {
return searchFn(str);
}).catch(function () {
callback("");
});
} | javascript | function parseInstallerLog(filepath, searchstring, encoding, callback) {
var line = "";
var searchFn = function searchFn(str) {
var arr = str.split('\n'),
lineNum,
pos;
for (lineNum = arr.length - 1; lineNum >= 0; lineNum--) {
var searchStrNum;
for (searchStrNum = 0; searchStrNum < searchstring.length; searchStrNum++) {
pos = arr[lineNum].search(searchstring[searchStrNum]);
if (pos !== -1) {
line = arr[lineNum];
break;
}
}
if (pos !== -1) {
break;
}
}
callback(line);
};
fs.readFile(filepath, {"encoding": encoding})
.then(function (str) {
return searchFn(str);
}).catch(function () {
callback("");
});
} | [
"function",
"parseInstallerLog",
"(",
"filepath",
",",
"searchstring",
",",
"encoding",
",",
"callback",
")",
"{",
"var",
"line",
"=",
"\"\"",
";",
"var",
"searchFn",
"=",
"function",
"searchFn",
"(",
"str",
")",
"{",
"var",
"arr",
"=",
"str",
".",
"spli... | Parse the Installer log and search for a error strings
one it finds the line which has any of error String
it return that line and exit | [
"Parse",
"the",
"Installer",
"log",
"and",
"search",
"for",
"a",
"error",
"strings",
"one",
"it",
"finds",
"the",
"line",
"which",
"has",
"any",
"of",
"error",
"String",
"it",
"return",
"that",
"line",
"and",
"exit"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js#L187-L215 | train | Parses installer log | [
30522,
3853,
11968,
20240,
23808,
24164,
12190,
8649,
1006,
5371,
15069,
1010,
3945,
3367,
4892,
1010,
17181,
1010,
2655,
5963,
1007,
1063,
13075,
2240,
1027,
1000,
1000,
1025,
13075,
3945,
2546,
2078,
1027,
3853,
3945,
2546,
2078,
1006,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | examples/node/dynamic_codegen/route_guide/route_guide_client.js | runGetFeature | function runGetFeature(callback) {
var next = _.after(2, callback);
function featureCallback(error, feature) {
if (error) {
callback(error);
return;
}
if (feature.name === '') {
console.log('Found no feature at ' +
feature.location.latitude/COORD_FACTOR + ', ' +
feature.location.longitude/COORD_FACTOR);
} else {
console.log('Found feature called "' + feature.name + '" at ' +
feature.location.latitude/COORD_FACTOR + ', ' +
feature.location.longitude/COORD_FACTOR);
}
next();
}
var point1 = {
latitude: 409146138,
longitude: -746188906
};
var point2 = {
latitude: 0,
longitude: 0
};
client.getFeature(point1, featureCallback);
client.getFeature(point2, featureCallback);
} | javascript | function runGetFeature(callback) {
var next = _.after(2, callback);
function featureCallback(error, feature) {
if (error) {
callback(error);
return;
}
if (feature.name === '') {
console.log('Found no feature at ' +
feature.location.latitude/COORD_FACTOR + ', ' +
feature.location.longitude/COORD_FACTOR);
} else {
console.log('Found feature called "' + feature.name + '" at ' +
feature.location.latitude/COORD_FACTOR + ', ' +
feature.location.longitude/COORD_FACTOR);
}
next();
}
var point1 = {
latitude: 409146138,
longitude: -746188906
};
var point2 = {
latitude: 0,
longitude: 0
};
client.getFeature(point1, featureCallback);
client.getFeature(point2, featureCallback);
} | [
"function",
"runGetFeature",
"(",
"callback",
")",
"{",
"var",
"next",
"=",
"_",
".",
"after",
"(",
"2",
",",
"callback",
")",
";",
"function",
"featureCallback",
"(",
"error",
",",
"feature",
")",
"{",
"if",
"(",
"error",
")",
"{",
"callback",
"(",
... | Run the getFeature demo. Calls getFeature with a point known to have a
feature and a point known not to have a feature.
@param {function} callback Called when this demo is complete | [
"Run",
"the",
"getFeature",
"demo",
".",
"Calls",
"getFeature",
"with",
"a",
"point",
"known",
"to",
"have",
"a",
"feature",
"and",
"a",
"point",
"known",
"not",
"to",
"have",
"a",
"feature",
"."
] | cc75d93818410e2b0edd0fa3009a6def9ac403ca | https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/dynamic_codegen/route_guide/route_guide_client.js#L47-L75 | train | Get a feature from the cluster | [
30522,
3853,
2448,
18150,
7959,
4017,
5397,
1006,
2655,
5963,
1007,
1063,
13075,
2279,
1027,
1035,
1012,
2044,
1006,
1016,
1010,
2655,
5963,
1007,
1025,
3853,
3444,
9289,
20850,
8684,
1006,
7561,
1010,
3444,
1007,
1063,
2065,
1006,
7561,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesBase.js | function () {
var result = new $.Deferred();
var path = this.path;
var createIfMissing = this.createIfMissing;
var recreateIfInvalid = this.recreateIfInvalid;
var self = this;
if (path) {
var prefFile = FileSystem.getFileForPath(path);
prefFile.read({}, function (err, text) {
if (err) {
if (createIfMissing) {
// Unreadable file is also unwritable -- delete so get recreated
if (recreateIfInvalid && (err === FileSystemError.NOT_READABLE || err === FileSystemError.UNSUPPORTED_ENCODING)) {
appshell.fs.moveToTrash(path, function (err) {
if (err) {
console.log("Cannot move unreadable preferences file " + path + " to trash!!");
} else {
console.log("Brackets has recreated the unreadable preferences file " + path + ". You may refer to the deleted file in trash in case you need it!!");
}
}.bind(this));
}
result.resolve({});
} else {
result.reject(new Error("Unable to load preferences at " + path + " " + err));
}
return;
}
self._lineEndings = FileUtils.sniffLineEndings(text);
// If the file is empty, turn it into an empty object
if (/^\s*$/.test(text)) {
result.resolve({});
} else {
try {
result.resolve(JSON.parse(text));
} catch (e) {
if (recreateIfInvalid) {
// JSON parsing error -- recreate the preferences file
appshell.fs.moveToTrash(path, function (err) {
if (err) {
console.log("Cannot move unparseable preferences file " + path + " to trash!!");
} else {
console.log("Brackets has recreated the Invalid JSON preferences file " + path + ". You may refer to the deleted file in trash in case you need it!!");
}
}.bind(this));
result.resolve({});
} else {
result.reject(new ParsingError("Invalid JSON settings at " + path + "(" + e.toString() + ")"));
}
}
}
});
} else {
result.resolve({});
}
return result.promise();
} | javascript | function () {
var result = new $.Deferred();
var path = this.path;
var createIfMissing = this.createIfMissing;
var recreateIfInvalid = this.recreateIfInvalid;
var self = this;
if (path) {
var prefFile = FileSystem.getFileForPath(path);
prefFile.read({}, function (err, text) {
if (err) {
if (createIfMissing) {
// Unreadable file is also unwritable -- delete so get recreated
if (recreateIfInvalid && (err === FileSystemError.NOT_READABLE || err === FileSystemError.UNSUPPORTED_ENCODING)) {
appshell.fs.moveToTrash(path, function (err) {
if (err) {
console.log("Cannot move unreadable preferences file " + path + " to trash!!");
} else {
console.log("Brackets has recreated the unreadable preferences file " + path + ". You may refer to the deleted file in trash in case you need it!!");
}
}.bind(this));
}
result.resolve({});
} else {
result.reject(new Error("Unable to load preferences at " + path + " " + err));
}
return;
}
self._lineEndings = FileUtils.sniffLineEndings(text);
// If the file is empty, turn it into an empty object
if (/^\s*$/.test(text)) {
result.resolve({});
} else {
try {
result.resolve(JSON.parse(text));
} catch (e) {
if (recreateIfInvalid) {
// JSON parsing error -- recreate the preferences file
appshell.fs.moveToTrash(path, function (err) {
if (err) {
console.log("Cannot move unparseable preferences file " + path + " to trash!!");
} else {
console.log("Brackets has recreated the Invalid JSON preferences file " + path + ". You may refer to the deleted file in trash in case you need it!!");
}
}.bind(this));
result.resolve({});
} else {
result.reject(new ParsingError("Invalid JSON settings at " + path + "(" + e.toString() + ")"));
}
}
}
});
} else {
result.resolve({});
}
return result.promise();
} | [
"function",
"(",
")",
"{",
"var",
"result",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
";",
"var",
"path",
"=",
"this",
".",
"path",
";",
"var",
"createIfMissing",
"=",
"this",
".",
"createIfMissing",
";",
"var",
"recreateIfInvalid",
"=",
"this",
".",... | Loads the preferences from disk. Can throw an exception if the file is not
readable or parseable.
@return {Promise} Resolved with the data once it has been parsed. | [
"Loads",
"the",
"preferences",
"from",
"disk",
".",
"Can",
"throw",
"an",
"exception",
"if",
"the",
"file",
"is",
"not",
"readable",
"or",
"parseable",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L170-L229 | train | Load the preferences file | [
30522,
3853,
1006,
1007,
1063,
13075,
2765,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
13075,
4130,
1027,
2023,
1012,
4130,
1025,
13075,
3443,
10128,
15630,
7741,
1027,
2023,
1012,
3443,
10128,
15630,
7741,
1025,
13075,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensions/default/JavaScriptRefactoring/RenameIdentifier.js | requestFindRefs | function requestFindRefs(session, document, offset) {
if (!document || !session) {
return;
}
var path = document.file.fullPath,
fileInfo = {
type: MessageIds.TERN_FILE_INFO_TYPE_FULL,
name: path,
offsetLines: 0,
text: ScopeManager.filterText(session.getJavascriptText())
};
var ternPromise = getRefs(fileInfo, offset);
return {promise: ternPromise};
} | javascript | function requestFindRefs(session, document, offset) {
if (!document || !session) {
return;
}
var path = document.file.fullPath,
fileInfo = {
type: MessageIds.TERN_FILE_INFO_TYPE_FULL,
name: path,
offsetLines: 0,
text: ScopeManager.filterText(session.getJavascriptText())
};
var ternPromise = getRefs(fileInfo, offset);
return {promise: ternPromise};
} | [
"function",
"requestFindRefs",
"(",
"session",
",",
"document",
",",
"offset",
")",
"{",
"if",
"(",
"!",
"document",
"||",
"!",
"session",
")",
"{",
"return",
";",
"}",
"var",
"path",
"=",
"document",
".",
"file",
".",
"fullPath",
",",
"fileInfo",
"=",... | Create info required to find reference | [
"Create",
"info",
"required",
"to",
"find",
"reference"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/RenameIdentifier.js#L55-L69 | train | Request find refs | [
30522,
3853,
5227,
16294,
16200,
10343,
1006,
5219,
1010,
6254,
1010,
16396,
1007,
30524,
5371,
1012,
2440,
15069,
1010,
5371,
2378,
14876,
1027,
1063,
2828,
1024,
4471,
9821,
1012,
28774,
2078,
1035,
5371,
1035,
18558,
1035,
2828,
1035,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/widgets/InlineMenu.js | _rotateSelection | function _rotateSelection(distance) {
var len = self.items.length,
pos;
if (self.selectedIndex < 0) {
// set the initial selection
pos = (distance > 0) ? distance - 1 : len - 1;
} else {
// adjust current selection
pos = self.selectedIndex;
// Don't "rotate" until all items have been shown
if (distance > 0) {
if (pos === (len - 1)) {
pos = 0; // wrap
} else {
pos = Math.min(pos + distance, len - 1);
}
} else {
if (pos === 0) {
pos = (len - 1); // wrap
} else {
pos = Math.max(pos + distance, 0);
}
}
}
self._setSelectedIndex(pos);
} | javascript | function _rotateSelection(distance) {
var len = self.items.length,
pos;
if (self.selectedIndex < 0) {
// set the initial selection
pos = (distance > 0) ? distance - 1 : len - 1;
} else {
// adjust current selection
pos = self.selectedIndex;
// Don't "rotate" until all items have been shown
if (distance > 0) {
if (pos === (len - 1)) {
pos = 0; // wrap
} else {
pos = Math.min(pos + distance, len - 1);
}
} else {
if (pos === 0) {
pos = (len - 1); // wrap
} else {
pos = Math.max(pos + distance, 0);
}
}
}
self._setSelectedIndex(pos);
} | [
"function",
"_rotateSelection",
"(",
"distance",
")",
"{",
"var",
"len",
"=",
"self",
".",
"items",
".",
"length",
",",
"pos",
";",
"if",
"(",
"self",
".",
"selectedIndex",
"<",
"0",
")",
"{",
"// set the initial selection",
"pos",
"=",
"(",
"distance",
... | positive distance rotates down; negative distance rotates up | [
"positive",
"distance",
"rotates",
"down",
";",
"negative",
"distance",
"rotates",
"up"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/widgets/InlineMenu.js#L279-L308 | train | Rotate the selection to the specified distance. | [
30522,
3853,
1035,
24357,
11246,
18491,
1006,
3292,
1007,
1063,
13075,
18798,
1027,
2969,
1012,
5167,
1012,
3091,
1010,
13433,
2015,
1025,
2065,
1006,
2969,
1012,
3479,
22254,
10288,
1026,
1014,
1007,
1063,
1013,
1013,
2275,
1996,
3988,
498... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-js | lib/event-stream/event-message-chunker.js | eventMessageChunker | function eventMessageChunker(buffer) {
/** @type Buffer[] */
var messages = [];
var offset = 0;
while (offset < buffer.length) {
var totalLength = buffer.readInt32BE(offset);
// create new buffer for individual message (shares memory with original)
var message = buffer.slice(offset, totalLength + offset);
// increment offset to it starts at the next message
offset += totalLength;
messages.push(message);
}
return messages;
} | javascript | function eventMessageChunker(buffer) {
/** @type Buffer[] */
var messages = [];
var offset = 0;
while (offset < buffer.length) {
var totalLength = buffer.readInt32BE(offset);
// create new buffer for individual message (shares memory with original)
var message = buffer.slice(offset, totalLength + offset);
// increment offset to it starts at the next message
offset += totalLength;
messages.push(message);
}
return messages;
} | [
"function",
"eventMessageChunker",
"(",
"buffer",
")",
"{",
"/** @type Buffer[] */",
"var",
"messages",
"=",
"[",
"]",
";",
"var",
"offset",
"=",
"0",
";",
"while",
"(",
"offset",
"<",
"buffer",
".",
"length",
")",
"{",
"var",
"totalLength",
"=",
"buffer",... | Takes in a buffer of event messages and splits them into individual messages.
@param {Buffer} buffer
@api private | [
"Takes",
"in",
"a",
"buffer",
"of",
"event",
"messages",
"and",
"splits",
"them",
"into",
"individual",
"messages",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/event-stream/event-message-chunker.js#L6-L23 | train | chunk the given buffer into messages | [
30522,
3853,
2724,
7834,
3736,
3351,
20760,
8950,
2121,
1006,
17698,
1007,
1063,
1013,
1008,
1008,
1030,
2828,
17698,
1031,
1033,
1008,
1013,
13075,
7696,
1027,
1031,
1033,
1025,
13075,
16396,
1027,
1014,
1025,
2096,
1006,
16396,
1026,
1769... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/key-spacing.js | createGroups | function createGroups(node) {
if (node.properties.length === 1) {
return [node.properties];
}
return node.properties.reduce((groups, property) => {
const currentGroup = last(groups),
prev = last(currentGroup);
if (!prev || continuesPropertyGroup(prev, property)) {
currentGroup.push(property);
} else {
groups.push([property]);
}
return groups;
}, [
[]
]);
} | javascript | function createGroups(node) {
if (node.properties.length === 1) {
return [node.properties];
}
return node.properties.reduce((groups, property) => {
const currentGroup = last(groups),
prev = last(currentGroup);
if (!prev || continuesPropertyGroup(prev, property)) {
currentGroup.push(property);
} else {
groups.push([property]);
}
return groups;
}, [
[]
]);
} | [
"function",
"createGroups",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"properties",
".",
"length",
"===",
"1",
")",
"{",
"return",
"[",
"node",
".",
"properties",
"]",
";",
"}",
"return",
"node",
".",
"properties",
".",
"reduce",
"(",
"(",
"grou... | Creates groups of properties.
@param {ASTNode} node ObjectExpression node being evaluated.
@returns {Array.<ASTNode[]>} Groups of property AST node lists. | [
"Creates",
"groups",
"of",
"properties",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/key-spacing.js#L522-L541 | train | Create groups of properties | [
30522,
3853,
3443,
17058,
2015,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
5144,
1012,
3091,
1027,
1027,
1027,
1015,
1007,
1063,
2709,
1031,
13045,
1012,
5144,
1033,
1025,
1065,
2709,
13045,
1012,
5144,
1012,
5547,
1006,
1006,
2967,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jiahaog/nativefier | src/infer/inferIcon.js | getMatchingIcons | function getMatchingIcons(iconsWithScores, maxScore) {
return iconsWithScores
.filter((item) => item.score === maxScore)
.map((item) => Object.assign({}, item, { ext: path.extname(item.url) }));
} | javascript | function getMatchingIcons(iconsWithScores, maxScore) {
return iconsWithScores
.filter((item) => item.score === maxScore)
.map((item) => Object.assign({}, item, { ext: path.extname(item.url) }));
} | [
"function",
"getMatchingIcons",
"(",
"iconsWithScores",
",",
"maxScore",
")",
"{",
"return",
"iconsWithScores",
".",
"filter",
"(",
"(",
"item",
")",
"=>",
"item",
".",
"score",
"===",
"maxScore",
")",
".",
"map",
"(",
"(",
"item",
")",
"=>",
"Object",
"... | also maps ext to icon object | [
"also",
"maps",
"ext",
"to",
"icon",
"object"
] | b959956a38ce51a9dd95d42308f0a6c66489b624 | https://github.com/jiahaog/nativefier/blob/b959956a38ce51a9dd95d42308f0a6c66489b624/src/infer/inferIcon.js#L26-L30 | train | Get matching icons | [
30522,
3853,
2131,
18900,
8450,
28524,
2015,
1006,
18407,
24415,
9363,
6072,
1010,
4098,
9363,
2890,
1007,
1063,
2709,
18407,
24415,
9363,
6072,
1012,
11307,
1006,
1006,
8875,
1007,
1027,
1028,
8875,
1012,
3556,
1027,
1027,
1027,
4098,
9363... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DatePicker.js | resolveDependenciesToUnified | function resolveDependenciesToUnified() {
if ( !Calendar || !DateRange ) {
sap.ui.getCore().loadLibrary("sap.ui.unified");
Calendar = sap.ui.requireSync("sap/ui/unified/Calendar");
DateRange = sap.ui.requireSync("sap/ui/unified/DateRange");
}
} | javascript | function resolveDependenciesToUnified() {
if ( !Calendar || !DateRange ) {
sap.ui.getCore().loadLibrary("sap.ui.unified");
Calendar = sap.ui.requireSync("sap/ui/unified/Calendar");
DateRange = sap.ui.requireSync("sap/ui/unified/DateRange");
}
} | [
"function",
"resolveDependenciesToUnified",
"(",
")",
"{",
"if",
"(",
"!",
"Calendar",
"||",
"!",
"DateRange",
")",
"{",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"loadLibrary",
"(",
"\"sap.ui.unified\"",
")",
";",
"Calendar",
"=",
"sap",
".",
"ui... | /*
helper to resolve lazy dependencies
TODO: should act asynchronously | [
"/",
"*",
"helper",
"to",
"resolve",
"lazy",
"dependencies",
"TODO",
":",
"should",
"act",
"asynchronously"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/DatePicker.js#L1044-L1050 | train | This function will load the library and load the dependencies to unified | [
30522,
3853,
10395,
13699,
10497,
15266,
24826,
25201,
1006,
1007,
1063,
2065,
1006,
999,
8094,
1064,
1064,
999,
3058,
24388,
2063,
1007,
1063,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
1012,
7170,
29521,
19848,
2100,
1006,
1000,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moleculerjs/moleculer | bin/moleculer-runner.js | startWorkers | function startWorkers(instances) {
let stopping = false;
cluster.on("exit", function(worker, code) {
if (!stopping) {
// only restart the worker if the exit was by an error
if (production && code !== 0) {
logger.info(`The worker #${worker.id} has disconnected`);
logger.info(`Worker #${worker.id} restarting...`);
cluster.fork();
logger.info(`Worker #${worker.id} restarted`);
} else {
process.exit(code);
}
}
});
const workerCount = Number.isInteger(instances) && instances > 0 ? instances : os.cpus().length;
logger.info(`Starting ${workerCount} workers...`);
for (let i = 0; i < workerCount; i++) {
cluster.fork();
}
stopSignals.forEach(function (signal) {
process.on(signal, () => {
logger.info(`Got ${signal}, stopping workers...`);
stopping = true;
cluster.disconnect(function () {
logger.info("All workers stopped, exiting.");
process.exit(0);
});
});
});
} | javascript | function startWorkers(instances) {
let stopping = false;
cluster.on("exit", function(worker, code) {
if (!stopping) {
// only restart the worker if the exit was by an error
if (production && code !== 0) {
logger.info(`The worker #${worker.id} has disconnected`);
logger.info(`Worker #${worker.id} restarting...`);
cluster.fork();
logger.info(`Worker #${worker.id} restarted`);
} else {
process.exit(code);
}
}
});
const workerCount = Number.isInteger(instances) && instances > 0 ? instances : os.cpus().length;
logger.info(`Starting ${workerCount} workers...`);
for (let i = 0; i < workerCount; i++) {
cluster.fork();
}
stopSignals.forEach(function (signal) {
process.on(signal, () => {
logger.info(`Got ${signal}, stopping workers...`);
stopping = true;
cluster.disconnect(function () {
logger.info("All workers stopped, exiting.");
process.exit(0);
});
});
});
} | [
"function",
"startWorkers",
"(",
"instances",
")",
"{",
"let",
"stopping",
"=",
"false",
";",
"cluster",
".",
"on",
"(",
"\"exit\"",
",",
"function",
"(",
"worker",
",",
"code",
")",
"{",
"if",
"(",
"!",
"stopping",
")",
"{",
"// only restart the worker if... | /*
Start cluster workers | [
"/",
"*",
"Start",
"cluster",
"workers"
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/bin/moleculer-runner.js#L359-L394 | train | Starts all workers | [
30522,
3853,
2707,
6198,
2545,
1006,
12107,
1007,
1063,
2292,
7458,
1027,
6270,
1025,
9324,
1012,
2006,
1006,
1000,
6164,
1000,
1010,
3853,
1006,
7309,
1010,
3642,
1007,
1063,
2065,
1006,
999,
7458,
1007,
1063,
1013,
1013,
2069,
23818,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesBase.js | _findMatchingGlob | function _findMatchingGlob(pathData, filename) {
var globs = Object.keys(pathData),
globCounter;
if (!filename) {
return;
}
for (globCounter = 0; globCounter < globs.length; globCounter++) {
var glob = globs[globCounter];
if (globmatch(filename, glob)) {
return glob;
}
}
} | javascript | function _findMatchingGlob(pathData, filename) {
var globs = Object.keys(pathData),
globCounter;
if (!filename) {
return;
}
for (globCounter = 0; globCounter < globs.length; globCounter++) {
var glob = globs[globCounter];
if (globmatch(filename, glob)) {
return glob;
}
}
} | [
"function",
"_findMatchingGlob",
"(",
"pathData",
",",
"filename",
")",
"{",
"var",
"globs",
"=",
"Object",
".",
"keys",
"(",
"pathData",
")",
",",
"globCounter",
";",
"if",
"(",
"!",
"filename",
")",
"{",
"return",
";",
"}",
"for",
"(",
"globCounter",
... | Utility functions for the PathLayer
@private
Look for a matching file glob among the collection of paths.
@param {Object} pathData The keys are globs and the values are the preferences for that glob
@param {string} filename relative filename to match against the globs
@return {?string} glob pattern that matched, if any | [
"Utility",
"functions",
"for",
"the",
"PathLayer",
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L573-L588 | train | Find a glob in the pathData | [
30522,
3853,
1035,
2424,
18900,
8450,
23296,
16429,
1006,
4130,
2850,
2696,
1010,
5371,
18442,
1007,
1063,
13075,
1043,
4135,
5910,
1027,
4874,
1012,
6309,
1006,
4130,
2850,
2696,
1007,
1010,
1043,
4135,
9818,
21723,
2121,
1025,
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... |
eslint/eslint | lib/rules/no-var.js | getScopeNode | function getScopeNode(node) {
for (let currentNode = node; currentNode; currentNode = currentNode.parent) {
if (SCOPE_NODE_TYPE.test(currentNode.type)) {
return currentNode;
}
}
/* istanbul ignore next : unreachable */
return null;
} | javascript | function getScopeNode(node) {
for (let currentNode = node; currentNode; currentNode = currentNode.parent) {
if (SCOPE_NODE_TYPE.test(currentNode.type)) {
return currentNode;
}
}
/* istanbul ignore next : unreachable */
return null;
} | [
"function",
"getScopeNode",
"(",
"node",
")",
"{",
"for",
"(",
"let",
"currentNode",
"=",
"node",
";",
"currentNode",
";",
"currentNode",
"=",
"currentNode",
".",
"parent",
")",
"{",
"if",
"(",
"SCOPE_NODE_TYPE",
".",
"test",
"(",
"currentNode",
".",
"type... | Gets the scope node which directly contains a given node.
@param {ASTNode} node - A node to get. This is a `VariableDeclaration` or
an `Identifier`.
@returns {ASTNode} A scope node. This is one of `Program`, `BlockStatement`,
`SwitchStatement`, `ForStatement`, `ForInStatement`, and
`ForOfStatement`. | [
"Gets",
"the",
"scope",
"node",
"which",
"directly",
"contains",
"a",
"given",
"node",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-var.js#L91-L100 | train | Returns the scope node of a node | [
30522,
3853,
4152,
16186,
3630,
3207,
1006,
13045,
1007,
1063,
2005,
1006,
2292,
2783,
3630,
3207,
1027,
13045,
1025,
2783,
3630,
3207,
1025,
2783,
3630,
3207,
1027,
2783,
3630,
3207,
1012,
6687,
1007,
1063,
2065,
1006,
9531,
1035,
13045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | src/platforms/web/util/style.js | normalizeStyleData | function normalizeStyleData (data: VNodeData): ?Object {
const style = normalizeStyleBinding(data.style)
// static style is pre-processed into an object during compilation
// and is always a fresh object, so it's safe to merge into it
return data.staticStyle
? extend(data.staticStyle, style)
: style
} | javascript | function normalizeStyleData (data: VNodeData): ?Object {
const style = normalizeStyleBinding(data.style)
// static style is pre-processed into an object during compilation
// and is always a fresh object, so it's safe to merge into it
return data.staticStyle
? extend(data.staticStyle, style)
: style
} | [
"function",
"normalizeStyleData",
"(",
"data",
":",
"VNodeData",
")",
":",
"?",
"Object",
"{",
"const",
"style",
"=",
"normalizeStyleBinding",
"(",
"data",
".",
"style",
")",
"// static style is pre-processed into an object during compilation",
"// and is always a fresh obj... | merge static and dynamic style data on the same vnode | [
"merge",
"static",
"and",
"dynamic",
"style",
"data",
"on",
"the",
"same",
"vnode"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/src/platforms/web/util/style.js#L19-L26 | train | Normalizes the style data into a single object | [
30522,
3853,
3671,
10057,
27983,
2850,
2696,
1006,
2951,
1024,
1058,
3630,
5732,
6790,
1007,
1024,
1029,
4874,
1063,
9530,
3367,
2806,
1027,
3671,
10057,
27983,
8428,
4667,
1006,
2951,
1012,
2806,
1007,
1013,
1013,
10763,
2806,
2003,
3653,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeekyAnts/vue-native-core | src/platforms/vue-native/runtime/render-helpers/transitionWeb.js | checkDuration | function checkDuration(val, name) {
if (typeof val !== "number") {
warn(
`<transition> explicit ${name} duration is not a valid number - ` +
`got ${JSON.stringify(val)}.`
);
} else if (isNaN(val)) {
warn(
`<transition> explicit ${name} duration is NaN - ` +
"the duration expression might be incorrect."
);
}
} | javascript | function checkDuration(val, name) {
if (typeof val !== "number") {
warn(
`<transition> explicit ${name} duration is not a valid number - ` +
`got ${JSON.stringify(val)}.`
);
} else if (isNaN(val)) {
warn(
`<transition> explicit ${name} duration is NaN - ` +
"the duration expression might be incorrect."
);
}
} | [
"function",
"checkDuration",
"(",
"val",
",",
"name",
")",
"{",
"if",
"(",
"typeof",
"val",
"!==",
"\"number\"",
")",
"{",
"warn",
"(",
"`",
"${",
"name",
"}",
"`",
"+",
"`",
"${",
"JSON",
".",
"stringify",
"(",
"val",
")",
"}",
"`",
")",
";",
... | only used in dev mode | [
"only",
"used",
"in",
"dev",
"mode"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/src/platforms/vue-native/runtime/render-helpers/transitionWeb.js#L61-L73 | train | Check if the duration expression is valid | [
30522,
3853,
4638,
24979,
3370,
1006,
11748,
1010,
2171,
1007,
1063,
2065,
1006,
2828,
11253,
11748,
999,
1027,
1027,
1000,
2193,
1000,
1007,
1063,
11582,
1006,
1036,
1026,
6653,
1028,
13216,
1002,
1063,
2171,
1065,
9367,
2003,
2025,
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... |
eslint/eslint | lib/rules/max-lines-per-function.js | getCommentLineNumbers | function getCommentLineNumbers(comments) {
const map = new Map();
if (!comments) {
return map;
}
comments.forEach(comment => {
for (let i = comment.loc.start.line; i <= comment.loc.end.line; i++) {
map.set(i, comment);
}
});
return map;
} | javascript | function getCommentLineNumbers(comments) {
const map = new Map();
if (!comments) {
return map;
}
comments.forEach(comment => {
for (let i = comment.loc.start.line; i <= comment.loc.end.line; i++) {
map.set(i, comment);
}
});
return map;
} | [
"function",
"getCommentLineNumbers",
"(",
"comments",
")",
"{",
"const",
"map",
"=",
"new",
"Map",
"(",
")",
";",
"if",
"(",
"!",
"comments",
")",
"{",
"return",
"map",
";",
"}",
"comments",
".",
"forEach",
"(",
"comment",
"=>",
"{",
"for",
"(",
"let... | Given a list of comment nodes, return a map with numeric keys (source code line numbers) and comment token values.
@param {Array} comments An array of comment nodes.
@returns {Map.<string,Node>} A map with numeric keys (source code line numbers) and comment token values. | [
"Given",
"a",
"list",
"of",
"comment",
"nodes",
"return",
"a",
"map",
"with",
"numeric",
"keys",
"(",
"source",
"code",
"line",
"numbers",
")",
"and",
"comment",
"token",
"values",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/max-lines-per-function.js#L52-L64 | train | Get a map of line numbers for a comment | [
30522,
3853,
2131,
9006,
3672,
4179,
19172,
17198,
1006,
7928,
1007,
1063,
9530,
3367,
4949,
1027,
2047,
4949,
1006,
1007,
1025,
2065,
1006,
999,
7928,
1007,
1063,
2709,
4949,
1025,
1065,
7928,
1012,
18921,
6776,
1006,
7615,
1027,
1028,
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 | findAncestor | function findAncestor(node, predicate) {
var last = false;
while (node != null && !(last = predicate(node))) {
node = node.parentNode;
}
return last ? node : null;
} | javascript | function findAncestor(node, predicate) {
var last = false;
while (node != null && !(last = predicate(node))) {
node = node.parentNode;
}
return last ? node : null;
} | [
"function",
"findAncestor",
"(",
"node",
",",
"predicate",
")",
"{",
"var",
"last",
"=",
"false",
";",
"while",
"(",
"node",
"!=",
"null",
"&&",
"!",
"(",
"last",
"=",
"predicate",
"(",
"node",
")",
")",
")",
"{",
"node",
"=",
"node",
".",
"parentN... | Return the first ancestor for which the {@code predicate} returns true.
@param {Node} node The node to check.
@param {function(Node):boolean} predicate The function that tests the
nodes.
@return {Node} The found ancestor or null if not found. | [
"Return",
"the",
"first",
"ancestor",
"for",
"which",
"the",
"{"
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L121-L127 | train | Find an ancestor of node that satisfies predicate | [
30522,
3853,
2424,
26755,
4263,
1006,
13045,
1010,
3653,
30524,
3630,
3207,
1025,
1065,
2709,
2197,
1029,
13045,
1024,
19701,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-js | lib/cloudfront/signer.js | function (options, cb) {
try {
var resource = getResource(options.url);
} catch (err) {
return handleError(err, cb);
}
var parsedUrl = url.parse(options.url, true),
signatureHash = Object.prototype.hasOwnProperty.call(options, 'policy')
? signWithCustomPolicy(options.policy, this.keyPairId, this.privateKey)
: signWithCannedPolicy(resource, options.expires, this.keyPairId, this.privateKey);
parsedUrl.search = null;
for (var key in signatureHash) {
if (Object.prototype.hasOwnProperty.call(signatureHash, key)) {
parsedUrl.query[key] = signatureHash[key];
}
}
try {
var signedUrl = determineScheme(options.url) === 'rtmp'
? getRtmpUrl(url.format(parsedUrl))
: url.format(parsedUrl);
} catch (err) {
return handleError(err, cb);
}
return handleSuccess(signedUrl, cb);
} | javascript | function (options, cb) {
try {
var resource = getResource(options.url);
} catch (err) {
return handleError(err, cb);
}
var parsedUrl = url.parse(options.url, true),
signatureHash = Object.prototype.hasOwnProperty.call(options, 'policy')
? signWithCustomPolicy(options.policy, this.keyPairId, this.privateKey)
: signWithCannedPolicy(resource, options.expires, this.keyPairId, this.privateKey);
parsedUrl.search = null;
for (var key in signatureHash) {
if (Object.prototype.hasOwnProperty.call(signatureHash, key)) {
parsedUrl.query[key] = signatureHash[key];
}
}
try {
var signedUrl = determineScheme(options.url) === 'rtmp'
? getRtmpUrl(url.format(parsedUrl))
: url.format(parsedUrl);
} catch (err) {
return handleError(err, cb);
}
return handleSuccess(signedUrl, cb);
} | [
"function",
"(",
"options",
",",
"cb",
")",
"{",
"try",
"{",
"var",
"resource",
"=",
"getResource",
"(",
"options",
".",
"url",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"return",
"handleError",
"(",
"err",
",",
"cb",
")",
";",
"}",
"var",
"p... | Create a signed Amazon CloudFront URL.
Keep in mind that URLs meant for use in media/flash players may have
different requirements for URL formats (e.g. some require that the
extension be removed, some require the file name to be prefixed
- mp4:<path>, some require you to add "/cfx/st" into your URL).
@param options [Object] The options to create a signed URL.
@option options url [String] The URL to which the signature will grant
access. Any query params included with
the URL should be encoded. Required.
@option options expires [Number] A Unix UTC timestamp indicating when the
signature should expire. Required unless you
pass in a full policy.
@option options policy [String] A CloudFront JSON policy. Required unless
you pass in a url and an expiry time.
@param cb [Function] if a callback is provided, this function will
pass the URL as the second parameter (after the error parameter) to
the callback function.
@return [String] if called synchronously (with no callback), returns the
signed URL.
@return [null] nothing is returned if a callback is provided. | [
"Create",
"a",
"signed",
"Amazon",
"CloudFront",
"URL",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/cloudfront/signer.js#L176-L204 | train | Signs a URL with the specified options | [
30522,
3853,
1006,
7047,
1010,
17324,
1007,
1063,
3046,
1063,
13075,
7692,
1027,
2131,
6072,
8162,
3401,
1006,
7047,
1012,
24471,
2140,
1007,
1025,
1065,
4608,
1006,
9413,
2099,
1007,
1063,
2709,
5047,
2121,
29165,
1006,
9413,
2099,
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... | |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/chart.js/Chart.js | function (obj) {
if (obj instanceof Color) {
return obj;
}
if (!(this instanceof Color)) {
return new Color(obj);
}
this.valid = false;
this.values = {
rgb: [0, 0, 0],
hsl: [0, 0, 0],
hsv: [0, 0, 0],
hwb: [0, 0, 0],
cmyk: [0, 0, 0, 0],
alpha: 1
};
// parse Color() argument
var vals;
if (typeof obj === 'string') {
vals = colorString.getRgba(obj);
if (vals) {
this.setValues('rgb', vals);
} else if (vals = colorString.getHsla(obj)) {
this.setValues('hsl', vals);
} else if (vals = colorString.getHwb(obj)) {
this.setValues('hwb', vals);
}
} else if (typeof obj === 'object') {
vals = obj;
if (vals.r !== undefined || vals.red !== undefined) {
this.setValues('rgb', vals);
} else if (vals.l !== undefined || vals.lightness !== undefined) {
this.setValues('hsl', vals);
} else if (vals.v !== undefined || vals.value !== undefined) {
this.setValues('hsv', vals);
} else if (vals.w !== undefined || vals.whiteness !== undefined) {
this.setValues('hwb', vals);
} else if (vals.c !== undefined || vals.cyan !== undefined) {
this.setValues('cmyk', vals);
}
}
} | javascript | function (obj) {
if (obj instanceof Color) {
return obj;
}
if (!(this instanceof Color)) {
return new Color(obj);
}
this.valid = false;
this.values = {
rgb: [0, 0, 0],
hsl: [0, 0, 0],
hsv: [0, 0, 0],
hwb: [0, 0, 0],
cmyk: [0, 0, 0, 0],
alpha: 1
};
// parse Color() argument
var vals;
if (typeof obj === 'string') {
vals = colorString.getRgba(obj);
if (vals) {
this.setValues('rgb', vals);
} else if (vals = colorString.getHsla(obj)) {
this.setValues('hsl', vals);
} else if (vals = colorString.getHwb(obj)) {
this.setValues('hwb', vals);
}
} else if (typeof obj === 'object') {
vals = obj;
if (vals.r !== undefined || vals.red !== undefined) {
this.setValues('rgb', vals);
} else if (vals.l !== undefined || vals.lightness !== undefined) {
this.setValues('hsl', vals);
} else if (vals.v !== undefined || vals.value !== undefined) {
this.setValues('hsv', vals);
} else if (vals.w !== undefined || vals.whiteness !== undefined) {
this.setValues('hwb', vals);
} else if (vals.c !== undefined || vals.cyan !== undefined) {
this.setValues('cmyk', vals);
}
}
} | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Color",
")",
"{",
"return",
"obj",
";",
"}",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Color",
")",
")",
"{",
"return",
"new",
"Color",
"(",
"obj",
")",
";",
"}",
"this",
".",
... | /* MIT license | [
"/",
"*",
"MIT",
"license"
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L1198-L1241 | train | Color constructor. | [
30522,
3853,
1006,
27885,
3501,
1007,
1063,
2065,
1006,
27885,
3501,
6013,
11253,
3609,
1007,
1063,
2709,
27885,
3501,
1025,
1065,
2065,
1006,
999,
1006,
2023,
6013,
11253,
3609,
1007,
1007,
1063,
2709,
2047,
3609,
1006,
27885,
3501,
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... | |
jgraph/mxgraph | javascript/mxClient.js | function(e)
{
if ((e.type == 'touchstart' || e.type == 'touchmove') && e.touches != null && e.touches[0] != null)
{
e = e.touches[0];
}
else if (e.type == 'touchend' && e.changedTouches != null && e.changedTouches[0] != null)
{
e = e.changedTouches[0];
}
return e;
} | javascript | function(e)
{
if ((e.type == 'touchstart' || e.type == 'touchmove') && e.touches != null && e.touches[0] != null)
{
e = e.touches[0];
}
else if (e.type == 'touchend' && e.changedTouches != null && e.changedTouches[0] != null)
{
e = e.changedTouches[0];
}
return e;
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"(",
"e",
".",
"type",
"==",
"'touchstart'",
"||",
"e",
".",
"type",
"==",
"'touchmove'",
")",
"&&",
"e",
".",
"touches",
"!=",
"null",
"&&",
"e",
".",
"touches",
"[",
"0",
"]",
"!=",
"null",
")",
"{",... | Function: getMainEvent
Returns the touch or mouse event that contains the mouse coordinates. | [
"Function",
":",
"getMainEvent"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L9986-L9998 | train | This function is used to get the event object from the event object | [
30522,
3853,
1006,
1041,
1007,
1063,
2065,
1006,
1006,
1041,
1012,
2828,
1027,
1027,
1005,
3543,
14117,
2102,
1005,
1064,
1064,
1041,
1012,
2828,
1027,
1027,
1005,
3543,
5302,
3726,
1005,
1007,
1004,
1004,
1041,
1012,
12817,
999,
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... | |
jgraph/mxgraph | javascript/mxClient.js | function (rect, m, style, flipH, flipV)
{
var d = mxUtils.getValue(style, mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST);
flipH = (flipH != null) ? flipH : mxUtils.getValue(style, mxConstants.STYLE_FLIPH, false);
flipV = (flipV != null) ? flipV : mxUtils.getValue(style, mxConstants.STYLE_FLIPV, false);
m.x = Math.round(Math.max(0, Math.min(rect.width, m.x)));
m.y = Math.round(Math.max(0, Math.min(rect.height, m.y)));
m.width = Math.round(Math.max(0, Math.min(rect.width, m.width)));
m.height = Math.round(Math.max(0, Math.min(rect.height, m.height)));
if ((flipV && (d == mxConstants.DIRECTION_SOUTH || d == mxConstants.DIRECTION_NORTH)) ||
(flipH && (d == mxConstants.DIRECTION_EAST || d == mxConstants.DIRECTION_WEST)))
{
var tmp = m.x;
m.x = m.width;
m.width = tmp;
}
if ((flipH && (d == mxConstants.DIRECTION_SOUTH || d == mxConstants.DIRECTION_NORTH)) ||
(flipV && (d == mxConstants.DIRECTION_EAST || d == mxConstants.DIRECTION_WEST)))
{
var tmp = m.y;
m.y = m.height;
m.height = tmp;
}
var m2 = mxRectangle.fromRectangle(m);
if (d == mxConstants.DIRECTION_SOUTH)
{
m2.y = m.x;
m2.x = m.height;
m2.width = m.y;
m2.height = m.width;
}
else if (d == mxConstants.DIRECTION_WEST)
{
m2.y = m.height;
m2.x = m.width;
m2.width = m.x;
m2.height = m.y;
}
else if (d == mxConstants.DIRECTION_NORTH)
{
m2.y = m.width;
m2.x = m.y;
m2.width = m.height;
m2.height = m.x;
}
return new mxRectangle(rect.x + m2.x, rect.y + m2.y, rect.width - m2.width - m2.x, rect.height - m2.height - m2.y);
} | javascript | function (rect, m, style, flipH, flipV)
{
var d = mxUtils.getValue(style, mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST);
flipH = (flipH != null) ? flipH : mxUtils.getValue(style, mxConstants.STYLE_FLIPH, false);
flipV = (flipV != null) ? flipV : mxUtils.getValue(style, mxConstants.STYLE_FLIPV, false);
m.x = Math.round(Math.max(0, Math.min(rect.width, m.x)));
m.y = Math.round(Math.max(0, Math.min(rect.height, m.y)));
m.width = Math.round(Math.max(0, Math.min(rect.width, m.width)));
m.height = Math.round(Math.max(0, Math.min(rect.height, m.height)));
if ((flipV && (d == mxConstants.DIRECTION_SOUTH || d == mxConstants.DIRECTION_NORTH)) ||
(flipH && (d == mxConstants.DIRECTION_EAST || d == mxConstants.DIRECTION_WEST)))
{
var tmp = m.x;
m.x = m.width;
m.width = tmp;
}
if ((flipH && (d == mxConstants.DIRECTION_SOUTH || d == mxConstants.DIRECTION_NORTH)) ||
(flipV && (d == mxConstants.DIRECTION_EAST || d == mxConstants.DIRECTION_WEST)))
{
var tmp = m.y;
m.y = m.height;
m.height = tmp;
}
var m2 = mxRectangle.fromRectangle(m);
if (d == mxConstants.DIRECTION_SOUTH)
{
m2.y = m.x;
m2.x = m.height;
m2.width = m.y;
m2.height = m.width;
}
else if (d == mxConstants.DIRECTION_WEST)
{
m2.y = m.height;
m2.x = m.width;
m2.width = m.x;
m2.height = m.y;
}
else if (d == mxConstants.DIRECTION_NORTH)
{
m2.y = m.width;
m2.x = m.y;
m2.width = m.height;
m2.height = m.x;
}
return new mxRectangle(rect.x + m2.x, rect.y + m2.y, rect.width - m2.width - m2.x, rect.height - m2.height - m2.y);
} | [
"function",
"(",
"rect",
",",
"m",
",",
"style",
",",
"flipH",
",",
"flipV",
")",
"{",
"var",
"d",
"=",
"mxUtils",
".",
"getValue",
"(",
"style",
",",
"mxConstants",
".",
"STYLE_DIRECTION",
",",
"mxConstants",
".",
"DIRECTION_EAST",
")",
";",
"flipH",
... | Function: getDirectedBounds
Adds the given margins to the given rectangle and rotates and flips the
rectangle according to the respective styles in style. | [
"Function",
":",
"getDirectedBounds"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L4451-L4503 | train | Updates the bounds of the given rectangle with the given style | [
30522,
3853,
1006,
28667,
2102,
1010,
1049,
1010,
2806,
1010,
11238,
2232,
1010,
11238,
2615,
1007,
1063,
13075,
1040,
1027,
25630,
21823,
4877,
1012,
2131,
10175,
5657,
1006,
2806,
1010,
25630,
8663,
12693,
3215,
1012,
2806,
1035,
3257,
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... | |
mescroll/mescroll | mescroll.js/html-demo/xinlang/option/mescroll-option.js | function(mescroll, downwarp) {
//初始化完毕的回调,可缓存dom
mescroll.downOnLoadDom = downwarp.getElementsByClassName("downwarp-onload")[0];
mescroll.downUnloadDom = downwarp.getElementsByClassName("downwarp-unload")[0];
mescroll.downTipDom = downwarp.getElementsByClassName("downwarp-tip")[0];
mescroll.downArrowDom = downwarp.getElementsByClassName("downwarp-arrow")[0];
} | javascript | function(mescroll, downwarp) {
//初始化完毕的回调,可缓存dom
mescroll.downOnLoadDom = downwarp.getElementsByClassName("downwarp-onload")[0];
mescroll.downUnloadDom = downwarp.getElementsByClassName("downwarp-unload")[0];
mescroll.downTipDom = downwarp.getElementsByClassName("downwarp-tip")[0];
mescroll.downArrowDom = downwarp.getElementsByClassName("downwarp-arrow")[0];
} | [
"function",
"(",
"mescroll",
",",
"downwarp",
")",
"{",
"//初始化完毕的回调,可缓存dom",
"mescroll",
".",
"downOnLoadDom",
"=",
"downwarp",
".",
"getElementsByClassName",
"(",
"\"downwarp-onload\"",
")",
"[",
"0",
"]",
";",
"mescroll",
".",
"downUnloadDom",
"=",
"downwarp",
... | 布局内容 | [
"布局内容"
] | 43d3dcf3062da0fe95995ddcb5e93f5725792c98 | https://github.com/mescroll/mescroll/blob/43d3dcf3062da0fe95995ddcb5e93f5725792c98/mescroll.js/html-demo/xinlang/option/mescroll-option.js#L65-L71 | train | init downwarp dom | [
30522,
3853,
1006,
2033,
11020,
28402,
1010,
2091,
9028,
2361,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
100,
1916,
100,
100,
1010,
100,
100,
100,
14383,
2033,
11020,
28402,
1012,
2091,
2239,
11066,
9527,
1027,
2091,
9028,
2361,
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... | |
aws/aws-sdk-js | lib/discover_endpoint.js | optionalDiscoverEndpoint | function optionalDiscoverEndpoint(request) {
var service = request.service;
var api = service.api;
var operationModel = api.operations ? api.operations[request.operation] : undefined;
var inputShape = operationModel ? operationModel.input : undefined;
var identifiers = marshallCustomIdentifiers(request, inputShape);
var cacheKey = getCacheKey(request);
if (Object.keys(identifiers).length > 0) {
cacheKey = util.update(cacheKey, identifiers);
if (operationModel) cacheKey.operation = operationModel.name;
}
var endpoints = AWS.endpointCache.get(cacheKey);
if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {
//endpoint operation is being made but response not yet received
//or endpoint operation just failed in 1 minute
return;
} else if (endpoints && endpoints.length > 0) {
//found endpoint record from cache
request.httpRequest.updateEndpoint(endpoints[0].Address);
} else {
//endpoint record not in cache or outdated. make discovery operation
var endpointRequest = service.makeRequest(api.endpointOperation, {
Operation: operationModel.name,
Identifiers: identifiers,
});
addApiVersionHeader(endpointRequest);
endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);
endpointRequest.removeListener('retry', AWS.EventListeners.Core.RETRY_CHECK);
//put in a placeholder for endpoints already requested, prevent
//too much in-flight calls
AWS.endpointCache.put(cacheKey, [{
Address: '',
CachePeriodInMinutes: 1
}]);
endpointRequest.send(function(err, data) {
if (data && data.Endpoints) {
AWS.endpointCache.put(cacheKey, data.Endpoints);
} else if (err) {
AWS.endpointCache.put(cacheKey, [{
Address: '',
CachePeriodInMinutes: 1 //not to make more endpoint operation in next 1 minute
}]);
}
});
}
} | javascript | function optionalDiscoverEndpoint(request) {
var service = request.service;
var api = service.api;
var operationModel = api.operations ? api.operations[request.operation] : undefined;
var inputShape = operationModel ? operationModel.input : undefined;
var identifiers = marshallCustomIdentifiers(request, inputShape);
var cacheKey = getCacheKey(request);
if (Object.keys(identifiers).length > 0) {
cacheKey = util.update(cacheKey, identifiers);
if (operationModel) cacheKey.operation = operationModel.name;
}
var endpoints = AWS.endpointCache.get(cacheKey);
if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {
//endpoint operation is being made but response not yet received
//or endpoint operation just failed in 1 minute
return;
} else if (endpoints && endpoints.length > 0) {
//found endpoint record from cache
request.httpRequest.updateEndpoint(endpoints[0].Address);
} else {
//endpoint record not in cache or outdated. make discovery operation
var endpointRequest = service.makeRequest(api.endpointOperation, {
Operation: operationModel.name,
Identifiers: identifiers,
});
addApiVersionHeader(endpointRequest);
endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);
endpointRequest.removeListener('retry', AWS.EventListeners.Core.RETRY_CHECK);
//put in a placeholder for endpoints already requested, prevent
//too much in-flight calls
AWS.endpointCache.put(cacheKey, [{
Address: '',
CachePeriodInMinutes: 1
}]);
endpointRequest.send(function(err, data) {
if (data && data.Endpoints) {
AWS.endpointCache.put(cacheKey, data.Endpoints);
} else if (err) {
AWS.endpointCache.put(cacheKey, [{
Address: '',
CachePeriodInMinutes: 1 //not to make more endpoint operation in next 1 minute
}]);
}
});
}
} | [
"function",
"optionalDiscoverEndpoint",
"(",
"request",
")",
"{",
"var",
"service",
"=",
"request",
".",
"service",
";",
"var",
"api",
"=",
"service",
".",
"api",
";",
"var",
"operationModel",
"=",
"api",
".",
"operations",
"?",
"api",
".",
"operations",
"... | Call endpoint discovery operation when it's optional.
When endpoint is available in cache then use the cached endpoints. If endpoints
are unavailable then use regional endpoints and call endpoint discovery operation
asynchronously. This is turned off by default.
@param [object] request object
@api private | [
"Call",
"endpoint",
"discovery",
"operation",
"when",
"it",
"s",
"optional",
".",
"When",
"endpoint",
"is",
"available",
"in",
"cache",
"then",
"use",
"the",
"cached",
"endpoints",
".",
"If",
"endpoints",
"are",
"unavailable",
"then",
"use",
"regional",
"endpo... | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/discover_endpoint.js#L72-L118 | train | optional Discover endpoint | [
30522,
3853,
11887,
10521,
3597,
28943,
4859,
8400,
1006,
5227,
1007,
1063,
13075,
2326,
1027,
5227,
1012,
2326,
1025,
13075,
17928,
1027,
2326,
1012,
17928,
1025,
13075,
3169,
5302,
9247,
1027,
17928,
1012,
3136,
1029,
17928,
1012,
3136,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (pres)
{
if (this.socket && this.socket.readyState !== WebSocket.CLOSED) {
if (pres) {
this._conn.send(pres);
}
var close = $build("close", { "xmlns": Strophe.NS.FRAMING, });
this._conn.xmlOutput(close);
var closeString = Strophe.serialize(close);
this._conn.rawOutput(closeString);
try {
this.socket.send(closeString);
} catch (e) {
Strophe.info("Couldn't send <close /> tag.");
}
}
this._conn._doDisconnect();
} | javascript | function (pres)
{
if (this.socket && this.socket.readyState !== WebSocket.CLOSED) {
if (pres) {
this._conn.send(pres);
}
var close = $build("close", { "xmlns": Strophe.NS.FRAMING, });
this._conn.xmlOutput(close);
var closeString = Strophe.serialize(close);
this._conn.rawOutput(closeString);
try {
this.socket.send(closeString);
} catch (e) {
Strophe.info("Couldn't send <close /> tag.");
}
}
this._conn._doDisconnect();
} | [
"function",
"(",
"pres",
")",
"{",
"if",
"(",
"this",
".",
"socket",
"&&",
"this",
".",
"socket",
".",
"readyState",
"!==",
"WebSocket",
".",
"CLOSED",
")",
"{",
"if",
"(",
"pres",
")",
"{",
"this",
".",
"_conn",
".",
"send",
"(",
"pres",
")",
";... | PrivateFunction: _disconnect
_Private_ function called by Strophe.Connection.disconnect
Disconnects and sends a last stanza if one is given
Parameters:
(Request) pres - This stanza will be sent before disconnecting. | [
"PrivateFunction",
":",
"_disconnect",
"_Private_",
"function",
"called",
"by",
"Strophe",
".",
"Connection",
".",
"disconnect"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L4974-L4991 | train | Send a close tag to the server | [
30522,
3853,
1006,
3653,
2015,
1007,
1063,
2065,
1006,
2023,
1012,
22278,
1004,
1004,
2023,
1012,
22278,
1012,
3201,
9153,
2618,
999,
1027,
1027,
4773,
6499,
19869,
2102,
1012,
2701,
1007,
1063,
2065,
1006,
3653,
2015,
1007,
1063,
2023,
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/services/url/utils.js | getVersionPath | function getVersionPath(options) {
const apiVersions = config.get('api:versions');
let requestedVersion = options.version || 'v0.1';
let requestedVersionType = options.type || 'content';
let versionData = apiVersions[requestedVersion];
if (typeof versionData === 'string') {
versionData = apiVersions[versionData];
}
let versionPath = versionData[requestedVersionType];
return `/${versionPath}/`;
} | javascript | function getVersionPath(options) {
const apiVersions = config.get('api:versions');
let requestedVersion = options.version || 'v0.1';
let requestedVersionType = options.type || 'content';
let versionData = apiVersions[requestedVersion];
if (typeof versionData === 'string') {
versionData = apiVersions[versionData];
}
let versionPath = versionData[requestedVersionType];
return `/${versionPath}/`;
} | [
"function",
"getVersionPath",
"(",
"options",
")",
"{",
"const",
"apiVersions",
"=",
"config",
".",
"get",
"(",
"'api:versions'",
")",
";",
"let",
"requestedVersion",
"=",
"options",
".",
"version",
"||",
"'v0.1'",
";",
"let",
"requestedVersionType",
"=",
"opt... | Returns path containing only the path for the specific version asked or deprecated by default
@param {Object} options {version} for which to get the path(stable, actice, deprecated),
{type} admin|content: defaults to {version: deprecated, type: content}
@return {string} API version path | [
"Returns",
"path",
"containing",
"only",
"the",
"path",
"for",
"the",
"specific",
"version",
"asked",
"or",
"deprecated",
"by",
"default"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/url/utils.js#L29-L39 | train | Get the path to the version of the resource | [
30522,
3853,
2131,
27774,
15069,
1006,
7047,
1007,
1063,
9530,
3367,
17928,
27774,
2015,
1027,
9530,
8873,
2290,
1012,
2131,
1006,
1005,
17928,
1024,
4617,
1005,
1007,
1025,
2292,
7303,
27774,
1027,
7047,
1012,
2544,
1064,
1064,
1005,
1058,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | examples/vector-labels.js | stringDivider | function stringDivider(str, width, spaceReplacer) {
if (str.length > width) {
let p = width;
while (p > 0 && (str[p] != ' ' && str[p] != '-')) {
p--;
}
if (p > 0) {
let left;
if (str.substring(p, p + 1) == '-') {
left = str.substring(0, p + 1);
} else {
left = str.substring(0, p);
}
const right = str.substring(p + 1);
return left + spaceReplacer + stringDivider(right, width, spaceReplacer);
}
}
return str;
} | javascript | function stringDivider(str, width, spaceReplacer) {
if (str.length > width) {
let p = width;
while (p > 0 && (str[p] != ' ' && str[p] != '-')) {
p--;
}
if (p > 0) {
let left;
if (str.substring(p, p + 1) == '-') {
left = str.substring(0, p + 1);
} else {
left = str.substring(0, p);
}
const right = str.substring(p + 1);
return left + spaceReplacer + stringDivider(right, width, spaceReplacer);
}
}
return str;
} | [
"function",
"stringDivider",
"(",
"str",
",",
"width",
",",
"spaceReplacer",
")",
"{",
"if",
"(",
"str",
".",
"length",
">",
"width",
")",
"{",
"let",
"p",
"=",
"width",
";",
"while",
"(",
"p",
">",
"0",
"&&",
"(",
"str",
"[",
"p",
"]",
"!=",
"... | http://stackoverflow.com/questions/14484787/wrap-text-in-javascript | [
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"14484787",
"/",
"wrap",
"-",
"text",
"-",
"in",
"-",
"javascript"
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/vector-labels.js#L233-L251 | train | divides a string by a given width | [
30522,
3853,
5164,
4305,
17258,
2121,
1006,
2358,
2099,
1010,
9381,
1010,
2686,
2890,
24759,
10732,
2099,
1007,
1063,
2065,
1006,
2358,
2099,
1012,
3091,
1028,
9381,
1007,
1063,
2292,
1052,
1027,
9381,
1025,
2096,
1006,
1052,
1028,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/GrowingEnablement.js | function(vInsert, oDomRef) {
this.applyPendingGroupItem();
var iLength = this._aChunk.length;
if (!iLength) {
return;
}
if (this._oControl.getGrowingDirection() == ListGrowingDirection.Upwards) {
this._aChunk.reverse();
if (vInsert === true) {
vInsert = 0;
} else if (typeof vInsert == "number") {
vInsert = this._iRenderedDataItems - iLength - vInsert;
}
}
oDomRef = oDomRef || this._oContainerDomRef;
this._oRM = this._oRM || sap.ui.getCore().createRenderManager();
for (var i = 0; i < iLength; i++) {
this._oRM.renderControl(this._aChunk[i]);
}
this._oRM.flush(oDomRef, false, this._getDomIndex(vInsert));
this._aChunk = [];
} | javascript | function(vInsert, oDomRef) {
this.applyPendingGroupItem();
var iLength = this._aChunk.length;
if (!iLength) {
return;
}
if (this._oControl.getGrowingDirection() == ListGrowingDirection.Upwards) {
this._aChunk.reverse();
if (vInsert === true) {
vInsert = 0;
} else if (typeof vInsert == "number") {
vInsert = this._iRenderedDataItems - iLength - vInsert;
}
}
oDomRef = oDomRef || this._oContainerDomRef;
this._oRM = this._oRM || sap.ui.getCore().createRenderManager();
for (var i = 0; i < iLength; i++) {
this._oRM.renderControl(this._aChunk[i]);
}
this._oRM.flush(oDomRef, false, this._getDomIndex(vInsert));
this._aChunk = [];
} | [
"function",
"(",
"vInsert",
",",
"oDomRef",
")",
"{",
"this",
".",
"applyPendingGroupItem",
"(",
")",
";",
"var",
"iLength",
"=",
"this",
".",
"_aChunk",
".",
"length",
";",
"if",
"(",
"!",
"iLength",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
... | render all the collected items in the chunk and flush them into the DOM vInsert whether to append (true) or replace (falsy) or to insert at a certain position (int) | [
"render",
"all",
"the",
"collected",
"items",
"in",
"the",
"chunk",
"and",
"flush",
"them",
"into",
"the",
"DOM",
"vInsert",
"whether",
"to",
"append",
"(",
"true",
")",
"or",
"replace",
"(",
"falsy",
")",
"or",
"to",
"insert",
"at",
"a",
"certain",
"p... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L386-L412 | train | Renders the items in the chunk of items | [
30522,
3853,
1006,
19354,
8043,
2102,
1010,
1051,
9527,
2890,
2546,
1007,
1063,
2023,
1012,
6611,
11837,
4667,
17058,
4221,
2213,
1006,
1007,
30524,
1006,
2023,
1012,
1035,
1051,
8663,
13181,
2140,
1012,
2131,
16523,
14138,
4305,
2890,
7542... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
nhn/tui.editor | src/js/codemirror/fixOrderedListNumber.js | fixNumber | function fixNumber(lineNumber, prevIndentLength, startIndex, cm) {
let indent, delimiter, text, indentLength;
let index = startIndex;
let lineText = cm.getLine(lineNumber);
do {
[, indent, , , delimiter, text] = listRE.exec(lineText);
indentLength = indent.length;
if (indentLength === prevIndentLength) {
// fix number
cm.replaceRange(`${indent}${index}${delimiter}${text}`, {
line: lineNumber,
ch: 0
}, {
line: lineNumber,
ch: lineText.length
});
index += 1;
lineNumber += 1;
} else if (indentLength > prevIndentLength) {
// nested list start
lineNumber = fixNumber(lineNumber, indentLength, 1, cm);
} else {
// nested list end
return lineNumber;
}
lineText = cm.getLine(lineNumber);
} while (listRE.test(lineText));
return lineNumber;
} | javascript | function fixNumber(lineNumber, prevIndentLength, startIndex, cm) {
let indent, delimiter, text, indentLength;
let index = startIndex;
let lineText = cm.getLine(lineNumber);
do {
[, indent, , , delimiter, text] = listRE.exec(lineText);
indentLength = indent.length;
if (indentLength === prevIndentLength) {
// fix number
cm.replaceRange(`${indent}${index}${delimiter}${text}`, {
line: lineNumber,
ch: 0
}, {
line: lineNumber,
ch: lineText.length
});
index += 1;
lineNumber += 1;
} else if (indentLength > prevIndentLength) {
// nested list start
lineNumber = fixNumber(lineNumber, indentLength, 1, cm);
} else {
// nested list end
return lineNumber;
}
lineText = cm.getLine(lineNumber);
} while (listRE.test(lineText));
return lineNumber;
} | [
"function",
"fixNumber",
"(",
"lineNumber",
",",
"prevIndentLength",
",",
"startIndex",
",",
"cm",
")",
"{",
"let",
"indent",
",",
"delimiter",
",",
"text",
",",
"indentLength",
";",
"let",
"index",
"=",
"startIndex",
";",
"let",
"lineText",
"=",
"cm",
"."... | fix list numbers
@param {number} lineNumber - line number of list item to be normalized
@param {number} prevIndentLength - previous indent length
@param {number} startIndex - start index
@param {CodeMirror} cm - CodeMirror instance
@returns {number} - next line number
@ignore | [
"fix",
"list",
"numbers"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/codemirror/fixOrderedListNumber.js#L62-L94 | train | fix number in nested list | [
30522,
3853,
8081,
19172,
5677,
1006,
17517,
29440,
1010,
3653,
6371,
16454,
7770,
13512,
2232,
1010,
2707,
22254,
10288,
1010,
4642,
1007,
1063,
2292,
27427,
4765,
1010,
3972,
27605,
3334,
1010,
3793,
1010,
27427,
4765,
7770,
13512,
2232,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
uber/deck.gl | modules/aggregation-layers/src/grid-layer/grid-aggregator.js | _pointsToGridHashing | function _pointsToGridHashing(points = [], cellSize, getPosition) {
// find the geometric center of sample points
let latMin = Infinity;
let latMax = -Infinity;
let pLat;
for (const pt of points) {
pLat = getPosition(pt)[1];
if (Number.isFinite(pLat)) {
latMin = pLat < latMin ? pLat : latMin;
latMax = pLat > latMax ? pLat : latMax;
}
}
const centerLat = (latMin + latMax) / 2;
const gridOffset = _calculateGridLatLonOffset(cellSize, centerLat);
if (gridOffset.xOffset <= 0 || gridOffset.yOffset <= 0) {
return {gridHash: {}, gridOffset};
}
// calculate count per cell
const gridHash = {};
for (const pt of points) {
const [lng, lat] = getPosition(pt);
if (Number.isFinite(lat) && Number.isFinite(lng)) {
const latIdx = Math.floor((lat + 90) / gridOffset.yOffset);
const lonIdx = Math.floor((lng + 180) / gridOffset.xOffset);
const key = `${latIdx}-${lonIdx}`;
gridHash[key] = gridHash[key] || {count: 0, points: []};
gridHash[key].count += 1;
gridHash[key].points.push(pt);
}
}
return {gridHash, gridOffset};
} | javascript | function _pointsToGridHashing(points = [], cellSize, getPosition) {
// find the geometric center of sample points
let latMin = Infinity;
let latMax = -Infinity;
let pLat;
for (const pt of points) {
pLat = getPosition(pt)[1];
if (Number.isFinite(pLat)) {
latMin = pLat < latMin ? pLat : latMin;
latMax = pLat > latMax ? pLat : latMax;
}
}
const centerLat = (latMin + latMax) / 2;
const gridOffset = _calculateGridLatLonOffset(cellSize, centerLat);
if (gridOffset.xOffset <= 0 || gridOffset.yOffset <= 0) {
return {gridHash: {}, gridOffset};
}
// calculate count per cell
const gridHash = {};
for (const pt of points) {
const [lng, lat] = getPosition(pt);
if (Number.isFinite(lat) && Number.isFinite(lng)) {
const latIdx = Math.floor((lat + 90) / gridOffset.yOffset);
const lonIdx = Math.floor((lng + 180) / gridOffset.xOffset);
const key = `${latIdx}-${lonIdx}`;
gridHash[key] = gridHash[key] || {count: 0, points: []};
gridHash[key].count += 1;
gridHash[key].points.push(pt);
}
}
return {gridHash, gridOffset};
} | [
"function",
"_pointsToGridHashing",
"(",
"points",
"=",
"[",
"]",
",",
"cellSize",
",",
"getPosition",
")",
"{",
"// find the geometric center of sample points",
"let",
"latMin",
"=",
"Infinity",
";",
"let",
"latMax",
"=",
"-",
"Infinity",
";",
"let",
"pLat",
";... | Project points into each cell, return a hash table of cells
@param {Iterable} points
@param {number} cellSize - unit size in meters
@param {function} getPosition - position accessor
@returns {object} - grid hash and cell dimension | [
"Project",
"points",
"into",
"each",
"cell",
"return",
"a",
"hash",
"table",
"of",
"cells"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/aggregation-layers/src/grid-layer/grid-aggregator.js#L46-L85 | train | Calculates the grid hashing of points | [
30522,
3853,
1035,
2685,
3406,
16523,
3593,
14949,
12053,
1006,
2685,
1027,
1031,
1033,
1010,
4442,
4697,
1010,
2131,
26994,
1007,
1063,
1013,
1013,
2424,
1996,
14965,
2415,
1997,
7099,
2685,
2292,
2474,
21246,
2378,
1027,
15579,
1025,
2292... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/radioButton/radio-button.js | listener | function listener(ev) {
if (element[0].hasAttribute('disabled') || rgCtrl.isDisabled()) return;
scope.$apply(function() {
rgCtrl.setViewValue(attr.value, ev && ev.type);
});
} | javascript | function listener(ev) {
if (element[0].hasAttribute('disabled') || rgCtrl.isDisabled()) return;
scope.$apply(function() {
rgCtrl.setViewValue(attr.value, ev && ev.type);
});
} | [
"function",
"listener",
"(",
"ev",
")",
"{",
"if",
"(",
"element",
"[",
"0",
"]",
".",
"hasAttribute",
"(",
"'disabled'",
")",
"||",
"rgCtrl",
".",
"isDisabled",
"(",
")",
")",
"return",
";",
"scope",
".",
"$apply",
"(",
"function",
"(",
")",
"{",
... | On click functionality. | [
"On",
"click",
"functionality",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/radioButton/radio-button.js#L299-L305 | train | The listener for the change event | [
30522,
3853,
19373,
1006,
23408,
1007,
1063,
2065,
1006,
5783,
1031,
1014,
1033,
1012,
2038,
19321,
3089,
8569,
2618,
1006,
1005,
9776,
1005,
1007,
1064,
1064,
1054,
18195,
16344,
2140,
1012,
2003,
10521,
3085,
2094,
1006,
1007,
1007,
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/model/analytics/odata4analytics.js | function() {
if (this._oFilterExpression == null) {
var oEntityType = this._oQueryResult.getEntityType();
this._oFilterExpression = new odata4analytics.FilterExpression(this._oQueryResult.getModel(), oEntityType
.getSchema(), oEntityType);
}
return this._oFilterExpression;
} | javascript | function() {
if (this._oFilterExpression == null) {
var oEntityType = this._oQueryResult.getEntityType();
this._oFilterExpression = new odata4analytics.FilterExpression(this._oQueryResult.getModel(), oEntityType
.getSchema(), oEntityType);
}
return this._oFilterExpression;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_oFilterExpression",
"==",
"null",
")",
"{",
"var",
"oEntityType",
"=",
"this",
".",
"_oQueryResult",
".",
"getEntityType",
"(",
")",
";",
"this",
".",
"_oFilterExpression",
"=",
"new",
"odata4analytics",
... | Get the filter expression for this request.
Expressions are represented by separate objects. If none exists so far, a
new expression object gets created.
@returns {sap.ui.model.analytics.odata4analytics.FilterExpression} The filter object
associated to this request.
@public
@function
@name sap.ui.model.analytics.odata4analytics.QueryResultRequest#getFilterExpression | [
"Get",
"the",
"filter",
"expression",
"for",
"this",
"request",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L4450-L4457 | train | Returns the filter expression for this query. | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
1997,
4014,
3334,
10288,
20110,
3258,
1027,
1027,
19701,
1007,
1063,
13075,
1051,
4765,
3012,
13874,
1027,
2023,
1012,
1035,
1051,
4226,
2854,
6072,
11314,
1012,
2131,
4765,
3012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/_AnnotationHelperExpression.js | function (oInterface, oPathValue, iIndex, sEdmType) {
var oParameter = Basics.descend(oPathValue, iIndex),
oResult;
oParameter.asExpression = true;
oResult = Expression.expression(oInterface, oParameter);
if (sEdmType && sEdmType !== oResult.type) {
Basics.error(oParameter,
"Expected " + sEdmType + " but instead saw " + oResult.type);
}
return oResult;
} | javascript | function (oInterface, oPathValue, iIndex, sEdmType) {
var oParameter = Basics.descend(oPathValue, iIndex),
oResult;
oParameter.asExpression = true;
oResult = Expression.expression(oInterface, oParameter);
if (sEdmType && sEdmType !== oResult.type) {
Basics.error(oParameter,
"Expected " + sEdmType + " but instead saw " + oResult.type);
}
return oResult;
} | [
"function",
"(",
"oInterface",
",",
"oPathValue",
",",
"iIndex",
",",
"sEdmType",
")",
"{",
"var",
"oParameter",
"=",
"Basics",
".",
"descend",
"(",
"oPathValue",
",",
"iIndex",
")",
",",
"oResult",
";",
"oParameter",
".",
"asExpression",
"=",
"true",
";",... | Evaluates a parameter and ensures that the result is of the given EDM type.
The function calls <code>expression</code> with <code>bExpression=true</code>. This will
cause any embedded <code>odata.concat</code> to generate an expression binding. This
should be correct in any case because only a standalone <code>concat</code> may generate
a composite binding.
@param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface
the callback interface related to the current formatter call
@param {object} oPathValue
path and value information pointing to the parameter array (see Expression object)
@param {number} iIndex
the parameter index
@param {string} [sEdmType]
the expected EDM type or <code>undefined</code> if any type is allowed
@returns {object}
the result object | [
"Evaluates",
"a",
"parameter",
"and",
"ensures",
"that",
"the",
"result",
"is",
"of",
"the",
"given",
"EDM",
"type",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L625-L637 | train | Returns the value of the parameter at the given index. | [
30522,
3853,
1006,
1051,
18447,
2121,
12172,
1010,
6728,
8988,
10175,
5657,
1010,
2462,
13629,
2595,
1010,
7367,
22117,
13874,
1007,
1063,
13075,
6728,
5400,
22828,
1027,
24078,
1012,
18855,
1006,
6728,
8988,
10175,
5657,
1010,
2462,
13629,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/require-atomic-updates.js | isLocalVariableWithoutEscape | function isLocalVariableWithoutEscape(expression, surroundingFunction) {
if (expression.type !== "Identifier") {
return false;
}
const variable = resolveVariable(expression);
if (!variable) {
return false;
}
return variable.references.every(reference => identifierToSurroundingFunctionMap.get(reference.identifier) === surroundingFunction) &&
variable.defs.every(def => identifierToSurroundingFunctionMap.get(def.name) === surroundingFunction);
} | javascript | function isLocalVariableWithoutEscape(expression, surroundingFunction) {
if (expression.type !== "Identifier") {
return false;
}
const variable = resolveVariable(expression);
if (!variable) {
return false;
}
return variable.references.every(reference => identifierToSurroundingFunctionMap.get(reference.identifier) === surroundingFunction) &&
variable.defs.every(def => identifierToSurroundingFunctionMap.get(def.name) === surroundingFunction);
} | [
"function",
"isLocalVariableWithoutEscape",
"(",
"expression",
",",
"surroundingFunction",
")",
"{",
"if",
"(",
"expression",
".",
"type",
"!==",
"\"Identifier\"",
")",
"{",
"return",
"false",
";",
"}",
"const",
"variable",
"=",
"resolveVariable",
"(",
"expression... | Checks if an expression is a variable that can only be observed within the given function.
@param {ASTNode} expression The expression to check
@param {ASTNode} surroundingFunction The function node
@returns {boolean} `true` if the expression is a variable which is local to the given function, and is never
referenced in a closure. | [
"Checks",
"if",
"an",
"expression",
"is",
"a",
"variable",
"that",
"can",
"only",
"be",
"observed",
"within",
"the",
"given",
"function",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/require-atomic-updates.js#L96-L109 | train | Check if expression is local variable without escaping | [
30522,
3853,
2003,
4135,
9289,
10755,
19210,
24415,
5833,
2229,
19464,
1006,
3670,
1010,
4193,
11263,
27989,
1007,
1063,
2065,
1006,
3670,
1012,
2828,
999,
1027,
1027,
1000,
8909,
4765,
18095,
1000,
1007,
1063,
2709,
6270,
1025,
1065,
9530,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/xpath/util.js | xmlValue | function xmlValue(node, disallowBrowserSpecificOptimization) {
if (!node) {
return '';
}
var ret = '';
if (node.nodeType == DOM_TEXT_NODE ||
node.nodeType == DOM_CDATA_SECTION_NODE) {
ret += node.nodeValue;
} else if (node.nodeType == DOM_ATTRIBUTE_NODE) {
if (ajaxsltIsIE6) {
ret += xmlValueIE6Hack(node);
} else {
ret += node.nodeValue;
}
} else if (node.nodeType == DOM_ELEMENT_NODE ||
node.nodeType == DOM_DOCUMENT_NODE ||
node.nodeType == DOM_DOCUMENT_FRAGMENT_NODE) {
if (!disallowBrowserSpecificOptimization) {
// IE, Safari, Opera, and friends
var innerText = node.innerText;
if (innerText != undefined) {
return innerText;
}
// Firefox
var textContent = node.textContent;
if (textContent != undefined) {
return textContent;
}
}
// pobrecito!
var len = node.childNodes.length;
for (var i = 0; i < len; ++i) {
ret += arguments.callee(node.childNodes[i]);
}
}
return ret;
} | javascript | function xmlValue(node, disallowBrowserSpecificOptimization) {
if (!node) {
return '';
}
var ret = '';
if (node.nodeType == DOM_TEXT_NODE ||
node.nodeType == DOM_CDATA_SECTION_NODE) {
ret += node.nodeValue;
} else if (node.nodeType == DOM_ATTRIBUTE_NODE) {
if (ajaxsltIsIE6) {
ret += xmlValueIE6Hack(node);
} else {
ret += node.nodeValue;
}
} else if (node.nodeType == DOM_ELEMENT_NODE ||
node.nodeType == DOM_DOCUMENT_NODE ||
node.nodeType == DOM_DOCUMENT_FRAGMENT_NODE) {
if (!disallowBrowserSpecificOptimization) {
// IE, Safari, Opera, and friends
var innerText = node.innerText;
if (innerText != undefined) {
return innerText;
}
// Firefox
var textContent = node.textContent;
if (textContent != undefined) {
return textContent;
}
}
// pobrecito!
var len = node.childNodes.length;
for (var i = 0; i < len; ++i) {
ret += arguments.callee(node.childNodes[i]);
}
}
return ret;
} | [
"function",
"xmlValue",
"(",
"node",
",",
"disallowBrowserSpecificOptimization",
")",
"{",
"if",
"(",
"!",
"node",
")",
"{",
"return",
"''",
";",
"}",
"var",
"ret",
"=",
"''",
";",
"if",
"(",
"node",
".",
"nodeType",
"==",
"DOM_TEXT_NODE",
"||",
"node",
... | Returns the text value of a node; for nodes without children this is the nodeValue, for nodes with children this is the concatenation of the value of all children. Browser-specific optimizations are used by default; they can be disabled by passing "true" in as the second parameter. | [
"Returns",
"the",
"text",
"value",
"of",
"a",
"node",
";",
"for",
"nodes",
"without",
"children",
"this",
"is",
"the",
"nodeValue",
"for",
"nodes",
"with",
"children",
"this",
"is",
"the",
"concatenation",
"of",
"the",
"value",
"of",
"all",
"children",
"."... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/util.js#L251-L289 | train | Returns the value of a node | [
30522,
3853,
20950,
10175,
5657,
1006,
13045,
1010,
4487,
12002,
8261,
12618,
9333,
2545,
5051,
6895,
8873,
3597,
13876,
27605,
30524,
13874,
1027,
1027,
14383,
1035,
3729,
6790,
1035,
2930,
1035,
13045,
1007,
1063,
2128,
2102,
1009,
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... |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | floydWarshall | function floydWarshall(options) {
var cy = this.cy();
var _floydWarshallDefault = floydWarshallDefaults(options),
weight = _floydWarshallDefault.weight,
directed = _floydWarshallDefault.directed;
var weightFn = weight;
var _this$byGroup = this.byGroup(),
nodes = _this$byGroup.nodes,
edges = _this$byGroup.edges;
var N = nodes.length;
var Nsq = N * N;
var indexOf = function indexOf(node) {
return nodes.indexOf(node);
};
var atIndex = function atIndex(i) {
return nodes[i];
}; // Initialize distance matrix
var dist = new Array(Nsq);
for (var n = 0; n < Nsq; n++) {
var j = n % N;
var i = (n - j) / N;
if (i === j) {
dist[n] = 0;
} else {
dist[n] = Infinity;
}
} // Initialize matrix used for path reconstruction
// Initialize distance matrix
var next = new Array(Nsq);
var edgeNext = new Array(Nsq); // Process edges
for (var _i = 0; _i < edges.length; _i++) {
var edge = edges[_i];
var src = edge.source()[0];
var tgt = edge.target()[0];
if (src === tgt) {
continue;
} // exclude loops
var s = indexOf(src);
var t = indexOf(tgt);
var st = s * N + t; // source to target index
var _weight = weightFn(edge); // Check if already process another edge between same 2 nodes
if (dist[st] > _weight) {
dist[st] = _weight;
next[st] = t;
edgeNext[st] = edge;
} // If undirected graph, process 'reversed' edge
if (!directed) {
var ts = t * N + s; // target to source index
if (!directed && dist[ts] > _weight) {
dist[ts] = _weight;
next[ts] = s;
edgeNext[ts] = edge;
}
}
} // Main loop
for (var k = 0; k < N; k++) {
for (var _i2 = 0; _i2 < N; _i2++) {
var ik = _i2 * N + k;
for (var _j = 0; _j < N; _j++) {
var ij = _i2 * N + _j;
var kj = k * N + _j;
if (dist[ik] + dist[kj] < dist[ij]) {
dist[ij] = dist[ik] + dist[kj];
next[ij] = next[ik];
}
}
}
}
var getArgEle = function getArgEle(ele) {
return (string(ele) ? cy.filter(ele) : ele)[0];
};
var indexOfArgEle = function indexOfArgEle(ele) {
return indexOf(getArgEle(ele));
};
var res = {
distance: function distance(from, to) {
var i = indexOfArgEle(from);
var j = indexOfArgEle(to);
return dist[i * N + j];
},
path: function path(from, to) {
var i = indexOfArgEle(from);
var j = indexOfArgEle(to);
var fromNode = atIndex(i);
if (i === j) {
return fromNode.collection();
}
if (next[i * N + j] == null) {
return cy.collection();
}
var path = cy.collection();
var prev = i;
var edge;
path.merge(fromNode);
while (i !== j) {
prev = i;
i = next[i * N + j];
edge = edgeNext[prev * N + i];
path.merge(edge);
path.merge(atIndex(i));
}
return path;
}
};
return res;
} | javascript | function floydWarshall(options) {
var cy = this.cy();
var _floydWarshallDefault = floydWarshallDefaults(options),
weight = _floydWarshallDefault.weight,
directed = _floydWarshallDefault.directed;
var weightFn = weight;
var _this$byGroup = this.byGroup(),
nodes = _this$byGroup.nodes,
edges = _this$byGroup.edges;
var N = nodes.length;
var Nsq = N * N;
var indexOf = function indexOf(node) {
return nodes.indexOf(node);
};
var atIndex = function atIndex(i) {
return nodes[i];
}; // Initialize distance matrix
var dist = new Array(Nsq);
for (var n = 0; n < Nsq; n++) {
var j = n % N;
var i = (n - j) / N;
if (i === j) {
dist[n] = 0;
} else {
dist[n] = Infinity;
}
} // Initialize matrix used for path reconstruction
// Initialize distance matrix
var next = new Array(Nsq);
var edgeNext = new Array(Nsq); // Process edges
for (var _i = 0; _i < edges.length; _i++) {
var edge = edges[_i];
var src = edge.source()[0];
var tgt = edge.target()[0];
if (src === tgt) {
continue;
} // exclude loops
var s = indexOf(src);
var t = indexOf(tgt);
var st = s * N + t; // source to target index
var _weight = weightFn(edge); // Check if already process another edge between same 2 nodes
if (dist[st] > _weight) {
dist[st] = _weight;
next[st] = t;
edgeNext[st] = edge;
} // If undirected graph, process 'reversed' edge
if (!directed) {
var ts = t * N + s; // target to source index
if (!directed && dist[ts] > _weight) {
dist[ts] = _weight;
next[ts] = s;
edgeNext[ts] = edge;
}
}
} // Main loop
for (var k = 0; k < N; k++) {
for (var _i2 = 0; _i2 < N; _i2++) {
var ik = _i2 * N + k;
for (var _j = 0; _j < N; _j++) {
var ij = _i2 * N + _j;
var kj = k * N + _j;
if (dist[ik] + dist[kj] < dist[ij]) {
dist[ij] = dist[ik] + dist[kj];
next[ij] = next[ik];
}
}
}
}
var getArgEle = function getArgEle(ele) {
return (string(ele) ? cy.filter(ele) : ele)[0];
};
var indexOfArgEle = function indexOfArgEle(ele) {
return indexOf(getArgEle(ele));
};
var res = {
distance: function distance(from, to) {
var i = indexOfArgEle(from);
var j = indexOfArgEle(to);
return dist[i * N + j];
},
path: function path(from, to) {
var i = indexOfArgEle(from);
var j = indexOfArgEle(to);
var fromNode = atIndex(i);
if (i === j) {
return fromNode.collection();
}
if (next[i * N + j] == null) {
return cy.collection();
}
var path = cy.collection();
var prev = i;
var edge;
path.merge(fromNode);
while (i !== j) {
prev = i;
i = next[i * N + j];
edge = edgeNext[prev * N + i];
path.merge(edge);
path.merge(atIndex(i));
}
return path;
}
};
return res;
} | [
"function",
"floydWarshall",
"(",
"options",
")",
"{",
"var",
"cy",
"=",
"this",
".",
"cy",
"(",
")",
";",
"var",
"_floydWarshallDefault",
"=",
"floydWarshallDefaults",
"(",
"options",
")",
",",
"weight",
"=",
"_floydWarshallDefault",
".",
"weight",
",",
"di... | Implemented from pseudocode from wikipedia | [
"Implemented",
"from",
"pseudocode",
"from",
"wikipedia"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L1718-L1857 | train | Returns a floyd - warshall formula | [
30522,
3853,
12305,
9028,
7377,
3363,
1006,
7047,
1007,
1063,
13075,
22330,
1027,
2023,
1012,
22330,
1006,
1007,
1025,
13075,
1035,
12305,
9028,
7377,
3363,
3207,
7011,
11314,
1027,
12305,
9028,
7377,
3363,
3207,
7011,
11314,
2015,
1006,
70... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lynckia/licode | extras/basic_example/public/script.js | startRecording | function startRecording() {
if (room !== undefined) {
if (!recording) {
room.startRecording(localStream, (id) => {
recording = true;
recordingId = id;
});
} else {
room.stopRecording(recordingId);
recording = false;
}
}
} | javascript | function startRecording() {
if (room !== undefined) {
if (!recording) {
room.startRecording(localStream, (id) => {
recording = true;
recordingId = id;
});
} else {
room.stopRecording(recordingId);
recording = false;
}
}
} | [
"function",
"startRecording",
"(",
")",
"{",
"if",
"(",
"room",
"!==",
"undefined",
")",
"{",
"if",
"(",
"!",
"recording",
")",
"{",
"room",
".",
"startRecording",
"(",
"localStream",
",",
"(",
"id",
")",
"=>",
"{",
"recording",
"=",
"true",
";",
"re... | eslint-disable-next-line no-unused-vars | [
"eslint",
"-",
"disable",
"-",
"next",
"-",
"line",
"no",
"-",
"unused",
"-",
"vars"
] | ce1f09ae30054f677fc25f2011b0e5072fa6f71f | https://github.com/lynckia/licode/blob/ce1f09ae30054f677fc25f2011b0e5072fa6f71f/extras/basic_example/public/script.js#L28-L40 | train | Start recording the local stream | [
30522,
3853,
2707,
2890,
27108,
4667,
1006,
1007,
1063,
2065,
1006,
2282,
999,
1027,
1027,
6151,
28344,
1007,
1063,
2065,
1006,
999,
3405,
1007,
1063,
2282,
1012,
2707,
2890,
27108,
4667,
1006,
10575,
25379,
1010,
1006,
8909,
1007,
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/v4/lib/_Cache.js | SingleCache | function SingleCache(oRequestor, sResourcePath, mQueryOptions, bSortExpandSelect,
fnGetOriginalResourcePath, bPost, sMetaPath, bFetchOperationReturnType) {
Cache.apply(this, arguments);
this.bFetchOperationReturnType = bFetchOperationReturnType;
this.sMetaPath = sMetaPath || this.sMetaPath; // overrides Cache c'tor
this.bPost = bPost;
this.bPosting = false;
this.oPromise = null; // a SyncPromise for the current value
} | javascript | function SingleCache(oRequestor, sResourcePath, mQueryOptions, bSortExpandSelect,
fnGetOriginalResourcePath, bPost, sMetaPath, bFetchOperationReturnType) {
Cache.apply(this, arguments);
this.bFetchOperationReturnType = bFetchOperationReturnType;
this.sMetaPath = sMetaPath || this.sMetaPath; // overrides Cache c'tor
this.bPost = bPost;
this.bPosting = false;
this.oPromise = null; // a SyncPromise for the current value
} | [
"function",
"SingleCache",
"(",
"oRequestor",
",",
"sResourcePath",
",",
"mQueryOptions",
",",
"bSortExpandSelect",
",",
"fnGetOriginalResourcePath",
",",
"bPost",
",",
"sMetaPath",
",",
"bFetchOperationReturnType",
")",
"{",
"Cache",
".",
"apply",
"(",
"this",
",",... | ********************************************************************************************* SingleCache *********************************************************************************************
Creates a cache for a single entity that performs requests using the given requestor.
@param {sap.ui.model.odata.v4.lib._Requestor} oRequestor
The requestor
@param {string} sResourcePath
A resource path relative to the service URL
@param {object} [mQueryOptions]
A map of key-value pairs representing the query string
@param {boolean} [bSortExpandSelect=false]
Whether the paths in $expand and $select shall be sorted in the cache's query string
@param {function} [fnGetOriginalResourcePath]
A function that returns the cache's original resource path to be used to build the target
path for bound messages; if it is not given or returns nothing, <code>sResourcePath</code>
is used instead
@param {boolean} [bPost]
Whether the cache uses POST requests. If <code>true</code>, only {@link #post} may lead to
a request, {@link #read} may only read from the cache; otherwise {@link #post} throws an
error.
@param {string} [sMetaPath]
Optional meta path in case it cannot be derived from the given resource path
@param {boolean} [bFetchOperationReturnType]
Whether the entity type of the operation return value must be fetched in
{@link #fetchTypes}
@private | [
"*********************************************************************************************",
"SingleCache",
"*********************************************************************************************",
"Creates",
"a",
"cache",
"for",
"a",
"single",
"entity",
"that",
"performs",
"reque... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L2042-L2051 | train | A cache that is used to cache a single resource. | [
30522,
3853,
2309,
3540,
5403,
1006,
10848,
15500,
2953,
1010,
5034,
2229,
8162,
3401,
15069,
1010,
1049,
4226,
2854,
7361,
9285,
1010,
18667,
11589,
10288,
9739,
5104,
12260,
6593,
1010,
1042,
15465,
29469,
24965,
6072,
8162,
3401,
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... |
Microsoft/vscode | extensions/php/build/update-grammar.js | fixBadRegex | function fixBadRegex(grammar) {
const scopeResolution = grammar.repository['scope-resolution'];
if (scopeResolution) {
const match = scopeResolution.patterns[0].match;
if (match === '(?i)([a-z_\\x{7f}-\\x{7fffffff}\\\\][a-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)') {
scopeResolution.patterns[0].match = '([A-Za-z_\\x{7f}-\\x{7fffffff}\\\\][A-Za-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)';
return;
}
}
throw new Error(`fixBadRegex callback couldn't patch the regex. It may be obsolete`);
} | javascript | function fixBadRegex(grammar) {
const scopeResolution = grammar.repository['scope-resolution'];
if (scopeResolution) {
const match = scopeResolution.patterns[0].match;
if (match === '(?i)([a-z_\\x{7f}-\\x{7fffffff}\\\\][a-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)') {
scopeResolution.patterns[0].match = '([A-Za-z_\\x{7f}-\\x{7fffffff}\\\\][A-Za-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)';
return;
}
}
throw new Error(`fixBadRegex callback couldn't patch the regex. It may be obsolete`);
} | [
"function",
"fixBadRegex",
"(",
"grammar",
")",
"{",
"const",
"scopeResolution",
"=",
"grammar",
".",
"repository",
"[",
"'scope-resolution'",
"]",
";",
"if",
"(",
"scopeResolution",
")",
"{",
"const",
"match",
"=",
"scopeResolution",
".",
"patterns",
"[",
"0"... | Workaround for https://github.com/Microsoft/vscode/issues/40279 and https://github.com/Microsoft/vscode-textmate/issues/59 | [
"Workaround",
"for",
"https",
":",
"//",
"github",
".",
"com",
"/",
"Microsoft",
"/",
"vscode",
"/",
"issues",
"/",
"40279",
"and",
"https",
":",
"//",
"github",
".",
"com",
"/",
"Microsoft",
"/",
"vscode",
"-",
"textmate",
"/",
"issues",
"/",
"59"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/extensions/php/build/update-grammar.js#L25-L36 | train | Fixes a regex that is not a valid scope - resolution. | [
30522,
3853,
8081,
9024,
2890,
3351,
2595,
1006,
8035,
1007,
1063,
9530,
3367,
9531,
6072,
4747,
13700,
1027,
8035,
1012,
22409,
1031,
1005,
9531,
1011,
5813,
1005,
1033,
1025,
2065,
1006,
9531,
6072,
4747,
13700,
1007,
1063,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/BindingParser.js | makeSimpleBindingInfo | function makeSimpleBindingInfo(sPath) {
var iPos = sPath.indexOf(">"),
oBindingInfo = { path : sPath };
if ( iPos > 0 ) {
oBindingInfo.model = sPath.slice(0,iPos);
oBindingInfo.path = sPath.slice(iPos + 1);
}
return oBindingInfo;
} | javascript | function makeSimpleBindingInfo(sPath) {
var iPos = sPath.indexOf(">"),
oBindingInfo = { path : sPath };
if ( iPos > 0 ) {
oBindingInfo.model = sPath.slice(0,iPos);
oBindingInfo.path = sPath.slice(iPos + 1);
}
return oBindingInfo;
} | [
"function",
"makeSimpleBindingInfo",
"(",
"sPath",
")",
"{",
"var",
"iPos",
"=",
"sPath",
".",
"indexOf",
"(",
"\">\"",
")",
",",
"oBindingInfo",
"=",
"{",
"path",
":",
"sPath",
"}",
";",
"if",
"(",
"iPos",
">",
"0",
")",
"{",
"oBindingInfo",
".",
"m... | Creates a binding info object with the given path.
If the path contains a model specifier (prefix separated with a '>'),
the <code>model</code> property is set as well and the prefix is
removed from the path.
@param {string} sPath
the given path
@returns {object}
a binding info object | [
"Creates",
"a",
"binding",
"info",
"object",
"with",
"the",
"given",
"path",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/BindingParser.js#L127-L137 | train | Creates a binding info object for a simple binding | [
30522,
3853,
3084,
5714,
10814,
8428,
4667,
2378,
14876,
1006,
14690,
2232,
1007,
1063,
13075,
12997,
2891,
1027,
14690,
2232,
1012,
5950,
11253,
1006,
1000,
1028,
1000,
1007,
1010,
27885,
22254,
2075,
2378,
14876,
1027,
1063,
4130,
1024,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObject.js | cloneBinding | function cloneBinding(oSource, sName, oClone, sTargetName) {
var oBindingInfo = oSource.mBindingInfos[sName];
oBindingInfo = oBindingInfo || oSource.getBindingInfo(sName); // fallback for forwarded bindings
var oCloneBindingInfo = jQuery.extend({}, oBindingInfo);
// clone the template if it is not sharable
if (!oBindingInfo.templateShareable && oBindingInfo.template && oBindingInfo.template.clone) {
oCloneBindingInfo.template = oBindingInfo.template.clone(sIdSuffix, aLocalIds);
delete oCloneBindingInfo.factory;
} else if ( oBindingInfo.templateShareable === MAYBE_SHAREABLE_OR_NOT ) {
// a 'clone' operation implies sharing the template (if templateShareable is not set to false)
oBindingInfo.templateShareable = oCloneBindingInfo.templateShareable = true;
Log.error(
"During a clone operation, a template was found that neither was marked with 'templateShareable:true' nor 'templateShareable:false'. " +
"The framework won't destroy the template. This could cause errors (e.g. duplicate IDs) or memory leaks " +
"(The template is used in aggregation '" + sName + "' of object '" + oSource.getId() + "')." +
"For more information, see documentation under 'Aggregation Binding'.");
}
// remove the runtime binding data (otherwise the property will not be connected again!)
delete oCloneBindingInfo.binding;
delete oCloneBindingInfo.modelChangeHandler;
delete oCloneBindingInfo.dataStateChangeHandler;
delete oCloneBindingInfo.modelRefreshHandler;
if (oBindingInfo.factory || oBindingInfo.template) {
oClone.bindAggregation(sTargetName, oCloneBindingInfo);
} else {
oClone.bindProperty(sTargetName, oCloneBindingInfo);
}
} | javascript | function cloneBinding(oSource, sName, oClone, sTargetName) {
var oBindingInfo = oSource.mBindingInfos[sName];
oBindingInfo = oBindingInfo || oSource.getBindingInfo(sName); // fallback for forwarded bindings
var oCloneBindingInfo = jQuery.extend({}, oBindingInfo);
// clone the template if it is not sharable
if (!oBindingInfo.templateShareable && oBindingInfo.template && oBindingInfo.template.clone) {
oCloneBindingInfo.template = oBindingInfo.template.clone(sIdSuffix, aLocalIds);
delete oCloneBindingInfo.factory;
} else if ( oBindingInfo.templateShareable === MAYBE_SHAREABLE_OR_NOT ) {
// a 'clone' operation implies sharing the template (if templateShareable is not set to false)
oBindingInfo.templateShareable = oCloneBindingInfo.templateShareable = true;
Log.error(
"During a clone operation, a template was found that neither was marked with 'templateShareable:true' nor 'templateShareable:false'. " +
"The framework won't destroy the template. This could cause errors (e.g. duplicate IDs) or memory leaks " +
"(The template is used in aggregation '" + sName + "' of object '" + oSource.getId() + "')." +
"For more information, see documentation under 'Aggregation Binding'.");
}
// remove the runtime binding data (otherwise the property will not be connected again!)
delete oCloneBindingInfo.binding;
delete oCloneBindingInfo.modelChangeHandler;
delete oCloneBindingInfo.dataStateChangeHandler;
delete oCloneBindingInfo.modelRefreshHandler;
if (oBindingInfo.factory || oBindingInfo.template) {
oClone.bindAggregation(sTargetName, oCloneBindingInfo);
} else {
oClone.bindProperty(sTargetName, oCloneBindingInfo);
}
} | [
"function",
"cloneBinding",
"(",
"oSource",
",",
"sName",
",",
"oClone",
",",
"sTargetName",
")",
"{",
"var",
"oBindingInfo",
"=",
"oSource",
".",
"mBindingInfos",
"[",
"sName",
"]",
";",
"oBindingInfo",
"=",
"oBindingInfo",
"||",
"oSource",
".",
"getBindingIn... | Clones the BindingInfo for the aggregation/property with the given name of this ManagedObject and binds
the aggregation/property with the given target name on the given clone using the same BindingInfo.
@param {string} sName the name of the binding to clone
@param {sap.ui.base.ManagedObject} oClone the object on which to establish the cloned binding
@param {string} sTargetName the name of the clone's aggregation to bind | [
"Clones",
"the",
"BindingInfo",
"for",
"the",
"aggregation",
"/",
"property",
"with",
"the",
"given",
"name",
"of",
"this",
"ManagedObject",
"and",
"binds",
"the",
"aggregation",
"/",
"property",
"with",
"the",
"given",
"target",
"name",
"on",
"the",
"given",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L4993-L5023 | train | Clones the binding | [
30522,
3853,
17598,
8428,
4667,
1006,
9808,
8162,
3401,
1010,
1055,
18442,
1010,
1051,
20464,
5643,
1010,
2732,
18150,
18442,
1007,
1063,
13075,
27885,
22254,
2075,
2378,
14876,
1027,
9808,
8162,
3401,
1012,
16914,
22254,
2075,
2378,
14876,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-js | doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/searchtools.js | function(query) {
// create the required interface elements
this.out = $('#search-results');
this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out);
this.dots = $('<span></span>').appendTo(this.title);
this.status = $('<p style="display: none"></p>').appendTo(this.out);
this.output = $('<ul class="search"/>').appendTo(this.out);
$('#search-progress').text(_('Preparing search...'));
this.startPulse();
// index already loaded, the browser was quick!
if (this.hasIndex())
this.query(query);
else
this.deferQuery(query);
} | javascript | function(query) {
// create the required interface elements
this.out = $('#search-results');
this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out);
this.dots = $('<span></span>').appendTo(this.title);
this.status = $('<p style="display: none"></p>').appendTo(this.out);
this.output = $('<ul class="search"/>').appendTo(this.out);
$('#search-progress').text(_('Preparing search...'));
this.startPulse();
// index already loaded, the browser was quick!
if (this.hasIndex())
this.query(query);
else
this.deferQuery(query);
} | [
"function",
"(",
"query",
")",
"{",
"// create the required interface elements",
"this",
".",
"out",
"=",
"$",
"(",
"'#search-results'",
")",
";",
"this",
".",
"title",
"=",
"$",
"(",
"'<h2>'",
"+",
"_",
"(",
"'Searching'",
")",
"+",
"'</h2>'",
")",
".",
... | perform a search for something | [
"perform",
"a",
"search",
"for",
"something"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/searchtools.js#L292-L308 | train | search the index | [
30522,
3853,
1006,
23032,
1007,
1063,
1013,
1013,
3443,
1996,
3223,
8278,
3787,
2023,
1012,
2041,
1027,
1002,
1006,
1005,
1001,
3945,
1011,
3463,
1005,
1007,
1025,
2023,
1012,
2516,
1027,
1002,
1006,
1005,
1026,
1044,
2475,
1028,
1005,
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... | |
firebase/firebase-js-sdk | scripts/docgen/generate-docs.js | fixLinks | function fixLinks(file) {
return fs.readFile(file, 'utf8').then(data => {
const flattenedLinks = data
.replace(/\.\.\//g, '')
.replace(/(modules|interfaces|classes)\//g, '');
let caseFixedLinks = flattenedLinks;
for (const lower in lowerToUpperLookup) {
const re = new RegExp(lower, 'g');
caseFixedLinks = caseFixedLinks.replace(re, lowerToUpperLookup[lower]);
}
return fs.writeFile(file, caseFixedLinks);
});
} | javascript | function fixLinks(file) {
return fs.readFile(file, 'utf8').then(data => {
const flattenedLinks = data
.replace(/\.\.\//g, '')
.replace(/(modules|interfaces|classes)\//g, '');
let caseFixedLinks = flattenedLinks;
for (const lower in lowerToUpperLookup) {
const re = new RegExp(lower, 'g');
caseFixedLinks = caseFixedLinks.replace(re, lowerToUpperLookup[lower]);
}
return fs.writeFile(file, caseFixedLinks);
});
} | [
"function",
"fixLinks",
"(",
"file",
")",
"{",
"return",
"fs",
".",
"readFile",
"(",
"file",
",",
"'utf8'",
")",
".",
"then",
"(",
"data",
"=>",
"{",
"const",
"flattenedLinks",
"=",
"data",
".",
"replace",
"(",
"/",
"\\.\\.\\/",
"/",
"g",
",",
"''",
... | Reformat links to match flat structure.
@param {string} file File to fix links in. | [
"Reformat",
"links",
"to",
"match",
"flat",
"structure",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/scripts/docgen/generate-docs.js#L90-L102 | train | Fixes links in a file | [
30522,
3853,
8081,
13767,
2015,
1006,
5371,
1007,
1063,
2709,
1042,
2015,
1012,
3191,
8873,
2571,
1006,
5371,
1010,
1005,
21183,
2546,
2620,
1005,
1007,
1012,
2059,
1006,
2951,
1027,
1028,
1063,
9530,
3367,
16379,
13767,
2015,
1027,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/datepicker/js/calendar.spec.js | findMonthElement | function findMonthElement(element, date) {
var months = element.querySelectorAll('[md-calendar-month-body]');
var monthHeader = dateLocale.monthHeaderFormatter(date);
var month;
for (var i = 0; i < months.length; i++) {
month = months[i];
if (month.querySelector('tr:first-child td:first-child').textContent === monthHeader) {
return month;
}
}
return null;
} | javascript | function findMonthElement(element, date) {
var months = element.querySelectorAll('[md-calendar-month-body]');
var monthHeader = dateLocale.monthHeaderFormatter(date);
var month;
for (var i = 0; i < months.length; i++) {
month = months[i];
if (month.querySelector('tr:first-child td:first-child').textContent === monthHeader) {
return month;
}
}
return null;
} | [
"function",
"findMonthElement",
"(",
"element",
",",
"date",
")",
"{",
"var",
"months",
"=",
"element",
".",
"querySelectorAll",
"(",
"'[md-calendar-month-body]'",
")",
";",
"var",
"monthHeader",
"=",
"dateLocale",
".",
"monthHeaderFormatter",
"(",
"date",
")",
... | Finds a month `tbody` in the calendar element given a date. | [
"Finds",
"a",
"month",
"tbody",
"in",
"the",
"calendar",
"element",
"given",
"a",
"date",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.spec.js#L59-L71 | train | Find the month element in the specified calendar container | [
30522,
3853,
2424,
9629,
16001,
13665,
1006,
5783,
1010,
3058,
1007,
1063,
13075,
2706,
1027,
5783,
1012,
23032,
11246,
22471,
6525,
3363,
1006,
1005,
1031,
9108,
1011,
8094,
1011,
3204,
1011,
2303,
1033,
1005,
1007,
1025,
13075,
3204,
4974... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | build/gulpfile.vscode.js | computeChecksums | function computeChecksums(out, filenames) {
var result = {};
filenames.forEach(function (filename) {
var fullPath = path.join(process.cwd(), out, filename);
result[filename] = computeChecksum(fullPath);
});
return result;
} | javascript | function computeChecksums(out, filenames) {
var result = {};
filenames.forEach(function (filename) {
var fullPath = path.join(process.cwd(), out, filename);
result[filename] = computeChecksum(fullPath);
});
return result;
} | [
"function",
"computeChecksums",
"(",
"out",
",",
"filenames",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"filenames",
".",
"forEach",
"(",
"function",
"(",
"filename",
")",
"{",
"var",
"fullPath",
"=",
"path",
".",
"join",
"(",
"process",
".",
"cwd... | Compute checksums for some files.
@param {string} out The out folder to read the file from.
@param {string[]} filenames The paths to compute a checksum for.
@return {Object} A map of paths to checksums. | [
"Compute",
"checksums",
"for",
"some",
"files",
"."
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/gulpfile.vscode.js#L230-L237 | train | Compute checksums for a list of filenames | [
30522,
3853,
24134,
5403,
10603,
18163,
1006,
2041,
1010,
5371,
18442,
2015,
1007,
1063,
13075,
2765,
1027,
1063,
1065,
1025,
5371,
18442,
2015,
1012,
18921,
6776,
1006,
3853,
1006,
5371,
18442,
1007,
1063,
13075,
2440,
15069,
1027,
4130,
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... |
angular/angular | aio/tools/examples/shared/protractor.config.js | formatOutput | function formatOutput(output) {
var indent = ' ';
var pad = ' ';
var results = [];
results.push('AppDir:' + output.appDir);
output.suites.forEach(function(suite) {
results.push(pad + 'Suite: ' + suite.description + ' -- ' + suite.status);
pad+=indent;
suite.specs.forEach(function(spec) {
results.push(pad + spec.status + ' - ' + spec.description);
if (spec.failedExpectations) {
pad+=indent;
spec.failedExpectations.forEach(function (fe) {
results.push(pad + 'message: ' + fe.message);
});
pad=pad.substr(2);
}
});
pad = pad.substr(2);
results.push('');
});
results.push('');
return results.join('\n');
} | javascript | function formatOutput(output) {
var indent = ' ';
var pad = ' ';
var results = [];
results.push('AppDir:' + output.appDir);
output.suites.forEach(function(suite) {
results.push(pad + 'Suite: ' + suite.description + ' -- ' + suite.status);
pad+=indent;
suite.specs.forEach(function(spec) {
results.push(pad + spec.status + ' - ' + spec.description);
if (spec.failedExpectations) {
pad+=indent;
spec.failedExpectations.forEach(function (fe) {
results.push(pad + 'message: ' + fe.message);
});
pad=pad.substr(2);
}
});
pad = pad.substr(2);
results.push('');
});
results.push('');
return results.join('\n');
} | [
"function",
"formatOutput",
"(",
"output",
")",
"{",
"var",
"indent",
"=",
"' '",
";",
"var",
"pad",
"=",
"' '",
";",
"var",
"results",
"=",
"[",
"]",
";",
"results",
".",
"push",
"(",
"'AppDir:'",
"+",
"output",
".",
"appDir",
")",
";",
"output",
... | for output file output | [
"for",
"output",
"file",
"output"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/shared/protractor.config.js#L122-L145 | train | Format the output of a test suite | [
30522,
3853,
4289,
5833,
18780,
1006,
6434,
1007,
1063,
13075,
27427,
4765,
1027,
1005,
1005,
1025,
13075,
11687,
1027,
1005,
1005,
1025,
13075,
3463,
1027,
1031,
1033,
1025,
3463,
1012,
5245,
1006,
1005,
10439,
4305,
2099,
1024,
1005,
1009... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
muaz-khan/RTCMultiConnection | dev/MediaStreamRecorder.js | checkFrames | function checkFrames(frames) {
if (!frames[0]) {
postMessage({
error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'
});
return;
}
var width = frames[0].width,
height = frames[0].height,
duration = frames[0].duration;
for (var i = 1; i < frames.length; i++) {
duration += frames[i].duration;
}
return {
duration: duration,
width: width,
height: height
};
} | javascript | function checkFrames(frames) {
if (!frames[0]) {
postMessage({
error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'
});
return;
}
var width = frames[0].width,
height = frames[0].height,
duration = frames[0].duration;
for (var i = 1; i < frames.length; i++) {
duration += frames[i].duration;
}
return {
duration: duration,
width: width,
height: height
};
} | [
"function",
"checkFrames",
"(",
"frames",
")",
"{",
"if",
"(",
"!",
"frames",
"[",
"0",
"]",
")",
"{",
"postMessage",
"(",
"{",
"error",
":",
"'Something went wrong. Maybe WebP format is not supported in the current browser.'",
"}",
")",
";",
"return",
";",
"}",
... | sums the lengths of all the frames and gets the duration | [
"sums",
"the",
"lengths",
"of",
"all",
"the",
"frames",
"and",
"gets",
"the",
"duration"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/MediaStreamRecorder.js#L2415-L2435 | train | Check frames for an error | [
30522,
3853,
4638,
15643,
2015,
1006,
11048,
1007,
1063,
2065,
1006,
999,
11048,
1031,
1014,
1033,
1007,
1063,
2695,
7834,
3736,
3351,
1006,
1063,
7561,
1024,
1005,
2242,
2253,
3308,
1012,
2672,
4773,
2361,
4289,
2003,
2025,
3569,
1999,
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/document/DocumentCommandHandlers.js | showFileOpenError | function showFileOpenError(name, path) {
return Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.ERROR_OPENING_FILE_TITLE,
StringUtils.format(
Strings.ERROR_OPENING_FILE,
StringUtils.breakableUrl(path),
FileUtils.getFileErrorString(name)
)
);
} | javascript | function showFileOpenError(name, path) {
return Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.ERROR_OPENING_FILE_TITLE,
StringUtils.format(
Strings.ERROR_OPENING_FILE,
StringUtils.breakableUrl(path),
FileUtils.getFileErrorString(name)
)
);
} | [
"function",
"showFileOpenError",
"(",
"name",
",",
"path",
")",
"{",
"return",
"Dialogs",
".",
"showModalDialog",
"(",
"DefaultDialogs",
".",
"DIALOG_ID_ERROR",
",",
"Strings",
".",
"ERROR_OPENING_FILE_TITLE",
",",
"StringUtils",
".",
"format",
"(",
"Strings",
"."... | Shows an error dialog indicating that the given file could not be opened due to the given error
@param {!FileSystemError} name
@return {!Dialog} | [
"Shows",
"an",
"error",
"dialog",
"indicating",
"that",
"the",
"given",
"file",
"could",
"not",
"be",
"opened",
"due",
"to",
"the",
"given",
"error"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L272-L282 | train | show file open error | [
30522,
3853,
2265,
8873,
2571,
26915,
2121,
29165,
1006,
2171,
1010,
4130,
1007,
1063,
2709,
13764,
8649,
2015,
1012,
2265,
5302,
9305,
27184,
8649,
1006,
12398,
27184,
8649,
2015,
1012,
13764,
8649,
1035,
8909,
1035,
7561,
1010,
7817,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/AutoUpdate/main.js | registerBracketsFunctions | function registerBracketsFunctions() {
functionMap["brackets.notifyinitializationComplete"] = handleInitializationComplete;
functionMap["brackets.showStatusInfo"] = showStatusInfo;
functionMap["brackets.notifyDownloadSuccess"] = handleDownloadSuccess;
functionMap["brackets.showErrorMessage"] = showErrorMessage;
functionMap["brackets.notifyDownloadFailure"] = handleDownloadFailure;
functionMap["brackets.notifySafeToDownload"] = handleSafeToDownload;
functionMap["brackets.notifyvalidationStatus"] = handleValidationStatus;
functionMap["brackets.notifyInstallationStatus"] = handleInstallationStatus;
ProjectManager.on("beforeProjectClose beforeAppClose", _handleAppClose);
} | javascript | function registerBracketsFunctions() {
functionMap["brackets.notifyinitializationComplete"] = handleInitializationComplete;
functionMap["brackets.showStatusInfo"] = showStatusInfo;
functionMap["brackets.notifyDownloadSuccess"] = handleDownloadSuccess;
functionMap["brackets.showErrorMessage"] = showErrorMessage;
functionMap["brackets.notifyDownloadFailure"] = handleDownloadFailure;
functionMap["brackets.notifySafeToDownload"] = handleSafeToDownload;
functionMap["brackets.notifyvalidationStatus"] = handleValidationStatus;
functionMap["brackets.notifyInstallationStatus"] = handleInstallationStatus;
ProjectManager.on("beforeProjectClose beforeAppClose", _handleAppClose);
} | [
"function",
"registerBracketsFunctions",
"(",
")",
"{",
"functionMap",
"[",
"\"brackets.notifyinitializationComplete\"",
"]",
"=",
"handleInitializationComplete",
";",
"functionMap",
"[",
"\"brackets.showStatusInfo\"",
"]",
"=",
"showStatusInfo",
";",
"functionMap",
"[",
"\... | Generates a map for brackets side functions | [
"Generates",
"a",
"map",
"for",
"brackets",
"side",
"functions"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L1098-L1109 | train | Registers brackets functions | [
30522,
3853,
4236,
10024,
19869,
3215,
11263,
27989,
2015,
1006,
1007,
1063,
3853,
2863,
2361,
1031,
1000,
19719,
1012,
2025,
8757,
5498,
20925,
3989,
9006,
10814,
2618,
1000,
1033,
1027,
5047,
5498,
20925,
3989,
9006,
10814,
2618,
1025,
38... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-useless-rename.js | checkDestructured | function checkDestructured(node) {
if (ignoreDestructuring) {
return;
}
const properties = node.properties;
for (let i = 0; i < properties.length; i++) {
if (properties[i].shorthand) {
continue;
}
/**
* If an ObjectPattern property is computed, we have no idea
* if a rename is useless or not. If an ObjectPattern property
* lacks a key, it is likely an ExperimentalRestProperty and
* so there is no "renaming" occurring here.
*/
if (properties[i].computed || !properties[i].key) {
continue;
}
if (properties[i].key.type === "Identifier" && properties[i].key.name === properties[i].value.name ||
properties[i].key.type === "Literal" && properties[i].key.value === properties[i].value.name) {
reportError(properties[i], properties[i].key, properties[i].value, "Destructuring assignment");
}
}
} | javascript | function checkDestructured(node) {
if (ignoreDestructuring) {
return;
}
const properties = node.properties;
for (let i = 0; i < properties.length; i++) {
if (properties[i].shorthand) {
continue;
}
/**
* If an ObjectPattern property is computed, we have no idea
* if a rename is useless or not. If an ObjectPattern property
* lacks a key, it is likely an ExperimentalRestProperty and
* so there is no "renaming" occurring here.
*/
if (properties[i].computed || !properties[i].key) {
continue;
}
if (properties[i].key.type === "Identifier" && properties[i].key.name === properties[i].value.name ||
properties[i].key.type === "Literal" && properties[i].key.value === properties[i].value.name) {
reportError(properties[i], properties[i].key, properties[i].value, "Destructuring assignment");
}
}
} | [
"function",
"checkDestructured",
"(",
"node",
")",
"{",
"if",
"(",
"ignoreDestructuring",
")",
"{",
"return",
";",
"}",
"const",
"properties",
"=",
"node",
".",
"properties",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"properties",
".",
"len... | Checks whether a destructured assignment is unnecessarily renamed
@param {ASTNode} node - node to check
@returns {void} | [
"Checks",
"whether",
"a",
"destructured",
"assignment",
"is",
"unnecessarily",
"renamed"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-rename.js#L80-L107 | train | Check if a destructured assignment is not useless | [
30522,
3853,
4638,
6155,
18300,
12165,
1006,
13045,
1007,
1063,
2065,
1006,
6439,
4355,
6820,
19159,
1007,
1063,
2709,
1025,
1065,
9530,
3367,
5144,
1027,
13045,
1012,
5144,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026,
5144,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js | CollectionCache | function CollectionCache(oRequestor, sResourcePath, mQueryOptions, bSortExpandSelect,
sDeepResourcePath) {
Cache.call(this, oRequestor, sResourcePath, mQueryOptions, bSortExpandSelect, function () {
return sDeepResourcePath;
});
this.sContext = undefined; // the "@odata.context" from the responses
this.aElements = []; // the available elements
this.aElements.$byPredicate = {};
this.aElements.$count = undefined; // see setCount
this.aElements.$created = 0; // number of (client-side) created elements
this.aElements.$tail = undefined; // promise for a read w/o $top
// upper limit for @odata.count, maybe sharp; assumes #getQueryString can $filter out all
// created elements
this.iLimit = Infinity;
// an array of objects with ranges for pending read requests; each having the following
// properties:
// - iStart: the start (inclusive)
// - iEnd: the end (exclusive)
this.aReadRequests = [];
this.oSyncPromiseAll = undefined;
} | javascript | function CollectionCache(oRequestor, sResourcePath, mQueryOptions, bSortExpandSelect,
sDeepResourcePath) {
Cache.call(this, oRequestor, sResourcePath, mQueryOptions, bSortExpandSelect, function () {
return sDeepResourcePath;
});
this.sContext = undefined; // the "@odata.context" from the responses
this.aElements = []; // the available elements
this.aElements.$byPredicate = {};
this.aElements.$count = undefined; // see setCount
this.aElements.$created = 0; // number of (client-side) created elements
this.aElements.$tail = undefined; // promise for a read w/o $top
// upper limit for @odata.count, maybe sharp; assumes #getQueryString can $filter out all
// created elements
this.iLimit = Infinity;
// an array of objects with ranges for pending read requests; each having the following
// properties:
// - iStart: the start (inclusive)
// - iEnd: the end (exclusive)
this.aReadRequests = [];
this.oSyncPromiseAll = undefined;
} | [
"function",
"CollectionCache",
"(",
"oRequestor",
",",
"sResourcePath",
",",
"mQueryOptions",
",",
"bSortExpandSelect",
",",
"sDeepResourcePath",
")",
"{",
"Cache",
".",
"call",
"(",
"this",
",",
"oRequestor",
",",
"sResourcePath",
",",
"mQueryOptions",
",",
"bSor... | ********************************************************************************************* CollectionCache *********************************************************************************************
Creates a cache for a collection of entities that performs requests using the given
requestor.
@param {sap.ui.model.odata.v4.lib._Requestor} oRequestor
The requestor
@param {string} sResourcePath
A resource path relative to the service URL
@param {object} [mQueryOptions]
A map of key-value pairs representing the query string
@param {boolean} [bSortExpandSelect=false]
Whether the paths in $expand and $select shall be sorted in the cache's query string
@param {string} [sDeepResourcePath=sResourcePath]
The deep resource path to be used to build the target path for bound messages | [
"*********************************************************************************************",
"CollectionCache",
"*********************************************************************************************",
"Creates",
"a",
"cache",
"for",
"a",
"collection",
"of",
"entities",
"that",
"p... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L1196-L1217 | train | A cache that stores the results of a collection of items in the cache. | [
30522,
3853,
3074,
3540,
5403,
1006,
10848,
15500,
2953,
1010,
5034,
2229,
8162,
3401,
15069,
1010,
1049,
4226,
2854,
7361,
9285,
1010,
18667,
11589,
10288,
9739,
5104,
12260,
6593,
1010,
17371,
4402,
28994,
8162,
3401,
15069,
1007,
1063,
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... |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function () {
this.writeToInput();
if (this.options.onStart && typeof this.options.onStart === "function") {
if (this.options.scope) {
this.options.onStart.call(this.options.scope, this.result);
} else {
this.options.onStart(this.result);
}
}
} | javascript | function () {
this.writeToInput();
if (this.options.onStart && typeof this.options.onStart === "function") {
if (this.options.scope) {
this.options.onStart.call(this.options.scope, this.result);
} else {
this.options.onStart(this.result);
}
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"writeToInput",
"(",
")",
";",
"if",
"(",
"this",
".",
"options",
".",
"onStart",
"&&",
"typeof",
"this",
".",
"options",
".",
"onStart",
"===",
"\"function\"",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",... | ============================================================================================================= Callbacks | [
"=============================================================================================================",
"Callbacks"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1673-L1683 | train | End of the process | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
4339,
3406,
2378,
18780,
1006,
1007,
1025,
2065,
1006,
2023,
1012,
7047,
1012,
2006,
14117,
2102,
1004,
1004,
2828,
11253,
2023,
1012,
7047,
1012,
2006,
14117,
2102,
1027,
1027,
1027,
1000,
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... | |
aframevr/aframe | src/components/scene/pool.js | function (el) {
var index = this.usedEls.indexOf(el);
if (index === -1) {
warn('The returned entity was not previously pooled from ' + this.attrName);
return;
}
this.usedEls.splice(index, 1);
this.availableEls.push(el);
el.object3D.visible = false;
el.pause();
return el;
} | javascript | function (el) {
var index = this.usedEls.indexOf(el);
if (index === -1) {
warn('The returned entity was not previously pooled from ' + this.attrName);
return;
}
this.usedEls.splice(index, 1);
this.availableEls.push(el);
el.object3D.visible = false;
el.pause();
return el;
} | [
"function",
"(",
"el",
")",
"{",
"var",
"index",
"=",
"this",
".",
"usedEls",
".",
"indexOf",
"(",
"el",
")",
";",
"if",
"(",
"index",
"===",
"-",
"1",
")",
"{",
"warn",
"(",
"'The returned entity was not previously pooled from '",
"+",
"this",
".",
"att... | Used to return a used entity to the pool. | [
"Used",
"to",
"return",
"a",
"used",
"entity",
"to",
"the",
"pool",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/scene/pool.js#L104-L115 | train | Returns an entity that was previously pooled from this. attrName | [
30522,
3853,
1006,
3449,
1007,
1063,
13075,
5950,
1027,
2023,
1012,
2109,
9050,
1012,
5950,
11253,
1006,
3449,
1007,
1025,
2065,
1006,
5950,
1027,
1027,
1027,
1011,
1015,
1007,
1063,
11582,
1006,
1005,
1996,
2513,
9178,
2001,
2025,
3130,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ThemeSettings.js | getValues | function getValues() {
var result = {};
Object.keys(defaults).forEach(function (key) {
result[key] = prefs.get(key);
});
result.fontFamily = ViewCommandHandlers.getFontFamily();
result.fontSize = ViewCommandHandlers.getFontSize();
result.validFontSizeRegExp = ViewCommandHandlers.validFontSizeRegExp;
return result;
} | javascript | function getValues() {
var result = {};
Object.keys(defaults).forEach(function (key) {
result[key] = prefs.get(key);
});
result.fontFamily = ViewCommandHandlers.getFontFamily();
result.fontSize = ViewCommandHandlers.getFontSize();
result.validFontSizeRegExp = ViewCommandHandlers.validFontSizeRegExp;
return result;
} | [
"function",
"getValues",
"(",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"defaults",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"result",
"[",
"key",
"]",
"=",
"prefs",
".",
"get",
"(",
"key",
")",... | @private
Gets all the configurable settings that need to be loaded in the settings dialog
@return {Object} a collection with all the settings | [
"@private",
"Gets",
"all",
"the",
"configurable",
"settings",
"that",
"need",
"to",
"be",
"loaded",
"in",
"the",
"settings",
"dialog"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/ThemeSettings.js#L62-L73 | train | Get the values of the preferences | [
30522,
3853,
2131,
10175,
15808,
1006,
1007,
1063,
13075,
2765,
1027,
1063,
1065,
1025,
4874,
1012,
6309,
1006,
12398,
2015,
1007,
1012,
18921,
6776,
1006,
3853,
1006,
3145,
1007,
1063,
2765,
1031,
3145,
1033,
1027,
3653,
10343,
1012,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
caolan/async | lib/mapLimit.js | mapLimit | function mapLimit (coll, limit, iteratee, callback) {
return _map(eachOfLimit(limit), coll, iteratee, callback)
} | javascript | function mapLimit (coll, limit, iteratee, callback) {
return _map(eachOfLimit(limit), coll, iteratee, callback)
} | [
"function",
"mapLimit",
"(",
"coll",
",",
"limit",
",",
"iteratee",
",",
"callback",
")",
"{",
"return",
"_map",
"(",
"eachOfLimit",
"(",
"limit",
")",
",",
"coll",
",",
"iteratee",
",",
"callback",
")",
"}"
] | The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time.
@name mapLimit
@static
@memberOf module:Collections
@method
@see [async.map]{@link module:Collections.map}
@category Collection
@param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
@param {number} limit - The maximum number of async operations at a time.
@param {AsyncFunction} iteratee - An async function to apply to each item in
`coll`.
The iteratee should complete with the transformed item.
Invoked with (item, callback).
@param {Function} [callback] - A callback which is called when all `iteratee`
functions have finished, or an error occurs. Results is an array of the
transformed items from the `coll`. Invoked with (err, results).
@returns {Promise} a promise, if no callback is passed | [
"The",
"same",
"as",
"[",
"map",
"]",
"{",
"@link",
"module",
":",
"Collections",
".",
"map",
"}",
"but",
"runs",
"a",
"maximum",
"of",
"limit",
"async",
"operations",
"at",
"a",
"time",
"."
] | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/mapLimit.js#L25-L27 | train | Creates a new collection with the results of running each iteration in the collection. | [
30522,
3853,
4949,
17960,
4183,
1006,
8902,
2140,
1010,
5787,
1010,
2009,
22139,
2063,
1010,
2655,
5963,
1007,
1063,
2709,
1035,
4949,
1006,
2169,
11253,
17960,
4183,
1006,
5787,
1007,
1010,
8902,
2140,
1010,
2009,
22139,
2063,
1010,
2655,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc-node | packages/grpc-native-core/src/client.js | ClientWritableStream | function ClientWritableStream(call) {
Writable.call(this, {objectMode: true});
this.call = call;
var self = this;
this.on('finish', function() {
self.call.halfClose();
});
} | javascript | function ClientWritableStream(call) {
Writable.call(this, {objectMode: true});
this.call = call;
var self = this;
this.on('finish', function() {
self.call.halfClose();
});
} | [
"function",
"ClientWritableStream",
"(",
"call",
")",
"{",
"Writable",
".",
"call",
"(",
"this",
",",
"{",
"objectMode",
":",
"true",
"}",
")",
";",
"this",
".",
"call",
"=",
"call",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"on",
"(",
"'f... | A stream that the client can write to. Used for calls that are streaming from
the client side.
@constructor grpc~ClientWritableStream
@extends external:Writable
@borrows grpc~ClientUnaryCall#cancel as grpc~ClientWritableStream#cancel
@borrows grpc~ClientUnaryCall#getPeer as grpc~ClientWritableStream#getPeer
@borrows grpc~ClientUnaryCall#event:metadata as
grpc~ClientWritableStream#metadata
@borrows grpc~ClientUnaryCall#event:status as
grpc~ClientWritableStream#status
@param {InterceptingCall} call Exposes gRPC request operations, processed by
an interceptor stack. | [
"A",
"stream",
"that",
"the",
"client",
"can",
"write",
"to",
".",
"Used",
"for",
"calls",
"that",
"are",
"streaming",
"from",
"the",
"client",
"side",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client.js#L97-L104 | train | Writable stream for a client | [
30522,
3853,
7396,
13088,
6590,
13510,
25379,
1006,
2655,
1007,
1063,
25697,
3085,
1012,
2655,
1006,
2023,
1010,
1063,
4874,
5302,
3207,
1024,
2995,
1065,
1007,
1025,
2023,
1012,
2655,
1027,
2655,
1025,
13075,
2969,
1027,
2023,
1025,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/MainViewManager.js | _closeList | function _closeList(paneId, fileList) {
_forEachPaneOrPanes(paneId, function (pane) {
var closedList = pane.removeViews(fileList);
closedList.forEach(function (file) {
_removeFileFromMRU(pane.id, file);
});
exports.trigger("workingSetRemoveList", closedList, pane.id);
});
} | javascript | function _closeList(paneId, fileList) {
_forEachPaneOrPanes(paneId, function (pane) {
var closedList = pane.removeViews(fileList);
closedList.forEach(function (file) {
_removeFileFromMRU(pane.id, file);
});
exports.trigger("workingSetRemoveList", closedList, pane.id);
});
} | [
"function",
"_closeList",
"(",
"paneId",
",",
"fileList",
")",
"{",
"_forEachPaneOrPanes",
"(",
"paneId",
",",
"function",
"(",
"pane",
")",
"{",
"var",
"closedList",
"=",
"pane",
".",
"removeViews",
"(",
"fileList",
")",
";",
"closedList",
".",
"forEach",
... | Closes a list of file in the specified pane or panes
@param {!string} paneId - id of the pane in which to open the document
@param {!Array.<File>} fileList - files to close
This function does not fail if the file is not open | [
"Closes",
"a",
"list",
"of",
"file",
"in",
"the",
"specified",
"pane",
"or",
"panes"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1368-L1377 | train | Close a list of files | [
30522,
3853,
1035,
2485,
9863,
1006,
6090,
7416,
2094,
1010,
5371,
9863,
1007,
1063,
1035,
18921,
6776,
9739,
8780,
14536,
7231,
2015,
1006,
6090,
7416,
2094,
1010,
3853,
1006,
6090,
2063,
1007,
1063,
13075,
2701,
9863,
1027,
6090,
2063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tensorflow/tfjs-models | posenet/demos/demo_util.js | drawPoints | function drawPoints(ctx, points, radius, color) {
const data = points.buffer().values;
for (let i = 0; i < data.length; i += 2) {
const pointY = data[i];
const pointX = data[i + 1];
if (pointX !== 0 && pointY !== 0) {
ctx.beginPath();
ctx.arc(pointX, pointY, radius, 0, 2 * Math.PI);
ctx.fillStyle = color;
ctx.fill();
}
}
} | javascript | function drawPoints(ctx, points, radius, color) {
const data = points.buffer().values;
for (let i = 0; i < data.length; i += 2) {
const pointY = data[i];
const pointX = data[i + 1];
if (pointX !== 0 && pointY !== 0) {
ctx.beginPath();
ctx.arc(pointX, pointY, radius, 0, 2 * Math.PI);
ctx.fillStyle = color;
ctx.fill();
}
}
} | [
"function",
"drawPoints",
"(",
"ctx",
",",
"points",
",",
"radius",
",",
"color",
")",
"{",
"const",
"data",
"=",
"points",
".",
"buffer",
"(",
")",
".",
"values",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
... | Used by the drawHeatMapValues method to draw heatmap points on to
the canvas | [
"Used",
"by",
"the",
"drawHeatMapValues",
"method",
"to",
"draw",
"heatmap",
"points",
"on",
"to",
"the",
"canvas"
] | af194797c90cc5bcac1060d3cd41b0258a34c7dc | https://github.com/tensorflow/tfjs-models/blob/af194797c90cc5bcac1060d3cd41b0258a34c7dc/posenet/demos/demo_util.js#L143-L157 | train | Draw a polygon of points | [
30522,
3853,
4009,
26521,
1006,
14931,
2595,
1010,
2685,
1010,
12177,
1010,
3609,
1007,
1063,
9530,
3367,
2951,
1027,
2685,
1012,
17698,
1006,
1007,
1012,
5300,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026,
2951,
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... |
adobe/brackets | src/JSUtils/ScopeManager.js | handlePrimePumpCompletion | function handlePrimePumpCompletion(response) {
var path = response.path,
type = response.type,
$deferredHints = getPendingRequest(path, OFFSET_ZERO, type);
if ($deferredHints) {
$deferredHints.resolve();
}
} | javascript | function handlePrimePumpCompletion(response) {
var path = response.path,
type = response.type,
$deferredHints = getPendingRequest(path, OFFSET_ZERO, type);
if ($deferredHints) {
$deferredHints.resolve();
}
} | [
"function",
"handlePrimePumpCompletion",
"(",
"response",
")",
"{",
"var",
"path",
"=",
"response",
".",
"path",
",",
"type",
"=",
"response",
".",
"type",
",",
"$deferredHints",
"=",
"getPendingRequest",
"(",
"path",
",",
"OFFSET_ZERO",
",",
"type",
")",
";... | Handle the response from the tern node domain when
it responds to the prime pump message.
@param {{path: string, type: string}} response - the response from node domain | [
"Handle",
"the",
"response",
"from",
"the",
"tern",
"node",
"domain",
"when",
"it",
"responds",
"to",
"the",
"prime",
"pump",
"message",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L1009-L1018 | train | Handle Prime Pump completion | [
30522,
3853,
5047,
18098,
14428,
14289,
8737,
9006,
10814,
3508,
1006,
3433,
1007,
1063,
13075,
4130,
1027,
3433,
1012,
4130,
1010,
2828,
1027,
3433,
1012,
2828,
1010,
1002,
13366,
28849,
19114,
7666,
1027,
2131,
11837,
4667,
2890,
15500,
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... |
apache/incubator-echarts | src/coord/calendar/Calendar.js | function (point) {
var nthX = Math.floor((point[0] - this._rect.x) / this._sw) + 1;
var nthY = Math.floor((point[1] - this._rect.y) / this._sh) + 1;
var range = this._rangeInfo.range;
if (this._orient === 'vertical') {
return this._getDateByWeeksAndDay(nthY, nthX - 1, range);
}
return this._getDateByWeeksAndDay(nthX, nthY - 1, range);
} | javascript | function (point) {
var nthX = Math.floor((point[0] - this._rect.x) / this._sw) + 1;
var nthY = Math.floor((point[1] - this._rect.y) / this._sh) + 1;
var range = this._rangeInfo.range;
if (this._orient === 'vertical') {
return this._getDateByWeeksAndDay(nthY, nthX - 1, range);
}
return this._getDateByWeeksAndDay(nthX, nthY - 1, range);
} | [
"function",
"(",
"point",
")",
"{",
"var",
"nthX",
"=",
"Math",
".",
"floor",
"(",
"(",
"point",
"[",
"0",
"]",
"-",
"this",
".",
"_rect",
".",
"x",
")",
"/",
"this",
".",
"_sw",
")",
"+",
"1",
";",
"var",
"nthY",
"=",
"Math",
".",
"floor",
... | Convert a (x, y) point to time date
@param {Array} point point
@return {Object} date | [
"Convert",
"a",
"(",
"x",
"y",
")",
"point",
"to",
"time",
"date"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/calendar/Calendar.js#L291-L301 | train | Get the date of the page at the given point | [
30522,
3853,
1006,
2391,
1007,
1063,
13075,
23961,
2232,
2595,
1027,
8785,
1012,
2723,
1006,
1006,
2391,
1031,
1014,
1033,
1011,
2023,
1012,
1035,
28667,
2102,
1012,
1060,
1007,
1013,
2023,
1012,
1035,
25430,
1007,
1009,
1015,
1025,
13075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
wuchangming/spy-debugger | buildin_modules/weinre/web/client/UglifyJS/parse-js.js | NodeWithToken | function NodeWithToken(str, start, end) {
this.name = str;
this.start = start;
this.end = end;
} | javascript | function NodeWithToken(str, start, end) {
this.name = str;
this.start = start;
this.end = end;
} | [
"function",
"NodeWithToken",
"(",
"str",
",",
"start",
",",
"end",
")",
"{",
"this",
".",
"name",
"=",
"str",
";",
"this",
".",
"start",
"=",
"start",
";",
"this",
".",
"end",
"=",
"end",
";",
"}"
] | /* -----[ Parser ]----- | [
"/",
"*",
"-----",
"[",
"Parser",
"]",
"-----"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/UglifyJS/parse-js.js#L607-L611 | train | NodeWithToken constructor. | [
30522,
3853,
13045,
24415,
18715,
2368,
1006,
2358,
2099,
1010,
2707,
1010,
2203,
1007,
1063,
2023,
1012,
2171,
1027,
2358,
2099,
1025,
2023,
1012,
2707,
1027,
2707,
1025,
2023,
1012,
2203,
1027,
2203,
1025,
1065,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Freeboard/freeboard | js/freeboard.thirdparty.js | function( val ) {
if ( val <= this._valueMin() ) {
return this._valueMin();
}
if ( val >= this._valueMax() ) {
return this._valueMax();
}
var step = ( this.options.step > 0 ) ? this.options.step : 1,
valModStep = (val - this._valueMin()) % step,
alignValue = val - valModStep;
if ( Math.abs(valModStep) * 2 >= step ) {
alignValue += ( valModStep > 0 ) ? step : ( -step );
}
// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see #4124)
return parseFloat( alignValue.toFixed(5) );
} | javascript | function( val ) {
if ( val <= this._valueMin() ) {
return this._valueMin();
}
if ( val >= this._valueMax() ) {
return this._valueMax();
}
var step = ( this.options.step > 0 ) ? this.options.step : 1,
valModStep = (val - this._valueMin()) % step,
alignValue = val - valModStep;
if ( Math.abs(valModStep) * 2 >= step ) {
alignValue += ( valModStep > 0 ) ? step : ( -step );
}
// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see #4124)
return parseFloat( alignValue.toFixed(5) );
} | [
"function",
"(",
"val",
")",
"{",
"if",
"(",
"val",
"<=",
"this",
".",
"_valueMin",
"(",
")",
")",
"{",
"return",
"this",
".",
"_valueMin",
"(",
")",
";",
"}",
"if",
"(",
"val",
">=",
"this",
".",
"_valueMax",
"(",
")",
")",
"{",
"return",
"thi... | returns the step-aligned value that val is closest to, between (inclusive) min and max | [
"returns",
"the",
"step",
"-",
"aligned",
"value",
"that",
"val",
"is",
"closest",
"to",
"between",
"(",
"inclusive",
")",
"min",
"and",
"max"
] | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L13151-L13169 | train | Returns the value of the slider. | [
30522,
3853,
1006,
11748,
1007,
1063,
2065,
1006,
11748,
1026,
1027,
2023,
1012,
1035,
3643,
10020,
1006,
1007,
1007,
1063,
2709,
2023,
1012,
1035,
3643,
10020,
1006,
1007,
1025,
1065,
2065,
1006,
11748,
1028,
1027,
2023,
1012,
1035,
3643,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
firebase/firebaseui-web | demo/public/app.js | function(user) {
document.getElementById('user-signed-in').style.display = 'block';
document.getElementById('user-signed-out').style.display = 'none';
document.getElementById('name').textContent = user.displayName;
document.getElementById('email').textContent = user.email;
document.getElementById('phone').textContent = user.phoneNumber;
if (user.photoURL){
var photoURL = user.photoURL;
// Append size to the photo URL for Google hosted images to avoid requesting
// the image with its original resolution (using more bandwidth than needed)
// when it is going to be presented in smaller size.
if ((photoURL.indexOf('googleusercontent.com') != -1) ||
(photoURL.indexOf('ggpht.com') != -1)) {
photoURL = photoURL + '?sz=' +
document.getElementById('photo').clientHeight;
}
document.getElementById('photo').src = photoURL;
document.getElementById('photo').style.display = 'block';
} else {
document.getElementById('photo').style.display = 'none';
}
} | javascript | function(user) {
document.getElementById('user-signed-in').style.display = 'block';
document.getElementById('user-signed-out').style.display = 'none';
document.getElementById('name').textContent = user.displayName;
document.getElementById('email').textContent = user.email;
document.getElementById('phone').textContent = user.phoneNumber;
if (user.photoURL){
var photoURL = user.photoURL;
// Append size to the photo URL for Google hosted images to avoid requesting
// the image with its original resolution (using more bandwidth than needed)
// when it is going to be presented in smaller size.
if ((photoURL.indexOf('googleusercontent.com') != -1) ||
(photoURL.indexOf('ggpht.com') != -1)) {
photoURL = photoURL + '?sz=' +
document.getElementById('photo').clientHeight;
}
document.getElementById('photo').src = photoURL;
document.getElementById('photo').style.display = 'block';
} else {
document.getElementById('photo').style.display = 'none';
}
} | [
"function",
"(",
"user",
")",
"{",
"document",
".",
"getElementById",
"(",
"'user-signed-in'",
")",
".",
"style",
".",
"display",
"=",
"'block'",
";",
"document",
".",
"getElementById",
"(",
"'user-signed-out'",
")",
".",
"style",
".",
"display",
"=",
"'none... | Displays the UI for a signed in user.
@param {!firebase.User} user | [
"Displays",
"the",
"UI",
"for",
"a",
"signed",
"in",
"user",
"."
] | c10aa51e38aeb38dc63baa22b48cd6690c2be087 | https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/demo/public/app.js#L127-L148 | train | This function is called when a user is signed in | [
30522,
3853,
1006,
5310,
1007,
1063,
6254,
1012,
2131,
12260,
3672,
3762,
3593,
1006,
1005,
5310,
1011,
2772,
1011,
1999,
1005,
1007,
1012,
2806,
1012,
4653,
1027,
1005,
3796,
1005,
1025,
6254,
1012,
2131,
12260,
3672,
3762,
3593,
1006,
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... | |
laurent22/joplin | Clipper/joplin-webclipper/content_scripts/Readability.js | function() {
var doc = this._doc;
var curTitle = "";
var origTitle = "";
try {
curTitle = origTitle = doc.title;
// If they had an element with id "title" in their HTML
if (typeof curTitle !== "string")
curTitle = origTitle = this._getInnerText(doc.getElementsByTagName('title')[0]);
} catch (e) {/* ignore exceptions setting the title. */}
var titleHadHierarchicalSeparators = false;
function wordCount(str) {
return str.split(/\s+/).length;
}
// If there's a separator in the title, first remove the final part
if ((/ [\|\-\\\/>»] /).test(curTitle)) {
titleHadHierarchicalSeparators = / [\\\/>»] /.test(curTitle);
curTitle = origTitle.replace(/(.*)[\|\-\\\/>»] .*/gi, '$1');
// If the resulting title is too short (3 words or fewer), remove
// the first part instead:
if (wordCount(curTitle) < 3)
curTitle = origTitle.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi, '$1');
} else if (curTitle.indexOf(': ') !== -1) {
// Check if we have an heading containing this exact string, so we
// could assume it's the full title.
var headings = this._concatNodeLists(
doc.getElementsByTagName('h1'),
doc.getElementsByTagName('h2')
);
var match = this._someNode(headings, function(heading) {
return heading.textContent === curTitle;
});
// If we don't, let's extract the title out of the original title string.
if (!match) {
curTitle = origTitle.substring(origTitle.lastIndexOf(':') + 1);
// If the title is now too short, try the first colon instead:
if (wordCount(curTitle) < 3) {
curTitle = origTitle.substring(origTitle.indexOf(':') + 1);
// But if we have too many words before the colon there's something weird
// with the titles and the H tags so let's just use the original title instead
} else if (wordCount(origTitle.substr(0, origTitle.indexOf(':'))) > 5) {
curTitle = origTitle;
}
}
} else if (curTitle.length > 150 || curTitle.length < 15) {
var hOnes = doc.getElementsByTagName('h1');
if (hOnes.length === 1)
curTitle = this._getInnerText(hOnes[0]);
}
curTitle = curTitle.trim();
// If we now have 4 words or fewer as our title, and either no
// 'hierarchical' separators (\, /, > or ») were found in the original
// title or we decreased the number of words by more than 1 word, use
// the original title.
var curTitleWordCount = wordCount(curTitle);
if (curTitleWordCount <= 4 &&
(!titleHadHierarchicalSeparators ||
curTitleWordCount != wordCount(origTitle.replace(/[\|\-\\\/>»]+/g, "")) - 1)) {
curTitle = origTitle;
}
return curTitle;
} | javascript | function() {
var doc = this._doc;
var curTitle = "";
var origTitle = "";
try {
curTitle = origTitle = doc.title;
// If they had an element with id "title" in their HTML
if (typeof curTitle !== "string")
curTitle = origTitle = this._getInnerText(doc.getElementsByTagName('title')[0]);
} catch (e) {/* ignore exceptions setting the title. */}
var titleHadHierarchicalSeparators = false;
function wordCount(str) {
return str.split(/\s+/).length;
}
// If there's a separator in the title, first remove the final part
if ((/ [\|\-\\\/>»] /).test(curTitle)) {
titleHadHierarchicalSeparators = / [\\\/>»] /.test(curTitle);
curTitle = origTitle.replace(/(.*)[\|\-\\\/>»] .*/gi, '$1');
// If the resulting title is too short (3 words or fewer), remove
// the first part instead:
if (wordCount(curTitle) < 3)
curTitle = origTitle.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi, '$1');
} else if (curTitle.indexOf(': ') !== -1) {
// Check if we have an heading containing this exact string, so we
// could assume it's the full title.
var headings = this._concatNodeLists(
doc.getElementsByTagName('h1'),
doc.getElementsByTagName('h2')
);
var match = this._someNode(headings, function(heading) {
return heading.textContent === curTitle;
});
// If we don't, let's extract the title out of the original title string.
if (!match) {
curTitle = origTitle.substring(origTitle.lastIndexOf(':') + 1);
// If the title is now too short, try the first colon instead:
if (wordCount(curTitle) < 3) {
curTitle = origTitle.substring(origTitle.indexOf(':') + 1);
// But if we have too many words before the colon there's something weird
// with the titles and the H tags so let's just use the original title instead
} else if (wordCount(origTitle.substr(0, origTitle.indexOf(':'))) > 5) {
curTitle = origTitle;
}
}
} else if (curTitle.length > 150 || curTitle.length < 15) {
var hOnes = doc.getElementsByTagName('h1');
if (hOnes.length === 1)
curTitle = this._getInnerText(hOnes[0]);
}
curTitle = curTitle.trim();
// If we now have 4 words or fewer as our title, and either no
// 'hierarchical' separators (\, /, > or ») were found in the original
// title or we decreased the number of words by more than 1 word, use
// the original title.
var curTitleWordCount = wordCount(curTitle);
if (curTitleWordCount <= 4 &&
(!titleHadHierarchicalSeparators ||
curTitleWordCount != wordCount(origTitle.replace(/[\|\-\\\/>»]+/g, "")) - 1)) {
curTitle = origTitle;
}
return curTitle;
} | [
"function",
"(",
")",
"{",
"var",
"doc",
"=",
"this",
".",
"_doc",
";",
"var",
"curTitle",
"=",
"\"\"",
";",
"var",
"origTitle",
"=",
"\"\"",
";",
"try",
"{",
"curTitle",
"=",
"origTitle",
"=",
"doc",
".",
"title",
";",
"// If they had an element with id... | Get the article title as an H1.
@return void | [
"Get",
"the",
"article",
"title",
"as",
"an",
"H1",
"."
] | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L352-L423 | train | Get the current page title | [
30522,
3853,
1006,
1007,
1063,
13075,
9986,
1027,
2023,
1012,
1035,
9986,
1025,
13075,
20099,
4183,
2571,
1027,
1000,
1000,
1025,
13075,
2030,
8004,
3775,
9286,
1027,
1000,
1000,
1025,
3046,
1063,
20099,
4183,
2571,
1027,
2030,
8004,
3775,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
summernote/summernote | src/js/base/core/dom.js | makeOffsetPath | function makeOffsetPath(ancestor, node) {
const ancestors = listAncestor(node, func.eq(ancestor));
return ancestors.map(position).reverse();
} | javascript | function makeOffsetPath(ancestor, node) {
const ancestors = listAncestor(node, func.eq(ancestor));
return ancestors.map(position).reverse();
} | [
"function",
"makeOffsetPath",
"(",
"ancestor",
",",
"node",
")",
"{",
"const",
"ancestors",
"=",
"listAncestor",
"(",
"node",
",",
"func",
".",
"eq",
"(",
"ancestor",
")",
")",
";",
"return",
"ancestors",
".",
"map",
"(",
"position",
")",
".",
"reverse",... | @method makeOffsetPath
return offsetPath(array of offset) from ancestor
@param {Node} ancestor - ancestor node
@param {Node} node | [
"@method",
"makeOffsetPath"
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L702-L705 | train | Make an offset path for an ancestor | [
30522,
3853,
2191,
27475,
3388,
15069,
1006,
13032,
1010,
13045,
1007,
1063,
9530,
3367,
10748,
1027,
2862,
26755,
4263,
1006,
13045,
1010,
4569,
2278,
1012,
1041,
4160,
1006,
13032,
1007,
1007,
1025,
2709,
10748,
1012,
4949,
1006,
2597,
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... |
grpc/grpc-node | packages/grpc-native-core/src/client.js | _readsDone | function _readsDone(status) {
/* jshint validthis: true */
if (!status) {
status = {code: constants.status.OK, details: 'OK'};
}
if (status.code !== constants.status.OK) {
this.call.cancelWithStatus(status.code, status.details);
}
this.finished = true;
this.read_status = status;
this._emitStatusIfDone();
} | javascript | function _readsDone(status) {
/* jshint validthis: true */
if (!status) {
status = {code: constants.status.OK, details: 'OK'};
}
if (status.code !== constants.status.OK) {
this.call.cancelWithStatus(status.code, status.details);
}
this.finished = true;
this.read_status = status;
this._emitStatusIfDone();
} | [
"function",
"_readsDone",
"(",
"status",
")",
"{",
"/* jshint validthis: true */",
"if",
"(",
"!",
"status",
")",
"{",
"status",
"=",
"{",
"code",
":",
"constants",
".",
"status",
".",
"OK",
",",
"details",
":",
"'OK'",
"}",
";",
"}",
"if",
"(",
"statu... | Called when all messages from the server have been processed. The status
parameter indicates that the call should end with that status. status
defaults to OK if not provided.
@param {Object!} status The status that the call should end with
@private | [
"Called",
"when",
"all",
"messages",
"from",
"the",
"server",
"have",
"been",
"processed",
".",
"The",
"status",
"parameter",
"indicates",
"that",
"the",
"call",
"should",
"end",
"with",
"that",
"status",
".",
"status",
"defaults",
"to",
"OK",
"if",
"not",
... | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client.js#L189-L200 | train | Called when all the reads have been completed | [
30522,
3853,
1035,
9631,
5280,
2063,
1006,
3570,
1007,
1063,
1013,
1008,
1046,
17426,
2102,
9398,
15222,
2015,
1024,
2995,
1008,
1013,
2065,
1006,
999,
3570,
1007,
1063,
3570,
1027,
1063,
3642,
1024,
5377,
2015,
1012,
3570,
1012,
7929,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Agents/RemoteFunctions.js | showGoto | function showGoto(targets) {
if (!_currentMenu) {
return;
}
_currentMenu.createBody();
var i;
for (i in targets) {
_currentMenu.addItem(targets[i]);
}
_currentMenu.show();
} | javascript | function showGoto(targets) {
if (!_currentMenu) {
return;
}
_currentMenu.createBody();
var i;
for (i in targets) {
_currentMenu.addItem(targets[i]);
}
_currentMenu.show();
} | [
"function",
"showGoto",
"(",
"targets",
")",
"{",
"if",
"(",
"!",
"_currentMenu",
")",
"{",
"return",
";",
"}",
"_currentMenu",
".",
"createBody",
"(",
")",
";",
"var",
"i",
";",
"for",
"(",
"i",
"in",
"targets",
")",
"{",
"_currentMenu",
".",
"addIt... | show goto | [
"show",
"goto"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/RemoteFunctions.js#L643-L653 | train | showGoto - Shows the goto menu | [
30522,
3853,
2265,
3995,
3406,
1006,
7889,
1007,
1063,
2065,
1006,
999,
1035,
2783,
3549,
2226,
1007,
1063,
2709,
1025,
1065,
1035,
2783,
3549,
2226,
1012,
3443,
23684,
1006,
1007,
1025,
13075,
1045,
1025,
2005,
1006,
1045,
1999,
7889,
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... |
codemirror/CodeMirror | src/display/operations.js | endOperations | function endOperations(group) {
let ops = group.ops
for (let i = 0; i < ops.length; i++) // Read DOM
endOperation_R1(ops[i])
for (let i = 0; i < ops.length; i++) // Write DOM (maybe)
endOperation_W1(ops[i])
for (let i = 0; i < ops.length; i++) // Read DOM
endOperation_R2(ops[i])
for (let i = 0; i < ops.length; i++) // Write DOM (maybe)
endOperation_W2(ops[i])
for (let i = 0; i < ops.length; i++) // Read DOM
endOperation_finish(ops[i])
} | javascript | function endOperations(group) {
let ops = group.ops
for (let i = 0; i < ops.length; i++) // Read DOM
endOperation_R1(ops[i])
for (let i = 0; i < ops.length; i++) // Write DOM (maybe)
endOperation_W1(ops[i])
for (let i = 0; i < ops.length; i++) // Read DOM
endOperation_R2(ops[i])
for (let i = 0; i < ops.length; i++) // Write DOM (maybe)
endOperation_W2(ops[i])
for (let i = 0; i < ops.length; i++) // Read DOM
endOperation_finish(ops[i])
} | [
"function",
"endOperations",
"(",
"group",
")",
"{",
"let",
"ops",
"=",
"group",
".",
"ops",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"ops",
".",
"length",
";",
"i",
"++",
")",
"// Read DOM",
"endOperation_R1",
"(",
"ops",
"[",
"i",
"]",
... | The DOM updates done when an operation finishes are batched so that the minimum number of relayouts are required. | [
"The",
"DOM",
"updates",
"done",
"when",
"an",
"operation",
"finishes",
"are",
"batched",
"so",
"that",
"the",
"minimum",
"number",
"of",
"relayouts",
"are",
"required",
"."
] | dab6f676107c10ba8d16c654a42f66cae3f27db1 | https://github.com/codemirror/CodeMirror/blob/dab6f676107c10ba8d16c654a42f66cae3f27db1/src/display/operations.js#L56-L68 | train | End operations in a group | [
30522,
3853,
2203,
25918,
10708,
1006,
2177,
1007,
1063,
2292,
23092,
1027,
2177,
1012,
23092,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026,
23092,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1013,
1013,
3191,
14383,
2203,
25918,
3370... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/new-cap.js | calculateCapIsNewExceptions | function calculateCapIsNewExceptions(config) {
let capIsNewExceptions = checkArray(config, "capIsNewExceptions", CAPS_ALLOWED);
if (capIsNewExceptions !== CAPS_ALLOWED) {
capIsNewExceptions = capIsNewExceptions.concat(CAPS_ALLOWED);
}
return capIsNewExceptions.reduce(invert, {});
} | javascript | function calculateCapIsNewExceptions(config) {
let capIsNewExceptions = checkArray(config, "capIsNewExceptions", CAPS_ALLOWED);
if (capIsNewExceptions !== CAPS_ALLOWED) {
capIsNewExceptions = capIsNewExceptions.concat(CAPS_ALLOWED);
}
return capIsNewExceptions.reduce(invert, {});
} | [
"function",
"calculateCapIsNewExceptions",
"(",
"config",
")",
"{",
"let",
"capIsNewExceptions",
"=",
"checkArray",
"(",
"config",
",",
"\"capIsNewExceptions\"",
",",
"CAPS_ALLOWED",
")",
";",
"if",
"(",
"capIsNewExceptions",
"!==",
"CAPS_ALLOWED",
")",
"{",
"capIsN... | Creates an object with the cap is new exceptions as its keys and true as their values.
@param {Object} config Rule configuration
@returns {Object} Object with cap is new exceptions. | [
"Creates",
"an",
"object",
"with",
"the",
"cap",
"is",
"new",
"exceptions",
"as",
"its",
"keys",
"and",
"true",
"as",
"their",
"values",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/new-cap.js#L61-L69 | train | Calculates the number of new exceptions that are not allowed by the current process | [
30522,
3853,
18422,
17695,
2483,
2638,
8545,
2595,
24422,
2015,
1006,
9530,
8873,
2290,
1007,
1063,
2292,
6178,
2483,
2638,
8545,
2595,
24422,
2015,
1027,
4638,
2906,
9447,
1006,
9530,
8873,
2290,
1010,
1000,
6178,
2483,
2638,
8545,
2595,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/autocomplete/js/autocompleteController.js | getVerticalOffset | function getVerticalOffset () {
var offset = 0;
var inputContainer = $element.find('md-input-container');
if (inputContainer.length) {
var input = inputContainer.find('input');
offset = inputContainer.prop('offsetHeight');
offset -= input.prop('offsetTop');
offset -= input.prop('offsetHeight');
// add in the height left up top for the floating label text
offset += inputContainer.prop('offsetTop');
}
return offset;
} | javascript | function getVerticalOffset () {
var offset = 0;
var inputContainer = $element.find('md-input-container');
if (inputContainer.length) {
var input = inputContainer.find('input');
offset = inputContainer.prop('offsetHeight');
offset -= input.prop('offsetTop');
offset -= input.prop('offsetHeight');
// add in the height left up top for the floating label text
offset += inputContainer.prop('offsetTop');
}
return offset;
} | [
"function",
"getVerticalOffset",
"(",
")",
"{",
"var",
"offset",
"=",
"0",
";",
"var",
"inputContainer",
"=",
"$element",
".",
"find",
"(",
"'md-input-container'",
")",
";",
"if",
"(",
"inputContainer",
".",
"length",
")",
"{",
"var",
"input",
"=",
"inputC... | Calculates the vertical offset for floating label examples to account for ngMessages
@returns {number} | [
"Calculates",
"the",
"vertical",
"offset",
"for",
"floating",
"label",
"examples",
"to",
"account",
"for",
"ngMessages"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L188-L200 | train | Get the vertical offset of the input container | [
30522,
3853,
2131,
16874,
7476,
27475,
3388,
1006,
1007,
1063,
13075,
16396,
1027,
1014,
1025,
13075,
7953,
8663,
18249,
2121,
1027,
1002,
5783,
1012,
2424,
1006,
1005,
9108,
1011,
7953,
1011,
11661,
1005,
1007,
1025,
2065,
1006,
7953,
8663... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vuepress | packages/vuepress/lib/handleUnknownCommand.js | inferUserDocsDirectory | async function inferUserDocsDirectory (cwd) {
const paths = await globby([
'**/.vuepress/config.js',
'!node_modules'
], {
cwd,
dot: true
})
const siteConfigPath = paths && paths[0]
if (siteConfigPath) {
return path.resolve(
cwd,
siteConfigPath.replace('.vuepress/config.js', '')
)
}
return null
} | javascript | async function inferUserDocsDirectory (cwd) {
const paths = await globby([
'**/.vuepress/config.js',
'!node_modules'
], {
cwd,
dot: true
})
const siteConfigPath = paths && paths[0]
if (siteConfigPath) {
return path.resolve(
cwd,
siteConfigPath.replace('.vuepress/config.js', '')
)
}
return null
} | [
"async",
"function",
"inferUserDocsDirectory",
"(",
"cwd",
")",
"{",
"const",
"paths",
"=",
"await",
"globby",
"(",
"[",
"'**/.vuepress/config.js'",
",",
"'!node_modules'",
"]",
",",
"{",
"cwd",
",",
"dot",
":",
"true",
"}",
")",
"const",
"siteConfigPath",
"... | When user type `vuepress [customCommand] --help`, VuePress will try to detect where user to place docs. | [
"When",
"user",
"type",
"vuepress",
"[",
"customCommand",
"]",
"--",
"help",
"VuePress",
"will",
"try",
"to",
"detect",
"where",
"user",
"to",
"place",
"docs",
"."
] | 15784acc0cf2e87de3c147895b2c3977b0195d78 | https://github.com/vuejs/vuepress/blob/15784acc0cf2e87de3c147895b2c3977b0195d78/packages/vuepress/lib/handleUnknownCommand.js#L53-L69 | train | Infer user docs directory from site. json | [
30522,
2004,
6038,
2278,
3853,
1999,
7512,
20330,
3527,
6169,
4305,
2890,
16761,
2100,
1006,
19296,
2094,
1007,
1063,
9530,
3367,
10425,
1027,
26751,
1043,
4135,
14075,
1006,
1031,
1005,
1008,
1008,
1013,
1012,
24728,
13699,
8303,
1013,
953... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/v2/utils/serializers/output/utils/members.js | hideMembersOnlyContent | function hideMembersOnlyContent(attrs, frame) {
const membersEnabled = labs.isSet('members');
if (!membersEnabled) {
return PERMIT_CONTENT;
}
const postHasMemberTag = attrs.tags && attrs.tags.find((tag) => {
return (tag.name === MEMBER_TAG);
});
const requestFromMember = frame.original.context.member;
if (!postHasMemberTag) {
return PERMIT_CONTENT;
}
if (!requestFromMember) {
return BLOCK_CONTENT;
}
const memberHasPlan = !!(frame.original.context.member.plans || []).length;
if (!membersService.api.isPaymentConfigured()) {
return PERMIT_CONTENT;
}
if (memberHasPlan) {
return PERMIT_CONTENT;
}
return BLOCK_CONTENT;
} | javascript | function hideMembersOnlyContent(attrs, frame) {
const membersEnabled = labs.isSet('members');
if (!membersEnabled) {
return PERMIT_CONTENT;
}
const postHasMemberTag = attrs.tags && attrs.tags.find((tag) => {
return (tag.name === MEMBER_TAG);
});
const requestFromMember = frame.original.context.member;
if (!postHasMemberTag) {
return PERMIT_CONTENT;
}
if (!requestFromMember) {
return BLOCK_CONTENT;
}
const memberHasPlan = !!(frame.original.context.member.plans || []).length;
if (!membersService.api.isPaymentConfigured()) {
return PERMIT_CONTENT;
}
if (memberHasPlan) {
return PERMIT_CONTENT;
}
return BLOCK_CONTENT;
} | [
"function",
"hideMembersOnlyContent",
"(",
"attrs",
",",
"frame",
")",
"{",
"const",
"membersEnabled",
"=",
"labs",
".",
"isSet",
"(",
"'members'",
")",
";",
"if",
"(",
"!",
"membersEnabled",
")",
"{",
"return",
"PERMIT_CONTENT",
";",
"}",
"const",
"postHasM... | Checks if request should hide memnbers only content | [
"Checks",
"if",
"request",
"should",
"hide",
"memnbers",
"only",
"content"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v2/utils/serializers/output/utils/members.js#L8-L33 | train | hide members only content | [
30522,
3853,
5342,
4168,
21784,
3385,
2135,
8663,
6528,
2102,
1006,
2012,
16344,
2015,
1010,
4853,
1007,
1063,
9530,
3367,
2372,
8189,
23242,
1027,
13625,
1012,
26354,
3388,
1006,
1005,
2372,
1005,
1007,
1025,
2065,
1006,
999,
2372,
8189,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(contentEditable) {
contentEditable.className = (contentEditable.className && contentEditable.className != '') ? contentEditable.className + " wysihtml5-sandbox" : "wysihtml5-sandbox";
this._loadElement(contentEditable, true);
return contentEditable;
} | javascript | function(contentEditable) {
contentEditable.className = (contentEditable.className && contentEditable.className != '') ? contentEditable.className + " wysihtml5-sandbox" : "wysihtml5-sandbox";
this._loadElement(contentEditable, true);
return contentEditable;
} | [
"function",
"(",
"contentEditable",
")",
"{",
"contentEditable",
".",
"className",
"=",
"(",
"contentEditable",
".",
"className",
"&&",
"contentEditable",
".",
"className",
"!=",
"''",
")",
"?",
"contentEditable",
".",
"className",
"+",
"\" wysihtml5-sandbox\"",
"... | initiates an allready existent contenteditable | [
"initiates",
"an",
"allready",
"existent",
"contenteditable"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L7111-L7115 | train | Creates a new element with the sandbox class | [
30522,
3853,
1006,
4180,
2098,
6590,
3468,
1007,
1063,
4180,
2098,
6590,
3468,
1012,
2465,
18442,
1027,
1006,
4180,
2098,
6590,
3468,
1012,
2465,
18442,
1004,
1004,
4180,
2098,
6590,
3468,
1012,
2465,
18442,
999,
1027,
1005,
1005,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
badges/shields | lib/logos.js | decodeDataUrlFromQueryParam | function decodeDataUrlFromQueryParam(value) {
if (typeof value !== 'string') {
return undefined
}
const maybeDataUrl = prependPrefix(value, 'data:')
.replace(/ /g, '+')
.replace(/\s/g, '')
return isDataUrl(maybeDataUrl) ? maybeDataUrl : undefined
} | javascript | function decodeDataUrlFromQueryParam(value) {
if (typeof value !== 'string') {
return undefined
}
const maybeDataUrl = prependPrefix(value, 'data:')
.replace(/ /g, '+')
.replace(/\s/g, '')
return isDataUrl(maybeDataUrl) ? maybeDataUrl : undefined
} | [
"function",
"decodeDataUrlFromQueryParam",
"(",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!==",
"'string'",
")",
"{",
"return",
"undefined",
"}",
"const",
"maybeDataUrl",
"=",
"prependPrefix",
"(",
"value",
",",
"'data:'",
")",
".",
"replace",
"(",
"... | +'s are replaced with spaces when used in query params, this returns them to +'s, then removes remaining whitespace. https://github.com/badges/shields/pull/1546 | [
"+",
"s",
"are",
"replaced",
"with",
"spaces",
"when",
"used",
"in",
"query",
"params",
"this",
"returns",
"them",
"to",
"+",
"s",
"then",
"removes",
"remaining",
"whitespace",
".",
"https",
":",
"//",
"github",
".",
"com",
"/",
"badges",
"/",
"shields",... | 283601423f3d1a19aae83bf62032d40683948636 | https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/lib/logos.js#L40-L48 | train | Decode data url from query string | [
30522,
3853,
21933,
5732,
6790,
3126,
10270,
21716,
4226,
2854,
28689,
2213,
1006,
3643,
1007,
1063,
2065,
1006,
2828,
11253,
3643,
999,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
2709,
6151,
28344,
1065,
9530,
3367,
2672,
2850,
2696,
3126,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | getPath | function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
} | javascript | function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
} | [
"function",
"getPath",
"(",
"oBindingOrContext",
")",
"{",
"return",
"oBindingOrContext",
"instanceof",
"Context",
"?",
"oBindingOrContext",
".",
"getPath",
"(",
")",
":",
"oBindingOrContext",
".",
"getModel",
"(",
")",
".",
"resolve",
"(",
"oBindingOrContext",
".... | Returns the resolved path for the given single binding or model context.
@param {sap.ui.model.Binding|sap.ui.model.Context} oBindingOrContext
single binding or model context
@returns {string}
the resolved path | [
"Returns",
"the",
"resolved",
"path",
"for",
"the",
"given",
"single",
"binding",
"or",
"model",
"context",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L123-L128 | train | Returns the path of the given binding or context. | [
30522,
3853,
2131,
15069,
1006,
27885,
22254,
2075,
2953,
8663,
18209,
1007,
1063,
2709,
27885,
22254,
2075,
2953,
8663,
18209,
6013,
11253,
6123,
1029,
27885,
22254,
2075,
2953,
8663,
18209,
1012,
2131,
15069,
1006,
1007,
1024,
27885,
22254,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/chart/heatmap/HeatmapLayer.js | function () {
var brushCanvas = this._brushCanvas || (this._brushCanvas = zrUtil.createCanvas());
// set brush size
var r = this.pointSize + this.blurSize;
var d = r * 2;
brushCanvas.width = d;
brushCanvas.height = d;
var ctx = brushCanvas.getContext('2d');
ctx.clearRect(0, 0, d, d);
// in order to render shadow without the distinct circle,
// draw the distinct circle in an invisible place,
// and use shadowOffset to draw shadow in the center of the canvas
ctx.shadowOffsetX = d;
ctx.shadowBlur = this.blurSize;
// draw the shadow in black, and use alpha and shadow blur to generate
// color in color map
ctx.shadowColor = '#000';
// draw circle in the left to the canvas
ctx.beginPath();
ctx.arc(-r, r, this.pointSize, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fill();
return brushCanvas;
} | javascript | function () {
var brushCanvas = this._brushCanvas || (this._brushCanvas = zrUtil.createCanvas());
// set brush size
var r = this.pointSize + this.blurSize;
var d = r * 2;
brushCanvas.width = d;
brushCanvas.height = d;
var ctx = brushCanvas.getContext('2d');
ctx.clearRect(0, 0, d, d);
// in order to render shadow without the distinct circle,
// draw the distinct circle in an invisible place,
// and use shadowOffset to draw shadow in the center of the canvas
ctx.shadowOffsetX = d;
ctx.shadowBlur = this.blurSize;
// draw the shadow in black, and use alpha and shadow blur to generate
// color in color map
ctx.shadowColor = '#000';
// draw circle in the left to the canvas
ctx.beginPath();
ctx.arc(-r, r, this.pointSize, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fill();
return brushCanvas;
} | [
"function",
"(",
")",
"{",
"var",
"brushCanvas",
"=",
"this",
".",
"_brushCanvas",
"||",
"(",
"this",
".",
"_brushCanvas",
"=",
"zrUtil",
".",
"createCanvas",
"(",
")",
")",
";",
"// set brush size",
"var",
"r",
"=",
"this",
".",
"pointSize",
"+",
"this"... | get canvas of a black circle brush used for canvas to draw later
@private
@returns {Object} circle brush canvas | [
"get",
"canvas",
"of",
"a",
"black",
"circle",
"brush",
"used",
"for",
"canvas",
"to",
"draw",
"later"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/heatmap/HeatmapLayer.js#L127-L153 | train | Creates a canvas that can be used to draw the image | [
30522,
3853,
1006,
1007,
1063,
13075,
8248,
9336,
12044,
1027,
2023,
1012,
1035,
8248,
9336,
12044,
1064,
1064,
1006,
2023,
1012,
1035,
8248,
9336,
12044,
1027,
1062,
22134,
4014,
1012,
3443,
9336,
12044,
1006,
1007,
1007,
1025,
1013,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/util/traverser.js | getVisitorKeys | function getVisitorKeys(visitorKeys, node) {
let keys = visitorKeys[node.type];
if (!keys) {
keys = vk.getKeys(node);
debug("Unknown node type \"%s\": Estimated visitor keys %j", node.type, keys);
}
return keys;
} | javascript | function getVisitorKeys(visitorKeys, node) {
let keys = visitorKeys[node.type];
if (!keys) {
keys = vk.getKeys(node);
debug("Unknown node type \"%s\": Estimated visitor keys %j", node.type, keys);
}
return keys;
} | [
"function",
"getVisitorKeys",
"(",
"visitorKeys",
",",
"node",
")",
"{",
"let",
"keys",
"=",
"visitorKeys",
"[",
"node",
".",
"type",
"]",
";",
"if",
"(",
"!",
"keys",
")",
"{",
"keys",
"=",
"vk",
".",
"getKeys",
"(",
"node",
")",
";",
"debug",
"("... | Get the visitor keys of a given node.
@param {Object} visitorKeys The map of visitor keys.
@param {ASTNode} node The node to get their visitor keys.
@returns {string[]} The visitor keys of the node. | [
"Get",
"the",
"visitor",
"keys",
"of",
"a",
"given",
"node",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/traverser.js#L43-L52 | train | Get the visitor keys for a node | [
30522,
3853,
2131,
11365,
15660,
14839,
2015,
1006,
10367,
14839,
2015,
1010,
13045,
1007,
1063,
2292,
6309,
1027,
10367,
14839,
2015,
1031,
13045,
1012,
2828,
1033,
1025,
2065,
1006,
999,
6309,
1007,
1063,
6309,
1027,
1058,
2243,
1012,
213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(e, normalizeSpaces) {
normalizeSpaces = (typeof normalizeSpaces === 'undefined') ? true : normalizeSpaces;
var textContent = e.textContent.trim();
if (normalizeSpaces) {
return textContent.replace(this.REGEXPS.normalize, " ");
}
return textContent;
} | javascript | function(e, normalizeSpaces) {
normalizeSpaces = (typeof normalizeSpaces === 'undefined') ? true : normalizeSpaces;
var textContent = e.textContent.trim();
if (normalizeSpaces) {
return textContent.replace(this.REGEXPS.normalize, " ");
}
return textContent;
} | [
"function",
"(",
"e",
",",
"normalizeSpaces",
")",
"{",
"normalizeSpaces",
"=",
"(",
"typeof",
"normalizeSpaces",
"===",
"'undefined'",
")",
"?",
"true",
":",
"normalizeSpaces",
";",
"var",
"textContent",
"=",
"e",
".",
"textContent",
".",
"trim",
"(",
")",
... | Get the inner text of a node - cross browser compatibly.
This also strips out any excess whitespace to be found.
@param Element
@param Boolean normalizeSpaces (default: true)
@return string | [
"Get",
"the",
"inner",
"text",
"of",
"a",
"node",
"-",
"cross",
"browser",
"compatibly",
".",
"This",
"also",
"strips",
"out",
"any",
"excess",
"whitespace",
"to",
"be",
"found",
"."
] | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L1339-L1347 | train | Returns the text content of an element | [
30522,
3853,
1006,
1041,
1010,
3671,
10057,
15327,
2015,
1007,
1063,
3671,
10057,
15327,
2015,
1027,
1006,
2828,
11253,
3671,
10057,
15327,
2015,
1027,
1027,
1027,
1005,
6151,
28344,
1005,
1007,
1029,
2995,
1024,
3671,
10057,
15327,
2015,
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... | |
openlayers/openlayers | src/ol/format/TopoJSON.js | readFeaturesFromGeometryCollection | function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, property, name, opt_options) {
const geometries = collection['geometries'];
const features = [];
for (let i = 0, ii = geometries.length; i < ii; ++i) {
features[i] = readFeatureFromGeometry(
geometries[i], arcs, scale, translate, property, name, opt_options);
}
return features;
} | javascript | function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, property, name, opt_options) {
const geometries = collection['geometries'];
const features = [];
for (let i = 0, ii = geometries.length; i < ii; ++i) {
features[i] = readFeatureFromGeometry(
geometries[i], arcs, scale, translate, property, name, opt_options);
}
return features;
} | [
"function",
"readFeaturesFromGeometryCollection",
"(",
"collection",
",",
"arcs",
",",
"scale",
",",
"translate",
",",
"property",
",",
"name",
",",
"opt_options",
")",
"{",
"const",
"geometries",
"=",
"collection",
"[",
"'geometries'",
"]",
";",
"const",
"featu... | Create features from a TopoJSON GeometryCollection object.
@param {TopoJSONGeometryCollection} collection TopoJSON Geometry
object.
@param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
@param {Array<number>} scale Scale for each dimension.
@param {Array<number>} translate Translation for each dimension.
@param {string|undefined} property Property to set the `GeometryCollection`'s parent
object to.
@param {string} name Name of the `Topology`'s child object.
@param {import("./Feature.js").ReadOptions=} opt_options Read options.
@return {Array<Feature>} Array of features. | [
"Create",
"features",
"from",
"a",
"TopoJSON",
"GeometryCollection",
"object",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/TopoJSON.js#L307-L315 | train | Reads features from a geometry collection | [
30522,
3853,
3191,
7959,
4017,
14900,
19699,
5358,
3351,
8462,
11129,
26895,
18491,
1006,
3074,
1010,
29137,
1010,
4094,
30524,
20248,
11368,
5134,
1027,
3074,
1031,
1005,
20248,
11368,
5134,
1005,
1033,
1025,
9530,
3367,
2838,
1027,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/type/Double.js | getFormatter | function getFormatter(oType) {
var oFormatOptions;
if (!oType.oFormat) {
oFormatOptions = jQuery.extend({groupingEnabled : true}, oType.oFormatOptions);
oType.oFormat = NumberFormat.getFloatInstance(oFormatOptions);
}
return oType.oFormat;
} | javascript | function getFormatter(oType) {
var oFormatOptions;
if (!oType.oFormat) {
oFormatOptions = jQuery.extend({groupingEnabled : true}, oType.oFormatOptions);
oType.oFormat = NumberFormat.getFloatInstance(oFormatOptions);
}
return oType.oFormat;
} | [
"function",
"getFormatter",
"(",
"oType",
")",
"{",
"var",
"oFormatOptions",
";",
"if",
"(",
"!",
"oType",
".",
"oFormat",
")",
"{",
"oFormatOptions",
"=",
"jQuery",
".",
"extend",
"(",
"{",
"groupingEnabled",
":",
"true",
"}",
",",
"oType",
".",
"oForma... | Returns the formatter. Creates it lazily.
@param {sap.ui.model.odata.type.Double} oType
the type instance
@returns {sap.ui.core.format.NumberFormat}
the formatter | [
"Returns",
"the",
"formatter",
".",
"Creates",
"it",
"lazily",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/Double.js#L34-L42 | train | Returns the formatter for the given type. | [
30522,
3853,
2131,
14192,
20097,
1006,
27178,
18863,
1007,
1063,
13075,
1997,
2953,
18900,
7361,
9285,
1025,
2065,
1006,
999,
27178,
18863,
1012,
1997,
2953,
18900,
1007,
1063,
1997,
2953,
18900,
7361,
9285,
1027,
1046,
4226,
2854,
1012,
79... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js | step | function step(sSegment, i, aSegments) {
var bContinue, iIndexOfAt, bSplitSegment;
if (sSegment === "$Annotations") {
return log(WARNING, "Invalid segment: $Annotations");
}
if (vResult !== mScope && typeof vResult === "object" && sSegment in vResult) {
// fast path for pure "JSON" drill-down, but this cannot replace scopeLookup()!
if (sSegment[0] === "$" || rNumber.test(sSegment)) {
bODataMode = false; // technical property, switch to pure "JSON" drill-down
}
} else {
// split trailing computed annotation, @sapui.name, or annotation
iIndexOfAt = sSegment.indexOf("@@");
if (iIndexOfAt < 0) {
if (sSegment.length > 11 && sSegment.slice(-11) === "@sapui.name") {
iIndexOfAt = sSegment.length - 11;
} else {
iIndexOfAt = sSegment.indexOf("@");
}
}
if (iIndexOfAt > 0) {
// <17.2 SimpleIdentifier|17.3 QualifiedName>@<annotation[@annotation]>
// Note: only the 1st annotation may use external targeting, the rest is
// pure "JSON" drill-down (except for computed annotations/"@sapui.name")!
if (!step(sSegment.slice(0, iIndexOfAt), i, aSegments)) {
return false;
}
sSegment = sSegment.slice(iIndexOfAt);
bSplitSegment = true;
}
if (typeof vResult === "string"
&& !(bSplitSegment && (sSegment === "@sapui.name" || sSegment[1] === "@"))
// indirection: treat string content as a meta model path unless followed by
// a computed annotation
&& !steps(vResult, aSegments.slice(0, i))) {
return false;
}
if (bODataMode) {
if (sSegment[0] === "$" || rNumber.test(sSegment)) {
// technical property, switch to pure "JSON" drill-down
bODataMode = false;
} else if (!bSplitSegment) {
if (sSegment[0] !== "@" && sSegment.indexOf(".") > 0) {
// "17.3 QualifiedName": scope lookup
return scopeLookup(sSegment);
} else if (vResult && "$Type" in vResult) {
// implicit $Type insertion, e.g. at (navigation) property
if (!scopeLookup(vResult.$Type, "$Type")) {
return false;
}
} else if (vResult && "$Action" in vResult) {
// implicit $Action insertion at action import
if (!scopeLookup(vResult.$Action, "$Action")) {
return false;
}
vBindingParameterType = UNBOUND;
} else if (vResult && "$Function" in vResult) {
// implicit $Function insertion at function import
if (!scopeLookup(vResult.$Function, "$Function")) {
return false;
}
} else if (i === 0) {
// "17.2 SimpleIdentifier" (or placeholder):
// lookup inside schema child (which is determined lazily)
sTarget = sName = sSchemaChildName
= sSchemaChildName || mScope.$EntityContainer;
vResult = oSchemaChild = oSchemaChild || mScope[sSchemaChildName];
if (sSegment && sSegment[0] !== "@"
&& !(sSegment in oSchemaChild)) {
return log(WARNING, "Unknown child ", sSegment, " of ",
sSchemaChildName);
}
}
if (Array.isArray(vResult)) { // overloads of Action or Function
bContinue = annotationAtParameter(sSegment, aSegments[i]);
if (bContinue !== undefined) {
return bContinue;
}
if (vBindingParameterType) {
vResult = vResult.filter(isRightOverload);
}
if (sSegment === "@$ui5.overload") {
return true;
}
if (vResult.length !== 1) {
return log(WARNING, "Expected a single overload, but found "
+ vResult.length);
}
if (isParameter(sSegment, vResult[0])) {
return true;
}
vResult = vResult[0].$ReturnType;
sTarget = sTarget + "/0/$ReturnType"; // for logWithLocation() only
if (vResult) {
if (sSegment === "value"
&& !(mScope[vResult.$Type]
&& mScope[vResult.$Type].value)) {
// symbolic name "value" points to primitive return type
sName = undefined; // block "@sapui.name"
return true;
}
if (!scopeLookup(vResult.$Type, "$Type")) {
return false;
}
}
if (!sSegment) { // empty segment forces $ReturnType insertion
return true;
}
}
}
}
// Note: trailing slash is useful to force implicit lookup or $Type insertion
if (!sSegment) { // empty segment is at end or else...
return i + 1 >= aSegments.length || log(WARNING, "Invalid empty segment");
}
if (sSegment[0] === "@") {
if (sSegment === "@sapui.name") {
vResult = sName;
if (vResult === undefined) {
log(WARNING, "Unsupported path before @sapui.name");
} else if (i + 1 < aSegments.length) {
log(WARNING, "Unsupported path after @sapui.name");
}
return false;
}
if (sSegment[1] === "@") {
// computed annotation
if (i + 1 < aSegments.length) {
return log(WARNING, "Unsupported path after ", sSegment);
}
return computedAnnotation(sSegment, [""].concat(aSegments.slice(0, i),
aSegments[i].slice(0, iIndexOfAt)).join("/"));
}
}
if (!vResult || typeof vResult !== "object") {
// Note: even an OData path cannot continue here (e.g. by type cast)
vResult = undefined;
return !bInsideAnnotation && log(DEBUG, "Invalid segment: ", sSegment);
}
if (bODataMode && sSegment[0] === "@") {
// annotation(s) via external targeting
// Note: inline annotations can only be reached via pure "JSON" drill-down,
// e.g. ".../$ReturnType/@..."
vResult = mScope.$Annotations[sTarget] || {};
bInsideAnnotation = true;
bODataMode = false; // switch to pure "JSON" drill-down
} else if (sSegment === "$" && i + 1 < aSegments.length) {
return log(WARNING, "Unsupported path after $");
}
}
if (sSegment !== "@" && sSegment !== "$") {
if (sSegment[0] === "@") {
bInsideAnnotation = true;
}
sName = bODataMode || sSegment[0] === "@" ? sSegment : undefined;
sTarget = bODataMode ? sTarget + "/" + sSegment : undefined;
vResult = vResult[sSegment];
}
return true;
} | javascript | function step(sSegment, i, aSegments) {
var bContinue, iIndexOfAt, bSplitSegment;
if (sSegment === "$Annotations") {
return log(WARNING, "Invalid segment: $Annotations");
}
if (vResult !== mScope && typeof vResult === "object" && sSegment in vResult) {
// fast path for pure "JSON" drill-down, but this cannot replace scopeLookup()!
if (sSegment[0] === "$" || rNumber.test(sSegment)) {
bODataMode = false; // technical property, switch to pure "JSON" drill-down
}
} else {
// split trailing computed annotation, @sapui.name, or annotation
iIndexOfAt = sSegment.indexOf("@@");
if (iIndexOfAt < 0) {
if (sSegment.length > 11 && sSegment.slice(-11) === "@sapui.name") {
iIndexOfAt = sSegment.length - 11;
} else {
iIndexOfAt = sSegment.indexOf("@");
}
}
if (iIndexOfAt > 0) {
// <17.2 SimpleIdentifier|17.3 QualifiedName>@<annotation[@annotation]>
// Note: only the 1st annotation may use external targeting, the rest is
// pure "JSON" drill-down (except for computed annotations/"@sapui.name")!
if (!step(sSegment.slice(0, iIndexOfAt), i, aSegments)) {
return false;
}
sSegment = sSegment.slice(iIndexOfAt);
bSplitSegment = true;
}
if (typeof vResult === "string"
&& !(bSplitSegment && (sSegment === "@sapui.name" || sSegment[1] === "@"))
// indirection: treat string content as a meta model path unless followed by
// a computed annotation
&& !steps(vResult, aSegments.slice(0, i))) {
return false;
}
if (bODataMode) {
if (sSegment[0] === "$" || rNumber.test(sSegment)) {
// technical property, switch to pure "JSON" drill-down
bODataMode = false;
} else if (!bSplitSegment) {
if (sSegment[0] !== "@" && sSegment.indexOf(".") > 0) {
// "17.3 QualifiedName": scope lookup
return scopeLookup(sSegment);
} else if (vResult && "$Type" in vResult) {
// implicit $Type insertion, e.g. at (navigation) property
if (!scopeLookup(vResult.$Type, "$Type")) {
return false;
}
} else if (vResult && "$Action" in vResult) {
// implicit $Action insertion at action import
if (!scopeLookup(vResult.$Action, "$Action")) {
return false;
}
vBindingParameterType = UNBOUND;
} else if (vResult && "$Function" in vResult) {
// implicit $Function insertion at function import
if (!scopeLookup(vResult.$Function, "$Function")) {
return false;
}
} else if (i === 0) {
// "17.2 SimpleIdentifier" (or placeholder):
// lookup inside schema child (which is determined lazily)
sTarget = sName = sSchemaChildName
= sSchemaChildName || mScope.$EntityContainer;
vResult = oSchemaChild = oSchemaChild || mScope[sSchemaChildName];
if (sSegment && sSegment[0] !== "@"
&& !(sSegment in oSchemaChild)) {
return log(WARNING, "Unknown child ", sSegment, " of ",
sSchemaChildName);
}
}
if (Array.isArray(vResult)) { // overloads of Action or Function
bContinue = annotationAtParameter(sSegment, aSegments[i]);
if (bContinue !== undefined) {
return bContinue;
}
if (vBindingParameterType) {
vResult = vResult.filter(isRightOverload);
}
if (sSegment === "@$ui5.overload") {
return true;
}
if (vResult.length !== 1) {
return log(WARNING, "Expected a single overload, but found "
+ vResult.length);
}
if (isParameter(sSegment, vResult[0])) {
return true;
}
vResult = vResult[0].$ReturnType;
sTarget = sTarget + "/0/$ReturnType"; // for logWithLocation() only
if (vResult) {
if (sSegment === "value"
&& !(mScope[vResult.$Type]
&& mScope[vResult.$Type].value)) {
// symbolic name "value" points to primitive return type
sName = undefined; // block "@sapui.name"
return true;
}
if (!scopeLookup(vResult.$Type, "$Type")) {
return false;
}
}
if (!sSegment) { // empty segment forces $ReturnType insertion
return true;
}
}
}
}
// Note: trailing slash is useful to force implicit lookup or $Type insertion
if (!sSegment) { // empty segment is at end or else...
return i + 1 >= aSegments.length || log(WARNING, "Invalid empty segment");
}
if (sSegment[0] === "@") {
if (sSegment === "@sapui.name") {
vResult = sName;
if (vResult === undefined) {
log(WARNING, "Unsupported path before @sapui.name");
} else if (i + 1 < aSegments.length) {
log(WARNING, "Unsupported path after @sapui.name");
}
return false;
}
if (sSegment[1] === "@") {
// computed annotation
if (i + 1 < aSegments.length) {
return log(WARNING, "Unsupported path after ", sSegment);
}
return computedAnnotation(sSegment, [""].concat(aSegments.slice(0, i),
aSegments[i].slice(0, iIndexOfAt)).join("/"));
}
}
if (!vResult || typeof vResult !== "object") {
// Note: even an OData path cannot continue here (e.g. by type cast)
vResult = undefined;
return !bInsideAnnotation && log(DEBUG, "Invalid segment: ", sSegment);
}
if (bODataMode && sSegment[0] === "@") {
// annotation(s) via external targeting
// Note: inline annotations can only be reached via pure "JSON" drill-down,
// e.g. ".../$ReturnType/@..."
vResult = mScope.$Annotations[sTarget] || {};
bInsideAnnotation = true;
bODataMode = false; // switch to pure "JSON" drill-down
} else if (sSegment === "$" && i + 1 < aSegments.length) {
return log(WARNING, "Unsupported path after $");
}
}
if (sSegment !== "@" && sSegment !== "$") {
if (sSegment[0] === "@") {
bInsideAnnotation = true;
}
sName = bODataMode || sSegment[0] === "@" ? sSegment : undefined;
sTarget = bODataMode ? sTarget + "/" + sSegment : undefined;
vResult = vResult[sSegment];
}
return true;
} | [
"function",
"step",
"(",
"sSegment",
",",
"i",
",",
"aSegments",
")",
"{",
"var",
"bContinue",
",",
"iIndexOfAt",
",",
"bSplitSegment",
";",
"if",
"(",
"sSegment",
"===",
"\"$Annotations\"",
")",
"{",
"return",
"log",
"(",
"WARNING",
",",
"\"Invalid segment:... | /*
Takes one step according to the given segment, starting at the current
<code>vResult</code> and changing that.
@param {string} sSegment
Current segment
@param {number} i
Current segment's index
@param {string[]} aSegments
All segments
@returns {boolean}
Whether to continue after this step | [
"/",
"*",
"Takes",
"one",
"step",
"according",
"to",
"the",
"given",
"segment",
"starting",
"at",
"the",
"current",
"<code",
">",
"vResult<",
"/",
"code",
">",
"and",
"changing",
"that",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1216-L1381 | train | This function is called by the controller to determine if the given segment is a valid segment. | [
30522,
3853,
3357,
1006,
7020,
13910,
3672,
1010,
1045,
1010,
2004,
13910,
8163,
1007,
1063,
13075,
4647,
12162,
2378,
5657,
1010,
2462,
13629,
2595,
11253,
4017,
1010,
18667,
24759,
12762,
13910,
3672,
1025,
2065,
1006,
7020,
13910,
3672,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getinsomnia/insomnia | packages/insomnia-app/app/sync-legacy/index.js | _handleChangeAndPush | async function _handleChangeAndPush(event, doc, timestamp) {
// Update the resource content and set dirty
// TODO: Remove one of these steps since it does encryption twice
// in the case where the resource does not exist yet
const resource = await getOrCreateResourceForDoc(doc);
const updatedResource = await store.updateResource(resource, {
name: doc.name || 'n/a',
lastEdited: timestamp,
lastEditedBy: session.getAccountId(),
encContent: await encryptDoc(resource.resourceGroupId, doc),
removed: event === db.CHANGE_REMOVE,
dirty: true,
});
// Debounce pushing of dirty resources
logger.debug(`Queue ${event} ${updatedResource.id}`);
} | javascript | async function _handleChangeAndPush(event, doc, timestamp) {
// Update the resource content and set dirty
// TODO: Remove one of these steps since it does encryption twice
// in the case where the resource does not exist yet
const resource = await getOrCreateResourceForDoc(doc);
const updatedResource = await store.updateResource(resource, {
name: doc.name || 'n/a',
lastEdited: timestamp,
lastEditedBy: session.getAccountId(),
encContent: await encryptDoc(resource.resourceGroupId, doc),
removed: event === db.CHANGE_REMOVE,
dirty: true,
});
// Debounce pushing of dirty resources
logger.debug(`Queue ${event} ${updatedResource.id}`);
} | [
"async",
"function",
"_handleChangeAndPush",
"(",
"event",
",",
"doc",
",",
"timestamp",
")",
"{",
"// Update the resource content and set dirty",
"// TODO: Remove one of these steps since it does encryption twice",
"// in the case where the resource does not exist yet",
"const",
"reso... | ~~~~~~~ // HELPERS // ~~~~~~~ // | [
"~~~~~~~",
"//",
"HELPERS",
"//",
"~~~~~~~",
"//"
] | e24ce7f7b41246e700c4b9bdb6b34b6652ad589b | https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-app/app/sync-legacy/index.js#L577-L594 | train | Handle a change event and push the resource to the store | [
30522,
2004,
6038,
2278,
3853,
1035,
5047,
22305,
11219,
18927,
20668,
1006,
2724,
1010,
9986,
1010,
2335,
15464,
2361,
1007,
1063,
1013,
1013,
30524,
1997,
2122,
4084,
2144,
2009,
2515,
21999,
3807,
1013,
1013,
1999,
1996,
2553,
2073,
1996... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Batch.js | _serializeBatchRequest | function _serializeBatchRequest(aRequests, iChangeSetIndex) {
var sBatchBoundary = (iChangeSetIndex !== undefined ? "changeset_" : "batch_")
+ jQuery.sap.uid(),
bIsChangeSet = iChangeSetIndex !== undefined,
aRequestBody = [];
if (bIsChangeSet) {
aRequestBody = aRequestBody.concat("Content-Type: multipart/mixed;boundary=",
sBatchBoundary, "\r\n\r\n");
}
aRequests.forEach(function (oRequest, iRequestIndex) {
var sContentIdHeader = "",
sUrl = oRequest.url;
if (bIsChangeSet) {
sContentIdHeader = "Content-ID:" + iRequestIndex + "." + iChangeSetIndex + "\r\n";
}
aRequestBody = aRequestBody.concat("--", sBatchBoundary, "\r\n");
if (Array.isArray(oRequest)) {
if (bIsChangeSet) {
throw new Error('Change set must not contain a nested change set.');
}
aRequestBody = aRequestBody.concat(
_serializeBatchRequest(oRequest, iRequestIndex).body);
} else {
if (bIsChangeSet && !mAllowedChangeSetMethods[oRequest.method]) {
throw new Error("Invalid HTTP request method: " + oRequest.method +
". Change set must contain only POST, PUT, PATCH or DELETE requests.");
}
// adjust URL if it contains Content-ID reference by adding the change set index
sUrl = sUrl.replace(rContentIdReference, "$&." + iChangeSetIndex);
aRequestBody = aRequestBody.concat(
"Content-Type:application/http\r\n",
"Content-Transfer-Encoding:binary\r\n",
sContentIdHeader,
"\r\n",
oRequest.method, " ", sUrl, " HTTP/1.1\r\n",
serializeHeaders(_Helper.resolveIfMatchHeader(oRequest.headers)),
"\r\n",
JSON.stringify(oRequest.body) || "", "\r\n");
}
});
aRequestBody = aRequestBody.concat("--", sBatchBoundary, "--\r\n");
return {body : aRequestBody, batchBoundary : sBatchBoundary};
} | javascript | function _serializeBatchRequest(aRequests, iChangeSetIndex) {
var sBatchBoundary = (iChangeSetIndex !== undefined ? "changeset_" : "batch_")
+ jQuery.sap.uid(),
bIsChangeSet = iChangeSetIndex !== undefined,
aRequestBody = [];
if (bIsChangeSet) {
aRequestBody = aRequestBody.concat("Content-Type: multipart/mixed;boundary=",
sBatchBoundary, "\r\n\r\n");
}
aRequests.forEach(function (oRequest, iRequestIndex) {
var sContentIdHeader = "",
sUrl = oRequest.url;
if (bIsChangeSet) {
sContentIdHeader = "Content-ID:" + iRequestIndex + "." + iChangeSetIndex + "\r\n";
}
aRequestBody = aRequestBody.concat("--", sBatchBoundary, "\r\n");
if (Array.isArray(oRequest)) {
if (bIsChangeSet) {
throw new Error('Change set must not contain a nested change set.');
}
aRequestBody = aRequestBody.concat(
_serializeBatchRequest(oRequest, iRequestIndex).body);
} else {
if (bIsChangeSet && !mAllowedChangeSetMethods[oRequest.method]) {
throw new Error("Invalid HTTP request method: " + oRequest.method +
". Change set must contain only POST, PUT, PATCH or DELETE requests.");
}
// adjust URL if it contains Content-ID reference by adding the change set index
sUrl = sUrl.replace(rContentIdReference, "$&." + iChangeSetIndex);
aRequestBody = aRequestBody.concat(
"Content-Type:application/http\r\n",
"Content-Transfer-Encoding:binary\r\n",
sContentIdHeader,
"\r\n",
oRequest.method, " ", sUrl, " HTTP/1.1\r\n",
serializeHeaders(_Helper.resolveIfMatchHeader(oRequest.headers)),
"\r\n",
JSON.stringify(oRequest.body) || "", "\r\n");
}
});
aRequestBody = aRequestBody.concat("--", sBatchBoundary, "--\r\n");
return {body : aRequestBody, batchBoundary : sBatchBoundary};
} | [
"function",
"_serializeBatchRequest",
"(",
"aRequests",
",",
"iChangeSetIndex",
")",
"{",
"var",
"sBatchBoundary",
"=",
"(",
"iChangeSetIndex",
"!==",
"undefined",
"?",
"\"changeset_\"",
":",
"\"batch_\"",
")",
"+",
"jQuery",
".",
"sap",
".",
"uid",
"(",
")",
... | Serializes the given array of request objects into $batch request body.
@param {object[]} aRequests
See parameter <code>aRequests</code> of serializeBatchRequest function
@param {number} [iChangeSetIndex]
Is only specified if the function is called to serialize change sets and
contains zero-based index of the change set within <code>aRequests</code> array.
@returns {object}
The $batch request object with the following structure
<ul>
<li><code>body</code>: {string[]} Array of strings representing batch request body
<li><code>batchBoundary</code>: {string} Batch boundary value
</ul> | [
"Serializes",
"the",
"given",
"array",
"of",
"request",
"objects",
"into",
"$batch",
"request",
"body",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Batch.js#L244-L293 | train | Serialize a batch request | [
30522,
3853,
1035,
7642,
4697,
14479,
2818,
2890,
15500,
1006,
2024,
15500,
2015,
1010,
22564,
22043,
13462,
22254,
10288,
1007,
1063,
13075,
24829,
4017,
2818,
15494,
5649,
1027,
1006,
22564,
22043,
13462,
22254,
10288,
999,
1027,
1027,
6151... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/document/DocumentCommandHandlers.js | handleFileQuit | function handleFileQuit(commandData) {
return _handleWindowGoingAway(
commandData,
function () {
brackets.app.quit();
},
function () {
// if fail, don't exit: user canceled (or asked us to save changes first, but we failed to do so)
brackets.app.abortQuit();
}
);
} | javascript | function handleFileQuit(commandData) {
return _handleWindowGoingAway(
commandData,
function () {
brackets.app.quit();
},
function () {
// if fail, don't exit: user canceled (or asked us to save changes first, but we failed to do so)
brackets.app.abortQuit();
}
);
} | [
"function",
"handleFileQuit",
"(",
"commandData",
")",
"{",
"return",
"_handleWindowGoingAway",
"(",
"commandData",
",",
"function",
"(",
")",
"{",
"brackets",
".",
"app",
".",
"quit",
"(",
")",
";",
"}",
",",
"function",
"(",
")",
"{",
"// if fail, don't ex... | Closes the window, then quits the app | [
"Closes",
"the",
"window",
"then",
"quits",
"the",
"app"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L1507-L1518 | train | handleFileQuit - quit the window | [
30522,
3853,
5047,
8873,
2571,
15549,
2102,
1006,
3094,
2850,
2696,
1007,
1063,
2709,
1035,
5047,
11101,
5004,
26966,
9497,
1006,
3094,
2850,
2696,
1010,
3853,
1006,
1007,
1063,
19719,
1012,
10439,
1012,
8046,
1006,
1007,
1025,
1065,
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... |
GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | mergeHook | function mergeHook (
parentVal,
childVal
) {
return childVal
? parentVal
? parentVal.concat(childVal)
: Array.isArray(childVal)
? childVal
: [childVal]
: parentVal
} | javascript | function mergeHook (
parentVal,
childVal
) {
return childVal
? parentVal
? parentVal.concat(childVal)
: Array.isArray(childVal)
? childVal
: [childVal]
: parentVal
} | [
"function",
"mergeHook",
"(",
"parentVal",
",",
"childVal",
")",
"{",
"return",
"childVal",
"?",
"parentVal",
"?",
"parentVal",
".",
"concat",
"(",
"childVal",
")",
":",
"Array",
".",
"isArray",
"(",
"childVal",
")",
"?",
"childVal",
":",
"[",
"childVal",
... | Hooks and props are merged as arrays. | [
"Hooks",
"and",
"props",
"are",
"merged",
"as",
"arrays",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L1251-L1262 | train | Merge the two values | [
30522,
3853,
13590,
6806,
6559,
1006,
6687,
10175,
1010,
2775,
10175,
1007,
1063,
2709,
2775,
10175,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fex-team/webuploader | dist/webuploader.withoutimage.js | function() {
var sts = [].slice.call( arguments, 0 ),
ret = [],
i = 0,
len = this._queue.length,
file;
for ( ; i < len; i++ ) {
file = this._queue[ i ];
if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) {
continue;
}
ret.push( file );
}
return ret;
} | javascript | function() {
var sts = [].slice.call( arguments, 0 ),
ret = [],
i = 0,
len = this._queue.length,
file;
for ( ; i < len; i++ ) {
file = this._queue[ i ];
if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) {
continue;
}
ret.push( file );
}
return ret;
} | [
"function",
"(",
")",
"{",
"var",
"sts",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
",",
"ret",
"=",
"[",
"]",
",",
"i",
"=",
"0",
",",
"len",
"=",
"this",
".",
"_queue",
".",
"length",
",",
"file",
";",
"for... | 获取指定类型的文件列表, 列表中每一个成员为[File](#WebUploader:File)对象。
@grammar getFiles( [status1[, status2 ...]] ) => Array
@method getFiles
@param {String} [status] [文件状态值](#WebUploader:File:File.Status) | [
"获取指定类型的文件列表",
"列表中每一个成员为",
"[",
"File",
"]",
"(",
"#WebUploader",
":",
"File",
")",
"对象。"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L2269-L2287 | train | Returns an array of all the files in the queue | [
30522,
3853,
1006,
1007,
1063,
13075,
8541,
1027,
1031,
1033,
1012,
14704,
1012,
2655,
1006,
9918,
1010,
1014,
1007,
1010,
2128,
2102,
1027,
1031,
1033,
1010,
1045,
1027,
1014,
1010,
18798,
1027,
2023,
1012,
1035,
24240,
1012,
3091,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/less.js | peek | function peek(tok) {
if (typeof(tok) === 'string') {
return input.charAt(i) === tok;
} else {
return tok.test(current);
}
} | javascript | function peek(tok) {
if (typeof(tok) === 'string') {
return input.charAt(i) === tok;
} else {
return tok.test(current);
}
} | [
"function",
"peek",
"(",
"tok",
")",
"{",
"if",
"(",
"typeof",
"(",
"tok",
")",
"===",
"'string'",
")",
"{",
"return",
"input",
".",
"charAt",
"(",
"i",
")",
"===",
"tok",
";",
"}",
"else",
"{",
"return",
"tok",
".",
"test",
"(",
"current",
")",
... | Same as $(), but don't change the state of the parser, just return the match. | [
"Same",
"as",
"$",
"()",
"but",
"don",
"t",
"change",
"the",
"state",
"of",
"the",
"parser",
"just",
"return",
"the",
"match",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L283-L289 | train | Check if the current token is a valid token | [
30522,
3853,
19043,
1006,
2000,
2243,
1007,
1063,
2065,
1006,
2828,
11253,
1006,
2000,
2243,
1007,
1027,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
2709,
7953,
1012,
25869,
4017,
1006,
1045,
1007,
1027,
1027,
1027,
2000,
2243,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/autocomplete/js/autocompleteController.js | fetchResults | function fetchResults (searchText) {
var items = $scope.$parent.$eval(itemExpr),
term = searchText.toLowerCase(),
isList = angular.isArray(items),
isPromise = !!items.then; // Every promise should contain a `then` property
if (isList) onResultsRetrieved(items);
else if (isPromise) handleAsyncResults(items);
function handleAsyncResults(items) {
if (!items) return;
items = $q.when(items);
fetchesInProgress++;
setLoading(true);
$mdUtil.nextTick(function () {
items
.then(onResultsRetrieved)
.finally(function(){
if (--fetchesInProgress === 0) {
setLoading(false);
}
});
},true, $scope);
}
function onResultsRetrieved(matches) {
cache[term] = matches;
// Just cache the results if the request is now outdated.
// The request becomes outdated, when the new searchText has changed during the result fetching.
if ((searchText || '') !== ($scope.searchText || '')) {
return;
}
handleResults(matches);
}
} | javascript | function fetchResults (searchText) {
var items = $scope.$parent.$eval(itemExpr),
term = searchText.toLowerCase(),
isList = angular.isArray(items),
isPromise = !!items.then; // Every promise should contain a `then` property
if (isList) onResultsRetrieved(items);
else if (isPromise) handleAsyncResults(items);
function handleAsyncResults(items) {
if (!items) return;
items = $q.when(items);
fetchesInProgress++;
setLoading(true);
$mdUtil.nextTick(function () {
items
.then(onResultsRetrieved)
.finally(function(){
if (--fetchesInProgress === 0) {
setLoading(false);
}
});
},true, $scope);
}
function onResultsRetrieved(matches) {
cache[term] = matches;
// Just cache the results if the request is now outdated.
// The request becomes outdated, when the new searchText has changed during the result fetching.
if ((searchText || '') !== ($scope.searchText || '')) {
return;
}
handleResults(matches);
}
} | [
"function",
"fetchResults",
"(",
"searchText",
")",
"{",
"var",
"items",
"=",
"$scope",
".",
"$parent",
".",
"$eval",
"(",
"itemExpr",
")",
",",
"term",
"=",
"searchText",
".",
"toLowerCase",
"(",
")",
",",
"isList",
"=",
"angular",
".",
"isArray",
"(",
... | Fetches the results for the provided search text.
@param searchText | [
"Fetches",
"the",
"results",
"for",
"the",
"provided",
"search",
"text",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L882-L920 | train | Fetch the results from the server | [
30522,
3853,
18584,
6072,
11314,
2015,
1006,
3945,
18209,
1007,
1063,
13075,
5167,
1027,
1002,
9531,
1012,
1002,
6687,
1012,
1002,
9345,
2140,
1006,
8875,
10288,
18098,
1007,
1010,
2744,
1027,
3945,
18209,
1012,
2000,
27663,
18992,
3366,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mui-org/material-ui | docs/src/pages/discover-more/showcase/Showcase.js | sortFactory | function sortFactory(key) {
return function sortNumeric(a, b) {
if (b[key] < a[key]) {
return -1;
}
if (b[key] > a[key]) {
return 1;
}
return 0;
};
} | javascript | function sortFactory(key) {
return function sortNumeric(a, b) {
if (b[key] < a[key]) {
return -1;
}
if (b[key] > a[key]) {
return 1;
}
return 0;
};
} | [
"function",
"sortFactory",
"(",
"key",
")",
"{",
"return",
"function",
"sortNumeric",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"b",
"[",
"key",
"]",
"<",
"a",
"[",
"key",
"]",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"b",
"[",
"key"... | Returns a function that sorts reverse numerically by value of `key` | [
"Returns",
"a",
"function",
"that",
"sorts",
"reverse",
"numerically",
"by",
"value",
"of",
"key"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/pages/discover-more/showcase/Showcase.js#L60-L70 | train | Creates a function that sorts the data by the given key. | [
30522,
3853,
4066,
21450,
1006,
3145,
1007,
1063,
2709,
3853,
4066,
19172,
22420,
1006,
1037,
1010,
1038,
1007,
1063,
2065,
1006,
1038,
1031,
3145,
1033,
1026,
1037,
1031,
3145,
1033,
1007,
1063,
2709,
1011,
1015,
1025,
1065,
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... |
SheetJS/js-xlsx | xlsx.js | parse_Hyperlink | function parse_Hyperlink(blob, length) {
var end = blob.l + length;
var sVer = blob.read_shift(4);
if(sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer);
var flags = blob.read_shift(2);
blob.l += 2;
var displayName, targetFrameName, moniker, oleMoniker, Loc="", guid, fileTime;
if(flags & 0x0010) displayName = parse_HyperlinkString(blob, end - blob.l);
if(flags & 0x0080) targetFrameName = parse_HyperlinkString(blob, end - blob.l);
if((flags & 0x0101) === 0x0101) moniker = parse_HyperlinkString(blob, end - blob.l);
if((flags & 0x0101) === 0x0001) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l);
if(flags & 0x0008) Loc = parse_HyperlinkString(blob, end - blob.l);
if(flags & 0x0020) guid = blob.read_shift(16);
if(flags & 0x0040) fileTime = parse_FILETIME(blob/*, 8*/);
blob.l = end;
var target = targetFrameName||moniker||oleMoniker||"";
if(target && Loc) target+="#"+Loc;
if(!target) target = "#" + Loc;
var out = ({Target:target});
if(guid) out.guid = guid;
if(fileTime) out.time = fileTime;
if(displayName) out.Tooltip = displayName;
return out;
} | javascript | function parse_Hyperlink(blob, length) {
var end = blob.l + length;
var sVer = blob.read_shift(4);
if(sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer);
var flags = blob.read_shift(2);
blob.l += 2;
var displayName, targetFrameName, moniker, oleMoniker, Loc="", guid, fileTime;
if(flags & 0x0010) displayName = parse_HyperlinkString(blob, end - blob.l);
if(flags & 0x0080) targetFrameName = parse_HyperlinkString(blob, end - blob.l);
if((flags & 0x0101) === 0x0101) moniker = parse_HyperlinkString(blob, end - blob.l);
if((flags & 0x0101) === 0x0001) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l);
if(flags & 0x0008) Loc = parse_HyperlinkString(blob, end - blob.l);
if(flags & 0x0020) guid = blob.read_shift(16);
if(flags & 0x0040) fileTime = parse_FILETIME(blob/*, 8*/);
blob.l = end;
var target = targetFrameName||moniker||oleMoniker||"";
if(target && Loc) target+="#"+Loc;
if(!target) target = "#" + Loc;
var out = ({Target:target});
if(guid) out.guid = guid;
if(fileTime) out.time = fileTime;
if(displayName) out.Tooltip = displayName;
return out;
} | [
"function",
"parse_Hyperlink",
"(",
"blob",
",",
"length",
")",
"{",
"var",
"end",
"=",
"blob",
".",
"l",
"+",
"length",
";",
"var",
"sVer",
"=",
"blob",
".",
"read_shift",
"(",
"4",
")",
";",
"if",
"(",
"sVer",
"!==",
"2",
")",
"throw",
"new",
"... | /* [MS-OSHARED] 2.3.7.1 Hyperlink Object | [
"/",
"*",
"[",
"MS",
"-",
"OSHARED",
"]",
"2",
".",
"3",
".",
"7",
".",
"1",
"Hyperlink",
"Object"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5506-L5529 | train | Parse Hyperlink | [
30522,
3853,
11968,
3366,
1035,
23760,
13767,
1006,
1038,
4135,
2497,
1010,
3091,
1007,
1063,
13075,
2203,
1027,
1038,
4135,
2497,
1012,
1048,
1009,
3091,
1025,
13075,
17917,
2121,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1018,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js | function (sValue) {
var oModel = this._oDialog.getModel("view"),
oRadioBtnStandart = this._getControl("standard", this._SUPPORT_ASSISTANT_POPOVER_ID),
oRadioBtnCustom = this._getControl("custom", this._SUPPORT_ASSISTANT_POPOVER_ID),
oCustom = this._getControl("customBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID),
oStandard = this._getControl("standardBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID),
bStandardLocationEnabled;
this._resetValueState(oCustom);
this._resetValueState(oStandard);
if (sValue === "standard") {
bStandardLocationEnabled = true;
oModel.setProperty("/StandardBootstrapURL", this._storage.get(this._LOCAL_STORAGE_KEYS.STANDARD_URL));
oStandard.setSelectedKey(oModel.getProperty("/StandardBootstrapURL"));
} else {
bStandardLocationEnabled = false;
}
oStandard.setEnabled(bStandardLocationEnabled);
oRadioBtnStandart.setSelected(bStandardLocationEnabled);
oCustom.setEnabled(!bStandardLocationEnabled);
oRadioBtnCustom.setSelected(!bStandardLocationEnabled);
this._storage.put(this._LOCAL_STORAGE_KEYS.LOCATION, sValue);
oModel.setProperty("/SelectedLocation", this._storage.get(this._LOCAL_STORAGE_KEYS.LOCATION));
} | javascript | function (sValue) {
var oModel = this._oDialog.getModel("view"),
oRadioBtnStandart = this._getControl("standard", this._SUPPORT_ASSISTANT_POPOVER_ID),
oRadioBtnCustom = this._getControl("custom", this._SUPPORT_ASSISTANT_POPOVER_ID),
oCustom = this._getControl("customBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID),
oStandard = this._getControl("standardBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID),
bStandardLocationEnabled;
this._resetValueState(oCustom);
this._resetValueState(oStandard);
if (sValue === "standard") {
bStandardLocationEnabled = true;
oModel.setProperty("/StandardBootstrapURL", this._storage.get(this._LOCAL_STORAGE_KEYS.STANDARD_URL));
oStandard.setSelectedKey(oModel.getProperty("/StandardBootstrapURL"));
} else {
bStandardLocationEnabled = false;
}
oStandard.setEnabled(bStandardLocationEnabled);
oRadioBtnStandart.setSelected(bStandardLocationEnabled);
oCustom.setEnabled(!bStandardLocationEnabled);
oRadioBtnCustom.setSelected(!bStandardLocationEnabled);
this._storage.put(this._LOCAL_STORAGE_KEYS.LOCATION, sValue);
oModel.setProperty("/SelectedLocation", this._storage.get(this._LOCAL_STORAGE_KEYS.LOCATION));
} | [
"function",
"(",
"sValue",
")",
"{",
"var",
"oModel",
"=",
"this",
".",
"_oDialog",
".",
"getModel",
"(",
"\"view\"",
")",
",",
"oRadioBtnStandart",
"=",
"this",
".",
"_getControl",
"(",
"\"standard\"",
",",
"this",
".",
"_SUPPORT_ASSISTANT_POPOVER_ID",
")",
... | Sets active location and toggle between "standard" and "custom" locations.
Saves last active location.
@param {string} sValue Possible values "standard" or "custom"
@private | [
"Sets",
"active",
"location",
"and",
"toggle",
"between",
"standard",
"and",
"custom",
"locations",
".",
"Saves",
"last",
"active",
"location",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L729-L755 | train | Sets the location of the specified location | [
30522,
3853,
1006,
17917,
2389,
5657,
1007,
1063,
13075,
18168,
10244,
2140,
1027,
2023,
1012,
1035,
21045,
23067,
2290,
1012,
2131,
5302,
9247,
1006,
1000,
3193,
1000,
1007,
1010,
2030,
17190,
16429,
2102,
23808,
13832,
5339,
1027,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/ui/external/ElementTree.js | _findNearestDOMParent | function _findNearestDOMParent(element, parentNodeName) {
while (element.nodeName !== parentNodeName) {
if (element.nodeName === "CONTROL-TREE") {
break;
}
element = element.parentNode;
}
return element;
} | javascript | function _findNearestDOMParent(element, parentNodeName) {
while (element.nodeName !== parentNodeName) {
if (element.nodeName === "CONTROL-TREE") {
break;
}
element = element.parentNode;
}
return element;
} | [
"function",
"_findNearestDOMParent",
"(",
"element",
",",
"parentNodeName",
")",
"{",
"while",
"(",
"element",
".",
"nodeName",
"!==",
"parentNodeName",
")",
"{",
"if",
"(",
"element",
".",
"nodeName",
"===",
"\"CONTROL-TREE\"",
")",
"{",
"break",
";",
"}",
... | Search for the nearest parent Node.
@param {element} element - HTML DOM element that will be the root of the search
@param {string} parentNodeName - The desired HTML parent element nodeName
@returns {Object} HTML DOM element
@private | [
"Search",
"for",
"the",
"nearest",
"parent",
"Node",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/external/ElementTree.js#L102-L111 | train | Find the nearest DOM parent of an element | [
30522,
3853,
1035,
2424,
22084,
28533,
9527,
19362,
4765,
1006,
5783,
1010,
6687,
3630,
4181,
14074,
1007,
1063,
2096,
1006,
5783,
1012,
13045,
18442,
999,
1027,
1027,
6687,
3630,
4181,
14074,
1007,
1063,
2065,
1006,
5783,
1012,
13045,
1844... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Manifest.js | function(bAsync) {
// find i18n property paths in the manifest if i18n texts in
// the manifest which should be processed
var aI18nProperties = [];
processObject(this._oManifest, function(oObject, sKey, vValue) {
var match = vValue.match(rManifestTemplate);
if (match) {
aI18nProperties.push({
object: oObject,
key: sKey
});
}
});
if (aI18nProperties.length > 0) {
var fnReplaceI18n = function(oResourceBundle) {
var fnReplaceI18nText = function(sMatch, sI18nKey) {
return oResourceBundle.getText(sI18nKey);
};
for (var i = 0, l = aI18nProperties.length; i < l; i++) {
var oProperty = aI18nProperties[i];
oProperty.object[oProperty.key] = oProperty.object[oProperty.key].replace(rManifestTemplate, fnReplaceI18nText);
}
};
if (bAsync) {
return this._loadI18n(bAsync).then(fnReplaceI18n);
} else {
fnReplaceI18n(this._loadI18n(bAsync));
}
} else {
return bAsync ? Promise.resolve() : undefined;
}
} | javascript | function(bAsync) {
// find i18n property paths in the manifest if i18n texts in
// the manifest which should be processed
var aI18nProperties = [];
processObject(this._oManifest, function(oObject, sKey, vValue) {
var match = vValue.match(rManifestTemplate);
if (match) {
aI18nProperties.push({
object: oObject,
key: sKey
});
}
});
if (aI18nProperties.length > 0) {
var fnReplaceI18n = function(oResourceBundle) {
var fnReplaceI18nText = function(sMatch, sI18nKey) {
return oResourceBundle.getText(sI18nKey);
};
for (var i = 0, l = aI18nProperties.length; i < l; i++) {
var oProperty = aI18nProperties[i];
oProperty.object[oProperty.key] = oProperty.object[oProperty.key].replace(rManifestTemplate, fnReplaceI18nText);
}
};
if (bAsync) {
return this._loadI18n(bAsync).then(fnReplaceI18n);
} else {
fnReplaceI18n(this._loadI18n(bAsync));
}
} else {
return bAsync ? Promise.resolve() : undefined;
}
} | [
"function",
"(",
"bAsync",
")",
"{",
"// find i18n property paths in the manifest if i18n texts in",
"// the manifest which should be processed",
"var",
"aI18nProperties",
"=",
"[",
"]",
";",
"processObject",
"(",
"this",
".",
"_oManifest",
",",
"function",
"(",
"oObject",
... | Triggers the processing of the i18n texts to replace them
with the values from "sap.app/i18n"
@param {boolean} bAsync true, if the ResourceBundle will be loaded async
@return {Promise|undefined} when using the API async it will return a Promise which resolves when the texts have been replaced | [
"Triggers",
"the",
"processing",
"of",
"the",
"i18n",
"texts",
"to",
"replace",
"them",
"with",
"the",
"values",
"from",
"sap",
".",
"app",
"/",
"i18n"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L223-L260 | train | This function will find all the i18n texts in the manifest | [
30522,
3853,
1006,
19021,
6038,
2278,
1007,
1063,
1013,
1013,
2424,
1045,
15136,
2078,
3200,
10425,
1999,
1996,
19676,
2065,
1045,
15136,
2078,
6981,
1999,
1013,
1013,
1996,
19676,
2029,
2323,
2022,
13995,
13075,
9932,
15136,
16275,
18981,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensions/default/DebugCommands/main.js | _getChildPrefs | function _getChildPrefs(prefItem) {
var finalObj = {},
keysFound = false;
if (!prefItem) {
return {};
}
function _populateKeys(allKeys) {
var prop;
if (typeof (allKeys) === "object") {
// iterate through the list.
keysFound = true;
for (prop in allKeys) {
if (allKeys.hasOwnProperty(prop)) {
finalObj[prop] = allKeys[prop];
}
}
}
}
_populateKeys(prefItem.initial);
_populateKeys(prefItem.keys);
// Last resort: Maybe plain objects, in which case
// we blindly extract all the properties.
if (!keysFound) {
_populateKeys(prefItem);
}
return finalObj;
} | javascript | function _getChildPrefs(prefItem) {
var finalObj = {},
keysFound = false;
if (!prefItem) {
return {};
}
function _populateKeys(allKeys) {
var prop;
if (typeof (allKeys) === "object") {
// iterate through the list.
keysFound = true;
for (prop in allKeys) {
if (allKeys.hasOwnProperty(prop)) {
finalObj[prop] = allKeys[prop];
}
}
}
}
_populateKeys(prefItem.initial);
_populateKeys(prefItem.keys);
// Last resort: Maybe plain objects, in which case
// we blindly extract all the properties.
if (!keysFound) {
_populateKeys(prefItem);
}
return finalObj;
} | [
"function",
"_getChildPrefs",
"(",
"prefItem",
")",
"{",
"var",
"finalObj",
"=",
"{",
"}",
",",
"keysFound",
"=",
"false",
";",
"if",
"(",
"!",
"prefItem",
")",
"{",
"return",
"{",
"}",
";",
"}",
"function",
"_populateKeys",
"(",
"allKeys",
")",
"{",
... | /*
This method tries to match between initial objects
and key objects and then aggregates objects from both
the properties. | [
"/",
"*",
"This",
"method",
"tries",
"to",
"match",
"between",
"initial",
"objects",
"and",
"key",
"objects",
"and",
"then",
"aggregates",
"objects",
"from",
"both",
"the",
"properties",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/DebugCommands/main.js#L445-L478 | train | Get the child preferences object | [
30522,
3853,
1035,
2131,
19339,
28139,
10343,
1006,
3653,
8873,
18532,
1007,
1063,
13075,
2345,
16429,
3501,
1027,
1063,
1065,
1010,
6309,
14876,
8630,
1027,
6270,
1025,
2065,
1006,
999,
3653,
8873,
18532,
1007,
1063,
2709,
1063,
1065,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.