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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
angular/protractor | website/docgen/processors/add-links.js | function(str, doc) {
var oldStr = null;
while (str != oldStr) {
oldStr = str;
var matches = /{\s*@link[plain]*\s+([^]+?)\s*}/.exec(str);
if (matches) {
var str = str.replace(
new RegExp('{\\s*@link[plain]*\\s+' +
matches[1].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '\\s*}'),
toMarkdownLinkFormat(matches[1], doc,
matches[0].indexOf('linkplain') == -1)
);
}
}
return str;
} | javascript | function(str, doc) {
var oldStr = null;
while (str != oldStr) {
oldStr = str;
var matches = /{\s*@link[plain]*\s+([^]+?)\s*}/.exec(str);
if (matches) {
var str = str.replace(
new RegExp('{\\s*@link[plain]*\\s+' +
matches[1].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '\\s*}'),
toMarkdownLinkFormat(matches[1], doc,
matches[0].indexOf('linkplain') == -1)
);
}
}
return str;
} | [
"function",
"(",
"str",
",",
"doc",
")",
"{",
"var",
"oldStr",
"=",
"null",
";",
"while",
"(",
"str",
"!=",
"oldStr",
")",
"{",
"oldStr",
"=",
"str",
";",
"var",
"matches",
"=",
"/",
"{\\s*@link[plain]*\\s+([^]+?)\\s*}",
"/",
".",
"exec",
"(",
"str",
... | Add links to @link annotations. For example: `{@link foo.bar}` will be
transformed into `[foo.bar](foo.bar)` and `{@link foo.bar FooBar Link}` will
be transfirned into `[FooBar Link](foo.bar)`
@param {string} str The string with the annotations.
@param {!Object} doc Current document.
@return {string} A link in markdown format. | [
"Add",
"links",
"to"
] | 4f74a4ec753c97adfe955fe468a39286a0a55837 | https://github.com/angular/protractor/blob/4f74a4ec753c97adfe955fe468a39286a0a55837/website/docgen/processors/add-links.js#L46-L61 | train | Convert a Markdown string to Markdown Link format | [
30522,
3853,
1006,
2358,
2099,
1010,
9986,
1007,
1063,
13075,
19457,
16344,
1027,
19701,
1025,
2096,
1006,
2358,
2099,
999,
1027,
19457,
16344,
1007,
1063,
19457,
16344,
1027,
2358,
2099,
1025,
13075,
3503,
1027,
1013,
1063,
1032,
1055,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/LocaleData.js | function(aScales, sStyle) {
if (sStyle === undefined) {
sStyle = "wide";
}
assert(sStyle === "wide" || sStyle === "short" || sStyle === "narrow", "sStyle is only allowed to be set with 'wide', 'short' or 'narrow'");
var aPatterns = [],
aPluralCategories = this.getPluralCategories(),
oScale,
oTimeEntry,
iValue,
iSign;
if (!aScales) {
aScales = ["year", "month", "week", "day", "hour", "minute", "second"];
}
aScales.forEach(function(sScale) {
oScale = this._get("dateFields", sScale + "-" + sStyle);
for (var sEntry in oScale) {
if (sEntry.indexOf("relative-type-") === 0) {
iValue = parseInt(sEntry.substr(14));
aPatterns.push({
scale: sScale,
value: iValue,
pattern: oScale[sEntry]
});
} else if (sEntry.indexOf("relativeTime-type-") == 0) {
oTimeEntry = oScale[sEntry];
iSign = sEntry.substr(18) === "past" ? -1 : 1;
aPluralCategories.forEach(function(sKey) { // eslint-disable-line no-loop-func
aPatterns.push({
scale: sScale,
sign: iSign,
pattern: oTimeEntry["relativeTimePattern-count-" + sKey]
});
});
}
}
}.bind(this));
return aPatterns;
} | javascript | function(aScales, sStyle) {
if (sStyle === undefined) {
sStyle = "wide";
}
assert(sStyle === "wide" || sStyle === "short" || sStyle === "narrow", "sStyle is only allowed to be set with 'wide', 'short' or 'narrow'");
var aPatterns = [],
aPluralCategories = this.getPluralCategories(),
oScale,
oTimeEntry,
iValue,
iSign;
if (!aScales) {
aScales = ["year", "month", "week", "day", "hour", "minute", "second"];
}
aScales.forEach(function(sScale) {
oScale = this._get("dateFields", sScale + "-" + sStyle);
for (var sEntry in oScale) {
if (sEntry.indexOf("relative-type-") === 0) {
iValue = parseInt(sEntry.substr(14));
aPatterns.push({
scale: sScale,
value: iValue,
pattern: oScale[sEntry]
});
} else if (sEntry.indexOf("relativeTime-type-") == 0) {
oTimeEntry = oScale[sEntry];
iSign = sEntry.substr(18) === "past" ? -1 : 1;
aPluralCategories.forEach(function(sKey) { // eslint-disable-line no-loop-func
aPatterns.push({
scale: sScale,
sign: iSign,
pattern: oTimeEntry["relativeTimePattern-count-" + sKey]
});
});
}
}
}.bind(this));
return aPatterns;
} | [
"function",
"(",
"aScales",
",",
"sStyle",
")",
"{",
"if",
"(",
"sStyle",
"===",
"undefined",
")",
"{",
"sStyle",
"=",
"\"wide\"",
";",
"}",
"assert",
"(",
"sStyle",
"===",
"\"wide\"",
"||",
"sStyle",
"===",
"\"short\"",
"||",
"sStyle",
"===",
"\"narrow\... | Returns relative time patterns for the given scales as an array of objects containing scale, value and pattern.
The array may contain the following values: "year", "month", "week", "day", "hour", "minute" and "second". If
no scales are given, patterns for all available scales will be returned.
The return array will contain objects looking like:
<pre>
{
scale: "minute",
sign: 1,
pattern: "in {0} minutes"
}
</pre>
@param {string[]} aScales The scales for which the available patterns should be returned
@param {string} [sStyle="wide"] @since 1.32.10, 1.34.4 The style of the scale patterns. The valid values are "wide", "short" and "narrow".
@returns {object[]} An array of all relative time patterns
@public
@since 1.34 | [
"Returns",
"relative",
"time",
"patterns",
"for",
"the",
"given",
"scales",
"as",
"an",
"array",
"of",
"objects",
"containing",
"scale",
"value",
"and",
"pattern",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L1084-L1127 | train | Returns an array of patterns for the given scales | [
30522,
3853,
1006,
2004,
9289,
2229,
1010,
7020,
27983,
1007,
1063,
2065,
1006,
7020,
27983,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
7020,
27983,
1027,
1000,
2898,
1000,
1025,
1065,
20865,
1006,
7020,
27983,
1027,
1027,
1027,
1000,
2898,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GitbookIO/gitbook | lib/api/encodeGlobal.js | function(inputFile, outputFile, content) {
return Promise()
.then(function() {
var outputFilePath = PathUtils.resolveInRoot(outputFolder, outputFile);
return fs.ensureFile(outputFilePath)
.then(function() {
return fs.copy(inputFile, outputFilePath);
});
});
} | javascript | function(inputFile, outputFile, content) {
return Promise()
.then(function() {
var outputFilePath = PathUtils.resolveInRoot(outputFolder, outputFile);
return fs.ensureFile(outputFilePath)
.then(function() {
return fs.copy(inputFile, outputFilePath);
});
});
} | [
"function",
"(",
"inputFile",
",",
"outputFile",
",",
"content",
")",
"{",
"return",
"Promise",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"var",
"outputFilePath",
"=",
"PathUtils",
".",
"resolveInRoot",
"(",
"outputFolder",
",",
"outputFile",
... | Copy a file to the output folder
It creates the required folder.
@param {String} inputFile
@param {String} outputFile
@param {Buffer} content
@return {Promise} | [
"Copy",
"a",
"file",
"to",
"the",
"output",
"folder",
"It",
"creates",
"the",
"required",
"folder",
"."
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/api/encodeGlobal.js#L218-L228 | train | Copy a file to a file system | [
30522,
3853,
1006,
7953,
8873,
2571,
1010,
6434,
8873,
2571,
1010,
4180,
1007,
1063,
2709,
4872,
1006,
1007,
1012,
2059,
1006,
3853,
1006,
1007,
1063,
13075,
6434,
8873,
2571,
15069,
1027,
4130,
21823,
4877,
1012,
10663,
2378,
3217,
4140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
moleculerjs/moleculer | src/middlewares/metrics.js | generateMetricPayload | function generateMetricPayload(ctx) {
let payload = {
id: ctx.id,
requestID: ctx.requestID,
level: ctx.level,
startTime: ctx.startTime,
remoteCall: ctx.nodeID !== ctx.broker.nodeID
};
// Process extra metrics
processExtraMetrics(ctx, payload);
if (ctx.action) {
payload.action = {
name: ctx.action.name
};
}
if (ctx.service) {
payload.service = {
name: ctx.service.name,
version: ctx.service.version
};
}
if (ctx.parentID)
payload.parent = ctx.parentID;
payload.nodeID = ctx.broker.nodeID;
if (payload.remoteCall)
payload.callerNodeID = ctx.nodeID;
return payload;
} | javascript | function generateMetricPayload(ctx) {
let payload = {
id: ctx.id,
requestID: ctx.requestID,
level: ctx.level,
startTime: ctx.startTime,
remoteCall: ctx.nodeID !== ctx.broker.nodeID
};
// Process extra metrics
processExtraMetrics(ctx, payload);
if (ctx.action) {
payload.action = {
name: ctx.action.name
};
}
if (ctx.service) {
payload.service = {
name: ctx.service.name,
version: ctx.service.version
};
}
if (ctx.parentID)
payload.parent = ctx.parentID;
payload.nodeID = ctx.broker.nodeID;
if (payload.remoteCall)
payload.callerNodeID = ctx.nodeID;
return payload;
} | [
"function",
"generateMetricPayload",
"(",
"ctx",
")",
"{",
"let",
"payload",
"=",
"{",
"id",
":",
"ctx",
".",
"id",
",",
"requestID",
":",
"ctx",
".",
"requestID",
",",
"level",
":",
"ctx",
".",
"level",
",",
"startTime",
":",
"ctx",
".",
"startTime",
... | Generate metrics payload
@param {Context} ctx
@returns {Object} | [
"Generate",
"metrics",
"payload"
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/metrics.js#L57-L89 | train | Generate a metric payload | [
30522,
3853,
9699,
12589,
4502,
8516,
10441,
2094,
1006,
14931,
2595,
1007,
1063,
2292,
18093,
1027,
1063,
8909,
1024,
14931,
2595,
1012,
8909,
1010,
5227,
3593,
1024,
14931,
2595,
1012,
5227,
3593,
1010,
2504,
1024,
14931,
2595,
1012,
2504... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | addNodesToDrag | function addNodesToDrag(nodes, opts) {
opts = opts || {};
var hasCompoundNodes = nodes.cy().hasCompoundNodes();
if (opts.inDragLayer) {
nodes.forEach(setInDragLayer);
nodes.neighborhood().stdFilter(function (ele) {
return !hasCompoundNodes || ele.isEdge();
}).forEach(setInDragLayer);
}
if (opts.addToList) {
nodes.forEach(function (ele) {
addToDragList(ele, opts);
});
}
addDescendantsToDrag(nodes, opts); // always add to drag
// also add nodes and edges related to the topmost ancestor
updateAncestorsInDragLayer(nodes, {
inDragLayer: opts.inDragLayer
});
r.updateCachedGrabbedEles();
} | javascript | function addNodesToDrag(nodes, opts) {
opts = opts || {};
var hasCompoundNodes = nodes.cy().hasCompoundNodes();
if (opts.inDragLayer) {
nodes.forEach(setInDragLayer);
nodes.neighborhood().stdFilter(function (ele) {
return !hasCompoundNodes || ele.isEdge();
}).forEach(setInDragLayer);
}
if (opts.addToList) {
nodes.forEach(function (ele) {
addToDragList(ele, opts);
});
}
addDescendantsToDrag(nodes, opts); // always add to drag
// also add nodes and edges related to the topmost ancestor
updateAncestorsInDragLayer(nodes, {
inDragLayer: opts.inDragLayer
});
r.updateCachedGrabbedEles();
} | [
"function",
"addNodesToDrag",
"(",
"nodes",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"hasCompoundNodes",
"=",
"nodes",
".",
"cy",
"(",
")",
".",
"hasCompoundNodes",
"(",
")",
";",
"if",
"(",
"opts",
".",
"inDragLayer",
... | adds the given nodes and its neighbourhood to the drag layer | [
"adds",
"the",
"given",
"nodes",
"and",
"its",
"neighbourhood",
"to",
"the",
"drag",
"layer"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L23307-L23331 | train | add nodes to drag layer | [
30522,
3853,
5587,
3630,
6155,
3406,
7265,
2290,
1006,
14164,
1010,
23569,
2015,
1007,
1063,
23569,
2015,
1027,
23569,
2015,
1064,
1064,
1063,
1065,
1025,
13075,
2038,
9006,
6873,
8630,
3630,
6155,
1027,
14164,
1012,
22330,
1006,
1007,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Microsoft/vscode | src/main.js | stripComments | function stripComments(content) {
const regexp = /("(?:[^\\"]*(?:\\.)?)*")|('(?:[^\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
return content.replace(regexp, function (match, m1, m2, m3, m4) {
// Only one of m1, m2, m3, m4 matches
if (m3) {
// A block comment. Replace with nothing
return '';
} else if (m4) {
// A line comment. If it ends in \r?\n then keep it.
const length_1 = m4.length;
if (length_1 > 2 && m4[length_1 - 1] === '\n') {
return m4[length_1 - 2] === '\r' ? '\r\n' : '\n';
}
else {
return '';
}
} else {
// We match a string
return match;
}
});
} | javascript | function stripComments(content) {
const regexp = /("(?:[^\\"]*(?:\\.)?)*")|('(?:[^\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
return content.replace(regexp, function (match, m1, m2, m3, m4) {
// Only one of m1, m2, m3, m4 matches
if (m3) {
// A block comment. Replace with nothing
return '';
} else if (m4) {
// A line comment. If it ends in \r?\n then keep it.
const length_1 = m4.length;
if (length_1 > 2 && m4[length_1 - 1] === '\n') {
return m4[length_1 - 2] === '\r' ? '\r\n' : '\n';
}
else {
return '';
}
} else {
// We match a string
return match;
}
});
} | [
"function",
"stripComments",
"(",
"content",
")",
"{",
"const",
"regexp",
"=",
"/",
"(\"(?:[^\\\\\"]*(?:\\\\.)?)*\")|('(?:[^\\\\']*(?:\\\\.)?)*')|(\\/\\*(?:\\r?\\n|.)*?\\*\\/)|(\\/{2,}.*?(?:(?:\\r?\\n)|$))",
"/",
"g",
";",
"return",
"content",
".",
"replace",
"(",
"regexp",
"... | #region NLS Support
@param {string} content
@returns {string} | [
"#region",
"NLS",
"Support"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/main.js#L300-L322 | train | Strip comments from a string | [
30522,
3853,
6167,
9006,
8163,
1006,
4180,
1007,
1063,
9530,
3367,
19723,
10288,
2361,
1027,
1013,
1006,
1000,
1006,
1029,
1024,
1031,
1034,
1032,
1032,
1000,
1033,
1008,
1006,
1029,
1024,
1032,
1032,
1012,
1007,
1029,
1007,
1008,
1000,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | dist/js/materialize.js | Sidenav | function Sidenav(el, options) {
_classCallCheck(this, Sidenav);
var _this31 = _possibleConstructorReturn(this, (Sidenav.__proto__ || Object.getPrototypeOf(Sidenav)).call(this, Sidenav, el, options));
_this31.el.M_Sidenav = _this31;
_this31.id = _this31.$el.attr('id');
/**
* Options for the Sidenav
* @member Sidenav#options
* @prop {String} [edge='left'] - Side of screen on which Sidenav appears
* @prop {Boolean} [draggable=true] - Allow swipe gestures to open/close Sidenav
* @prop {Number} [inDuration=250] - Length in ms of enter transition
* @prop {Number} [outDuration=200] - Length in ms of exit transition
* @prop {Function} onOpenStart - Function called when sidenav starts entering
* @prop {Function} onOpenEnd - Function called when sidenav finishes entering
* @prop {Function} onCloseStart - Function called when sidenav starts exiting
* @prop {Function} onCloseEnd - Function called when sidenav finishes exiting
*/
_this31.options = $.extend({}, Sidenav.defaults, options);
/**
* Describes open/close state of Sidenav
* @type {Boolean}
*/
_this31.isOpen = false;
/**
* Describes if Sidenav is fixed
* @type {Boolean}
*/
_this31.isFixed = _this31.el.classList.contains('sidenav-fixed');
/**
* Describes if Sidenav is being draggeed
* @type {Boolean}
*/
_this31.isDragged = false;
// Window size variables for window resize checks
_this31.lastWindowWidth = window.innerWidth;
_this31.lastWindowHeight = window.innerHeight;
_this31._createOverlay();
_this31._createDragTarget();
_this31._setupEventHandlers();
_this31._setupClasses();
_this31._setupFixed();
Sidenav._sidenavs.push(_this31);
return _this31;
} | javascript | function Sidenav(el, options) {
_classCallCheck(this, Sidenav);
var _this31 = _possibleConstructorReturn(this, (Sidenav.__proto__ || Object.getPrototypeOf(Sidenav)).call(this, Sidenav, el, options));
_this31.el.M_Sidenav = _this31;
_this31.id = _this31.$el.attr('id');
/**
* Options for the Sidenav
* @member Sidenav#options
* @prop {String} [edge='left'] - Side of screen on which Sidenav appears
* @prop {Boolean} [draggable=true] - Allow swipe gestures to open/close Sidenav
* @prop {Number} [inDuration=250] - Length in ms of enter transition
* @prop {Number} [outDuration=200] - Length in ms of exit transition
* @prop {Function} onOpenStart - Function called when sidenav starts entering
* @prop {Function} onOpenEnd - Function called when sidenav finishes entering
* @prop {Function} onCloseStart - Function called when sidenav starts exiting
* @prop {Function} onCloseEnd - Function called when sidenav finishes exiting
*/
_this31.options = $.extend({}, Sidenav.defaults, options);
/**
* Describes open/close state of Sidenav
* @type {Boolean}
*/
_this31.isOpen = false;
/**
* Describes if Sidenav is fixed
* @type {Boolean}
*/
_this31.isFixed = _this31.el.classList.contains('sidenav-fixed');
/**
* Describes if Sidenav is being draggeed
* @type {Boolean}
*/
_this31.isDragged = false;
// Window size variables for window resize checks
_this31.lastWindowWidth = window.innerWidth;
_this31.lastWindowHeight = window.innerHeight;
_this31._createOverlay();
_this31._createDragTarget();
_this31._setupEventHandlers();
_this31._setupClasses();
_this31._setupFixed();
Sidenav._sidenavs.push(_this31);
return _this31;
} | [
"function",
"Sidenav",
"(",
"el",
",",
"options",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"Sidenav",
")",
";",
"var",
"_this31",
"=",
"_possibleConstructorReturn",
"(",
"this",
",",
"(",
"Sidenav",
".",
"__proto__",
"||",
"Object",
".",
"getPrototypeO... | Construct Sidenav instance and set up overlay
@constructor
@param {Element} el
@param {Object} options | [
"Construct",
"Sidenav",
"instance",
"and",
"set",
"up",
"overlay"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L5486-L5538 | train | Creates a new Sidenav instance. | [
30522,
3853,
2217,
2532,
2615,
1006,
3449,
1010,
7047,
1007,
1063,
1035,
2465,
9289,
29358,
11012,
1006,
2023,
1010,
2217,
2532,
2615,
1007,
1025,
13075,
1035,
2023,
21486,
1027,
1035,
2825,
8663,
3367,
6820,
16761,
13465,
14287,
1006,
2023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
quasarframework/quasar | ui/src/components/datetime/persian.js | j2d | function j2d (jy, jm, jd) {
const r = jalCal(jy, true)
return g2d(r.gy, 3, r.march) + (jm - 1) * 31 - div(jm, 7) * (jm - 7) + jd - 1
} | javascript | function j2d (jy, jm, jd) {
const r = jalCal(jy, true)
return g2d(r.gy, 3, r.march) + (jm - 1) * 31 - div(jm, 7) * (jm - 7) + jd - 1
} | [
"function",
"j2d",
"(",
"jy",
",",
"jm",
",",
"jd",
")",
"{",
"const",
"r",
"=",
"jalCal",
"(",
"jy",
",",
"true",
")",
"return",
"g2d",
"(",
"r",
".",
"gy",
",",
"3",
",",
"r",
".",
"march",
")",
"+",
"(",
"jm",
"-",
"1",
")",
"*",
"31",... | /*
Converts a date of the Jalaali calendar to the Julian Day number.
@param jy Jalaali year (1 to 3100)
@param jm Jalaali month (1 to 12)
@param jd Jalaali day (1 to 29/31)
@return Julian Day number | [
"/",
"*",
"Converts",
"a",
"date",
"of",
"the",
"Jalaali",
"calendar",
"to",
"the",
"Julian",
"Day",
"number",
"."
] | 5d2fb6c96bff6095236f8ca6fe07a037e32e06b3 | https://github.com/quasarframework/quasar/blob/5d2fb6c96bff6095236f8ca6fe07a037e32e06b3/ui/src/components/datetime/persian.js#L165-L168 | train | J2D - > jd | [
30522,
3853,
1046,
2475,
2094,
1006,
1046,
2100,
1010,
1046,
2213,
1010,
26219,
1007,
1063,
9530,
3367,
1054,
1027,
14855,
15472,
2389,
1006,
1046,
2100,
1010,
2995,
1007,
2709,
1043,
2475,
2094,
1006,
1054,
1012,
1043,
2100,
1010,
1017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/hand-controls.js | getGestureEventName | function getGestureEventName (gesture, active) {
var eventName;
if (!gesture) { return; }
eventName = EVENTS[gesture];
if (eventName === 'grip') {
return eventName + (active ? 'close' : 'open');
}
if (eventName === 'point' || eventName === 'thumb') {
return eventName + (active ? 'up' : 'down');
}
if (eventName === 'pointing' || eventName === 'pistol') {
return eventName + (active ? 'start' : 'end');
}
return;
} | javascript | function getGestureEventName (gesture, active) {
var eventName;
if (!gesture) { return; }
eventName = EVENTS[gesture];
if (eventName === 'grip') {
return eventName + (active ? 'close' : 'open');
}
if (eventName === 'point' || eventName === 'thumb') {
return eventName + (active ? 'up' : 'down');
}
if (eventName === 'pointing' || eventName === 'pistol') {
return eventName + (active ? 'start' : 'end');
}
return;
} | [
"function",
"getGestureEventName",
"(",
"gesture",
",",
"active",
")",
"{",
"var",
"eventName",
";",
"if",
"(",
"!",
"gesture",
")",
"{",
"return",
";",
"}",
"eventName",
"=",
"EVENTS",
"[",
"gesture",
"]",
";",
"if",
"(",
"eventName",
"===",
"'grip'",
... | Suffix gestures based on toggle state (e.g., open/close, up/down, start/end).
@param {string} gesture
@param {boolean} active | [
"Suffix",
"gestures",
"based",
"on",
"toggle",
"state",
"(",
"e",
".",
"g",
".",
"open",
"/",
"close",
"up",
"/",
"down",
"start",
"/",
"end",
")",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/hand-controls.js#L372-L388 | train | Get event name for given gesture | [
30522,
3853,
2131,
8449,
11244,
18697,
3372,
18442,
1006,
9218,
1010,
3161,
1007,
1063,
13075,
2724,
18442,
1025,
2065,
1006,
999,
9218,
1007,
1063,
2709,
1025,
1065,
2724,
18442,
1027,
2824,
1031,
9218,
1033,
1025,
2065,
1006,
2724,
18442,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/commons/color/get-background-color.js | sortPageBackground | function sortPageBackground(elmStack) {
let bodyIndex = elmStack.indexOf(document.body);
let bgNodes = elmStack;
if (
// Check that the body background is the page's background
bodyIndex > 1 && // only if there are negative z-index elements
!color.elementHasImage(document.documentElement) &&
color.getOwnBackgroundColor(
window.getComputedStyle(document.documentElement)
).alpha === 0
) {
// Remove body and html from it's current place
bgNodes.splice(bodyIndex, 1);
bgNodes.splice(elmStack.indexOf(document.documentElement), 1);
// Put the body background as the lowest element
bgNodes.push(document.body);
}
return bgNodes;
} | javascript | function sortPageBackground(elmStack) {
let bodyIndex = elmStack.indexOf(document.body);
let bgNodes = elmStack;
if (
// Check that the body background is the page's background
bodyIndex > 1 && // only if there are negative z-index elements
!color.elementHasImage(document.documentElement) &&
color.getOwnBackgroundColor(
window.getComputedStyle(document.documentElement)
).alpha === 0
) {
// Remove body and html from it's current place
bgNodes.splice(bodyIndex, 1);
bgNodes.splice(elmStack.indexOf(document.documentElement), 1);
// Put the body background as the lowest element
bgNodes.push(document.body);
}
return bgNodes;
} | [
"function",
"sortPageBackground",
"(",
"elmStack",
")",
"{",
"let",
"bodyIndex",
"=",
"elmStack",
".",
"indexOf",
"(",
"document",
".",
"body",
")",
";",
"let",
"bgNodes",
"=",
"elmStack",
";",
"if",
"(",
"// Check that the body background is the page's background",... | Look at document and body elements for relevant background information
@method sortPageBackground
@private
@param {Array} elmStack
@returns {Array} | [
"Look",
"at",
"document",
"and",
"body",
"elements",
"for",
"relevant",
"background",
"information"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/commons/color/get-background-color.js#L207-L227 | train | Sort the background nodes in the stack | [
30522,
3853,
4066,
13704,
5963,
16365,
1006,
17709,
9153,
3600,
1007,
1063,
2292,
2303,
22254,
10288,
1027,
17709,
9153,
3600,
1012,
5950,
11253,
1006,
6254,
1012,
2303,
1007,
1025,
2292,
1038,
26745,
6155,
1027,
17709,
9153,
3600,
1025,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/HealthLogger.js | setHealthDataLog | function setHealthDataLog(key, dataObject) {
var healthData = getStoredHealthData();
healthData[key] = dataObject;
setHealthData(healthData);
} | javascript | function setHealthDataLog(key, dataObject) {
var healthData = getStoredHealthData();
healthData[key] = dataObject;
setHealthData(healthData);
} | [
"function",
"setHealthDataLog",
"(",
"key",
",",
"dataObject",
")",
"{",
"var",
"healthData",
"=",
"getStoredHealthData",
"(",
")",
";",
"healthData",
"[",
"key",
"]",
"=",
"dataObject",
";",
"setHealthData",
"(",
"healthData",
")",
";",
"}"
] | Sets the health data for the given key
@param {Object} dataObject The object to be stored as health data for the key | [
"Sets",
"the",
"health",
"data",
"for",
"the",
"given",
"key"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/HealthLogger.js#L116-L120 | train | Set the data to be logged in the log | [
30522,
3853,
6662,
15879,
2705,
2850,
9080,
8649,
1006,
3145,
1010,
2951,
16429,
20614,
1007,
1063,
13075,
2740,
2850,
2696,
1027,
4152,
19277,
16425,
15879,
2705,
2850,
2696,
1006,
1007,
1025,
2740,
2850,
2696,
1031,
3145,
1033,
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/dateUtil.js | isDateWithinRange | function isDateWithinRange(date, minDate, maxDate) {
var dateAtMidnight = createDateAtMidnight(date);
var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null;
var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null;
return (!minDateAtMidnight || minDateAtMidnight <= dateAtMidnight) &&
(!maxDateAtMidnight || maxDateAtMidnight >= dateAtMidnight);
} | javascript | function isDateWithinRange(date, minDate, maxDate) {
var dateAtMidnight = createDateAtMidnight(date);
var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null;
var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null;
return (!minDateAtMidnight || minDateAtMidnight <= dateAtMidnight) &&
(!maxDateAtMidnight || maxDateAtMidnight >= dateAtMidnight);
} | [
"function",
"isDateWithinRange",
"(",
"date",
",",
"minDate",
",",
"maxDate",
")",
"{",
"var",
"dateAtMidnight",
"=",
"createDateAtMidnight",
"(",
"date",
")",
";",
"var",
"minDateAtMidnight",
"=",
"isValidDate",
"(",
"minDate",
")",
"?",
"createDateAtMidnight",
... | Checks if a date is within a min and max range, ignoring the time component.
If minDate or maxDate are not dates, they are ignored.
@param {Date} date
@param {Date} minDate
@param {Date} maxDate | [
"Checks",
"if",
"a",
"date",
"is",
"within",
"a",
"min",
"and",
"max",
"range",
"ignoring",
"the",
"time",
"component",
".",
"If",
"minDate",
"or",
"maxDate",
"are",
"not",
"dates",
"they",
"are",
"ignored",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L235-L241 | train | Check if date is within range | [
30522,
3853,
2003,
13701,
24415,
2378,
24388,
2063,
1006,
3058,
1010,
2568,
3686,
1010,
4098,
13701,
1007,
1063,
13075,
3058,
4017,
4328,
2094,
15864,
1027,
2580,
3686,
4017,
4328,
2094,
15864,
1006,
3058,
1007,
1025,
13075,
2568,
3686,
401... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/core/component.js | function (value, silent) {
var schema = this.schema;
if (this.isSingleProperty) { return parseProperty(value, schema); }
return parseProperties(styleParser.parse(value), schema, true, this.name, silent);
} | javascript | function (value, silent) {
var schema = this.schema;
if (this.isSingleProperty) { return parseProperty(value, schema); }
return parseProperties(styleParser.parse(value), schema, true, this.name, silent);
} | [
"function",
"(",
"value",
",",
"silent",
")",
"{",
"var",
"schema",
"=",
"this",
".",
"schema",
";",
"if",
"(",
"this",
".",
"isSingleProperty",
")",
"{",
"return",
"parseProperty",
"(",
"value",
",",
"schema",
")",
";",
"}",
"return",
"parseProperties",... | Parses each property based on property type.
If component is single-property, then parses the single property value.
@param {string} value - HTML attribute value.
@param {boolean} silent - Suppress warning messages.
@returns {object} Component data. | [
"Parses",
"each",
"property",
"based",
"on",
"property",
"type",
".",
"If",
"component",
"is",
"single",
"-",
"property",
"then",
"parses",
"the",
"single",
"property",
"value",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/component.js#L157-L161 | train | Parse the value | [
30522,
3853,
1006,
3643,
1010,
4333,
1007,
1063,
13075,
8040,
28433,
1027,
2023,
1012,
8040,
28433,
1025,
2065,
1006,
2023,
1012,
26354,
2075,
2571,
21572,
4842,
3723,
1007,
1063,
2709,
11968,
3366,
21572,
4842,
3723,
1006,
3643,
1010,
8040... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
firebase/firebaseui-web | javascript/widgets/handler/common.js | function() {
firebaseui.auth.storage.setPendingRedirectStatus(app.getAppId());
app.registerPending(component.executePromiseRequest(
/** @type {function (): !goog.Promise} */ (
goog.bind(app.startSignInWithRedirect, app)),
[provider],
function() {
// Only run below logic if the environment is potentially a Cordova
// environment. This check is not required but will minimize the
// need to change existing tests that assertSignInWithRedirect.
if (firebaseui.auth.util.getScheme() !== 'file:') {
return;
}
// This will resolve in a Cordova environment. Result should be
// obtained from getRedirectResult and then treated like a
// signInWithPopup operation.
return app.registerPending(app.getRedirectResult()
.then(function(result) {
// Pass result in promise to callback handler.
component.dispose();
// Removes pending redirect status if sign-in with redirect
// resolves in Cordova environment.
firebaseui.auth.storage.removePendingRedirectStatus(
app.getAppId());
firebaseui.auth.widget.handler.handle(
firebaseui.auth.widget.HandlerName.CALLBACK,
app,
container,
goog.Promise.resolve(result));
}, signInResultErrorCallback));
},
providerSigninFailedCallback));
} | javascript | function() {
firebaseui.auth.storage.setPendingRedirectStatus(app.getAppId());
app.registerPending(component.executePromiseRequest(
/** @type {function (): !goog.Promise} */ (
goog.bind(app.startSignInWithRedirect, app)),
[provider],
function() {
// Only run below logic if the environment is potentially a Cordova
// environment. This check is not required but will minimize the
// need to change existing tests that assertSignInWithRedirect.
if (firebaseui.auth.util.getScheme() !== 'file:') {
return;
}
// This will resolve in a Cordova environment. Result should be
// obtained from getRedirectResult and then treated like a
// signInWithPopup operation.
return app.registerPending(app.getRedirectResult()
.then(function(result) {
// Pass result in promise to callback handler.
component.dispose();
// Removes pending redirect status if sign-in with redirect
// resolves in Cordova environment.
firebaseui.auth.storage.removePendingRedirectStatus(
app.getAppId());
firebaseui.auth.widget.handler.handle(
firebaseui.auth.widget.HandlerName.CALLBACK,
app,
container,
goog.Promise.resolve(result));
}, signInResultErrorCallback));
},
providerSigninFailedCallback));
} | [
"function",
"(",
")",
"{",
"firebaseui",
".",
"auth",
".",
"storage",
".",
"setPendingRedirectStatus",
"(",
"app",
".",
"getAppId",
"(",
")",
")",
";",
"app",
".",
"registerPending",
"(",
"component",
".",
"executePromiseRequest",
"(",
"/** @type {function (): !... | Redirect processor. | [
"Redirect",
"processor",
"."
] | c10aa51e38aeb38dc63baa22b48cd6690c2be087 | https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/javascript/widgets/handler/common.js#L1027-L1059 | train | Sign - in with redirect | [
30522,
3853,
1006,
1007,
1063,
2543,
15058,
10179,
1012,
8740,
2705,
1012,
5527,
1012,
2275,
11837,
4667,
5596,
7442,
16649,
29336,
2271,
1006,
10439,
1012,
2131,
29098,
3593,
1006,
1007,
1007,
1025,
10439,
1012,
4236,
11837,
4667,
1006,
69... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 (data, colorFunc, state) {
var gradientPixels = this._gradientPixels;
var pixelsSingleState = gradientPixels[state] || (gradientPixels[state] = new Uint8ClampedArray(256 * 4));
var color = [0, 0, 0, 0];
var off = 0;
for (var i = 0; i < 256; i++) {
colorFunc[state](i / 255, true, color);
pixelsSingleState[off++] = color[0];
pixelsSingleState[off++] = color[1];
pixelsSingleState[off++] = color[2];
pixelsSingleState[off++] = color[3];
}
return pixelsSingleState;
} | javascript | function (data, colorFunc, state) {
var gradientPixels = this._gradientPixels;
var pixelsSingleState = gradientPixels[state] || (gradientPixels[state] = new Uint8ClampedArray(256 * 4));
var color = [0, 0, 0, 0];
var off = 0;
for (var i = 0; i < 256; i++) {
colorFunc[state](i / 255, true, color);
pixelsSingleState[off++] = color[0];
pixelsSingleState[off++] = color[1];
pixelsSingleState[off++] = color[2];
pixelsSingleState[off++] = color[3];
}
return pixelsSingleState;
} | [
"function",
"(",
"data",
",",
"colorFunc",
",",
"state",
")",
"{",
"var",
"gradientPixels",
"=",
"this",
".",
"_gradientPixels",
";",
"var",
"pixelsSingleState",
"=",
"gradientPixels",
"[",
"state",
"]",
"||",
"(",
"gradientPixels",
"[",
"state",
"]",
"=",
... | get gradient color map
@private | [
"get",
"gradient",
"color",
"map"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/heatmap/HeatmapLayer.js#L159-L172 | train | get gradient pixels | [
30522,
3853,
1006,
2951,
1010,
3609,
11263,
12273,
1010,
2110,
1007,
1063,
13075,
17978,
8197,
2595,
9050,
1027,
2023,
1012,
1035,
17978,
8197,
2595,
9050,
1025,
13075,
27725,
7741,
4244,
12259,
1027,
17978,
8197,
2595,
9050,
1031,
2110,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/no-constant-condition.js | isLogicalIdentity | function isLogicalIdentity(node, operator) {
switch (node.type) {
case "Literal":
return (operator === "||" && node.value === true) ||
(operator === "&&" && node.value === false);
case "UnaryExpression":
return (operator === "&&" && node.operator === "void");
case "LogicalExpression":
return isLogicalIdentity(node.left, node.operator) ||
isLogicalIdentity(node.right, node.operator);
// no default
}
return false;
} | javascript | function isLogicalIdentity(node, operator) {
switch (node.type) {
case "Literal":
return (operator === "||" && node.value === true) ||
(operator === "&&" && node.value === false);
case "UnaryExpression":
return (operator === "&&" && node.operator === "void");
case "LogicalExpression":
return isLogicalIdentity(node.left, node.operator) ||
isLogicalIdentity(node.right, node.operator);
// no default
}
return false;
} | [
"function",
"isLogicalIdentity",
"(",
"node",
",",
"operator",
")",
"{",
"switch",
"(",
"node",
".",
"type",
")",
"{",
"case",
"\"Literal\"",
":",
"return",
"(",
"operator",
"===",
"\"||\"",
"&&",
"node",
".",
"value",
"===",
"true",
")",
"||",
"(",
"o... | -------------------------------------------------------------------------- Helpers --------------------------------------------------------------------------
Checks if a branch node of LogicalExpression short circuits the whole condition
@param {ASTNode} node The branch of main condition which needs to be checked
@param {string} operator The operator of the main LogicalExpression.
@returns {boolean} true when condition short circuits whole condition | [
"--------------------------------------------------------------------------",
"Helpers",
"--------------------------------------------------------------------------",
"Checks",
"if",
"a",
"branch",
"node",
"of",
"LogicalExpression",
"short",
"circuits",
"the",
"whole",
"condition"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-constant-condition.js#L66-L82 | train | isLogicalIdentity - Check if a node is a logical identity | [
30522,
3853,
2003,
9966,
5178,
16778,
3723,
1006,
13045,
1010,
6872,
1007,
1063,
6942,
1006,
13045,
1012,
2828,
1007,
1063,
2553,
1000,
18204,
1000,
1024,
2709,
1006,
6872,
1027,
1027,
1027,
1000,
1064,
1064,
1000,
1004,
1004,
13045,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/chart/chart.js | chartExtension | function chartExtension(editor, options = {}) {
const optionLanguages = editor.options.codeBlockLanguages;
if (optionLanguages && optionLanguages.indexOf(LANG) < 0) {
optionLanguages.push(LANG);
}
options = util.extend({
usageStatistics: editor.options.usageStatistics
}, options);
codeBlockManager.setReplacer(LANG, codeBlockChartDataAndOptions => {
return chartReplacer(codeBlockChartDataAndOptions, options);
});
if (!editor.isViewer()) {
// treat wysiwyg paste event
_setWwCodeBlockManagerForChart(editor);
// treat markdown paste event
editor.eventManager.listen('pasteBefore', ev => _onMDPasteBefore(editor.mdEditor.cm, ev));
}
} | javascript | function chartExtension(editor, options = {}) {
const optionLanguages = editor.options.codeBlockLanguages;
if (optionLanguages && optionLanguages.indexOf(LANG) < 0) {
optionLanguages.push(LANG);
}
options = util.extend({
usageStatistics: editor.options.usageStatistics
}, options);
codeBlockManager.setReplacer(LANG, codeBlockChartDataAndOptions => {
return chartReplacer(codeBlockChartDataAndOptions, options);
});
if (!editor.isViewer()) {
// treat wysiwyg paste event
_setWwCodeBlockManagerForChart(editor);
// treat markdown paste event
editor.eventManager.listen('pasteBefore', ev => _onMDPasteBefore(editor.mdEditor.cm, ev));
}
} | [
"function",
"chartExtension",
"(",
"editor",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"optionLanguages",
"=",
"editor",
".",
"options",
".",
"codeBlockLanguages",
";",
"if",
"(",
"optionLanguages",
"&&",
"optionLanguages",
".",
"indexOf",
"(",
"LANG",... | chart plugin
@param {Editor} editor - editor
@param {Object} options - chart options
@param {number} [options.minWidth=0] - minimum width
@param {number} [options.maxWidth=0] - maximum width
@param {number} [options.minHeight=Infinity] - minimum height
@param {number} [options.maxHeight=Infinity] - maximum height
@param {number|string} [options.width='auto'] - default height
@param {number|string} [options.height='auto'] - default height
@ignore | [
"chart",
"plugin"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L513-L534 | train | chartExtension - Extension for chart | [
30522,
3853,
3673,
10288,
29048,
1006,
3559,
1010,
7047,
1027,
1063,
1065,
1007,
1063,
9530,
3367,
5724,
25023,
6692,
8449,
1027,
3559,
1012,
7047,
1012,
3642,
23467,
25023,
6692,
8449,
1025,
2065,
1006,
5724,
25023,
6692,
8449,
1004,
1004,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableAccExtension.js | function(oTable, oColumn) {
if (!oTable || !oColumn) {
return [];
}
var iHeaderRowCount = TableUtils.getHeaderRowCount(oTable),
sColumnId = oColumn.getId(),
aLabels = [sColumnId];
if (iHeaderRowCount > 1) {
for (var i = 1; i < iHeaderRowCount; i++) {
aLabels.push(sColumnId + "_" + i);
}
var aSpans = TableUtils.Column.getParentSpannedColumns(oTable, sColumnId);
if (aSpans && aSpans.length) {
for (var i = 0; i < aSpans.length; i++) {
var iLevel = aSpans[i].level;
var sParentId = aSpans[i].column.getId();
aLabels[iLevel] = iLevel === 0 ? sParentId : (sParentId + "_" + iLevel);
}
}
}
return aLabels;
} | javascript | function(oTable, oColumn) {
if (!oTable || !oColumn) {
return [];
}
var iHeaderRowCount = TableUtils.getHeaderRowCount(oTable),
sColumnId = oColumn.getId(),
aLabels = [sColumnId];
if (iHeaderRowCount > 1) {
for (var i = 1; i < iHeaderRowCount; i++) {
aLabels.push(sColumnId + "_" + i);
}
var aSpans = TableUtils.Column.getParentSpannedColumns(oTable, sColumnId);
if (aSpans && aSpans.length) {
for (var i = 0; i < aSpans.length; i++) {
var iLevel = aSpans[i].level;
var sParentId = aSpans[i].column.getId();
aLabels[iLevel] = iLevel === 0 ? sParentId : (sParentId + "_" + iLevel);
}
}
}
return aLabels;
} | [
"function",
"(",
"oTable",
",",
"oColumn",
")",
"{",
"if",
"(",
"!",
"oTable",
"||",
"!",
"oColumn",
")",
"{",
"return",
"[",
"]",
";",
"}",
"var",
"iHeaderRowCount",
"=",
"TableUtils",
".",
"getHeaderRowCount",
"(",
"oTable",
")",
",",
"sColumnId",
"=... | /*
Returns the IDs of the column headers which are relevant for the given column (esp. in multi header case). | [
"/",
"*",
"Returns",
"the",
"IDs",
"of",
"the",
"column",
"headers",
"which",
"are",
"relevant",
"for",
"the",
"given",
"column",
"(",
"esp",
".",
"in",
"multi",
"header",
"case",
")",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L162-L187 | train | Returns an array of labels for the given column | [
30522,
3853,
1006,
27178,
3085,
1010,
1051,
25778,
2819,
2078,
1007,
1063,
2065,
1006,
999,
27178,
3085,
1064,
1064,
999,
1051,
25778,
2819,
2078,
1007,
1063,
2709,
1031,
1033,
1025,
1065,
13075,
1045,
4974,
2121,
10524,
3597,
16671,
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... | |
angular/material | src/core/services/interimElement/interimElement.js | compileElement | function compileElement(options) {
var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null;
return compiled || $q(function (resolve) {
resolve({
locals: {},
link: function () {
return options.element;
}
});
});
} | javascript | function compileElement(options) {
var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null;
return compiled || $q(function (resolve) {
resolve({
locals: {},
link: function () {
return options.element;
}
});
});
} | [
"function",
"compileElement",
"(",
"options",
")",
"{",
"var",
"compiled",
"=",
"!",
"options",
".",
"skipCompile",
"?",
"$mdCompiler",
".",
"compile",
"(",
"options",
")",
":",
"null",
";",
"return",
"compiled",
"||",
"$q",
"(",
"function",
"(",
"resolve"... | Compile an element with a templateUrl, controller, and locals | [
"Compile",
"an",
"element",
"with",
"a",
"templateUrl",
"controller",
"and",
"locals"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L605-L617 | train | Compile an element | [
30522,
3853,
4012,
22090,
12260,
3672,
1006,
7047,
1007,
1063,
13075,
9227,
1027,
999,
7047,
1012,
13558,
9006,
22090,
1029,
1002,
9108,
9006,
22090,
2099,
1012,
4012,
22090,
1006,
7047,
1007,
1024,
19701,
1025,
2709,
9227,
1064,
1064,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/languageTools/LanguageClient/NodeToBracketsInterface.js | _generateUUID | function _generateUUID() {
var result,
numericSeed;
for (
result = numericSeed = '';
numericSeed++ < 36;
result += numericSeed * 51 & 52 ? (numericSeed ^ 15 ? 8 ^ Math.random() * (numericSeed ^ 20 ? 16 : 4) : 4).toString(16) : '-'
);
return result;
} | javascript | function _generateUUID() {
var result,
numericSeed;
for (
result = numericSeed = '';
numericSeed++ < 36;
result += numericSeed * 51 & 52 ? (numericSeed ^ 15 ? 8 ^ Math.random() * (numericSeed ^ 20 ? 16 : 4) : 4).toString(16) : '-'
);
return result;
} | [
"function",
"_generateUUID",
"(",
")",
"{",
"var",
"result",
",",
"numericSeed",
";",
"for",
"(",
"result",
"=",
"numericSeed",
"=",
"''",
";",
"numericSeed",
"++",
"<",
"36",
";",
"result",
"+=",
"numericSeed",
"*",
"51",
"&",
"52",
"?",
"(",
"numeric... | https://gist.github.com/LeverOne/1308368 /*eslint-disable | [
"https",
":",
"//",
"gist",
".",
"github",
".",
"com",
"/",
"LeverOne",
"/",
"1308368",
"/",
"*",
"eslint",
"-",
"disable"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/languageTools/LanguageClient/NodeToBracketsInterface.js#L36-L46 | train | Generate UUID | [
30522,
3853,
1035,
9699,
2226,
21272,
1006,
1007,
1063,
13075,
2765,
1010,
16371,
25531,
19763,
2094,
1025,
2005,
1006,
2765,
1027,
16371,
25531,
19763,
2094,
1027,
1005,
1005,
1025,
16371,
25531,
19763,
2094,
1009,
1009,
1026,
4029,
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... |
shipshapecode/shepherd | src/js/utils/modal.js | _createMaskOpening | function _createMaskOpening() {
const element = document.createElementNS(svgNS, 'rect');
_setAttributes(element, {
fill: '#000000',
id: elementIds.modalOverlayMaskOpening
});
return element;
} | javascript | function _createMaskOpening() {
const element = document.createElementNS(svgNS, 'rect');
_setAttributes(element, {
fill: '#000000',
id: elementIds.modalOverlayMaskOpening
});
return element;
} | [
"function",
"_createMaskOpening",
"(",
")",
"{",
"const",
"element",
"=",
"document",
".",
"createElementNS",
"(",
"svgNS",
",",
"'rect'",
")",
";",
"_setAttributes",
"(",
"element",
",",
"{",
"fill",
":",
"'#000000'",
",",
"id",
":",
"elementIds",
".",
"m... | <rect id="shepherdModalMaskOpening" fill="#000000"/> | [
"<rect",
"id",
"=",
"shepherdModalMaskOpening",
"fill",
"=",
"#000000",
"/",
">"
] | 0cb1c63fb07b58796358f6d33da5f6405e2b05f4 | https://github.com/shipshapecode/shepherd/blob/0cb1c63fb07b58796358f6d33da5f6405e2b05f4/src/js/utils/modal.js#L64-L73 | train | Create mask opening element | [
30522,
3853,
1035,
3443,
9335,
3683,
11837,
2075,
1006,
1007,
1063,
9530,
3367,
5783,
1027,
6254,
1012,
3443,
12260,
3672,
3619,
1006,
17917,
16206,
2015,
1010,
1005,
28667,
2102,
1005,
1007,
1025,
1035,
2275,
19321,
3089,
8569,
4570,
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... |
ecomfe/zrender | src/Painter.js | function (zlevel, config) {
if (config) {
var layerConfig = this._layerConfig;
if (!layerConfig[zlevel]) {
layerConfig[zlevel] = config;
}
else {
util.merge(layerConfig[zlevel], config, true);
}
for (var i = 0; i < this._zlevelList.length; i++) {
var _zlevel = this._zlevelList[i];
if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
var layer = this._layers[_zlevel];
util.merge(layer, layerConfig[zlevel], true);
}
}
}
} | javascript | function (zlevel, config) {
if (config) {
var layerConfig = this._layerConfig;
if (!layerConfig[zlevel]) {
layerConfig[zlevel] = config;
}
else {
util.merge(layerConfig[zlevel], config, true);
}
for (var i = 0; i < this._zlevelList.length; i++) {
var _zlevel = this._zlevelList[i];
if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
var layer = this._layers[_zlevel];
util.merge(layer, layerConfig[zlevel], true);
}
}
}
} | [
"function",
"(",
"zlevel",
",",
"config",
")",
"{",
"if",
"(",
"config",
")",
"{",
"var",
"layerConfig",
"=",
"this",
".",
"_layerConfig",
";",
"if",
"(",
"!",
"layerConfig",
"[",
"zlevel",
"]",
")",
"{",
"layerConfig",
"[",
"zlevel",
"]",
"=",
"conf... | 修改指定zlevel的绘制参数
@param {string} zlevel
@param {Object} config 配置对象
@param {string} [config.clearColor=0] 每次清空画布的颜色
@param {string} [config.motionBlur=false] 是否开启动态模糊
@param {number} [config.lastFrameAlpha=0.7]
在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显 | [
"修改指定zlevel的绘制参数"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/Painter.js#L794-L812 | train | Add a new record to the log | [
30522,
3853,
1006,
1062,
20414,
2884,
1010,
9530,
8873,
2290,
1007,
1063,
2065,
1006,
9530,
8873,
2290,
1007,
1063,
13075,
6741,
8663,
8873,
2290,
1027,
2023,
1012,
1035,
6741,
8663,
8873,
2290,
1025,
2065,
1006,
999,
6741,
8663,
8873,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/line/highlight.js | runMode | function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
let flattenSpans = mode.flattenSpans
if (flattenSpans == null) flattenSpans = cm.options.flattenSpans
let curStart = 0, curStyle = null
let stream = new StringStream(text, cm.options.tabSize, context), style
let inner = cm.options.addModeClass && [null]
if (text == "") extractLineClasses(callBlankLine(mode, context.state), lineClasses)
while (!stream.eol()) {
if (stream.pos > cm.options.maxHighlightLength) {
flattenSpans = false
if (forceToEnd) processLine(cm, text, context, stream.pos)
stream.pos = text.length
style = null
} else {
style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses)
}
if (inner) {
let mName = inner[0].name
if (mName) style = "m-" + (style ? mName + " " + style : mName)
}
if (!flattenSpans || curStyle != style) {
while (curStart < stream.start) {
curStart = Math.min(stream.start, curStart + 5000)
f(curStart, curStyle)
}
curStyle = style
}
stream.start = stream.pos
}
while (curStart < stream.pos) {
// Webkit seems to refuse to render text nodes longer than 57444
// characters, and returns inaccurate measurements in nodes
// starting around 5000 chars.
let pos = Math.min(stream.pos, curStart + 5000)
f(pos, curStyle)
curStart = pos
}
} | javascript | function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
let flattenSpans = mode.flattenSpans
if (flattenSpans == null) flattenSpans = cm.options.flattenSpans
let curStart = 0, curStyle = null
let stream = new StringStream(text, cm.options.tabSize, context), style
let inner = cm.options.addModeClass && [null]
if (text == "") extractLineClasses(callBlankLine(mode, context.state), lineClasses)
while (!stream.eol()) {
if (stream.pos > cm.options.maxHighlightLength) {
flattenSpans = false
if (forceToEnd) processLine(cm, text, context, stream.pos)
stream.pos = text.length
style = null
} else {
style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses)
}
if (inner) {
let mName = inner[0].name
if (mName) style = "m-" + (style ? mName + " " + style : mName)
}
if (!flattenSpans || curStyle != style) {
while (curStart < stream.start) {
curStart = Math.min(stream.start, curStart + 5000)
f(curStart, curStyle)
}
curStyle = style
}
stream.start = stream.pos
}
while (curStart < stream.pos) {
// Webkit seems to refuse to render text nodes longer than 57444
// characters, and returns inaccurate measurements in nodes
// starting around 5000 chars.
let pos = Math.min(stream.pos, curStart + 5000)
f(pos, curStyle)
curStart = pos
}
} | [
"function",
"runMode",
"(",
"cm",
",",
"text",
",",
"mode",
",",
"context",
",",
"f",
",",
"lineClasses",
",",
"forceToEnd",
")",
"{",
"let",
"flattenSpans",
"=",
"mode",
".",
"flattenSpans",
"if",
"(",
"flattenSpans",
"==",
"null",
")",
"flattenSpans",
... | Run the given mode's parser over a line, calling f for each token. | [
"Run",
"the",
"given",
"mode",
"s",
"parser",
"over",
"a",
"line",
"calling",
"f",
"for",
"each",
"token",
"."
] | dab6f676107c10ba8d16c654a42f66cae3f27db1 | https://github.com/codemirror/CodeMirror/blob/dab6f676107c10ba8d16c654a42f66cae3f27db1/src/line/highlight.js#L208-L245 | train | Run the mode in a loop. | [
30522,
3853,
2448,
5302,
3207,
1006,
4642,
1010,
3793,
1010,
5549,
1010,
6123,
1010,
1042,
1010,
2240,
26266,
2229,
1010,
2486,
3406,
10497,
30524,
8445,
1027,
1014,
1010,
12731,
12096,
12844,
1027,
19701,
2292,
5460,
1027,
2047,
7817,
2537... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | _trigger | function _trigger(element, name, value, autoRemove) {
var key = "data-ld-" + name;
if (value !== undefined && value !== null) {
element.setAttribute(key, value);
if (autoRemove) {
window.setTimeout(element.removeAttribute.bind(element, key));
}
} else {
element.removeAttribute(key);
}
} | javascript | function _trigger(element, name, value, autoRemove) {
var key = "data-ld-" + name;
if (value !== undefined && value !== null) {
element.setAttribute(key, value);
if (autoRemove) {
window.setTimeout(element.removeAttribute.bind(element, key));
}
} else {
element.removeAttribute(key);
}
} | [
"function",
"_trigger",
"(",
"element",
",",
"name",
",",
"value",
",",
"autoRemove",
")",
"{",
"var",
"key",
"=",
"\"data-ld-\"",
"+",
"name",
";",
"if",
"(",
"value",
"!==",
"undefined",
"&&",
"value",
"!==",
"null",
")",
"{",
"element",
".",
"setAtt... | set an event on a element | [
"set",
"an",
"event",
"on",
"a",
"element"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/RemoteFunctions.js#L109-L119 | train | Trigger an attribute change | [
30522,
3853,
1035,
9495,
1006,
5783,
1010,
2171,
1010,
3643,
1010,
8285,
28578,
21818,
1007,
1063,
13075,
3145,
1027,
1000,
2951,
1011,
25510,
1011,
1000,
1009,
2171,
1025,
2065,
1006,
3643,
999,
1027,
1027,
6151,
28344,
1004,
1004,
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/firebase-js-sdk | packages/auth/demo/public/script.js | signInWithPopupRedirect | function signInWithPopupRedirect(provider) {
var action = $("input[name=popup-redirect-action]:checked").val();
var type = $("input[name=popup-redirect-type]:checked").val();
var method = null;
var inst = null;
if (action == 'link' || action == 'reauthenticate') {
if (!activeUser()) {
alertError('No user logged in.');
return;
}
inst = activeUser();
method = action + 'With';
} else {
inst = auth;
method = 'signInWith';
}
if (type == 'popup') {
method += 'Popup';
} else {
method += 'Redirect';
}
// Get custom OAuth parameters.
var customParameters = {};
// For each entry.
$('form.customParamItem').each(function(index) {
// Get parameter key.
var key = $(this).find('input.customParamKey').val();
// Get parameter value.
var value = $(this).find('input.customParamValue').val();
// Save to list if valid.
if (key && value) {
customParameters[key] = value;
}
});
console.log('customParameters: ', customParameters);
// For older jscore versions that do not support this.
if (provider.setCustomParameters) {
// Set custom parameters on current provider.
provider.setCustomParameters(customParameters);
}
// Add scopes for providers who do have scopes available (i.e. not Twitter).
if (provider.addScope) {
// String.prototype.trim not available in IE8.
var scopes = $.trim($('#scopes').val()).split(/\s*,\s*/);
for (var i = 0; i < scopes.length; i++) {
provider.addScope(scopes[i]);
}
}
console.log('Provider:');
console.log(provider);
if (type == 'popup') {
inst[method](provider).then(function(response) {
console.log('Popup response:');
console.log(response);
alertSuccess(action + ' with ' + provider['providerId'] + ' successful!');
logAdditionalUserInfo(response);
onAuthSuccess(activeUser());
}, onAuthError);
} else {
try {
inst[method](provider).catch(onAuthError);
} catch (error) {
console.log('Error while calling ' + method);
console.error(error);
}
}
} | javascript | function signInWithPopupRedirect(provider) {
var action = $("input[name=popup-redirect-action]:checked").val();
var type = $("input[name=popup-redirect-type]:checked").val();
var method = null;
var inst = null;
if (action == 'link' || action == 'reauthenticate') {
if (!activeUser()) {
alertError('No user logged in.');
return;
}
inst = activeUser();
method = action + 'With';
} else {
inst = auth;
method = 'signInWith';
}
if (type == 'popup') {
method += 'Popup';
} else {
method += 'Redirect';
}
// Get custom OAuth parameters.
var customParameters = {};
// For each entry.
$('form.customParamItem').each(function(index) {
// Get parameter key.
var key = $(this).find('input.customParamKey').val();
// Get parameter value.
var value = $(this).find('input.customParamValue').val();
// Save to list if valid.
if (key && value) {
customParameters[key] = value;
}
});
console.log('customParameters: ', customParameters);
// For older jscore versions that do not support this.
if (provider.setCustomParameters) {
// Set custom parameters on current provider.
provider.setCustomParameters(customParameters);
}
// Add scopes for providers who do have scopes available (i.e. not Twitter).
if (provider.addScope) {
// String.prototype.trim not available in IE8.
var scopes = $.trim($('#scopes').val()).split(/\s*,\s*/);
for (var i = 0; i < scopes.length; i++) {
provider.addScope(scopes[i]);
}
}
console.log('Provider:');
console.log(provider);
if (type == 'popup') {
inst[method](provider).then(function(response) {
console.log('Popup response:');
console.log(response);
alertSuccess(action + ' with ' + provider['providerId'] + ' successful!');
logAdditionalUserInfo(response);
onAuthSuccess(activeUser());
}, onAuthError);
} else {
try {
inst[method](provider).catch(onAuthError);
} catch (error) {
console.log('Error while calling ' + method);
console.error(error);
}
}
} | [
"function",
"signInWithPopupRedirect",
"(",
"provider",
")",
"{",
"var",
"action",
"=",
"$",
"(",
"\"input[name=popup-redirect-action]:checked\"",
")",
".",
"val",
"(",
")",
";",
"var",
"type",
"=",
"$",
"(",
"\"input[name=popup-redirect-type]:checked\"",
")",
".",
... | Performs a popup/redirect action based on a given provider and the user's
selections.
@param {!firebase.auth.AuthProvider} provider The provider with which to
sign in. | [
"Performs",
"a",
"popup",
"/",
"redirect",
"action",
"based",
"on",
"a",
"given",
"provider",
"and",
"the",
"user",
"s",
"selections",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L968-L1035 | train | Sign in with popup redirect | [
30522,
3853,
3696,
2378,
24415,
16340,
6279,
5596,
7442,
6593,
1006,
10802,
1007,
1063,
13075,
2895,
1027,
1002,
1006,
1000,
7953,
1031,
2171,
1027,
3769,
6279,
1011,
2417,
7442,
6593,
1011,
2895,
1033,
1024,
7039,
1000,
1007,
1012,
11748,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/demo/weinre-demo.js | intervalStuff | function intervalStuff() {
var message = "doing interval stuff at " + new Date()
// add a timeout
setTimeout(function() { console.log(message)}, 333)
// add a timeline marker
console.markTimeline(message)
// write to local- and sessionStorage
if (window.localStorage) {
var smessage = message + " (local)"
window.localStorage.setItem( "item-" + storageIndex, smessage)
}
if (window.sessionStorage) {
var smessage = message + " (session)"
window.sessionStorage.setItem("item-" + storageIndex, smessage)
}
storageIndex++
// write the message to the page
output(message)
// do an XHR
var xhr = new XMLHttpRequest()
// xhr.addEventListener("readystatechange", function() {logXhr(this)})
xhr.open("GET", "../target/target-script.js", true)
xhr.send()
} | javascript | function intervalStuff() {
var message = "doing interval stuff at " + new Date()
// add a timeout
setTimeout(function() { console.log(message)}, 333)
// add a timeline marker
console.markTimeline(message)
// write to local- and sessionStorage
if (window.localStorage) {
var smessage = message + " (local)"
window.localStorage.setItem( "item-" + storageIndex, smessage)
}
if (window.sessionStorage) {
var smessage = message + " (session)"
window.sessionStorage.setItem("item-" + storageIndex, smessage)
}
storageIndex++
// write the message to the page
output(message)
// do an XHR
var xhr = new XMLHttpRequest()
// xhr.addEventListener("readystatechange", function() {logXhr(this)})
xhr.open("GET", "../target/target-script.js", true)
xhr.send()
} | [
"function",
"intervalStuff",
"(",
")",
"{",
"var",
"message",
"=",
"\"doing interval stuff at \"",
"+",
"new",
"Date",
"(",
")",
"// add a timeout",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"message",
")",
"}",
",",
"333",
... | ------------------------------------------------------------------------------ | [
"------------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/demo/weinre-demo.js#L89-L119 | train | This function is called every time a new interval is created. | [
30522,
3853,
14025,
8525,
4246,
1006,
1007,
1063,
13075,
4471,
1027,
1000,
2725,
13483,
4933,
2012,
1000,
1009,
2047,
3058,
1006,
1007,
1013,
1013,
5587,
1037,
2051,
5833,
2275,
7292,
5833,
1006,
3853,
1006,
1007,
1063,
10122,
1012,
8833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | mxLabel | function mxLabel(bounds, fill, stroke, strokewidth)
{
mxRectangleShape.call(this, bounds, fill, stroke, strokewidth);
} | javascript | function mxLabel(bounds, fill, stroke, strokewidth)
{
mxRectangleShape.call(this, bounds, fill, stroke, strokewidth);
} | [
"function",
"mxLabel",
"(",
"bounds",
",",
"fill",
",",
"stroke",
",",
"strokewidth",
")",
"{",
"mxRectangleShape",
".",
"call",
"(",
"this",
",",
"bounds",
",",
"fill",
",",
"stroke",
",",
"strokewidth",
")",
";",
"}"
] | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxLabel
Extends <mxShape> to implement an image shape with a label.
This shape is registered under <mxConstants.SHAPE_LABEL> in
<mxCellRenderer>.
Constructor: mxLabel
Constructs a new label shape.
Parameters:
bounds - <mxRectangle> that defines the bounds. This is stored in
<mxShape.bounds>.
fill - String that defines the fill color. This is stored in <fill>.
stroke - String that defines the stroke color. This is stored in <stroke>.
strokewidth - Optional integer that defines the stroke width. Default is
1. This is stored in <strokewidth>. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxLabel"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L27696-L27699 | train | Constructs a new label | [
30522,
3853,
25630,
20470,
2884,
1006,
19202,
1010,
6039,
1010,
6909,
1010,
6909,
9148,
11927,
2232,
1007,
1063,
25630,
2890,
25572,
3070,
4244,
3270,
5051,
1012,
2655,
1006,
2023,
1010,
19202,
1010,
6039,
1010,
6909,
1010,
6909,
9148,
1192... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | visitArray | function visitArray(aInstances, sMetaPath, sCollectionPath, sContextUrl) {
var mByPredicate = {}, i, iIndex, vInstance, sPredicate;
for (i = 0; i < aInstances.length; i += 1) {
vInstance = aInstances[i];
iIndex = sCollectionPath === "" ? iStart + i : i;
if (vInstance && typeof vInstance === "object") {
visitInstance(vInstance, sMetaPath, sCollectionPath, sContextUrl, iIndex);
sPredicate = _Helper.getPrivateAnnotation(vInstance, "predicate");
if (!sCollectionPath) {
// remember the key predicates / indices of the root entries to remove all
// messages for entities that have been read
aCachePaths.push(sPredicate || iIndex.toString());
}
if (sPredicate) {
mByPredicate[sPredicate] = vInstance;
aInstances.$byPredicate = mByPredicate;
}
}
}
} | javascript | function visitArray(aInstances, sMetaPath, sCollectionPath, sContextUrl) {
var mByPredicate = {}, i, iIndex, vInstance, sPredicate;
for (i = 0; i < aInstances.length; i += 1) {
vInstance = aInstances[i];
iIndex = sCollectionPath === "" ? iStart + i : i;
if (vInstance && typeof vInstance === "object") {
visitInstance(vInstance, sMetaPath, sCollectionPath, sContextUrl, iIndex);
sPredicate = _Helper.getPrivateAnnotation(vInstance, "predicate");
if (!sCollectionPath) {
// remember the key predicates / indices of the root entries to remove all
// messages for entities that have been read
aCachePaths.push(sPredicate || iIndex.toString());
}
if (sPredicate) {
mByPredicate[sPredicate] = vInstance;
aInstances.$byPredicate = mByPredicate;
}
}
}
} | [
"function",
"visitArray",
"(",
"aInstances",
",",
"sMetaPath",
",",
"sCollectionPath",
",",
"sContextUrl",
")",
"{",
"var",
"mByPredicate",
"=",
"{",
"}",
",",
"i",
",",
"iIndex",
",",
"vInstance",
",",
"sPredicate",
";",
"for",
"(",
"i",
"=",
"0",
";",
... | /*
Calls visitInstance for all object entries of the given collection and creates the map
$byPredicate from predicate to entity.
@param {*[]} aInstances The collection
@param {string} sMetaPath The meta path of the collection in mTypeForMetaPath
@param {string} sCollectionPath The path of the collection
@param {string} sContextUrl The context URL for message longtexts | [
"/",
"*",
"Calls",
"visitInstance",
"for",
"all",
"object",
"entries",
"of",
"the",
"given",
"collection",
"and",
"creates",
"the",
"map",
"$byPredicate",
"from",
"predicate",
"to",
"entity",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L1068-L1089 | train | Visit an array of objects | [
30522,
3853,
3942,
2906,
9447,
1006,
7110,
12693,
9623,
1010,
15488,
12928,
15069,
1010,
8040,
14511,
18491,
15069,
1010,
8040,
28040,
18413,
3126,
2140,
1007,
1063,
13075,
16914,
22571,
5596,
24695,
1027,
1063,
1065,
1010,
1045,
1010,
2462,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | splitNode | function splitNode(point, options) {
let isSkipPaddingBlankHTML = options && options.isSkipPaddingBlankHTML;
const isNotSplitEdgePoint = options && options.isNotSplitEdgePoint;
const isDiscardEmptySplits = options && options.isDiscardEmptySplits;
if (isDiscardEmptySplits) {
isSkipPaddingBlankHTML = true;
}
// edge case
if (isEdgePoint(point) && (isText(point.node) || isNotSplitEdgePoint)) {
if (isLeftEdgePoint(point)) {
return point.node;
} else if (isRightEdgePoint(point)) {
return point.node.nextSibling;
}
}
// split #text
if (isText(point.node)) {
return point.node.splitText(point.offset);
} else {
const childNode = point.node.childNodes[point.offset];
const clone = insertAfter(point.node.cloneNode(false), point.node);
appendChildNodes(clone, listNext(childNode));
if (!isSkipPaddingBlankHTML) {
paddingBlankHTML(point.node);
paddingBlankHTML(clone);
}
if (isDiscardEmptySplits) {
if (isEmpty(point.node)) {
remove(point.node);
}
if (isEmpty(clone)) {
remove(clone);
return point.node.nextSibling;
}
}
return clone;
}
} | javascript | function splitNode(point, options) {
let isSkipPaddingBlankHTML = options && options.isSkipPaddingBlankHTML;
const isNotSplitEdgePoint = options && options.isNotSplitEdgePoint;
const isDiscardEmptySplits = options && options.isDiscardEmptySplits;
if (isDiscardEmptySplits) {
isSkipPaddingBlankHTML = true;
}
// edge case
if (isEdgePoint(point) && (isText(point.node) || isNotSplitEdgePoint)) {
if (isLeftEdgePoint(point)) {
return point.node;
} else if (isRightEdgePoint(point)) {
return point.node.nextSibling;
}
}
// split #text
if (isText(point.node)) {
return point.node.splitText(point.offset);
} else {
const childNode = point.node.childNodes[point.offset];
const clone = insertAfter(point.node.cloneNode(false), point.node);
appendChildNodes(clone, listNext(childNode));
if (!isSkipPaddingBlankHTML) {
paddingBlankHTML(point.node);
paddingBlankHTML(clone);
}
if (isDiscardEmptySplits) {
if (isEmpty(point.node)) {
remove(point.node);
}
if (isEmpty(clone)) {
remove(clone);
return point.node.nextSibling;
}
}
return clone;
}
} | [
"function",
"splitNode",
"(",
"point",
",",
"options",
")",
"{",
"let",
"isSkipPaddingBlankHTML",
"=",
"options",
"&&",
"options",
".",
"isSkipPaddingBlankHTML",
";",
"const",
"isNotSplitEdgePoint",
"=",
"options",
"&&",
"options",
".",
"isNotSplitEdgePoint",
";",
... | @method splitNode
split element or #text
@param {BoundaryPoint} point
@param {Object} [options]
@param {Boolean} [options.isSkipPaddingBlankHTML] - default: false
@param {Boolean} [options.isNotSplitEdgePoint] - default: false
@param {Boolean} [options.isDiscardEmptySplits] - default: false
@return {Node} right node of boundaryPoint | [
"@method",
"splitNode"
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L739-L782 | train | split node by point | [
30522,
3853,
3975,
3630,
3207,
1006,
2391,
1010,
7047,
1007,
1063,
2292,
26354,
3211,
13944,
27027,
28522,
8950,
11039,
19968,
1027,
7047,
1004,
1004,
7047,
1012,
26354,
3211,
13944,
27027,
28522,
8950,
11039,
19968,
1025,
9530,
3367,
3475,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wangfupeng1988/wangEditor | src/js/menus/code/index.js | function (e) {
const editor = this.editor
const $elem = this.$elem
const $selectionELem = editor.selection.getSelectionContainerElem()
if (!$selectionELem) {
return
}
const $parentElem = $selectionELem.parent()
if ($selectionELem.getNodeName() === 'CODE' && $parentElem.getNodeName() === 'PRE') {
this._active = true
$elem.addClass('w-e-active')
} else {
this._active = false
$elem.removeClass('w-e-active')
}
} | javascript | function (e) {
const editor = this.editor
const $elem = this.$elem
const $selectionELem = editor.selection.getSelectionContainerElem()
if (!$selectionELem) {
return
}
const $parentElem = $selectionELem.parent()
if ($selectionELem.getNodeName() === 'CODE' && $parentElem.getNodeName() === 'PRE') {
this._active = true
$elem.addClass('w-e-active')
} else {
this._active = false
$elem.removeClass('w-e-active')
}
} | [
"function",
"(",
"e",
")",
"{",
"const",
"editor",
"=",
"this",
".",
"editor",
"const",
"$elem",
"=",
"this",
".",
"$elem",
"const",
"$selectionELem",
"=",
"editor",
".",
"selection",
".",
"getSelectionContainerElem",
"(",
")",
"if",
"(",
"!",
"$selectionE... | 试图改变 active 状态 | [
"试图改变",
"active",
"状态"
] | b77696f5e81c8ec13d9d341252d6b9fa8a22db18 | https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/code/index.js#L132-L147 | train | onSelectonSelect | [
30522,
3853,
1006,
1041,
1007,
1063,
9530,
3367,
3559,
1027,
2023,
1012,
3559,
9530,
3367,
1002,
3449,
6633,
1027,
2023,
1012,
1002,
3449,
6633,
9530,
3367,
1002,
4989,
12260,
2213,
1027,
3559,
1012,
4989,
1012,
4152,
12260,
7542,
8663,
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/utils/ShellAPI.js | executeCommand | function executeCommand(eventName) {
// Temporary fix for #2616 - don't execute the command if a modal dialog is open.
// This should really be fixed with proper menu enabling.
if ($(".modal.instance").length || !appReady) {
// Another hack to fix issue #3219 so that all test windows are closed
// as before the fix for #3152 has been introduced. isBracketsTestWindow
// property is explicitly set in createTestWindowAndRun() in SpecRunnerUtils.js.
if (window.isBracketsTestWindow) {
return false;
}
// Return false for all commands except file.close_window command for
// which we have to return true (issue #3152).
return (eventName === Commands.FILE_CLOSE_WINDOW);
}
// Use E for Error so that uglify doesn't change this to simply Error()
var promise, E = Error, e = new E(), stackDepth = e.stack.split("\n").length;
// This function should *only* be called as a top-level function. If the current
// stack depth is > 2, it is most likely because we are at a breakpoint.
if (stackDepth < 3) {
promise = CommandManager.execute(eventName);
} else {
console.error("Skipping command " + eventName + " because it looks like you are " +
"at a breakpoint. If you are NOT at a breakpoint, please " +
"file a bug and mention this comment. Stack depth = " + stackDepth + ".");
}
return (promise && promise.state() === "rejected") ? false : true;
} | javascript | function executeCommand(eventName) {
// Temporary fix for #2616 - don't execute the command if a modal dialog is open.
// This should really be fixed with proper menu enabling.
if ($(".modal.instance").length || !appReady) {
// Another hack to fix issue #3219 so that all test windows are closed
// as before the fix for #3152 has been introduced. isBracketsTestWindow
// property is explicitly set in createTestWindowAndRun() in SpecRunnerUtils.js.
if (window.isBracketsTestWindow) {
return false;
}
// Return false for all commands except file.close_window command for
// which we have to return true (issue #3152).
return (eventName === Commands.FILE_CLOSE_WINDOW);
}
// Use E for Error so that uglify doesn't change this to simply Error()
var promise, E = Error, e = new E(), stackDepth = e.stack.split("\n").length;
// This function should *only* be called as a top-level function. If the current
// stack depth is > 2, it is most likely because we are at a breakpoint.
if (stackDepth < 3) {
promise = CommandManager.execute(eventName);
} else {
console.error("Skipping command " + eventName + " because it looks like you are " +
"at a breakpoint. If you are NOT at a breakpoint, please " +
"file a bug and mention this comment. Stack depth = " + stackDepth + ".");
}
return (promise && promise.state() === "rejected") ? false : true;
} | [
"function",
"executeCommand",
"(",
"eventName",
")",
"{",
"// Temporary fix for #2616 - don't execute the command if a modal dialog is open.",
"// This should really be fixed with proper menu enabling.",
"if",
"(",
"$",
"(",
"\".modal.instance\"",
")",
".",
"length",
"||",
"!",
"... | Set to true after app is fully initialized
The native function BracketsShellAPI::DispatchBracketsJSCommand calls this function in order to enable
calling Brackets commands from the native shell. | [
"Set",
"to",
"true",
"after",
"app",
"is",
"fully",
"initialized",
"The",
"native",
"function",
"BracketsShellAPI",
"::",
"DispatchBracketsJSCommand",
"calls",
"this",
"function",
"in",
"order",
"to",
"enable",
"calling",
"Brackets",
"commands",
"from",
"the",
"na... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ShellAPI.js#L41-L69 | train | Execute a command | [
30522,
3853,
15389,
9006,
2386,
2094,
1006,
2724,
18442,
1007,
1063,
1013,
1013,
5741,
8081,
2005,
1001,
24441,
2575,
1011,
2123,
1005,
1056,
15389,
1996,
3094,
2065,
1037,
16913,
2389,
13764,
8649,
2003,
2330,
1012,
1013,
1013,
2023,
2323,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dimsemenov/PhotoSwipe | src/js/gestures.js | function(el, fn) {
if(!el || el === document) {
return false;
}
// don't search elements above pswp__scroll-wrap
if(el.getAttribute('class') && el.getAttribute('class').indexOf('pswp__scroll-wrap') > -1 ) {
return false;
}
if( fn(el) ) {
return el;
}
return _closestElement(el.parentNode, fn);
} | javascript | function(el, fn) {
if(!el || el === document) {
return false;
}
// don't search elements above pswp__scroll-wrap
if(el.getAttribute('class') && el.getAttribute('class').indexOf('pswp__scroll-wrap') > -1 ) {
return false;
}
if( fn(el) ) {
return el;
}
return _closestElement(el.parentNode, fn);
} | [
"function",
"(",
"el",
",",
"fn",
")",
"{",
"if",
"(",
"!",
"el",
"||",
"el",
"===",
"document",
")",
"{",
"return",
"false",
";",
"}",
"// don't search elements above pswp__scroll-wrap",
"if",
"(",
"el",
".",
"getAttribute",
"(",
"'class'",
")",
"&&",
"... | amount of pixels to drag to determine direction of swipe | [
"amount",
"of",
"pixels",
"to",
"drag",
"to",
"determine",
"direction",
"of",
"swipe"
] | 80607e12542a1a54ecefa837649e862b35dffd25 | https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L81-L96 | train | closest element | [
30522,
3853,
1006,
3449,
1010,
1042,
2078,
1007,
1063,
2065,
1006,
999,
3449,
1064,
1064,
3449,
1027,
1027,
1027,
6254,
1007,
1063,
2709,
6270,
1025,
1065,
1013,
1013,
2123,
1005,
1056,
3945,
3787,
2682,
8827,
2860,
2361,
1035,
1035,
1718... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | checkIfAnotherSessionInProgress | function checkIfAnotherSessionInProgress() {
var result = $.Deferred();
if(updateJsonHandler) {
var state = updateJsonHandler.state;
updateJsonHandler.refresh()
.done(function() {
var val = updateJsonHandler.get(updateProgressKey);
if(val !== null) {
result.resolve(val);
} else {
result.reject();
}
})
.fail(function() {
updateJsonHandler.state = state;
result.reject();
});
}
return result.promise();
} | javascript | function checkIfAnotherSessionInProgress() {
var result = $.Deferred();
if(updateJsonHandler) {
var state = updateJsonHandler.state;
updateJsonHandler.refresh()
.done(function() {
var val = updateJsonHandler.get(updateProgressKey);
if(val !== null) {
result.resolve(val);
} else {
result.reject();
}
})
.fail(function() {
updateJsonHandler.state = state;
result.reject();
});
}
return result.promise();
} | [
"function",
"checkIfAnotherSessionInProgress",
"(",
")",
"{",
"var",
"result",
"=",
"$",
".",
"Deferred",
"(",
")",
";",
"if",
"(",
"updateJsonHandler",
")",
"{",
"var",
"state",
"=",
"updateJsonHandler",
".",
"state",
";",
"updateJsonHandler",
".",
"refresh",... | Checks if an auto update session is currently in progress
@returns {boolean} - true if an auto update session is currently in progress, false otherwise | [
"Checks",
"if",
"an",
"auto",
"update",
"session",
"is",
"currently",
"in",
"progress"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L102-L122 | train | Check if another session is in progress | [
30522,
3853,
4638,
10128,
6761,
12399,
8583,
10992,
2378,
21572,
17603,
4757,
1006,
1007,
1063,
13075,
2765,
1027,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
2065,
1006,
10651,
22578,
2239,
11774,
3917,
1007,
1063,
13075,
2110,
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... |
wangfupeng1988/wangEditor | src/js/menus/img/index.js | function (e) {
const editor = this.editor
const $elem = this.$elem
if (editor._selectedImg) {
this._active = true
$elem.addClass('w-e-active')
} else {
this._active = false
$elem.removeClass('w-e-active')
}
} | javascript | function (e) {
const editor = this.editor
const $elem = this.$elem
if (editor._selectedImg) {
this._active = true
$elem.addClass('w-e-active')
} else {
this._active = false
$elem.removeClass('w-e-active')
}
} | [
"function",
"(",
"e",
")",
"{",
"const",
"editor",
"=",
"this",
".",
"editor",
"const",
"$elem",
"=",
"this",
".",
"$elem",
"if",
"(",
"editor",
".",
"_selectedImg",
")",
"{",
"this",
".",
"_active",
"=",
"true",
"$elem",
".",
"addClass",
"(",
"'w-e-... | 试图改变 active 状态 | [
"试图改变",
"active",
"状态"
] | b77696f5e81c8ec13d9d341252d6b9fa8a22db18 | https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/img/index.js#L239-L249 | train | onSelectonSelect | [
30522,
3853,
1006,
1041,
1007,
1063,
9530,
3367,
3559,
1027,
2023,
1012,
3559,
9530,
3367,
1002,
3449,
6633,
1027,
2023,
1012,
1002,
3449,
6633,
2065,
1006,
3559,
1012,
1035,
3479,
5714,
2290,
1007,
1063,
2023,
1012,
1035,
3161,
1027,
299... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | lib/jsdoc/ui5/plugin.js | createPropertyMap | function createPropertyMap(node, defaultKey) {
var result;
if ( node != null ) {
// if, instead of an object literal only a literal is given and there is a defaultKey, then wrap the literal in a map
if ( node.type === Syntax.Literal && defaultKey != null ) {
result = {};
result[defaultKey] = { type: Syntax.Property, value: node };
return result;
}
if ( node.type != Syntax.ObjectExpression ) {
// something went wrong, it's not an object literal
error("not an object literal:" + node.type + ":" + node.value);
// console.log(node.toSource());
return undefined;
}
// invariant: node.type == Syntax.ObjectExpression
result = {};
for (var i = 0; i < node.properties.length; i++) {
var prop = node.properties[i];
//console.log("objectproperty " + prop.type);
var name = getPropertyKey(prop);
//console.log("objectproperty " + prop.type + ":" + name);
result[name] = prop;
}
}
return result;
} | javascript | function createPropertyMap(node, defaultKey) {
var result;
if ( node != null ) {
// if, instead of an object literal only a literal is given and there is a defaultKey, then wrap the literal in a map
if ( node.type === Syntax.Literal && defaultKey != null ) {
result = {};
result[defaultKey] = { type: Syntax.Property, value: node };
return result;
}
if ( node.type != Syntax.ObjectExpression ) {
// something went wrong, it's not an object literal
error("not an object literal:" + node.type + ":" + node.value);
// console.log(node.toSource());
return undefined;
}
// invariant: node.type == Syntax.ObjectExpression
result = {};
for (var i = 0; i < node.properties.length; i++) {
var prop = node.properties[i];
//console.log("objectproperty " + prop.type);
var name = getPropertyKey(prop);
//console.log("objectproperty " + prop.type + ":" + name);
result[name] = prop;
}
}
return result;
} | [
"function",
"createPropertyMap",
"(",
"node",
",",
"defaultKey",
")",
"{",
"var",
"result",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"// if, instead of an object literal only a literal is given and there is a defaultKey, then wrap the literal in a map",
"if",
"(",
"n... | Creates a map of property values from an AST 'object literal' node.
The values in the map are again AST 'property' nodes (representing key/value pairs).
It would be more convenient to just return the values, but the property node is needed
to find the corresponding (preceding) documentation comment.
If a <code>defaultKey</code> is given and if the <code>node</code> is not an object literal
but another simple type literal, the value is treated as a shortcut for
<pre>
{
[defaultKey]: node.value
}
</pre>
This is used in ManagedObjectMetadata to allow a simpler declaration of properties by
specifying a type name only.
@param {ASTNode} node AST node for an object literal or simple literal
@param {string} [defaultKey=undefined] A default key to use for simple values
@returns {Map<string,Property>} Map of AST nodes of type 'Property', keyed by their property name | [
"Creates",
"a",
"map",
"of",
"property",
"values",
"from",
"an",
"AST",
"object",
"literal",
"node",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L387-L418 | train | Creates a map of property names to property values | [
30522,
3853,
3443,
21572,
4842,
3723,
2863,
2361,
1006,
13045,
1010,
12398,
14839,
1007,
1063,
13075,
2765,
1025,
2065,
1006,
13045,
999,
1027,
19701,
1007,
1063,
1013,
1013,
2065,
1010,
2612,
1997,
2019,
4874,
18204,
2069,
1037,
18204,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | mxObjectCodec | function mxObjectCodec(template, exclude, idrefs, mapping)
{
this.template = template;
this.exclude = (exclude != null) ? exclude : [];
this.idrefs = (idrefs != null) ? idrefs : [];
this.mapping = (mapping != null) ? mapping : [];
this.reverse = new Object();
for (var i in this.mapping)
{
this.reverse[this.mapping[i]] = i;
}
} | javascript | function mxObjectCodec(template, exclude, idrefs, mapping)
{
this.template = template;
this.exclude = (exclude != null) ? exclude : [];
this.idrefs = (idrefs != null) ? idrefs : [];
this.mapping = (mapping != null) ? mapping : [];
this.reverse = new Object();
for (var i in this.mapping)
{
this.reverse[this.mapping[i]] = i;
}
} | [
"function",
"mxObjectCodec",
"(",
"template",
",",
"exclude",
",",
"idrefs",
",",
"mapping",
")",
"{",
"this",
".",
"template",
"=",
"template",
";",
"this",
".",
"exclude",
"=",
"(",
"exclude",
"!=",
"null",
")",
"?",
"exclude",
":",
"[",
"]",
";",
... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxObjectCodec
Generic codec for JavaScript objects that implements a mapping between
JavaScript objects and XML nodes that maps each field or element to an
attribute or child node, and vice versa.
Atomic Values:
Consider the following example.
(code)
var obj = new Object();
obj.foo = "Foo";
obj.bar = "Bar";
(end)
This object is encoded into an XML node using the following.
(code)
var enc = new mxCodec();
var node = enc.encode(obj);
(end)
The output of the encoding may be viewed using <mxLog> as follows.
(code)
mxLog.show();
mxLog.debug(mxUtils.getPrettyXml(node));
(end)
Finally, the result of the encoding looks as follows.
(code)
<Object foo="Foo" bar="Bar"/>
(end)
In the above output, the foo and bar fields have been mapped to attributes
with the same names, and the name of the constructor was used for the
nodename.
Booleans:
Since booleans are numbers in JavaScript, all boolean values are encoded
into 1 for true and 0 for false. The decoder also accepts the string true
and false for boolean values.
Objects:
The above scheme is applied to all atomic fields, that is, to all non-object
fields of an object. For object fields, a child node is created with a
special attribute that contains the fieldname. This special attribute is
called "as" and hence, as is a reserved word that should not be used for a
fieldname.
Consider the following example where foo is an object and bar is an atomic
property of foo.
(code)
var obj = {foo: {bar: "Bar"}};
(end)
This will be mapped to the following XML structure by mxObjectCodec.
(code)
<Object>
<Object bar="Bar" as="foo"/>
</Object>
(end)
In the above output, the inner Object node contains the as-attribute that
specifies the fieldname in the enclosing object. That is, the field foo was
mapped to a child node with an as-attribute that has the value foo.
Arrays:
Arrays are special objects that are either associative, in which case each
key, value pair is treated like a field where the key is the fieldname, or
they are a sequence of atomic values and objects, which is mapped to a
sequence of child nodes. For object elements, the above scheme is applied
without the use of the special as-attribute for creating each child. For
atomic elements, a special add-node is created with the value stored in the
value-attribute.
For example, the following array contains one atomic value and one object
with a field called bar. Furthermore it contains two associative entries
called bar with an atomic value, and foo with an object value.
(code)
var obj = ["Bar", {bar: "Bar"}];
obj["bar"] = "Bar";
obj["foo"] = {bar: "Bar"};
(end)
This array is represented by the following XML nodes.
(code)
<Array bar="Bar">
<add value="Bar"/>
<Object bar="Bar"/>
<Object bar="Bar" as="foo"/>
</Array>
(end)
The Array node name is the name of the constructor. The additional
as-attribute in the last child contains the key of the associative entry,
whereas the second last child is part of the array sequence and does not
have an as-attribute.
References:
Objects may be represented as child nodes or attributes with ID values,
which are used to lookup the object in a table within <mxCodec>. The
<isReference> function is in charge of deciding if a specific field should
be encoded as a reference or not. Its default implementation returns true if
the fieldname is in <idrefs>, an array of strings that is used to configure
the <mxObjectCodec>.
Using this approach, the mapping does not guarantee that the referenced
object itself exists in the document. The fields that are encoded as
references must be carefully chosen to make sure all referenced objects
exist in the document, or may be resolved by some other means if necessary.
For example, in the case of the graph model all cells are stored in a tree
whose root is referenced by the model's root field. A tree is a structure
that is well suited for an XML representation, however, the additional edges
in the graph model have a reference to a source and target cell, which are
also contained in the tree. To handle this case, the source and target cell
of an edge are treated as references, whereas the children are treated as
objects. Since all cells are contained in the tree and no edge references a
source or target outside the tree, this setup makes sure all referenced
objects are contained in the document.
In the case of a tree structure we must further avoid infinite recursion by
ignoring the parent reference of each child. This is done by returning true
in <isExcluded>, whose default implementation uses the array of excluded
fieldnames passed to the mxObjectCodec constructor.
References are only used for cells in mxGraph. For defining other
referencable object types, the codec must be able to work out the ID of an
object. This is done by implementing <mxCodec.reference>. For decoding a
reference, the XML node with the respective id-attribute is fetched from the
document, decoded, and stored in a lookup table for later reference. For
looking up external objects, <mxCodec.lookup> may be implemented.
Expressions:
For decoding JavaScript expressions, the add-node may be used with a text
content that contains the JavaScript expression. For example, the following
creates a field called foo in the enclosing object and assigns it the value
of <mxConstants.ALIGN_LEFT>.
(code)
<Object>
<add as="foo">mxConstants.ALIGN_LEFT</add>
</Object>
(end)
The resulting object has a field called foo with the value "left". Its XML
representation looks as follows.
(code)
<Object foo="left"/>
(end)
This means the expression is evaluated at decoding time and the result of
the evaluation is stored in the respective field. Valid expressions are all
JavaScript expressions, including function definitions, which are mapped to
functions on the resulting object.
Expressions are only evaluated if <allowEval> is true.
Constructor: mxObjectCodec
Constructs a new codec for the specified template object.
The variables in the optional exclude array are ignored by
the codec. Variables in the optional idrefs array are
turned into references in the XML. The optional mapping
may be used to map from variable names to XML attributes.
The argument is created as follows:
(code)
var mapping = new Object();
mapping['variableName'] = 'attribute-name';
(end)
Parameters:
template - Prototypical instance of the object to be
encoded/decoded.
exclude - Optional array of fieldnames to be ignored.
idrefs - Optional array of fieldnames to be converted to/from
references.
mapping - Optional mapping from field- to attributenames. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxObjectCodec"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L86909-L86923 | train | The object codec | [
30522,
3853,
25630,
16429,
20614,
16044,
2278,
1006,
23561,
1010,
23329,
1010,
8909,
2890,
10343,
1010,
12375,
1007,
1063,
2023,
1012,
23561,
1027,
23561,
1025,
2023,
1012,
23329,
1027,
1006,
23329,
999,
1027,
19701,
1007,
1029,
23329,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/codemirror/markdown.js | blankLine | function blankLine(state) {
// Reset linkTitle state
state.linkTitle = false;
state.linkHref = false;
state.linkText = false;
// Reset EM state
state.em = false;
// Reset STRONG state
state.strong = false;
// Reset strikethrough state
state.strikethrough = false;
// Reset state.quote
state.quote = 0;
// Reset state.indentedCode
state.indentedCode = false;
if (state.f == htmlBlock) {
var exit = htmlModeMissing
if (!exit) {
var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
exit = inner.mode.name == "xml" && inner.state.tagStart === null &&
(!inner.state.context && inner.state.tokenize.isInText)
}
if (exit) {
state.f = inlineNormal;
state.block = blockNormal;
state.htmlState = null;
}
}
// Reset state.trailingSpace
state.trailingSpace = 0;
state.trailingSpaceNewLine = false;
// Mark this line as blank
state.prevLine = state.thisLine
state.thisLine = {stream: null}
return null;
} | javascript | function blankLine(state) {
// Reset linkTitle state
state.linkTitle = false;
state.linkHref = false;
state.linkText = false;
// Reset EM state
state.em = false;
// Reset STRONG state
state.strong = false;
// Reset strikethrough state
state.strikethrough = false;
// Reset state.quote
state.quote = 0;
// Reset state.indentedCode
state.indentedCode = false;
if (state.f == htmlBlock) {
var exit = htmlModeMissing
if (!exit) {
var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
exit = inner.mode.name == "xml" && inner.state.tagStart === null &&
(!inner.state.context && inner.state.tokenize.isInText)
}
if (exit) {
state.f = inlineNormal;
state.block = blockNormal;
state.htmlState = null;
}
}
// Reset state.trailingSpace
state.trailingSpace = 0;
state.trailingSpaceNewLine = false;
// Mark this line as blank
state.prevLine = state.thisLine
state.thisLine = {stream: null}
return null;
} | [
"function",
"blankLine",
"(",
"state",
")",
"{",
"// Reset linkTitle state",
"state",
".",
"linkTitle",
"=",
"false",
";",
"state",
".",
"linkHref",
"=",
"false",
";",
"state",
".",
"linkText",
"=",
"false",
";",
"// Reset EM state",
"state",
".",
"em",
"=",... | Blocks | [
"Blocks"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/codemirror/markdown.js#L109-L144 | train | Mark a blank line | [
30522,
3853,
8744,
4179,
1006,
2110,
1007,
1063,
1013,
1013,
25141,
4957,
3775,
9286,
2110,
2110,
1012,
4957,
3775,
9286,
1027,
6270,
1025,
2110,
1012,
4957,
28362,
2546,
1027,
6270,
1025,
2110,
1012,
4957,
18209,
1027,
6270,
1025,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
youzan/vant | build/build-style.js | compile | async function compile() {
let codes;
const paths = await glob(['./es/**/*.less', './lib/**/*.less'], { absolute: true });
codes = await Promise.all(paths.map(path => fs.readFile(path, 'utf-8')));
codes = await compileLess(codes, paths);
codes = await compilePostcss(codes, paths);
codes = await compileCsso(codes);
await dest(codes, paths);
} | javascript | async function compile() {
let codes;
const paths = await glob(['./es/**/*.less', './lib/**/*.less'], { absolute: true });
codes = await Promise.all(paths.map(path => fs.readFile(path, 'utf-8')));
codes = await compileLess(codes, paths);
codes = await compilePostcss(codes, paths);
codes = await compileCsso(codes);
await dest(codes, paths);
} | [
"async",
"function",
"compile",
"(",
")",
"{",
"let",
"codes",
";",
"const",
"paths",
"=",
"await",
"glob",
"(",
"[",
"'./es/**/*.less'",
",",
"'./lib/**/*.less'",
"]",
",",
"{",
"absolute",
":",
"true",
"}",
")",
";",
"codes",
"=",
"await",
"Promise",
... | compile component css | [
"compile",
"component",
"css"
] | 21589c9b9fd70b750deed1d31226b8d2c74d62c0 | https://github.com/youzan/vant/blob/21589c9b9fd70b750deed1d31226b8d2c74d62c0/build/build-style.js#L49-L59 | train | Compile all CSS files | [
30522,
2004,
6038,
2278,
3853,
4012,
22090,
1006,
1007,
1063,
2292,
9537,
1025,
9530,
3367,
10425,
1027,
26751,
1043,
4135,
2497,
1006,
1031,
1005,
1012,
1013,
9686,
1013,
1008,
1008,
1013,
1008,
1012,
2625,
1005,
1010,
1005,
1012,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js | searchIndex | function searchIndex(sQuery) {
sQuery = preprocessQuery(sQuery);
return new Promise(function(resolve, reject) {
fetchIndex().then(function(oIndex) {
var aSearchResults,
oSearchResultsCollector = new SearchResultCollector();
function searchByField(sFieldToSearch, sSubQuery, bReturnMatchedDocWord) {
var aResults = oIndex.search(sSubQuery, createSearchConfig(sFieldToSearch));
oSearchResultsCollector.add(aResults,
sSubQuery,
sFieldToSearch,
bReturnMatchedDocWord);
}
// search by fields in priority order
searchByField("title", sQuery);
METADATA_FIELDS.forEach(function(sField) {
lunr.tokenizer(sQuery).forEach(function(sSubQuery) {
searchByField(sField, sSubQuery, true);
});
});
searchByField("paramTypes", sQuery);
searchByField("contents", sQuery);
// collect all results
aSearchResults = oSearchResultsCollector.getAll();
resolve({
success: !!(aSearchResults.length),
totalHits: aSearchResults.length,
matches: aSearchResults
});
});
});
} | javascript | function searchIndex(sQuery) {
sQuery = preprocessQuery(sQuery);
return new Promise(function(resolve, reject) {
fetchIndex().then(function(oIndex) {
var aSearchResults,
oSearchResultsCollector = new SearchResultCollector();
function searchByField(sFieldToSearch, sSubQuery, bReturnMatchedDocWord) {
var aResults = oIndex.search(sSubQuery, createSearchConfig(sFieldToSearch));
oSearchResultsCollector.add(aResults,
sSubQuery,
sFieldToSearch,
bReturnMatchedDocWord);
}
// search by fields in priority order
searchByField("title", sQuery);
METADATA_FIELDS.forEach(function(sField) {
lunr.tokenizer(sQuery).forEach(function(sSubQuery) {
searchByField(sField, sSubQuery, true);
});
});
searchByField("paramTypes", sQuery);
searchByField("contents", sQuery);
// collect all results
aSearchResults = oSearchResultsCollector.getAll();
resolve({
success: !!(aSearchResults.length),
totalHits: aSearchResults.length,
matches: aSearchResults
});
});
});
} | [
"function",
"searchIndex",
"(",
"sQuery",
")",
"{",
"sQuery",
"=",
"preprocessQuery",
"(",
"sQuery",
")",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"fetchIndex",
"(",
")",
".",
"then",
"(",
"function",
"("... | Searches the index, given a search string
@param sQuery, the search string
@returns {Promise<any>} | [
"Searches",
"the",
"index",
"given",
"a",
"search",
"string"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js#L158-L200 | train | Search the index using the given query | [
30522,
3853,
3945,
22254,
10288,
1006,
5490,
13094,
2100,
1007,
1063,
5490,
13094,
2100,
1027,
17463,
3217,
9623,
17729,
2854,
1006,
5490,
13094,
2100,
1007,
1025,
2709,
2047,
4872,
1006,
3853,
1006,
10663,
1010,
15454,
1007,
1063,
18584,
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... |
mui-org/material-ui | docs/src/modules/components/GoogleAnalytics.js | handleClick | function handleClick(event) {
const rootNode = document;
let element = event.target;
while (element && element !== rootNode) {
const category = element.getAttribute('data-ga-event-category');
// We reach a tracking element, no need to look higher in the dom tree.
if (category) {
window.ga('send', {
hitType: 'event',
eventCategory: category,
eventAction: element.getAttribute('data-ga-event-action'),
eventLabel: element.getAttribute('data-ga-event-label'),
});
break;
}
element = element.parentNode;
}
} | javascript | function handleClick(event) {
const rootNode = document;
let element = event.target;
while (element && element !== rootNode) {
const category = element.getAttribute('data-ga-event-category');
// We reach a tracking element, no need to look higher in the dom tree.
if (category) {
window.ga('send', {
hitType: 'event',
eventCategory: category,
eventAction: element.getAttribute('data-ga-event-action'),
eventLabel: element.getAttribute('data-ga-event-label'),
});
break;
}
element = element.parentNode;
}
} | [
"function",
"handleClick",
"(",
"event",
")",
"{",
"const",
"rootNode",
"=",
"document",
";",
"let",
"element",
"=",
"event",
".",
"target",
";",
"while",
"(",
"element",
"&&",
"element",
"!==",
"rootNode",
")",
"{",
"const",
"category",
"=",
"element",
... | So we can write code like: <Button ga-event-category="demo" ga-event-action="expand" > Foo </Button> | [
"So",
"we",
"can",
"write",
"code",
"like",
":",
"<Button",
"ga",
"-",
"event",
"-",
"category",
"=",
"demo",
"ga",
"-",
"event",
"-",
"action",
"=",
"expand",
">",
"Foo",
"<",
"/",
"Button",
">"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/modules/components/GoogleAnalytics.js#L12-L32 | train | Handle click events | [
30522,
3853,
5047,
20464,
6799,
1006,
2724,
1007,
1063,
9530,
3367,
7117,
3630,
3207,
1027,
6254,
1025,
2292,
5783,
1027,
2724,
1012,
4539,
1025,
2096,
1006,
5783,
1004,
1004,
5783,
999,
1027,
1027,
7117,
3630,
3207,
1007,
1063,
9530,
336... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getsentry/sentry-javascript | packages/raven-node/lib/utils.js | snipLine | function snipLine(line, colno) {
var ll = line.length;
if (ll <= 150) return line;
if (colno > ll) colno = ll;
var start = Math.max(colno - 60, 0);
if (start < 5) start = 0;
var end = Math.min(start + 140, ll);
if (end > ll - 5) end = ll;
if (end === ll) start = Math.max(end - 140, 0);
line = line.slice(start, end);
if (start > 0) line = '{snip} ' + line;
if (end < ll) line += ' {snip}';
return line;
} | javascript | function snipLine(line, colno) {
var ll = line.length;
if (ll <= 150) return line;
if (colno > ll) colno = ll;
var start = Math.max(colno - 60, 0);
if (start < 5) start = 0;
var end = Math.min(start + 140, ll);
if (end > ll - 5) end = ll;
if (end === ll) start = Math.max(end - 140, 0);
line = line.slice(start, end);
if (start > 0) line = '{snip} ' + line;
if (end < ll) line += ' {snip}';
return line;
} | [
"function",
"snipLine",
"(",
"line",
",",
"colno",
")",
"{",
"var",
"ll",
"=",
"line",
".",
"length",
";",
"if",
"(",
"ll",
"<=",
"150",
")",
"return",
"line",
";",
"if",
"(",
"colno",
">",
"ll",
")",
"colno",
"=",
"ll",
";",
"var",
"start",
"=... | This is basically just `trim_line` from https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67 | [
"This",
"is",
"basically",
"just",
"trim_line",
"from",
"https",
":",
"//",
"github",
".",
"com",
"/",
"getsentry",
"/",
"sentry",
"/",
"blob",
"/",
"master",
"/",
"src",
"/",
"sentry",
"/",
"lang",
"/",
"javascript",
"/",
"processor",
".",
"py#L67"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-node/lib/utils.js#L297-L314 | train | snip line | [
30522,
3853,
1055,
3490,
28296,
2063,
1006,
2240,
1010,
8902,
3630,
1007,
1063,
13075,
2222,
1027,
2240,
1012,
3091,
1025,
2065,
1006,
2222,
1026,
1027,
5018,
1007,
2709,
2240,
1025,
2065,
1006,
8902,
3630,
1028,
2222,
1007,
8902,
3630,
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... |
ksky521/nodeppt | packages/nodeppt/lib/ask.js | render | function render(content, data) {
if (content && /{{([^{}]+)}}/g.test(content)) {
Object.keys(data).forEach(key => {
if (data[key] && typeof data[key] === 'string') {
content = content.split(new RegExp(`{{\\s*${key}\\s*}}`, 'g')).join(data[key]);
}
});
return content;
}
return content;
} | javascript | function render(content, data) {
if (content && /{{([^{}]+)}}/g.test(content)) {
Object.keys(data).forEach(key => {
if (data[key] && typeof data[key] === 'string') {
content = content.split(new RegExp(`{{\\s*${key}\\s*}}`, 'g')).join(data[key]);
}
});
return content;
}
return content;
} | [
"function",
"render",
"(",
"content",
",",
"data",
")",
"{",
"if",
"(",
"content",
"&&",
"/",
"{{([^{}]+)}}",
"/",
"g",
".",
"test",
"(",
"content",
")",
")",
"{",
"Object",
".",
"keys",
"(",
"data",
")",
".",
"forEach",
"(",
"key",
"=>",
"{",
"i... | 将 default 使用 templateData 渲染一下,比如作者之类的 | [
"将",
"default",
"使用",
"templateData",
"渲染一下,比如作者之类的"
] | ca77e29ef818c08b0522b31e3925b073cf159b9c | https://github.com/ksky521/nodeppt/blob/ca77e29ef818c08b0522b31e3925b073cf159b9c/packages/nodeppt/lib/ask.js#L26-L37 | train | render content with data | [
30522,
3853,
17552,
1006,
4180,
1010,
2951,
1007,
1063,
2065,
1006,
4180,
1004,
1004,
1013,
1063,
1063,
1006,
1031,
1034,
1063,
1065,
1033,
1009,
1007,
1065,
1065,
1013,
1043,
1012,
3231,
1006,
4180,
1007,
1007,
1063,
4874,
1012,
6309,
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... |
vuejs/vuex | dist/vuex.esm.js | normalizeNamespace | function normalizeNamespace (fn) {
return function (namespace, map) {
if (typeof namespace !== 'string') {
map = namespace;
namespace = '';
} else if (namespace.charAt(namespace.length - 1) !== '/') {
namespace += '/';
}
return fn(namespace, map)
}
} | javascript | function normalizeNamespace (fn) {
return function (namespace, map) {
if (typeof namespace !== 'string') {
map = namespace;
namespace = '';
} else if (namespace.charAt(namespace.length - 1) !== '/') {
namespace += '/';
}
return fn(namespace, map)
}
} | [
"function",
"normalizeNamespace",
"(",
"fn",
")",
"{",
"return",
"function",
"(",
"namespace",
",",
"map",
")",
"{",
"if",
"(",
"typeof",
"namespace",
"!==",
"'string'",
")",
"{",
"map",
"=",
"namespace",
";",
"namespace",
"=",
"''",
";",
"}",
"else",
... | Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map.
@param {Function} fn
@return {Function} | [
"Return",
"a",
"function",
"expect",
"two",
"param",
"contains",
"namespace",
"and",
"map",
".",
"it",
"will",
"normalize",
"the",
"namespace",
"and",
"then",
"the",
"param",
"s",
"function",
"will",
"handle",
"the",
"new",
"namespace",
"and",
"the",
"map",
... | d7c7f9844831f98c5c9aaca213746c4ccc5d6929 | https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/dist/vuex.esm.js#L960-L970 | train | normalize namespace | [
30522,
3853,
3671,
4697,
18442,
23058,
1006,
30524,
1005,
5164,
1005,
1007,
1063,
4949,
1027,
3415,
15327,
1025,
3415,
15327,
1027,
1005,
1005,
1025,
1065,
2842,
2065,
1006,
3415,
15327,
1012,
25869,
4017,
1006,
3415,
15327,
1012,
3091,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mui-org/material-ui | docs/src/pages/guides/interoperability/EmotionCSS.js | EmotionCSS | function EmotionCSS() {
return (
<div>
<Button>Material-UI</Button>
<Button
css={css`
background: linear-gradient(45deg, #fe6b8b 30%, #ff8e53 90%);
border-radius: 3px;
border: 0;
color: white;
height: 48px;
padding: 0 30px;
box-shadow: 0 3px 5px 2px rgba(255, 105, 135, 0.3);
`}
>
Emotion
</Button>
</div>
);
} | javascript | function EmotionCSS() {
return (
<div>
<Button>Material-UI</Button>
<Button
css={css`
background: linear-gradient(45deg, #fe6b8b 30%, #ff8e53 90%);
border-radius: 3px;
border: 0;
color: white;
height: 48px;
padding: 0 30px;
box-shadow: 0 3px 5px 2px rgba(255, 105, 135, 0.3);
`}
>
Emotion
</Button>
</div>
);
} | [
"function",
"EmotionCSS",
"(",
")",
"{",
"return",
"(",
"<",
"div",
">",
"\n ",
"<",
"Button",
">",
"Material-UI",
"<",
"/",
"Button",
">",
"\n ",
"<",
"Button",
"css",
"=",
"{",
"css",
"`",
"`",
"}",
">",
"\n Emotion\n ",
"<",
"/... | We just assign them the Button's className attribute | [
"We",
"just",
"assign",
"them",
"the",
"Button",
"s",
"className",
"attribute"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/pages/guides/interoperability/EmotionCSS.js#L6-L25 | train | EmotionCSS - > HTMLElement | [
30522,
3853,
7603,
6169,
2015,
1006,
1007,
1063,
2709,
1006,
1026,
4487,
2615,
1028,
1026,
6462,
1028,
3430,
1011,
21318,
1026,
1013,
6462,
1028,
1026,
6462,
20116,
2015,
1027,
1063,
20116,
2015,
1036,
4281,
1024,
7399,
1011,
17978,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/transform-apijson-for-sdk.js | function (target) {
var result = "";
if (target) {
target.forEach(function (element) {
result += element + '<br>';
});
}
result = this._preProcessLinksInTextBlock(result);
return result;
} | javascript | function (target) {
var result = "";
if (target) {
target.forEach(function (element) {
result += element + '<br>';
});
}
result = this._preProcessLinksInTextBlock(result);
return result;
} | [
"function",
"(",
"target",
")",
"{",
"var",
"result",
"=",
"\"\"",
";",
"if",
"(",
"target",
")",
"{",
"target",
".",
"forEach",
"(",
"function",
"(",
"element",
")",
"{",
"result",
"+=",
"element",
"+",
"'<br>'",
";",
"}",
")",
";",
"}",
"result",... | Formats the target and applies to texts of annotations
@param target - the array of texts to be formatted
@returns string - the formatted text | [
"Formats",
"the",
"target",
"and",
"applies",
"to",
"texts",
"of",
"annotations"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L968-L979 | train | Returns a string containing the links in the target text block | [
30522,
3853,
1006,
4539,
1007,
1063,
13075,
2765,
1027,
1000,
1000,
1025,
2065,
1006,
4539,
1007,
1063,
4539,
1012,
18921,
6776,
1006,
3853,
1006,
5783,
1007,
1063,
2765,
1009,
1027,
5783,
1009,
1005,
1026,
7987,
1028,
1005,
1025,
1065,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/utils/NodeConnection.js | setDeferredTimeout | function setDeferredTimeout(deferred, delay) {
var timer = setTimeout(function () {
deferred.reject("timeout");
}, delay);
deferred.always(function () { clearTimeout(timer); });
} | javascript | function setDeferredTimeout(deferred, delay) {
var timer = setTimeout(function () {
deferred.reject("timeout");
}, delay);
deferred.always(function () { clearTimeout(timer); });
} | [
"function",
"setDeferredTimeout",
"(",
"deferred",
",",
"delay",
")",
"{",
"var",
"timer",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"deferred",
".",
"reject",
"(",
"\"timeout\"",
")",
";",
"}",
",",
"delay",
")",
";",
"deferred",
".",
"always",... | 2^32 - 1
@private
Helper function to auto-reject a deferred after a given amount of time.
If the deferred is resolved/rejected manually, then the timeout is
automatically cleared. | [
"2^32",
"-",
"1"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/NodeConnection.js#L64-L69 | train | Set deferred timeout | [
30522,
3853,
2275,
3207,
7512,
5596,
7292,
5833,
1006,
13366,
28849,
2094,
1010,
8536,
1007,
1063,
13075,
25309,
1027,
2275,
7292,
5833,
1006,
3853,
1006,
1007,
1063,
13366,
28849,
2094,
1012,
15454,
1006,
1000,
2051,
5833,
1000,
1007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/scrollSync/scrollSync.js | changeButtonVisiblityStateIfNeed | function changeButtonVisiblityStateIfNeed() {
if (editor.mdPreviewStyle === 'vertical' && editor.currentMode === 'markdown') {
button.$el.show();
$divider.show();
} else {
button.$el.hide();
$divider.hide();
}
} | javascript | function changeButtonVisiblityStateIfNeed() {
if (editor.mdPreviewStyle === 'vertical' && editor.currentMode === 'markdown') {
button.$el.show();
$divider.show();
} else {
button.$el.hide();
$divider.hide();
}
} | [
"function",
"changeButtonVisiblityStateIfNeed",
"(",
")",
"{",
"if",
"(",
"editor",
".",
"mdPreviewStyle",
"===",
"'vertical'",
"&&",
"editor",
".",
"currentMode",
"===",
"'markdown'",
")",
"{",
"button",
".",
"$el",
".",
"show",
"(",
")",
";",
"$divider",
"... | change button visiblity state | [
"change",
"button",
"visiblity",
"state"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/scrollSync/scrollSync.js#L86-L94 | train | Change the visibility state of the button | [
30522,
3853,
2689,
8569,
15474,
11365,
12322,
18605,
9153,
2618,
10128,
24045,
2094,
1006,
1007,
1063,
2065,
1006,
3559,
1012,
9108,
28139,
8584,
21756,
2571,
1027,
1027,
1027,
1005,
7471,
1005,
1004,
1004,
3559,
1012,
2783,
5302,
3207,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getsentry/sentry-javascript | packages/raven-js/src/raven.js | function(msg, data) {
self.captureBreadcrumb({
message: msg,
level: data.level,
category: 'console'
});
} | javascript | function(msg, data) {
self.captureBreadcrumb({
message: msg,
level: data.level,
category: 'console'
});
} | [
"function",
"(",
"msg",
",",
"data",
")",
"{",
"self",
".",
"captureBreadcrumb",
"(",
"{",
"message",
":",
"msg",
",",
"level",
":",
"data",
".",
"level",
",",
"category",
":",
"'console'",
"}",
")",
";",
"}"
] | console | [
"console"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/src/raven.js#L1561-L1567 | train | Log a message to the console | [
30522,
3853,
1006,
5796,
2290,
1010,
2951,
1007,
1063,
2969,
1012,
5425,
27035,
26775,
25438,
1006,
1063,
4471,
1024,
5796,
2290,
1010,
2504,
1024,
2951,
1012,
2504,
1010,
4696,
1024,
1005,
10122,
1005,
1065,
1007,
1025,
1065,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | getBindingOrContext | function getBindingOrContext(iPart) {
if (!vBindingOrContext) {
// lazy initialization
// BEWARE: this is not yet defined when createContextInterface() is called!
vBindingOrContext = oWithControl.getBinding("any");
if (vBindingOrContext instanceof CompositeBinding) {
vBindingOrContext = vBindingOrContext.getBindings();
if (i !== undefined) { // not a root formatter
vBindingOrContext = vBindingOrContext[i];
}
}
}
return Array.isArray(vBindingOrContext)
? vBindingOrContext[iPart]
: vBindingOrContext;
} | javascript | function getBindingOrContext(iPart) {
if (!vBindingOrContext) {
// lazy initialization
// BEWARE: this is not yet defined when createContextInterface() is called!
vBindingOrContext = oWithControl.getBinding("any");
if (vBindingOrContext instanceof CompositeBinding) {
vBindingOrContext = vBindingOrContext.getBindings();
if (i !== undefined) { // not a root formatter
vBindingOrContext = vBindingOrContext[i];
}
}
}
return Array.isArray(vBindingOrContext)
? vBindingOrContext[iPart]
: vBindingOrContext;
} | [
"function",
"getBindingOrContext",
"(",
"iPart",
")",
"{",
"if",
"(",
"!",
"vBindingOrContext",
")",
"{",
"// lazy initialization",
"// BEWARE: this is not yet defined when createContextInterface() is called!",
"vBindingOrContext",
"=",
"oWithControl",
".",
"getBinding",
"(",
... | /*
Returns the single binding or model context related to the current formatter call.
@param {number} [iPart]
index of part in case of the root formatter of a composite binding
@returns {sap.ui.model.Binding|sap.ui.model.Context}
single binding or model context | [
"/",
"*",
"Returns",
"the",
"single",
"binding",
"or",
"model",
"context",
"related",
"to",
"the",
"current",
"formatter",
"call",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L95-L113 | train | Returns the binding or context for the given part | [
30522,
3853,
2131,
8428,
4667,
2953,
8663,
18209,
1006,
24531,
5339,
1007,
1063,
2065,
1006,
999,
1058,
8428,
4667,
2953,
8663,
18209,
1007,
1063,
1013,
1013,
13971,
3988,
3989,
1013,
1013,
2022,
8059,
1024,
2023,
2003,
2025,
2664,
4225,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/models/settings.js | migrateEnsureHotKeys | function migrateEnsureHotKeys(settings: Settings): Settings {
settings.hotKeyRegistry = {
...hotkeys.newDefaultRegistry(),
...settings.hotKeyRegistry,
};
return settings;
} | javascript | function migrateEnsureHotKeys(settings: Settings): Settings {
settings.hotKeyRegistry = {
...hotkeys.newDefaultRegistry(),
...settings.hotKeyRegistry,
};
return settings;
} | [
"function",
"migrateEnsureHotKeys",
"(",
"settings",
":",
"Settings",
")",
":",
"Settings",
"{",
"settings",
".",
"hotKeyRegistry",
"=",
"{",
"...",
"hotkeys",
".",
"newDefaultRegistry",
"(",
")",
",",
"...",
"settings",
".",
"hotKeyRegistry",
",",
"}",
";",
... | Ensure map is updated when new hotkeys are added | [
"Ensure",
"map",
"is",
"updated",
"when",
"new",
"hotkeys",
"are",
"added"
] | e24ce7f7b41246e700c4b9bdb6b34b6652ad589b | https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-app/app/models/settings.js#L127-L133 | train | Migrate the HotKeys to the default registry. | [
30522,
3853,
22806,
6132,
5397,
12326,
14839,
2015,
1006,
10906,
1024,
10906,
1007,
1024,
10906,
1063,
10906,
1012,
2980,
14839,
2890,
24063,
2854,
1027,
1063,
1012,
1012,
1012,
2980,
14839,
2015,
1012,
2047,
3207,
7011,
11314,
2890,
24063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/func-names.js | hasInferredName | function hasInferredName(node) {
const parent = node.parent;
return isObjectOrClassMethod(node) ||
(parent.type === "VariableDeclarator" && parent.id.type === "Identifier" && parent.init === node) ||
(parent.type === "Property" && parent.value === node) ||
(parent.type === "AssignmentExpression" && parent.left.type === "Identifier" && parent.right === node) ||
(parent.type === "ExportDefaultDeclaration" && parent.declaration === node) ||
(parent.type === "AssignmentPattern" && parent.right === node);
} | javascript | function hasInferredName(node) {
const parent = node.parent;
return isObjectOrClassMethod(node) ||
(parent.type === "VariableDeclarator" && parent.id.type === "Identifier" && parent.init === node) ||
(parent.type === "Property" && parent.value === node) ||
(parent.type === "AssignmentExpression" && parent.left.type === "Identifier" && parent.right === node) ||
(parent.type === "ExportDefaultDeclaration" && parent.declaration === node) ||
(parent.type === "AssignmentPattern" && parent.right === node);
} | [
"function",
"hasInferredName",
"(",
"node",
")",
"{",
"const",
"parent",
"=",
"node",
".",
"parent",
";",
"return",
"isObjectOrClassMethod",
"(",
"node",
")",
"||",
"(",
"parent",
".",
"type",
"===",
"\"VariableDeclarator\"",
"&&",
"parent",
".",
"id",
".",
... | Determines whether the current FunctionExpression node has a name that would be
inferred from context in a conforming ES6 environment.
@param {ASTNode} node - A node to check.
@returns {boolean} True if the node would have a name assigned automatically. | [
"Determines",
"whether",
"the",
"current",
"FunctionExpression",
"node",
"has",
"a",
"name",
"that",
"would",
"be",
"inferred",
"from",
"context",
"in",
"a",
"conforming",
"ES6",
"environment",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/func-names.js#L113-L122 | train | Check if node has inferred name | [
30522,
3853,
2038,
2378,
7512,
5596,
18442,
1006,
13045,
1007,
1063,
9530,
3367,
6687,
1027,
13045,
1012,
6687,
1025,
2709,
11163,
2497,
20614,
2953,
26266,
11368,
6806,
2094,
1006,
13045,
1007,
1064,
1064,
1006,
6687,
1012,
2828,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/angular | tools/npm/check-node-modules.js | _deleteDir | function _deleteDir(path) {
if (fs.existsSync(path)) {
var subpaths = fs.readdirSync(path);
subpaths.forEach(function(subpath) {
var curPath = path + '/' + subpath;
if (fs.lstatSync(curPath).isDirectory()) {
_deleteDir(curPath);
} else {
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
} | javascript | function _deleteDir(path) {
if (fs.existsSync(path)) {
var subpaths = fs.readdirSync(path);
subpaths.forEach(function(subpath) {
var curPath = path + '/' + subpath;
if (fs.lstatSync(curPath).isDirectory()) {
_deleteDir(curPath);
} else {
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
} | [
"function",
"_deleteDir",
"(",
"path",
")",
"{",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"path",
")",
")",
"{",
"var",
"subpaths",
"=",
"fs",
".",
"readdirSync",
"(",
"path",
")",
";",
"subpaths",
".",
"forEach",
"(",
"function",
"(",
"subpath",
")"... | Custom implementation of recursive `rm` because we can't rely on the state of node_modules to
pull in existing module. | [
"Custom",
"implementation",
"of",
"recursive",
"rm",
"because",
"we",
"can",
"t",
"rely",
"on",
"the",
"state",
"of",
"node_modules",
"to",
"pull",
"in",
"existing",
"module",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/npm/check-node-modules.js#L41-L54 | train | Delete directory | [
30522,
3853,
1035,
17159,
4313,
1006,
4130,
1007,
1063,
2065,
1006,
1042,
2015,
1012,
6526,
6508,
12273,
1006,
4130,
1007,
1007,
1063,
13075,
4942,
15069,
2015,
1027,
1042,
2015,
1012,
3191,
4305,
2869,
6038,
2278,
1006,
4130,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
NetEase/pomelo | lib/connectors/sioconnector.js | function(port, host, opts) {
if (!(this instanceof Connector)) {
return new Connector(port, host, opts);
}
EventEmitter.call(this);
this.port = port;
this.host = host;
this.opts = opts;
this.heartbeats = opts.heartbeats || true;
this.closeTimeout = opts.closeTimeout || 60;
this.heartbeatTimeout = opts.heartbeatTimeout || 60;
this.heartbeatInterval = opts.heartbeatInterval || 25;
} | javascript | function(port, host, opts) {
if (!(this instanceof Connector)) {
return new Connector(port, host, opts);
}
EventEmitter.call(this);
this.port = port;
this.host = host;
this.opts = opts;
this.heartbeats = opts.heartbeats || true;
this.closeTimeout = opts.closeTimeout || 60;
this.heartbeatTimeout = opts.heartbeatTimeout || 60;
this.heartbeatInterval = opts.heartbeatInterval || 25;
} | [
"function",
"(",
"port",
",",
"host",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Connector",
")",
")",
"{",
"return",
"new",
"Connector",
"(",
"port",
",",
"host",
",",
"opts",
")",
";",
"}",
"EventEmitter",
".",
"call",
"("... | Connector that manager low level connection and protocol bewteen server and client.
Develper can provide their own connector to switch the low level prototol, such as tcp or probuf. | [
"Connector",
"that",
"manager",
"low",
"level",
"connection",
"and",
"protocol",
"bewteen",
"server",
"and",
"client",
".",
"Develper",
"can",
"provide",
"their",
"own",
"connector",
"to",
"switch",
"the",
"low",
"level",
"prototol",
"such",
"as",
"tcp",
"or",... | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/sioconnector.js#L16-L29 | train | Constructor for a new Cluster connector. | [
30522,
3853,
1006,
3417,
1010,
3677,
1010,
23569,
2015,
1007,
1063,
2065,
1006,
999,
1006,
2023,
6013,
11253,
19400,
1007,
1007,
1063,
2709,
2047,
19400,
1006,
3417,
1010,
3677,
1010,
23569,
2015,
1007,
1025,
1065,
2724,
23238,
12079,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js | debugMsr | function debugMsr(sMsg, sKey, sMsrId) {
//avoid redundant string concatenation & getMeasurement call
if (Log.getLevel() >= Log.Level.DEBUG) {
Log.debug(sMsg + " for key [" + sKey + "] took: " + Measurement.getMeasurement(sMsrId).duration);
}
} | javascript | function debugMsr(sMsg, sKey, sMsrId) {
//avoid redundant string concatenation & getMeasurement call
if (Log.getLevel() >= Log.Level.DEBUG) {
Log.debug(sMsg + " for key [" + sKey + "] took: " + Measurement.getMeasurement(sMsrId).duration);
}
} | [
"function",
"debugMsr",
"(",
"sMsg",
",",
"sKey",
",",
"sMsrId",
")",
"{",
"//avoid redundant string concatenation & getMeasurement call",
"if",
"(",
"Log",
".",
"getLevel",
"(",
")",
">=",
"Log",
".",
"Level",
".",
"DEBUG",
")",
"{",
"Log",
".",
"debug",
"(... | Logs a debug message related to certain measurement if log level is debug or higher
@param {string} sMsg the message
@param {string} sKey the key to log message for
@param {string} sMsrId the measurementId to use for obtaining the jquery.sap.measure measurement | [
"Logs",
"a",
"debug",
"message",
"related",
"to",
"certain",
"measurement",
"if",
"log",
"level",
"is",
"debug",
"or",
"higher"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js#L898-L903 | train | debug msr | [
30522,
3853,
2139,
8569,
21693,
21338,
1006,
22434,
2290,
1010,
15315,
3240,
1010,
22434,
14615,
1007,
1063,
1013,
1013,
4468,
21707,
5164,
9530,
16280,
9323,
1004,
2131,
4168,
3022,
5397,
3672,
2655,
2065,
1006,
8833,
1012,
2131,
20414,
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... |
adobe/brackets | src/JSUtils/ScopeManager.js | requestGuesses | function requestGuesses(session, document) {
var $deferred = $.Deferred(),
fileInfo = getFileInfo(session),
offset = getOffset(session, fileInfo);
postMessage({
type: MessageIds.TERN_GET_GUESSES_MSG,
fileInfo: fileInfo,
offset: offset
});
var promise = addPendingRequest(fileInfo.name, offset, MessageIds.TERN_GET_GUESSES_MSG);
promise.done(function (guesses) {
session.setGuesses(guesses);
$deferred.resolve();
}).fail(function () {
$deferred.reject();
});
return $deferred.promise();
} | javascript | function requestGuesses(session, document) {
var $deferred = $.Deferred(),
fileInfo = getFileInfo(session),
offset = getOffset(session, fileInfo);
postMessage({
type: MessageIds.TERN_GET_GUESSES_MSG,
fileInfo: fileInfo,
offset: offset
});
var promise = addPendingRequest(fileInfo.name, offset, MessageIds.TERN_GET_GUESSES_MSG);
promise.done(function (guesses) {
session.setGuesses(guesses);
$deferred.resolve();
}).fail(function () {
$deferred.reject();
});
return $deferred.promise();
} | [
"function",
"requestGuesses",
"(",
"session",
",",
"document",
")",
"{",
"var",
"$deferred",
"=",
"$",
".",
"Deferred",
"(",
")",
",",
"fileInfo",
"=",
"getFileInfo",
"(",
"session",
")",
",",
"offset",
"=",
"getOffset",
"(",
"session",
",",
"fileInfo",
... | Get a Promise for all of the known properties from TernJS, for the directory and file.
The properties will be used as guesses in tern.
@param {Session} session - the active hinting session
@param {Document} document - the document for which scope info is
desired
@return {jQuery.Promise} - The promise will not complete until the tern
request has completed. | [
"Get",
"a",
"Promise",
"for",
"all",
"of",
"the",
"known",
"properties",
"from",
"TernJS",
"for",
"the",
"directory",
"and",
"file",
".",
"The",
"properties",
"will",
"be",
"used",
"as",
"guesses",
"in",
"tern",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L661-L681 | train | Request the guesses for a document | [
30522,
3853,
5227,
22967,
8583,
1006,
5219,
1010,
6254,
1007,
1063,
13075,
1002,
13366,
28849,
2094,
1027,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1010,
5371,
2378,
14876,
1027,
2131,
8873,
19856,
14876,
1006,
5219,
1007,
1010,
16396,
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... |
graphql/graphql-js | src/jsutils/dedent.js | fixIndent | function fixIndent(str: string): string {
const trimmedStr = str
.replace(/^\n*/m, '') // remove leading newline
.replace(/[ \t]*$/, ''); // remove trailing spaces and tabs
const indentMatch = /^[ \t]*/.exec(trimmedStr);
invariant(Array.isArray(indentMatch));
const indent = indentMatch[0]; // figure out indent
return trimmedStr.replace(RegExp('^' + indent, 'mg'), ''); // remove indent
} | javascript | function fixIndent(str: string): string {
const trimmedStr = str
.replace(/^\n*/m, '') // remove leading newline
.replace(/[ \t]*$/, ''); // remove trailing spaces and tabs
const indentMatch = /^[ \t]*/.exec(trimmedStr);
invariant(Array.isArray(indentMatch));
const indent = indentMatch[0]; // figure out indent
return trimmedStr.replace(RegExp('^' + indent, 'mg'), ''); // remove indent
} | [
"function",
"fixIndent",
"(",
"str",
":",
"string",
")",
":",
"string",
"{",
"const",
"trimmedStr",
"=",
"str",
".",
"replace",
"(",
"/",
"^\\n*",
"/",
"m",
",",
"''",
")",
"// remove leading newline",
".",
"replace",
"(",
"/",
"[ \\t]*$",
"/",
",",
"... | fixes indentation by removing leading spaces and tabs from each line | [
"fixes",
"indentation",
"by",
"removing",
"leading",
"spaces",
"and",
"tabs",
"from",
"each",
"line"
] | b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef | https://github.com/graphql/graphql-js/blob/b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef/src/jsutils/dedent.js#L15-L23 | train | Fixes indent of a string | [
30522,
3853,
8081,
22254,
4765,
1006,
2358,
2099,
1024,
5164,
1007,
1024,
5164,
1063,
9530,
3367,
21920,
3367,
2099,
1027,
2358,
2099,
1012,
5672,
1006,
1013,
1034,
1032,
1050,
1008,
1013,
1049,
1010,
1005,
1005,
1007,
1013,
1013,
6366,
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... |
chartjs/Chart.js | src/plugins/plugin.legend.js | getBoxWidth | function getBoxWidth(labelOpts, fontSize) {
return labelOpts.usePointStyle && labelOpts.boxWidth > fontSize ?
fontSize :
labelOpts.boxWidth;
} | javascript | function getBoxWidth(labelOpts, fontSize) {
return labelOpts.usePointStyle && labelOpts.boxWidth > fontSize ?
fontSize :
labelOpts.boxWidth;
} | [
"function",
"getBoxWidth",
"(",
"labelOpts",
",",
"fontSize",
")",
"{",
"return",
"labelOpts",
".",
"usePointStyle",
"&&",
"labelOpts",
".",
"boxWidth",
">",
"fontSize",
"?",
"fontSize",
":",
"labelOpts",
".",
"boxWidth",
";",
"}"
] | Helper function to get the box width based on the usePointStyle option
@param {object} labelopts - the label options on the legend
@param {number} fontSize - the label font size
@return {number} width of the color box area | [
"Helper",
"function",
"to",
"get",
"the",
"box",
"width",
"based",
"on",
"the",
"usePointStyle",
"option"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/plugins/plugin.legend.js#L94-L98 | train | Get the width of the box | [
30522,
3853,
2131,
8758,
9148,
11927,
2232,
1006,
3830,
7361,
3215,
1010,
15489,
5332,
4371,
1007,
1063,
2709,
3830,
7361,
3215,
1012,
2224,
26521,
27983,
1004,
1004,
3830,
7361,
3215,
1012,
3482,
9148,
11927,
2232,
1028,
15489,
5332,
4371,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/utils.js | createURI | function createURI(spec, originCharset, baseURI)
{
let iosvc = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
return iosvc.newURI(spec, originCharset, baseURI);
} | javascript | function createURI(spec, originCharset, baseURI)
{
let iosvc = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
return iosvc.newURI(spec, originCharset, baseURI);
} | [
"function",
"createURI",
"(",
"spec",
",",
"originCharset",
",",
"baseURI",
")",
"{",
"let",
"iosvc",
"=",
"Cc",
"[",
"\"@mozilla.org/network/io-service;1\"",
"]",
".",
"getService",
"(",
"Ci",
".",
"nsIIOService",
")",
";",
"return",
"iosvc",
".",
"newURI",
... | Create a new URI
@param {string} spec
The URI string in UTF-8 encoding.
@param {string} originCharset
The charset of the document from which this URI string originated.
@param {string} baseURI
If null, spec must specify an absolute URI. Otherwise, spec may be
resolved relative to baseURI, depending on the protocol.
@return A URI object
@type nsIURI | [
"Create",
"a",
"new",
"URI"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/utils.js#L256-L262 | train | Creates a new URI | [
30522,
3853,
3443,
9496,
1006,
28699,
1010,
4761,
7507,
22573,
2102,
1010,
2918,
9496,
1007,
1063,
2292,
16380,
25465,
1027,
10507,
1031,
1000,
1030,
9587,
5831,
4571,
1012,
8917,
1013,
2897,
1013,
22834,
1011,
2326,
1025,
1015,
1000,
1033,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/model/Global.js | function (condition) {
var mainType = condition.mainType;
if (!mainType) {
return [];
}
var index = condition.index;
var id = condition.id;
var name = condition.name;
var cpts = this._componentsMap.get(mainType);
if (!cpts || !cpts.length) {
return [];
}
var result;
if (index != null) {
if (!isArray(index)) {
index = [index];
}
result = filter(map(index, function (idx) {
return cpts[idx];
}), function (val) {
return !!val;
});
}
else if (id != null) {
var isIdArray = isArray(id);
result = filter(cpts, function (cpt) {
return (isIdArray && indexOf(id, cpt.id) >= 0)
|| (!isIdArray && cpt.id === id);
});
}
else if (name != null) {
var isNameArray = isArray(name);
result = filter(cpts, function (cpt) {
return (isNameArray && indexOf(name, cpt.name) >= 0)
|| (!isNameArray && cpt.name === name);
});
}
else {
// Return all components with mainType
result = cpts.slice();
}
return filterBySubType(result, condition);
} | javascript | function (condition) {
var mainType = condition.mainType;
if (!mainType) {
return [];
}
var index = condition.index;
var id = condition.id;
var name = condition.name;
var cpts = this._componentsMap.get(mainType);
if (!cpts || !cpts.length) {
return [];
}
var result;
if (index != null) {
if (!isArray(index)) {
index = [index];
}
result = filter(map(index, function (idx) {
return cpts[idx];
}), function (val) {
return !!val;
});
}
else if (id != null) {
var isIdArray = isArray(id);
result = filter(cpts, function (cpt) {
return (isIdArray && indexOf(id, cpt.id) >= 0)
|| (!isIdArray && cpt.id === id);
});
}
else if (name != null) {
var isNameArray = isArray(name);
result = filter(cpts, function (cpt) {
return (isNameArray && indexOf(name, cpt.name) >= 0)
|| (!isNameArray && cpt.name === name);
});
}
else {
// Return all components with mainType
result = cpts.slice();
}
return filterBySubType(result, condition);
} | [
"function",
"(",
"condition",
")",
"{",
"var",
"mainType",
"=",
"condition",
".",
"mainType",
";",
"if",
"(",
"!",
"mainType",
")",
"{",
"return",
"[",
"]",
";",
"}",
"var",
"index",
"=",
"condition",
".",
"index",
";",
"var",
"id",
"=",
"condition",... | If none of index and id and name used, return all components with mainType.
@param {Object} condition
@param {string} condition.mainType
@param {string} [condition.subType] If ignore, only query by mainType
@param {number|Array.<number>} [condition.index] Either input index or id or name.
@param {string|Array.<string>} [condition.id] Either input index or id or name.
@param {string|Array.<string>} [condition.name] Either input index or id or name.
@return {Array.<module:echarts/model/Component>} | [
"If",
"none",
"of",
"index",
"and",
"id",
"and",
"name",
"used",
"return",
"all",
"components",
"with",
"mainType",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Global.js#L314-L362 | train | Returns a list of all the pages that match the condition | [
30522,
3853,
1006,
4650,
1007,
1063,
13075,
2364,
13874,
1027,
4650,
1012,
2364,
13874,
1025,
2065,
1006,
999,
2364,
13874,
1007,
1063,
2709,
1031,
1033,
1025,
1065,
13075,
5950,
1027,
4650,
1012,
5950,
1025,
13075,
8909,
1027,
4650,
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... | |
apache/incubator-echarts | src/component/helper/BrushController.js | function (brushOptionList) {
if (__DEV__) {
zrUtil.assert(this._mounted);
}
brushOptionList = zrUtil.map(brushOptionList, function (brushOption) {
return zrUtil.merge(zrUtil.clone(DEFAULT_BRUSH_OPT), brushOption, true);
});
var tmpIdPrefix = '\0-brush-index-';
var oldCovers = this._covers;
var newCovers = this._covers = [];
var controller = this;
var creatingCover = this._creatingCover;
(new DataDiffer(oldCovers, brushOptionList, oldGetKey, getKey))
.add(addOrUpdate)
.update(addOrUpdate)
.remove(remove)
.execute();
return this;
function getKey(brushOption, index) {
return (brushOption.id != null ? brushOption.id : tmpIdPrefix + index)
+ '-' + brushOption.brushType;
}
function oldGetKey(cover, index) {
return getKey(cover.__brushOption, index);
}
function addOrUpdate(newIndex, oldIndex) {
var newBrushOption = brushOptionList[newIndex];
// Consider setOption in event listener of brushSelect,
// where updating cover when creating should be forbiden.
if (oldIndex != null && oldCovers[oldIndex] === creatingCover) {
newCovers[newIndex] = oldCovers[oldIndex];
}
else {
var cover = newCovers[newIndex] = oldIndex != null
? (
oldCovers[oldIndex].__brushOption = newBrushOption,
oldCovers[oldIndex]
)
: endCreating(controller, createCover(controller, newBrushOption));
updateCoverAfterCreation(controller, cover);
}
}
function remove(oldIndex) {
if (oldCovers[oldIndex] !== creatingCover) {
controller.group.remove(oldCovers[oldIndex]);
}
}
} | javascript | function (brushOptionList) {
if (__DEV__) {
zrUtil.assert(this._mounted);
}
brushOptionList = zrUtil.map(brushOptionList, function (brushOption) {
return zrUtil.merge(zrUtil.clone(DEFAULT_BRUSH_OPT), brushOption, true);
});
var tmpIdPrefix = '\0-brush-index-';
var oldCovers = this._covers;
var newCovers = this._covers = [];
var controller = this;
var creatingCover = this._creatingCover;
(new DataDiffer(oldCovers, brushOptionList, oldGetKey, getKey))
.add(addOrUpdate)
.update(addOrUpdate)
.remove(remove)
.execute();
return this;
function getKey(brushOption, index) {
return (brushOption.id != null ? brushOption.id : tmpIdPrefix + index)
+ '-' + brushOption.brushType;
}
function oldGetKey(cover, index) {
return getKey(cover.__brushOption, index);
}
function addOrUpdate(newIndex, oldIndex) {
var newBrushOption = brushOptionList[newIndex];
// Consider setOption in event listener of brushSelect,
// where updating cover when creating should be forbiden.
if (oldIndex != null && oldCovers[oldIndex] === creatingCover) {
newCovers[newIndex] = oldCovers[oldIndex];
}
else {
var cover = newCovers[newIndex] = oldIndex != null
? (
oldCovers[oldIndex].__brushOption = newBrushOption,
oldCovers[oldIndex]
)
: endCreating(controller, createCover(controller, newBrushOption));
updateCoverAfterCreation(controller, cover);
}
}
function remove(oldIndex) {
if (oldCovers[oldIndex] !== creatingCover) {
controller.group.remove(oldCovers[oldIndex]);
}
}
} | [
"function",
"(",
"brushOptionList",
")",
"{",
"if",
"(",
"__DEV__",
")",
"{",
"zrUtil",
".",
"assert",
"(",
"this",
".",
"_mounted",
")",
";",
"}",
"brushOptionList",
"=",
"zrUtil",
".",
"map",
"(",
"brushOptionList",
",",
"function",
"(",
"brushOption",
... | Update covers.
@param {Array.<Object>} brushOptionList Like:
[
{id: 'xx', brushType: 'line', range: [23, 44], brushStyle, transformable},
{id: 'yy', brushType: 'rect', range: [[23, 44], [23, 54]]},
...
]
`brushType` is required in each cover info. (can not be 'auto')
`id` is not mandatory.
`brushStyle`, `transformable` is not mandatory, use DEFAULT_BRUSH_OPT by default.
If brushOptionList is null/undefined, all covers removed. | [
"Update",
"covers",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/helper/BrushController.js#L286-L341 | train | Set the brush option list | [
30522,
3853,
1006,
30524,
1035,
1035,
16475,
1035,
1035,
1007,
1063,
1062,
22134,
4014,
1012,
20865,
1006,
2023,
1012,
1035,
5614,
1007,
1025,
1065,
8248,
7361,
3508,
9863,
1027,
1062,
22134,
4014,
1012,
4949,
1006,
8248,
7361,
3508,
9863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BlockLayerUtils.js | registerInteractionHandler | function registerInteractionHandler(fnHandler) {
var aSuppressHandler = [],
oParentDOM = this.$parent.get(0),
oBlockLayerDOM = this.$blockLayer.get(0);
for (var i = 0; i < aPreventedEvents.length; i++) {
// Add event listeners with "useCapture" settings to suppress events before dispatching/bubbling starts
oParentDOM.addEventListener(aPreventedEvents[i], fnHandler, {
capture: true,
passive: false
});
aSuppressHandler.push(EventTriggerHook.suppress(aPreventedEvents[i], oParentDOM, oBlockLayerDOM));
}
//for jQuery triggered events we also need the keydown handler
this.$blockLayer.bind('keydown', fnHandler);
return aSuppressHandler;
} | javascript | function registerInteractionHandler(fnHandler) {
var aSuppressHandler = [],
oParentDOM = this.$parent.get(0),
oBlockLayerDOM = this.$blockLayer.get(0);
for (var i = 0; i < aPreventedEvents.length; i++) {
// Add event listeners with "useCapture" settings to suppress events before dispatching/bubbling starts
oParentDOM.addEventListener(aPreventedEvents[i], fnHandler, {
capture: true,
passive: false
});
aSuppressHandler.push(EventTriggerHook.suppress(aPreventedEvents[i], oParentDOM, oBlockLayerDOM));
}
//for jQuery triggered events we also need the keydown handler
this.$blockLayer.bind('keydown', fnHandler);
return aSuppressHandler;
} | [
"function",
"registerInteractionHandler",
"(",
"fnHandler",
")",
"{",
"var",
"aSuppressHandler",
"=",
"[",
"]",
",",
"oParentDOM",
"=",
"this",
".",
"$parent",
".",
"get",
"(",
"0",
")",
",",
"oBlockLayerDOM",
"=",
"this",
".",
"$blockLayer",
".",
"get",
"... | Register event handler to suppress event within busy section | [
"Register",
"event",
"handler",
"to",
"suppress",
"event",
"within",
"busy",
"section"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js#L288-L305 | train | Adds event listener to suppress events | [
30522,
3853,
4236,
18447,
6906,
7542,
11774,
3917,
1006,
1042,
25311,
5685,
3917,
1007,
1063,
13075,
2004,
6279,
20110,
11774,
3917,
1027,
1031,
1033,
1010,
6728,
12069,
3372,
9527,
1027,
2023,
1012,
1002,
6687,
1012,
2131,
1006,
1014,
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 | mxDivResizer | function mxDivResizer(div, container)
{
if (div.nodeName.toLowerCase() == 'div')
{
if (container == null)
{
container = window;
}
this.div = div;
var style = mxUtils.getCurrentStyle(div);
if (style != null)
{
this.resizeWidth = style.width == 'auto';
this.resizeHeight = style.height == 'auto';
}
mxEvent.addListener(container, 'resize',
mxUtils.bind(this, function(evt)
{
if (!this.handlingResize)
{
this.handlingResize = true;
this.resize();
this.handlingResize = false;
}
})
);
this.resize();
}
} | javascript | function mxDivResizer(div, container)
{
if (div.nodeName.toLowerCase() == 'div')
{
if (container == null)
{
container = window;
}
this.div = div;
var style = mxUtils.getCurrentStyle(div);
if (style != null)
{
this.resizeWidth = style.width == 'auto';
this.resizeHeight = style.height == 'auto';
}
mxEvent.addListener(container, 'resize',
mxUtils.bind(this, function(evt)
{
if (!this.handlingResize)
{
this.handlingResize = true;
this.resize();
this.handlingResize = false;
}
})
);
this.resize();
}
} | [
"function",
"mxDivResizer",
"(",
"div",
",",
"container",
")",
"{",
"if",
"(",
"div",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
"==",
"'div'",
")",
"{",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"container",
"=",
"window",
";",
"}",
"this"... | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxDivResizer
Maintains the size of a div element in Internet Explorer. This is a
workaround for the right and bottom style being ignored in IE.
If you need a div to cover the scrollwidth and -height of a document,
then you can use this class as follows:
(code)
var resizer = new mxDivResizer(background);
resizer.getDocumentHeight = function()
{
return document.body.scrollHeight;
}
resizer.getDocumentWidth = function()
{
return document.body.scrollWidth;
}
resizer.resize();
(end)
Constructor: mxDivResizer
Constructs an object that maintains the size of a div
element when the window is being resized. This is only
required for Internet Explorer as it ignores the respective
stylesheet information for DIV elements.
Parameters:
div - Reference to the DOM node whose size should be maintained.
container - Optional Container that contains the div. Default is the
window. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxDivResizer"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L12882-L12914 | train | Resizes the given div | [
30522,
3853,
25630,
4305,
24790,
17629,
1006,
4487,
2615,
1010,
11661,
1007,
1063,
2065,
1006,
4487,
2615,
1012,
13045,
18442,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1027,
1027,
1005,
4487,
2615,
1005,
1007,
1063,
2065,
1006,
11661,
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... |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/io/zip.js | unzip | function unzip(src, dst) {
return load(src).then(zip => {
let promisedDirs = new Map;
let promises = [];
zip.z_.forEach((relPath, file) => {
let p;
if (file.dir) {
p = createDir(relPath);
} else {
let dirname = path.dirname(relPath);
if (dirname === '.') {
p = writeFile(relPath, file);
} else {
p = createDir(dirname).then(() => writeFile(relPath, file));
}
}
promises.push(p);
});
return Promise.all(promises).then(() => dst);
function createDir(dir) {
let p = promisedDirs.get(dir);
if (!p) {
p = io.mkdirp(path.join(dst, dir));
promisedDirs.set(dir, p);
}
return p;
}
function writeFile(relPath, file) {
return file.async('nodebuffer')
.then(buffer => io.write(path.join(dst, relPath), buffer));
}
});
} | javascript | function unzip(src, dst) {
return load(src).then(zip => {
let promisedDirs = new Map;
let promises = [];
zip.z_.forEach((relPath, file) => {
let p;
if (file.dir) {
p = createDir(relPath);
} else {
let dirname = path.dirname(relPath);
if (dirname === '.') {
p = writeFile(relPath, file);
} else {
p = createDir(dirname).then(() => writeFile(relPath, file));
}
}
promises.push(p);
});
return Promise.all(promises).then(() => dst);
function createDir(dir) {
let p = promisedDirs.get(dir);
if (!p) {
p = io.mkdirp(path.join(dst, dir));
promisedDirs.set(dir, p);
}
return p;
}
function writeFile(relPath, file) {
return file.async('nodebuffer')
.then(buffer => io.write(path.join(dst, relPath), buffer));
}
});
} | [
"function",
"unzip",
"(",
"src",
",",
"dst",
")",
"{",
"return",
"load",
"(",
"src",
")",
".",
"then",
"(",
"zip",
"=>",
"{",
"let",
"promisedDirs",
"=",
"new",
"Map",
";",
"let",
"promises",
"=",
"[",
"]",
";",
"zip",
".",
"z_",
".",
"forEach",
... | Asynchronously unzips an archive file.
@param {string} src path to the source file to unzip.
@param {string} dst path to the destination directory.
@return {!Promise<string>} a promise that will resolve with `dst` once the
archive has been unzipped. | [
"Asynchronously",
"unzips",
"an",
"archive",
"file",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/io/zip.js#L170-L206 | train | Unzips a zip file into a directory | [
30522,
3853,
4895,
5831,
2361,
1006,
5034,
2278,
1010,
16233,
2102,
1007,
1063,
2709,
7170,
1006,
5034,
2278,
1007,
1012,
2059,
1006,
14101,
1027,
1028,
1063,
2292,
5763,
4305,
2869,
1027,
2047,
4949,
1025,
2292,
10659,
1027,
1031,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/server.js | _read | function _read(size) {
/* jshint validthis: true */
var self = this;
/**
* Callback to be called when a READ event is received. Pushes the data onto
* the read queue and starts reading again if applicable
* @param {grpc.Event} event READ event object
*/
function readCallback(err, event) {
if (err) {
self.terminate();
return;
}
if (self.finished) {
self.push(null);
return;
}
var data = event.read;
var deserialized;
try {
deserialized = self.deserialize(data);
} catch (e) {
e.code = constants.status.INTERNAL;
self.emit('error', e);
return;
}
if (self.push(deserialized) && data !== null) {
var read_batch = {};
read_batch[grpc.opType.RECV_MESSAGE] = true;
self.call.startBatch(read_batch, readCallback);
} else {
self.reading = false;
}
}
if (self.finished) {
self.push(null);
} else {
if (!self.reading) {
self.reading = true;
var batch = {};
batch[grpc.opType.RECV_MESSAGE] = true;
self.call.startBatch(batch, readCallback);
}
}
} | javascript | function _read(size) {
/* jshint validthis: true */
var self = this;
/**
* Callback to be called when a READ event is received. Pushes the data onto
* the read queue and starts reading again if applicable
* @param {grpc.Event} event READ event object
*/
function readCallback(err, event) {
if (err) {
self.terminate();
return;
}
if (self.finished) {
self.push(null);
return;
}
var data = event.read;
var deserialized;
try {
deserialized = self.deserialize(data);
} catch (e) {
e.code = constants.status.INTERNAL;
self.emit('error', e);
return;
}
if (self.push(deserialized) && data !== null) {
var read_batch = {};
read_batch[grpc.opType.RECV_MESSAGE] = true;
self.call.startBatch(read_batch, readCallback);
} else {
self.reading = false;
}
}
if (self.finished) {
self.push(null);
} else {
if (!self.reading) {
self.reading = true;
var batch = {};
batch[grpc.opType.RECV_MESSAGE] = true;
self.call.startBatch(batch, readCallback);
}
}
} | [
"function",
"_read",
"(",
"size",
")",
"{",
"/* jshint validthis: true */",
"var",
"self",
"=",
"this",
";",
"/**\n * Callback to be called when a READ event is received. Pushes the data onto\n * the read queue and starts reading again if applicable\n * @param {grpc.Event} event READ e... | Start reading from the gRPC data source. This is an implementation of a
method required for implementing stream.Readable
@access private
@param {number} size Ignored | [
"Start",
"reading",
"from",
"the",
"gRPC",
"data",
"source",
".",
"This",
"is",
"an",
"implementation",
"of",
"a",
"method",
"required",
"for",
"implementing",
"stream",
".",
"Readable"
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/server.js#L378-L422 | train | Called when a read event is received. | [
30522,
3853,
1035,
3191,
1006,
2946,
1007,
1063,
1013,
1008,
1046,
17426,
2102,
9398,
15222,
2015,
1024,
2995,
1008,
1013,
13075,
2969,
1027,
2023,
1025,
1013,
1008,
1008,
1008,
2655,
5963,
2000,
2022,
2170,
2043,
1037,
3191,
2724,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeekyAnts/vue-native-core | dist/vue.runtime.common.js | del | function del (target, key) {
if (Array.isArray(target) && typeof key === 'number') {
target.splice(key, 1);
return
}
var ob = (target ).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid deleting properties on a Vue instance or its root $data ' +
'- just set it to null.'
);
return
}
if (!hasOwn(target, key)) {
return
}
delete target[key];
if (!ob) {
return
}
ob.dep.notify();
} | javascript | function del (target, key) {
if (Array.isArray(target) && typeof key === 'number') {
target.splice(key, 1);
return
}
var ob = (target ).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid deleting properties on a Vue instance or its root $data ' +
'- just set it to null.'
);
return
}
if (!hasOwn(target, key)) {
return
}
delete target[key];
if (!ob) {
return
}
ob.dep.notify();
} | [
"function",
"del",
"(",
"target",
",",
"key",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"target",
")",
"&&",
"typeof",
"key",
"===",
"'number'",
")",
"{",
"target",
".",
"splice",
"(",
"key",
",",
"1",
")",
";",
"return",
"}",
"var",
"ob... | Delete a property and trigger change if necessary. | [
"Delete",
"a",
"property",
"and",
"trigger",
"change",
"if",
"necessary",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L932-L953 | train | Delete a property from an object or array. | [
30522,
3853,
3972,
1006,
4539,
1010,
3145,
1007,
1063,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
4539,
1007,
1004,
1004,
2828,
11253,
3145,
1027,
1027,
1027,
1005,
2193,
1005,
1007,
1063,
4539,
1012,
11867,
13231,
1006,
3145,
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.table/src/sap/ui/table/TablePointerExtension.js | function(oTable, oEvent) {
var $Body = jQuery(document.body),
$Splitter = oTable.$("sb"),
$Document = jQuery(document),
offset = $Splitter.offset(),
height = $Splitter.height(),
width = $Splitter.width(),
bTouch = oTable._isTouchEvent(oEvent);
// Fix for IE text selection while dragging
$Body.bind("selectstart", InteractiveResizeHelper.onSelectStartWhileInteractiveResizing);
$Body.append(
"<div id=\"" + oTable.getId() + "-ghost\" class=\"sapUiTableInteractiveResizerGhost\" style =\" height:" + height + "px; width:"
+ width + "px; left:" + offset.left + "px; top:" + offset.top + "px\" ></div>");
// Append overlay over splitter to enable correct functionality of moving the splitter
$Splitter.append(
"<div id=\"" + oTable.getId() + "-rzoverlay\" style =\"left: 0px; right: 0px; bottom: 0px; top: 0px; position:absolute\" ></div>");
$Document.bind((bTouch ? "touchend" : "mouseup") + ".sapUiTableInteractiveResize",
InteractiveResizeHelper.exitInteractiveResizing.bind(oTable));
$Document.bind((bTouch ? "touchmove" : "mousemove") + ".sapUiTableInteractiveResize",
InteractiveResizeHelper.onMouseMoveWhileInteractiveResizing.bind(oTable)
);
oTable._disableTextSelection();
} | javascript | function(oTable, oEvent) {
var $Body = jQuery(document.body),
$Splitter = oTable.$("sb"),
$Document = jQuery(document),
offset = $Splitter.offset(),
height = $Splitter.height(),
width = $Splitter.width(),
bTouch = oTable._isTouchEvent(oEvent);
// Fix for IE text selection while dragging
$Body.bind("selectstart", InteractiveResizeHelper.onSelectStartWhileInteractiveResizing);
$Body.append(
"<div id=\"" + oTable.getId() + "-ghost\" class=\"sapUiTableInteractiveResizerGhost\" style =\" height:" + height + "px; width:"
+ width + "px; left:" + offset.left + "px; top:" + offset.top + "px\" ></div>");
// Append overlay over splitter to enable correct functionality of moving the splitter
$Splitter.append(
"<div id=\"" + oTable.getId() + "-rzoverlay\" style =\"left: 0px; right: 0px; bottom: 0px; top: 0px; position:absolute\" ></div>");
$Document.bind((bTouch ? "touchend" : "mouseup") + ".sapUiTableInteractiveResize",
InteractiveResizeHelper.exitInteractiveResizing.bind(oTable));
$Document.bind((bTouch ? "touchmove" : "mousemove") + ".sapUiTableInteractiveResize",
InteractiveResizeHelper.onMouseMoveWhileInteractiveResizing.bind(oTable)
);
oTable._disableTextSelection();
} | [
"function",
"(",
"oTable",
",",
"oEvent",
")",
"{",
"var",
"$Body",
"=",
"jQuery",
"(",
"document",
".",
"body",
")",
",",
"$Splitter",
"=",
"oTable",
".",
"$",
"(",
"\"sb\"",
")",
",",
"$Document",
"=",
"jQuery",
"(",
"document",
")",
",",
"offset",... | /*
Initializes the drag&drop for resizing | [
"/",
"*",
"Initializes",
"the",
"drag&drop",
"for",
"resizing"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L367-L394 | train | Handles mouseup and touchend events on the table | [
30522,
3853,
1006,
27178,
3085,
1010,
1051,
18697,
3372,
1007,
1063,
13075,
1002,
2303,
1027,
1046,
4226,
2854,
1006,
6254,
1012,
2303,
1007,
1010,
1002,
3975,
3334,
1027,
27178,
3085,
1012,
1002,
1006,
1000,
30524,
1027,
27178,
3085,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/autocomplete/js/autocompleteController.js | moveDropdown | function moveDropdown () {
if (!elements.$.root.length) return;
$mdTheming(elements.$.scrollContainer);
elements.$.scrollContainer.detach();
elements.$.root.append(elements.$.scrollContainer);
if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement);
} | javascript | function moveDropdown () {
if (!elements.$.root.length) return;
$mdTheming(elements.$.scrollContainer);
elements.$.scrollContainer.detach();
elements.$.root.append(elements.$.scrollContainer);
if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement);
} | [
"function",
"moveDropdown",
"(",
")",
"{",
"if",
"(",
"!",
"elements",
".",
"$",
".",
"root",
".",
"length",
")",
"return",
";",
"$mdTheming",
"(",
"elements",
".",
"$",
".",
"scrollContainer",
")",
";",
"elements",
".",
"$",
".",
"scrollContainer",
".... | Moves the dropdown menu to the body tag in order to avoid z-index and overflow issues. | [
"Moves",
"the",
"dropdown",
"menu",
"to",
"the",
"body",
"tag",
"in",
"order",
"to",
"avoid",
"z",
"-",
"index",
"and",
"overflow",
"issues",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L218-L224 | train | Move the dropdown to the root element | [
30522,
3853,
2333,
18981,
7698,
1006,
1007,
1063,
2065,
1006,
999,
3787,
1012,
1002,
1012,
7117,
1012,
3091,
1007,
2709,
1025,
1002,
9108,
10760,
6562,
1006,
3787,
1012,
30524,
17186,
8663,
18249,
2121,
1007,
1025,
2065,
1006,
1002,
2019,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | inspectNode | function inspectNode(node) {
if (!node) {
return "[No node]";
}
if (crashyTextNodes && isBrokenNode(node)) {
return "[Broken node]";
}
if (isCharacterDataNode(node)) {
return '"' + node.data + '"';
}
if (node.nodeType == 1) {
var idAttr = node.id ? ' id="' + node.id + '"' : "";
return "<" + node.nodeName + idAttr + ">[index:" + getNodeIndex(node) + ",length:" + node.childNodes.length + "][" + (node.innerHTML || "[innerHTML not supported]").slice(0, 25) + "]";
}
return node.nodeName;
} | javascript | function inspectNode(node) {
if (!node) {
return "[No node]";
}
if (crashyTextNodes && isBrokenNode(node)) {
return "[Broken node]";
}
if (isCharacterDataNode(node)) {
return '"' + node.data + '"';
}
if (node.nodeType == 1) {
var idAttr = node.id ? ' id="' + node.id + '"' : "";
return "<" + node.nodeName + idAttr + ">[index:" + getNodeIndex(node) + ",length:" + node.childNodes.length + "][" + (node.innerHTML || "[innerHTML not supported]").slice(0, 25) + "]";
}
return node.nodeName;
} | [
"function",
"inspectNode",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"node",
")",
"{",
"return",
"\"[No node]\"",
";",
"}",
"if",
"(",
"crashyTextNodes",
"&&",
"isBrokenNode",
"(",
"node",
")",
")",
"{",
"return",
"\"[Broken node]\"",
";",
"}",
"if",
"(",
... | /*---------------------------------------------------------------------------------------------------------------- | [
"/",
"*",
"----------------------------------------------------------------------------------------------------------------"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L830-L845 | train | inspectNode - inspect node | [
30522,
3853,
22459,
3630,
3207,
1006,
13045,
1007,
1063,
2065,
1006,
999,
13045,
1007,
1063,
2709,
1000,
1031,
2053,
13045,
1033,
1000,
1025,
1065,
2065,
1006,
5823,
17250,
18413,
3630,
6155,
1004,
1004,
2003,
29162,
3630,
3207,
1006,
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... |
netlify/netlify-cms | packages/netlify-cms-media-library-uploadcare/src/index.js | getFile | function getFile(url) {
const groupPattern = /~\d+\/nth\/\d+\//;
const uploaded = url.startsWith(CDN_BASE_URL) && !groupPattern.test(url);
return uploadcare.fileFrom(uploaded ? 'uploaded' : 'url', url);
} | javascript | function getFile(url) {
const groupPattern = /~\d+\/nth\/\d+\//;
const uploaded = url.startsWith(CDN_BASE_URL) && !groupPattern.test(url);
return uploadcare.fileFrom(uploaded ? 'uploaded' : 'url', url);
} | [
"function",
"getFile",
"(",
"url",
")",
"{",
"const",
"groupPattern",
"=",
"/",
"~\\d+\\/nth\\/\\d+\\/",
"/",
";",
"const",
"uploaded",
"=",
"url",
".",
"startsWith",
"(",
"CDN_BASE_URL",
")",
"&&",
"!",
"groupPattern",
".",
"test",
"(",
"url",
")",
";",
... | Convert a single url to an Uploadcare file object wrapped in a promise-like
object. Group urls that get passed here were not a part of a complete and
untouched group, so they'll be uploaded as new images (only way to do it). | [
"Convert",
"a",
"single",
"url",
"to",
"an",
"Uploadcare",
"file",
"object",
"wrapped",
"in",
"a",
"promise",
"-",
"like",
"object",
".",
"Group",
"urls",
"that",
"get",
"passed",
"here",
"were",
"not",
"a",
"part",
"of",
"a",
"complete",
"and",
"untouch... | 2488556590cbfdcefa626f2f2de01e7a160cf6ee | https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-media-library-uploadcare/src/index.js#L66-L70 | train | Get file from url | [
30522,
3853,
2131,
8873,
2571,
1006,
24471,
2140,
1007,
1063,
9530,
3367,
2177,
4502,
12079,
2078,
1027,
1013,
1066,
1032,
1040,
1009,
1032,
1013,
23961,
2232,
1032,
1013,
1032,
1040,
1009,
1032,
1013,
1013,
1025,
9530,
3367,
21345,
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... |
adobe/brackets | src/language/CSSUtils.js | addRuleToDocument | function addRuleToDocument(doc, selector, useTabChar, indentUnit) {
var newRule = "\n" + selector + " {\n",
blankLineOffset;
if (useTabChar) {
newRule += "\t";
blankLineOffset = 1;
} else {
var i;
for (i = 0; i < indentUnit; i++) {
newRule += " ";
}
blankLineOffset = indentUnit;
}
newRule += "\n}\n";
var docLines = doc.getText().split("\n"),
lastDocLine = docLines.length - 1,
lastDocChar = docLines[docLines.length - 1].length;
doc.replaceRange(newRule, {line: lastDocLine, ch: lastDocChar});
return {
range: {
from: {line: lastDocLine + 1, ch: 0},
to: {line: lastDocLine + 3, ch: 1}
},
pos: {line: lastDocLine + 2, ch: blankLineOffset}
};
} | javascript | function addRuleToDocument(doc, selector, useTabChar, indentUnit) {
var newRule = "\n" + selector + " {\n",
blankLineOffset;
if (useTabChar) {
newRule += "\t";
blankLineOffset = 1;
} else {
var i;
for (i = 0; i < indentUnit; i++) {
newRule += " ";
}
blankLineOffset = indentUnit;
}
newRule += "\n}\n";
var docLines = doc.getText().split("\n"),
lastDocLine = docLines.length - 1,
lastDocChar = docLines[docLines.length - 1].length;
doc.replaceRange(newRule, {line: lastDocLine, ch: lastDocChar});
return {
range: {
from: {line: lastDocLine + 1, ch: 0},
to: {line: lastDocLine + 3, ch: 1}
},
pos: {line: lastDocLine + 2, ch: blankLineOffset}
};
} | [
"function",
"addRuleToDocument",
"(",
"doc",
",",
"selector",
",",
"useTabChar",
",",
"indentUnit",
")",
"{",
"var",
"newRule",
"=",
"\"\\n\"",
"+",
"selector",
"+",
"\" {\\n\"",
",",
"blankLineOffset",
";",
"if",
"(",
"useTabChar",
")",
"{",
"newRule",
"+="... | Adds a new rule to the end of the given document, and returns the range of the added rule
and the position of the cursor on the indented blank line within it. Note that the range will
not include all the inserted text (we insert extra newlines before and after the rule).
@param {Document} doc The document to insert the rule into.
@param {string} selector The selector to use for the given rule.
@param {boolean} useTabChar Whether to indent with a tab.
@param {number} indentUnit If useTabChar is false, how many spaces to indent with.
@return {{range: {from: {line: number, ch: number}, to: {line: number, ch: number}}, pos: {line: number, ch: number}}}
The range of the inserted rule and the location where the cursor should be placed. | [
"Adds",
"a",
"new",
"rule",
"to",
"the",
"end",
"of",
"the",
"given",
"document",
"and",
"returns",
"the",
"range",
"of",
"the",
"added",
"rule",
"and",
"the",
"position",
"of",
"the",
"cursor",
"on",
"the",
"indented",
"blank",
"line",
"within",
"it",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CSSUtils.js#L1766-L1792 | train | Add a rule to the document | [
30522,
3853,
5587,
6820,
7485,
7716,
30524,
2571,
1027,
1000,
1032,
1050,
1000,
1009,
27000,
1009,
1000,
1063,
1032,
1050,
1000,
1010,
8744,
4179,
27475,
3388,
1025,
2065,
1006,
2224,
2696,
9818,
8167,
1007,
1063,
2047,
6820,
2571,
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... |
GeekyAnts/vue-native-core | dist/vue.react.js | extend$1 | function extend$1 (to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to
} | javascript | function extend$1 (to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to
} | [
"function",
"extend$1",
"(",
"to",
",",
"_from",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"_from",
")",
"{",
"to",
"[",
"key",
"]",
"=",
"_from",
"[",
"key",
"]",
";",
"}",
"return",
"to",
"}"
] | Mix properties into target object. | [
"Mix",
"properties",
"into",
"target",
"object",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.react.js#L169-L174 | train | Extend the given object with the properties from _from. | [
30522,
3853,
7949,
1002,
1015,
1006,
2000,
1010,
1035,
2013,
1007,
1063,
2005,
1006,
13075,
3145,
1999,
1035,
2013,
1007,
1063,
2000,
1031,
3145,
1033,
1027,
1035,
2013,
1031,
3145,
1033,
1025,
1065,
2709,
2000,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/services/theming/theming.js | ThemingService | function ThemingService($rootScope, $mdUtil, $q, $log) {
// Allow us to be invoked via a linking function signature.
var applyTheme = function (scope, el) {
if (el === undefined) { el = scope; scope = undefined; }
if (scope === undefined) { scope = $rootScope; }
applyTheme.inherit(el, el);
};
Object.defineProperty(applyTheme, 'THEMES', {
get: function () {
return angular.extend({}, THEMES);
}
});
Object.defineProperty(applyTheme, 'PALETTES', {
get: function () {
return angular.extend({}, PALETTES);
}
});
Object.defineProperty(applyTheme, 'ALWAYS_WATCH', {
get: function () {
return alwaysWatchTheme;
}
});
applyTheme.inherit = inheritTheme;
applyTheme.registered = registered;
applyTheme.defaultTheme = function() { return defaultTheme; };
applyTheme.generateTheme = function(name) { generateTheme(THEMES[name], name, themeConfig.nonce); };
applyTheme.defineTheme = function(name, options) {
options = options || {};
var theme = registerTheme(name);
if (options.primary) {
theme.primaryPalette(options.primary, options.primaryHues);
}
if (options.accent) {
theme.accentPalette(options.accent, options.accentHues);
}
if (options.warn) {
theme.warnPalette(options.warn, options.warnHues);
}
if (options.background) {
theme.backgroundPalette(options.background, options.backgroundHues);
}
if (options.dark){
theme.dark();
}
this.generateTheme(name);
return $q.resolve(name);
};
applyTheme.setBrowserColor = enableBrowserColor;
return applyTheme;
/**
* Determine is specified theme name is a valid, registered theme
*/
function registered(themeName) {
if (themeName === undefined || themeName === '') return true;
return applyTheme.THEMES[themeName] !== undefined;
}
/**
* Get theme name for the element, then update with Theme CSS class
*/
function inheritTheme (el, parent) {
var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController');
var scope = el.scope();
updateThemeClass(lookupThemeName());
if (ctrl) {
var watchTheme = alwaysWatchTheme ||
ctrl.$shouldWatch ||
$mdUtil.parseAttributeBoolean(el.attr('md-theme-watch'));
if (watchTheme || ctrl.isAsyncTheme) {
var clearNameWatcher = function () {
if (unwatch) {
unwatch();
unwatch = undefined;
}
};
var unwatch = ctrl.registerChanges(function(name) {
updateThemeClass(name);
if (!watchTheme) {
clearNameWatcher();
}
});
if (scope) {
scope.$on('$destroy', clearNameWatcher);
} else {
el.on('$destroy', clearNameWatcher);
}
}
}
/**
* Find the theme name from the parent controller or element data
*/
function lookupThemeName() {
// As a few components (dialog) add their controllers later, we should also watch for a controller init.
return ctrl && ctrl.$mdTheme || (defaultTheme === 'default' ? '' : defaultTheme);
}
/**
* Remove old theme class and apply a new one
* NOTE: if not a valid theme name, then the current name is not changed
*/
function updateThemeClass(theme) {
if (!theme) return;
if (!registered(theme)) {
$log.warn('Attempted to use unregistered theme \'' + theme + '\'. ' +
'Register it with $mdThemingProvider.theme().');
}
var oldTheme = el.data('$mdThemeName');
if (oldTheme) el.removeClass('md-' + oldTheme +'-theme');
el.addClass('md-' + theme + '-theme');
el.data('$mdThemeName', theme);
if (ctrl) {
el.data('$mdThemeController', ctrl);
}
}
}
} | javascript | function ThemingService($rootScope, $mdUtil, $q, $log) {
// Allow us to be invoked via a linking function signature.
var applyTheme = function (scope, el) {
if (el === undefined) { el = scope; scope = undefined; }
if (scope === undefined) { scope = $rootScope; }
applyTheme.inherit(el, el);
};
Object.defineProperty(applyTheme, 'THEMES', {
get: function () {
return angular.extend({}, THEMES);
}
});
Object.defineProperty(applyTheme, 'PALETTES', {
get: function () {
return angular.extend({}, PALETTES);
}
});
Object.defineProperty(applyTheme, 'ALWAYS_WATCH', {
get: function () {
return alwaysWatchTheme;
}
});
applyTheme.inherit = inheritTheme;
applyTheme.registered = registered;
applyTheme.defaultTheme = function() { return defaultTheme; };
applyTheme.generateTheme = function(name) { generateTheme(THEMES[name], name, themeConfig.nonce); };
applyTheme.defineTheme = function(name, options) {
options = options || {};
var theme = registerTheme(name);
if (options.primary) {
theme.primaryPalette(options.primary, options.primaryHues);
}
if (options.accent) {
theme.accentPalette(options.accent, options.accentHues);
}
if (options.warn) {
theme.warnPalette(options.warn, options.warnHues);
}
if (options.background) {
theme.backgroundPalette(options.background, options.backgroundHues);
}
if (options.dark){
theme.dark();
}
this.generateTheme(name);
return $q.resolve(name);
};
applyTheme.setBrowserColor = enableBrowserColor;
return applyTheme;
/**
* Determine is specified theme name is a valid, registered theme
*/
function registered(themeName) {
if (themeName === undefined || themeName === '') return true;
return applyTheme.THEMES[themeName] !== undefined;
}
/**
* Get theme name for the element, then update with Theme CSS class
*/
function inheritTheme (el, parent) {
var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController');
var scope = el.scope();
updateThemeClass(lookupThemeName());
if (ctrl) {
var watchTheme = alwaysWatchTheme ||
ctrl.$shouldWatch ||
$mdUtil.parseAttributeBoolean(el.attr('md-theme-watch'));
if (watchTheme || ctrl.isAsyncTheme) {
var clearNameWatcher = function () {
if (unwatch) {
unwatch();
unwatch = undefined;
}
};
var unwatch = ctrl.registerChanges(function(name) {
updateThemeClass(name);
if (!watchTheme) {
clearNameWatcher();
}
});
if (scope) {
scope.$on('$destroy', clearNameWatcher);
} else {
el.on('$destroy', clearNameWatcher);
}
}
}
/**
* Find the theme name from the parent controller or element data
*/
function lookupThemeName() {
// As a few components (dialog) add their controllers later, we should also watch for a controller init.
return ctrl && ctrl.$mdTheme || (defaultTheme === 'default' ? '' : defaultTheme);
}
/**
* Remove old theme class and apply a new one
* NOTE: if not a valid theme name, then the current name is not changed
*/
function updateThemeClass(theme) {
if (!theme) return;
if (!registered(theme)) {
$log.warn('Attempted to use unregistered theme \'' + theme + '\'. ' +
'Register it with $mdThemingProvider.theme().');
}
var oldTheme = el.data('$mdThemeName');
if (oldTheme) el.removeClass('md-' + oldTheme +'-theme');
el.addClass('md-' + theme + '-theme');
el.data('$mdThemeName', theme);
if (ctrl) {
el.data('$mdThemeController', ctrl);
}
}
}
} | [
"function",
"ThemingService",
"(",
"$rootScope",
",",
"$mdUtil",
",",
"$q",
",",
"$log",
")",
"{",
"// Allow us to be invoked via a linking function signature.",
"var",
"applyTheme",
"=",
"function",
"(",
"scope",
",",
"el",
")",
"{",
"if",
"(",
"el",
"===",
"un... | @ngdoc method
@name $mdTheming#defineTheme
@description
Dynamically define a theme by using an options object that contains palette names.
@param {string} name Theme name to define
@param {object} options Theme definition options
Options are:<br/>
- `primary` - `{string}`: The name of the primary palette to use in the theme.<br/>
- `primaryHues` - `{object=}`: Override hues for primary palette.<br/>
- `accent` - `{string}`: The name of the accent palette to use in the theme.<br/>
- `accentHues` - `{object=}`: Override hues for accent palette.<br/>
- `warn` - `{string}`: The name of the warn palette to use in the theme.<br/>
- `warnHues` - `{object=}`: Override hues for warn palette.<br/>
- `background` - `{string}`: The name of the background palette to use in the theme.<br/>
- `backgroundHues` - `{object=}`: Override hues for background palette.<br/>
- `dark` - `{boolean}`: Indicates if it's a dark theme.<br/>
@returns {Promise<string>} A resolved promise with the new theme name.
/* @ngInject | [
"@ngdoc",
"method",
"@name",
"$mdTheming#defineTheme",
"@description",
"Dynamically",
"define",
"a",
"theme",
"by",
"using",
"an",
"options",
"object",
"that",
"contains",
"palette",
"names",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L709-L840 | train | The ThemingService constructor. | [
30522,
3853,
2068,
8613,
2121,
7903,
2063,
1006,
1002,
6147,
16186,
1010,
1002,
9108,
21823,
2140,
1010,
1002,
1053,
1010,
1002,
8833,
1007,
1063,
1013,
1013,
3499,
2149,
2000,
2022,
24959,
3081,
1037,
11383,
3853,
8085,
1012,
13075,
6611,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | src/queue.js | function( file ) {
var me = this,
existing = this._map[ file.id ];
if ( existing ) {
delete this._map[ file.id ];
this._delFile(file);
file.destroy();
this.stats.numOfDeleted++;
}
} | javascript | function( file ) {
var me = this,
existing = this._map[ file.id ];
if ( existing ) {
delete this._map[ file.id ];
this._delFile(file);
file.destroy();
this.stats.numOfDeleted++;
}
} | [
"function",
"(",
"file",
")",
"{",
"var",
"me",
"=",
"this",
",",
"existing",
"=",
"this",
".",
"_map",
"[",
"file",
".",
"id",
"]",
";",
"if",
"(",
"existing",
")",
"{",
"delete",
"this",
".",
"_map",
"[",
"file",
".",
"id",
"]",
";",
"this",
... | 在队列中删除文件。
@grammar removeFile( file ) => Array
@method removeFile
@param {File} 文件对象。 | [
"在队列中删除文件。"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/src/queue.js#L158-L169 | train | Delete a file | [
30522,
3853,
1006,
5371,
1007,
1063,
13075,
2033,
1027,
2023,
1010,
4493,
1027,
2023,
1012,
1035,
4949,
1031,
5371,
1012,
8909,
1033,
1025,
2065,
1006,
4493,
1007,
1063,
3972,
12870,
2023,
1012,
1035,
4949,
1031,
5371,
1012,
8909,
1033,
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... | |
emberjs/ember.js | broccoli/build-info.js | readPackageVersion | function readPackageVersion(root) {
let pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
// use _originalVersion if present if we've already mutated it
return pkg._originalVersion || pkg.version;
} | javascript | function readPackageVersion(root) {
let pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
// use _originalVersion if present if we've already mutated it
return pkg._originalVersion || pkg.version;
} | [
"function",
"readPackageVersion",
"(",
"root",
")",
"{",
"let",
"pkg",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"path",
".",
"join",
"(",
"root",
",",
"'package.json'",
")",
",",
"'utf8'",
")",
")",
";",
"// use _originalVersion if p... | Read package version.
@param {string} root
@returns {string} | [
"Read",
"package",
"version",
"."
] | 7ef1d08b7fe44000cf97b3c43566d20337b0683d | https://github.com/emberjs/ember.js/blob/7ef1d08b7fe44000cf97b3c43566d20337b0683d/broccoli/build-info.js#L126-L130 | train | read package. json | [
30522,
3853,
3191,
23947,
4270,
27774,
1006,
7117,
1007,
1063,
2292,
1052,
2243,
2290,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
1042,
2015,
1012,
3191,
8873,
4244,
6038,
2278,
1006,
4130,
1012,
3693,
1006,
7117,
1010,
1005,
7427,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/date/Islamic.js | toIslamic | function toIslamic(oGregorian) {
var iGregorianYear = oGregorian.year,
iGregorianMonth = oGregorian.month,
iGregorianDay = oGregorian.day,
iIslamicYear,
iIslamicMonth,
iIslamicDay,
iMonths,
iDays,
iLeapAdj,
iJulianDay;
iLeapAdj = 0;
if ((iGregorianMonth + 1) > 2) {
iLeapAdj = isGregorianLeapYear(iGregorianYear) ? -1 : -2;
}
iJulianDay = (GREGORIAN_EPOCH_DAYS - 1) + (365 * (iGregorianYear - 1)) + Math.floor((iGregorianYear - 1) / 4)
+ (-Math.floor((iGregorianYear - 1) / 100)) + Math.floor((iGregorianYear - 1) / 400)
+ Math.floor((((367 * (iGregorianMonth + 1)) - 362) / 12)
+ iLeapAdj + iGregorianDay);
iJulianDay = Math.floor(iJulianDay) + 0.5;
iDays = iJulianDay - ISLAMIC_EPOCH_DAYS;
iMonths = Math.floor(iDays / 29.530588853); // day/CalendarAstronomer.SYNODIC_MONTH
if (iMonths < 0) { //negative means Islamic date before the Islamic's calendar start. So we do not apply customization.
iIslamicYear = Math.floor(iMonths / 12) + 1;
iIslamicMonth = iMonths % 12;
if (iIslamicMonth < 0) {
iIslamicMonth += 12;
}
iIslamicDay = iDays - monthStart(iIslamicYear, iIslamicMonth) + 1;
} else {
/* Guess the month start.
* Always also check the next month, since customization can
* differ. It can differ for not more than 3 days. so that
* checking the next month is enough.
*/
iMonths++;
/*
* Check the true month start for the given month. If it is
* later, check the previous month, until a suitable is found.
*/
while (getCustomMonthStartDays(iMonths) > iDays) {
iMonths--;
}
iIslamicYear = Math.floor(iMonths / 12) + 1;
iIslamicMonth = iMonths % 12;
iIslamicDay = (iDays - getCustomMonthStartDays(12 * (iIslamicYear - 1) + iIslamicMonth)) + 1;
}
return {
day: iIslamicDay,
month: iIslamicMonth,
year: iIslamicYear
};
} | javascript | function toIslamic(oGregorian) {
var iGregorianYear = oGregorian.year,
iGregorianMonth = oGregorian.month,
iGregorianDay = oGregorian.day,
iIslamicYear,
iIslamicMonth,
iIslamicDay,
iMonths,
iDays,
iLeapAdj,
iJulianDay;
iLeapAdj = 0;
if ((iGregorianMonth + 1) > 2) {
iLeapAdj = isGregorianLeapYear(iGregorianYear) ? -1 : -2;
}
iJulianDay = (GREGORIAN_EPOCH_DAYS - 1) + (365 * (iGregorianYear - 1)) + Math.floor((iGregorianYear - 1) / 4)
+ (-Math.floor((iGregorianYear - 1) / 100)) + Math.floor((iGregorianYear - 1) / 400)
+ Math.floor((((367 * (iGregorianMonth + 1)) - 362) / 12)
+ iLeapAdj + iGregorianDay);
iJulianDay = Math.floor(iJulianDay) + 0.5;
iDays = iJulianDay - ISLAMIC_EPOCH_DAYS;
iMonths = Math.floor(iDays / 29.530588853); // day/CalendarAstronomer.SYNODIC_MONTH
if (iMonths < 0) { //negative means Islamic date before the Islamic's calendar start. So we do not apply customization.
iIslamicYear = Math.floor(iMonths / 12) + 1;
iIslamicMonth = iMonths % 12;
if (iIslamicMonth < 0) {
iIslamicMonth += 12;
}
iIslamicDay = iDays - monthStart(iIslamicYear, iIslamicMonth) + 1;
} else {
/* Guess the month start.
* Always also check the next month, since customization can
* differ. It can differ for not more than 3 days. so that
* checking the next month is enough.
*/
iMonths++;
/*
* Check the true month start for the given month. If it is
* later, check the previous month, until a suitable is found.
*/
while (getCustomMonthStartDays(iMonths) > iDays) {
iMonths--;
}
iIslamicYear = Math.floor(iMonths / 12) + 1;
iIslamicMonth = iMonths % 12;
iIslamicDay = (iDays - getCustomMonthStartDays(12 * (iIslamicYear - 1) + iIslamicMonth)) + 1;
}
return {
day: iIslamicDay,
month: iIslamicMonth,
year: iIslamicYear
};
} | [
"function",
"toIslamic",
"(",
"oGregorian",
")",
"{",
"var",
"iGregorianYear",
"=",
"oGregorian",
".",
"year",
",",
"iGregorianMonth",
"=",
"oGregorian",
".",
"month",
",",
"iGregorianDay",
"=",
"oGregorian",
".",
"day",
",",
"iIslamicYear",
",",
"iIslamicMonth"... | Calculate islamic date from gregorian.
@param {object} oGregorian A JS object containing day, month and year in the gregorian calendar
@returns {object} The islamic date object created
@private | [
"Calculate",
"islamic",
"date",
"from",
"gregorian",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Islamic.js#L57-L116 | train | Convert a gregorian date to an Islamic date. | [
30522,
3853,
2000,
2483,
10278,
2594,
1006,
13958,
2890,
20255,
2937,
1007,
1063,
13075,
1045,
17603,
20255,
2937,
29100,
1027,
13958,
2890,
20255,
2937,
1012,
2095,
1010,
1045,
17603,
20255,
2937,
9629,
2232,
1027,
13958,
2890,
20255,
2937,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/sessionstore.js | undoClosedTab | function undoClosedTab(controller, event)
{
var count = sessionStoreService.getClosedTabCount(controller.window);
switch (event.type) {
case "menu":
throw new Error("Menu gets build dynamically and cannot be accessed.");
break;
case "shortcut":
var cmdKey = utils.getEntity(this.getDtds(), "tabCmd.commandkey");
controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true});
break;
}
if (count > 0)
controller.assertJS("subject.newTabCount < subject.oldTabCount",
{
newTabCount : sessionStoreService.getClosedTabCount(controller.window),
oldTabCount : count
});
} | javascript | function undoClosedTab(controller, event)
{
var count = sessionStoreService.getClosedTabCount(controller.window);
switch (event.type) {
case "menu":
throw new Error("Menu gets build dynamically and cannot be accessed.");
break;
case "shortcut":
var cmdKey = utils.getEntity(this.getDtds(), "tabCmd.commandkey");
controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true});
break;
}
if (count > 0)
controller.assertJS("subject.newTabCount < subject.oldTabCount",
{
newTabCount : sessionStoreService.getClosedTabCount(controller.window),
oldTabCount : count
});
} | [
"function",
"undoClosedTab",
"(",
"controller",
",",
"event",
")",
"{",
"var",
"count",
"=",
"sessionStoreService",
".",
"getClosedTabCount",
"(",
"controller",
".",
"window",
")",
";",
"switch",
"(",
"event",
".",
"type",
")",
"{",
"case",
"\"menu\"",
":",
... | Restores the tab which has been recently closed
@param {MozMillController} controller
MozMillController of the window to operate on
@param {object} event
Specifies the event to use to execute the command | [
"Restores",
"the",
"tab",
"which",
"has",
"been",
"recently",
"closed"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/sessionstore.js#L259-L279 | train | Undo a closed tab | [
30522,
3853,
25672,
20464,
24768,
2696,
2497,
1006,
11486,
1010,
2724,
1007,
1063,
13075,
4175,
1027,
6521,
19277,
8043,
7903,
2063,
1012,
2131,
20464,
24768,
2696,
9818,
21723,
1006,
11486,
1012,
3332,
1007,
1025,
6942,
1006,
2724,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
caolan/async | lib/everySeries.js | everySeries | function everySeries(coll, iteratee, callback) {
return createTester(bool => !bool, res => !res)(eachOfSeries, coll, iteratee, callback)
} | javascript | function everySeries(coll, iteratee, callback) {
return createTester(bool => !bool, res => !res)(eachOfSeries, coll, iteratee, callback)
} | [
"function",
"everySeries",
"(",
"coll",
",",
"iteratee",
",",
"callback",
")",
"{",
"return",
"createTester",
"(",
"bool",
"=>",
"!",
"bool",
",",
"res",
"=>",
"!",
"res",
")",
"(",
"eachOfSeries",
",",
"coll",
",",
"iteratee",
",",
"callback",
")",
"}... | The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
@name everySeries
@static
@memberOf module:Collections
@method
@see [async.every]{@link module:Collections.every}
@alias allSeries
@category Collection
@param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
@param {AsyncFunction} iteratee - An async truth test to apply to each item
in the collection in series.
The iteratee must complete with a boolean result value.
Invoked with (item, callback).
@param {Function} [callback] - A callback which is called after all the
`iteratee` functions have finished. Result will be either `true` or `false`
depending on the values of the async tests. Invoked with (err, result).
@returns {Promise} a promise, if no callback provided | [
"The",
"same",
"as",
"[",
"every",
"]",
"{",
"@link",
"module",
":",
"Collections",
".",
"every",
"}",
"but",
"runs",
"only",
"a",
"single",
"async",
"operation",
"at",
"a",
"time",
"."
] | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/everySeries.js#L25-L27 | train | Returns true if every item in coll is false | [
30522,
3853,
2296,
8043,
3111,
1006,
8902,
2140,
1010,
2009,
30524,
1010,
2655,
5963,
1007,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/jvectormap/lib/world-map.js | function(){
this.width = this.container.width();
this.height = this.container.height();
this.resize();
this.canvas.setSize(this.width, this.height);
this.applyTransform();
} | javascript | function(){
this.width = this.container.width();
this.height = this.container.height();
this.resize();
this.canvas.setSize(this.width, this.height);
this.applyTransform();
} | [
"function",
"(",
")",
"{",
"this",
".",
"width",
"=",
"this",
".",
"container",
".",
"width",
"(",
")",
";",
"this",
".",
"height",
"=",
"this",
".",
"container",
".",
"height",
"(",
")",
";",
"this",
".",
"resize",
"(",
")",
";",
"this",
".",
... | Synchronize the size of the map with the size of the container. Suitable in situations where the size of the container is changed programmatically or container is shown after it became visible. | [
"Synchronize",
"the",
"size",
"of",
"the",
"map",
"with",
"the",
"size",
"of",
"the",
"container",
".",
"Suitable",
"in",
"situations",
"where",
"the",
"size",
"of",
"the",
"container",
"is",
"changed",
"programmatically",
"or",
"container",
"is",
"shown",
"... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L190-L196 | train | Resizes the image and applies the transform | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
9381,
1027,
2023,
1012,
11661,
1012,
9381,
1006,
1007,
1025,
2023,
1012,
4578,
1027,
2023,
1012,
11661,
1012,
4578,
1006,
1007,
1025,
2023,
1012,
24501,
4697,
1006,
1007,
1025,
2023,
1012,
10683,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | third_party/closure/goog/net/streams/pbjsonstreamparser.js | readMore | function readMore() {
while (pos < input.length) {
if (!utils.isJsonWhitespace(input[pos])) {
return true;
}
pos++;
parser.streamPos_++;
}
return false;
} | javascript | function readMore() {
while (pos < input.length) {
if (!utils.isJsonWhitespace(input[pos])) {
return true;
}
pos++;
parser.streamPos_++;
}
return false;
} | [
"function",
"readMore",
"(",
")",
"{",
"while",
"(",
"pos",
"<",
"input",
".",
"length",
")",
"{",
"if",
"(",
"!",
"utils",
".",
"isJsonWhitespace",
"(",
"input",
"[",
"pos",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"pos",
"++",
";",
"pars... | Advances to the first non-whitespace input character.
@return {boolean} return false if no more non-whitespace input character | [
"Advances",
"to",
"the",
"first",
"non",
"-",
"whitespace",
"input",
"character",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/net/streams/pbjsonstreamparser.js#L240-L249 | train | Read more data from the input stream | [
30522,
3853,
3191,
5974,
1006,
1007,
1063,
2096,
1006,
13433,
2015,
1026,
7953,
1012,
3091,
1007,
1063,
2065,
1006,
999,
21183,
12146,
1012,
2003,
22578,
2239,
2860,
16584,
2229,
15327,
1006,
7953,
1031,
13433,
2015,
1033,
1007,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/cldr-openui5/lib/index.js | CLDR | function CLDR(oOptions) {
if (!(this instanceof CLDR)) {
return new CLDR(oOptions);
}
this._oOptions = oOptions;
events.EventEmitter.call(this);
} | javascript | function CLDR(oOptions) {
if (!(this instanceof CLDR)) {
return new CLDR(oOptions);
}
this._oOptions = oOptions;
events.EventEmitter.call(this);
} | [
"function",
"CLDR",
"(",
"oOptions",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"CLDR",
")",
")",
"{",
"return",
"new",
"CLDR",
"(",
"oOptions",
")",
";",
"}",
"this",
".",
"_oOptions",
"=",
"oOptions",
";",
"events",
".",
"EventEmitter",
"... | Generate UI5 CLDR JSON file for each suppported locale using from the modern JSON version CLDR file provided by unicode.org
The CLDR data is defined as a npm dependency, use npm update to fetch the latest released version.
The generated UI5 CLDR JSON files are saved under folder oOptions.output.
@param {object} oOptions The options parameter which contains the necessary settings
@param {string} oOptions.output] The path of a folder where the generated UI5 JSON files are stored
@class
@constructor | [
"Generate",
"UI5",
"CLDR",
"JSON",
"file",
"for",
"each",
"suppported",
"locale",
"using",
"from",
"the",
"modern",
"JSON",
"version",
"CLDR",
"file",
"provided",
"by",
"unicode",
".",
"org",
"The",
"CLDR",
"data",
"is",
"defined",
"as",
"a",
"npm",
"depen... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/cldr-openui5/lib/index.js#L19-L25 | train | Constructor for a new CLDR | [
30522,
3853,
18856,
13626,
1006,
1051,
7361,
9285,
1007,
1063,
2065,
1006,
999,
1006,
2023,
6013,
11253,
18856,
13626,
1007,
1007,
1063,
2709,
2047,
18856,
13626,
1006,
1051,
7361,
9285,
1007,
1025,
1065,
2023,
1012,
1035,
1051,
7361,
9285,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/space-unary-ops.js | checkForSpacesAfterYield | function checkForSpacesAfterYield(node) {
const tokens = sourceCode.getFirstTokens(node, 3),
word = "yield";
if (!node.argument || node.delegate) {
return;
}
checkUnaryWordOperatorForSpaces(node, tokens[0], tokens[1], word);
} | javascript | function checkForSpacesAfterYield(node) {
const tokens = sourceCode.getFirstTokens(node, 3),
word = "yield";
if (!node.argument || node.delegate) {
return;
}
checkUnaryWordOperatorForSpaces(node, tokens[0], tokens[1], word);
} | [
"function",
"checkForSpacesAfterYield",
"(",
"node",
")",
"{",
"const",
"tokens",
"=",
"sourceCode",
".",
"getFirstTokens",
"(",
"node",
",",
"3",
")",
",",
"word",
"=",
"\"yield\"",
";",
"if",
"(",
"!",
"node",
".",
"argument",
"||",
"node",
".",
"deleg... | Verifies YieldExpressions satisfy spacing requirements
@param {ASTnode} node AST node
@returns {void} | [
"Verifies",
"YieldExpressions",
"satisfy",
"spacing",
"requirements"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-unary-ops.js#L174-L183 | train | Check if a yield is after spaces | [
30522,
3853,
4638,
29278,
23058,
3736,
6199,
7301,
12891,
1006,
13045,
1007,
1063,
9530,
3367,
19204,
2015,
1027,
3120,
16044,
1012,
2131,
8873,
12096,
18715,
6132,
1006,
13045,
1010,
1017,
1007,
1010,
2773,
1027,
1000,
10750,
1000,
1025,
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/project/ProjectManager.js | getSelectedItem | function getSelectedItem() {
// Prefer file tree context, then file tree selection, else use working set
var selectedEntry = getFileTreeContext();
if (!selectedEntry) {
selectedEntry = model.getSelected();
}
if (!selectedEntry) {
selectedEntry = MainViewManager.getCurrentlyViewedFile();
}
return selectedEntry;
} | javascript | function getSelectedItem() {
// Prefer file tree context, then file tree selection, else use working set
var selectedEntry = getFileTreeContext();
if (!selectedEntry) {
selectedEntry = model.getSelected();
}
if (!selectedEntry) {
selectedEntry = MainViewManager.getCurrentlyViewedFile();
}
return selectedEntry;
} | [
"function",
"getSelectedItem",
"(",
")",
"{",
"// Prefer file tree context, then file tree selection, else use working set",
"var",
"selectedEntry",
"=",
"getFileTreeContext",
"(",
")",
";",
"if",
"(",
"!",
"selectedEntry",
")",
"{",
"selectedEntry",
"=",
"model",
".",
... | Returns the File or Directory corresponding to the item selected in the sidebar panel, whether in
the file tree OR in the working set; or null if no item is selected anywhere in the sidebar.
May NOT be identical to the current Document - a folder may be selected in the sidebar, or the sidebar may not
have the current document visible in the tree & working set.
@return {?(File|Directory)} | [
"Returns",
"the",
"File",
"or",
"Directory",
"corresponding",
"to",
"the",
"item",
"selected",
"in",
"the",
"sidebar",
"panel",
"whether",
"in",
"the",
"file",
"tree",
"OR",
"in",
"the",
"working",
"set",
";",
"or",
"null",
"if",
"no",
"item",
"is",
"sel... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectManager.js#L441-L451 | train | Returns the currently selected item | [
30522,
3853,
4152,
12260,
10985,
4221,
2213,
1006,
1007,
1063,
1013,
1013,
9544,
5371,
3392,
6123,
1010,
2059,
5371,
3392,
4989,
1010,
2842,
2224,
2551,
2275,
13075,
3479,
4765,
2854,
1027,
2131,
8873,
7485,
9910,
8663,
18209,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sparksuite/simplemde-markdown-editor | src/js/simplemde.js | isLocalStorageAvailable | function isLocalStorageAvailable() {
if(typeof localStorage === "object") {
try {
localStorage.setItem("smde_localStorage", 1);
localStorage.removeItem("smde_localStorage");
} catch(e) {
return false;
}
} else {
return false;
}
return true;
} | javascript | function isLocalStorageAvailable() {
if(typeof localStorage === "object") {
try {
localStorage.setItem("smde_localStorage", 1);
localStorage.removeItem("smde_localStorage");
} catch(e) {
return false;
}
} else {
return false;
}
return true;
} | [
"function",
"isLocalStorageAvailable",
"(",
")",
"{",
"if",
"(",
"typeof",
"localStorage",
"===",
"\"object\"",
")",
"{",
"try",
"{",
"localStorage",
".",
"setItem",
"(",
"\"smde_localStorage\"",
",",
"1",
")",
";",
"localStorage",
".",
"removeItem",
"(",
"\"s... | Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem throw QuotaExceededError. We're going to detect this and set a variable accordingly. | [
"Safari",
"in",
"Private",
"Browsing",
"Mode",
"looks",
"like",
"it",
"supports",
"localStorage",
"but",
"all",
"calls",
"to",
"setItem",
"throw",
"QuotaExceededError",
".",
"We",
"re",
"going",
"to",
"detect",
"this",
"and",
"set",
"a",
"variable",
"according... | 6abda7ab68cc20f4aca870eb243747951b90ab04 | https://github.com/sparksuite/simplemde-markdown-editor/blob/6abda7ab68cc20f4aca870eb243747951b90ab04/src/js/simplemde.js#L1530-L1543 | train | Check if local storage is available | [
30522,
3853,
2003,
4135,
9289,
23809,
4270,
12462,
11733,
3468,
1006,
1007,
1063,
2065,
1006,
2828,
11253,
10575,
4263,
4270,
1027,
1027,
1027,
1000,
4874,
1000,
1007,
1063,
3046,
1063,
10575,
4263,
4270,
1012,
2275,
4221,
2213,
1006,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/components/raycaster.js | function (time) {
var data = this.data;
var prevCheckTime = this.prevCheckTime;
if (!data.enabled) { return; }
// Only check for intersection if interval time has passed.
if (prevCheckTime && (time - prevCheckTime < data.interval)) { return; }
// Update check time.
this.prevCheckTime = time;
this.checkIntersections();
} | javascript | function (time) {
var data = this.data;
var prevCheckTime = this.prevCheckTime;
if (!data.enabled) { return; }
// Only check for intersection if interval time has passed.
if (prevCheckTime && (time - prevCheckTime < data.interval)) { return; }
// Update check time.
this.prevCheckTime = time;
this.checkIntersections();
} | [
"function",
"(",
"time",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
";",
"var",
"prevCheckTime",
"=",
"this",
".",
"prevCheckTime",
";",
"if",
"(",
"!",
"data",
".",
"enabled",
")",
"{",
"return",
";",
"}",
"// Only check for intersection if interv... | Check for intersections and cleared intersections on an interval. | [
"Check",
"for",
"intersections",
"and",
"cleared",
"intersections",
"on",
"an",
"interval",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/raycaster.js#L187-L199 | train | Check intersection of all items in the sectors | [
30522,
3853,
1006,
2051,
1007,
1063,
13075,
2951,
1027,
2023,
1012,
2951,
1025,
13075,
3653,
25465,
5369,
3600,
7292,
1027,
2023,
1012,
3653,
25465,
5369,
3600,
7292,
1025,
2065,
1006,
999,
2951,
1012,
9124,
1007,
1063,
2709,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
wangfupeng1988/wangEditor | src/js/menus/justify/index.js | Justify | function Justify(editor) {
this.editor = editor
this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-paragraph-left"></i></div>')
this.type = 'droplist'
// 当前是否 active 状态
this._active = false
// 初始化 droplist
this.droplist = new DropList(this, {
width: 100,
$title: $('<p>对齐方式</p>'),
type: 'list', // droplist 以列表形式展示
list: [
{ $elem: $('<span><i class="w-e-icon-paragraph-left"></i> 靠左</span>'), value: 'justifyLeft' },
{ $elem: $('<span><i class="w-e-icon-paragraph-center"></i> 居中</span>'), value: 'justifyCenter' },
{ $elem: $('<span><i class="w-e-icon-paragraph-right"></i> 靠右</span>'), value: 'justifyRight' }
],
onClick: (value) => {
// 注意 this 是指向当前的 List 对象
this._command(value)
}
})
} | javascript | function Justify(editor) {
this.editor = editor
this.$elem = $('<div class="w-e-menu"><i class="w-e-icon-paragraph-left"></i></div>')
this.type = 'droplist'
// 当前是否 active 状态
this._active = false
// 初始化 droplist
this.droplist = new DropList(this, {
width: 100,
$title: $('<p>对齐方式</p>'),
type: 'list', // droplist 以列表形式展示
list: [
{ $elem: $('<span><i class="w-e-icon-paragraph-left"></i> 靠左</span>'), value: 'justifyLeft' },
{ $elem: $('<span><i class="w-e-icon-paragraph-center"></i> 居中</span>'), value: 'justifyCenter' },
{ $elem: $('<span><i class="w-e-icon-paragraph-right"></i> 靠右</span>'), value: 'justifyRight' }
],
onClick: (value) => {
// 注意 this 是指向当前的 List 对象
this._command(value)
}
})
} | [
"function",
"Justify",
"(",
"editor",
")",
"{",
"this",
".",
"editor",
"=",
"editor",
"this",
".",
"$elem",
"=",
"$",
"(",
"'<div class=\"w-e-menu\"><i class=\"w-e-icon-paragraph-left\"></i></div>'",
")",
"this",
".",
"type",
"=",
"'droplist'",
"// 当前是否 active 状态",
... | 构造函数 | [
"构造函数"
] | b77696f5e81c8ec13d9d341252d6b9fa8a22db18 | https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/justify/index.js#L8-L31 | train | Justify 方式 | [
30522,
3853,
16114,
1006,
3559,
1007,
1063,
2023,
1012,
3559,
1027,
3559,
2023,
1012,
1002,
3449,
6633,
1027,
1002,
1006,
1005,
1026,
4487,
2615,
2465,
1027,
1000,
1059,
1011,
1041,
1011,
12183,
1000,
1028,
1026,
1045,
2465,
1027,
1000,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/MainViewManager.js | _closeAll | function _closeAll(paneId) {
_forEachPaneOrPanes(paneId, function (pane) {
var closedList = pane.getViewList();
closedList.forEach(function (file) {
_removeFileFromMRU(pane.id, file);
});
pane._reset();
exports.trigger("workingSetRemoveList", closedList, pane.id);
});
} | javascript | function _closeAll(paneId) {
_forEachPaneOrPanes(paneId, function (pane) {
var closedList = pane.getViewList();
closedList.forEach(function (file) {
_removeFileFromMRU(pane.id, file);
});
pane._reset();
exports.trigger("workingSetRemoveList", closedList, pane.id);
});
} | [
"function",
"_closeAll",
"(",
"paneId",
")",
"{",
"_forEachPaneOrPanes",
"(",
"paneId",
",",
"function",
"(",
"pane",
")",
"{",
"var",
"closedList",
"=",
"pane",
".",
"getViewList",
"(",
")",
";",
"closedList",
".",
"forEach",
"(",
"function",
"(",
"file",... | Closes all files in the specified pane or panes
@param {!string} paneId - id of the pane in which to open the document
This function does not fail if the file is not open | [
"Closes",
"all",
"files",
"in",
"the",
"specified",
"pane",
"or",
"panes"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1384-L1394 | train | Close all files in the specified pane or panes | [
30522,
3853,
1035,
2485,
8095,
1006,
6090,
7416,
2094,
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,
1012,
2131,
8584,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/base/ManagedObjectModel.js | _adaptDeepChildObservation | function _adaptDeepChildObservation(caller, oControl, oAggregation, bObserve) {
var aChildren = oAggregation.get(oControl) || [], oChild, bRecord;
for (var i = 0; i < aChildren.length; i++) {
oChild = aChildren[i];
if (!(oChild instanceof ManagedObject)) {
continue;
}
bRecord = true;
if (bObserve) {
caller._oObserver.observe(oChild, {
properties: true,
aggregations: true
});
} else {
caller._oObserver.unobserve(oChild, {
properties: true,
aggregations: true
});
}
var mAggregations = oChild.getMetadata().getAllAggregations();
for (var sKey in mAggregations) {
_adaptDeepChildObservation(caller, oChild, mAggregations[sKey], bObserve);
}
}
if (bRecord) {
var sKey = oControl.getId() + "/@" + oAggregation.name;
if (bObserve) {
if (!caller._mObservedCount.aggregations[sKey]) {
caller._mObservedCount.aggregations[sKey] = 0;
}
caller._mObservedCount.aggregations[sKey]++;
} else {
delete caller._mObservedCount.aggregations[sKey];
}
}
} | javascript | function _adaptDeepChildObservation(caller, oControl, oAggregation, bObserve) {
var aChildren = oAggregation.get(oControl) || [], oChild, bRecord;
for (var i = 0; i < aChildren.length; i++) {
oChild = aChildren[i];
if (!(oChild instanceof ManagedObject)) {
continue;
}
bRecord = true;
if (bObserve) {
caller._oObserver.observe(oChild, {
properties: true,
aggregations: true
});
} else {
caller._oObserver.unobserve(oChild, {
properties: true,
aggregations: true
});
}
var mAggregations = oChild.getMetadata().getAllAggregations();
for (var sKey in mAggregations) {
_adaptDeepChildObservation(caller, oChild, mAggregations[sKey], bObserve);
}
}
if (bRecord) {
var sKey = oControl.getId() + "/@" + oAggregation.name;
if (bObserve) {
if (!caller._mObservedCount.aggregations[sKey]) {
caller._mObservedCount.aggregations[sKey] = 0;
}
caller._mObservedCount.aggregations[sKey]++;
} else {
delete caller._mObservedCount.aggregations[sKey];
}
}
} | [
"function",
"_adaptDeepChildObservation",
"(",
"caller",
",",
"oControl",
",",
"oAggregation",
",",
"bObserve",
")",
"{",
"var",
"aChildren",
"=",
"oAggregation",
".",
"get",
"(",
"oControl",
")",
"||",
"[",
"]",
",",
"oChild",
",",
"bRecord",
";",
"for",
... | Adapt the observation of child controls in order to be able to react when e.g. the value
of a select inside a list changed. Currently the MOM is not updated then
@param {object} the caller, here the managed object model
@param {control} the control which shall be (un)observed
@param {object} the observed aggregation
@param {boolean} <code>true</code> for observing and <code>false</code> for unobserving
@private | [
"Adapt",
"the",
"observation",
"of",
"child",
"controls",
"in",
"order",
"to",
"be",
"able",
"to",
"react",
"when",
"e",
".",
"g",
".",
"the",
"value",
"of",
"a",
"select",
"inside",
"a",
"list",
"changed",
".",
"Currently",
"the",
"MOM",
"is",
"not",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js#L20-L61 | train | Adaptes the observers of a deep child aggregation. | [
30522,
3853,
1035,
15581,
26095,
15042,
19466,
3527,
5910,
2121,
21596,
1006,
20587,
1010,
1051,
8663,
13181,
2140,
1010,
1051,
8490,
17603,
12540,
1010,
3960,
8043,
3726,
1007,
1063,
13075,
9353,
19466,
16200,
2078,
1027,
1051,
8490,
17603,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.ux3/src/sap/ui/ux3/ExactList.js | function(oList, oAttribute) {
if (oAttribute.getSelected()) {
var aAttributes = oAttribute.getAttributesInternal(true);
if (aAttributes.length > 0) {
var oSubList;
if (oAttribute.getChangeListener()) {
oSubList = sap.ui.getCore().byId(oAttribute.getChangeListener().id);
} else {
oSubList = new ExactList();
}
oSubList.setData(oAttribute);
return oSubList;
}
}
return null;
} | javascript | function(oList, oAttribute) {
if (oAttribute.getSelected()) {
var aAttributes = oAttribute.getAttributesInternal(true);
if (aAttributes.length > 0) {
var oSubList;
if (oAttribute.getChangeListener()) {
oSubList = sap.ui.getCore().byId(oAttribute.getChangeListener().id);
} else {
oSubList = new ExactList();
}
oSubList.setData(oAttribute);
return oSubList;
}
}
return null;
} | [
"function",
"(",
"oList",
",",
"oAttribute",
")",
"{",
"if",
"(",
"oAttribute",
".",
"getSelected",
"(",
")",
")",
"{",
"var",
"aAttributes",
"=",
"oAttribute",
".",
"getAttributesInternal",
"(",
"true",
")",
";",
"if",
"(",
"aAttributes",
".",
"length",
... | Creates a new ExactList for the given attribute if the attribute is selected and does not have a corresponding list yet. If the attribute has a corresponding list already this list is returned. | [
"Creates",
"a",
"new",
"ExactList",
"for",
"the",
"given",
"attribute",
"if",
"the",
"attribute",
"is",
"selected",
"and",
"does",
"not",
"have",
"a",
"corresponding",
"list",
"yet",
".",
"If",
"the",
"attribute",
"has",
"a",
"corresponding",
"list",
"alread... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js#L1403-L1420 | train | Returns the list of attributes that have been selected | [
30522,
3853,
1006,
19330,
2923,
1010,
1051,
19321,
3089,
8569,
2618,
1007,
1063,
2065,
1006,
1051,
19321,
3089,
8569,
2618,
1012,
4152,
12260,
10985,
1006,
1007,
1007,
1063,
13075,
9779,
4779,
3089,
8569,
4570,
1027,
1051,
19321,
3089,
8569... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
mochajs/mocha | lib/suite.js | Suite | function Suite(title, parentContext, isRoot) {
if (!utils.isString(title)) {
throw createInvalidArgumentTypeError(
'Suite argument "title" must be a string. Received type "' +
typeof title +
'"',
'title',
'string'
);
}
this.title = title;
function Context() {}
Context.prototype = parentContext;
this.ctx = new Context();
this.suites = [];
this.tests = [];
this.pending = false;
this._beforeEach = [];
this._beforeAll = [];
this._afterEach = [];
this._afterAll = [];
this.root = isRoot === true;
this._timeout = 2000;
this._enableTimeouts = true;
this._slow = 75;
this._bail = false;
this._retries = -1;
this._onlyTests = [];
this._onlySuites = [];
this.delayed = false;
this.on('newListener', function(event) {
if (deprecatedEvents[event]) {
utils.deprecate(
'Event "' +
event +
'" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
);
}
});
} | javascript | function Suite(title, parentContext, isRoot) {
if (!utils.isString(title)) {
throw createInvalidArgumentTypeError(
'Suite argument "title" must be a string. Received type "' +
typeof title +
'"',
'title',
'string'
);
}
this.title = title;
function Context() {}
Context.prototype = parentContext;
this.ctx = new Context();
this.suites = [];
this.tests = [];
this.pending = false;
this._beforeEach = [];
this._beforeAll = [];
this._afterEach = [];
this._afterAll = [];
this.root = isRoot === true;
this._timeout = 2000;
this._enableTimeouts = true;
this._slow = 75;
this._bail = false;
this._retries = -1;
this._onlyTests = [];
this._onlySuites = [];
this.delayed = false;
this.on('newListener', function(event) {
if (deprecatedEvents[event]) {
utils.deprecate(
'Event "' +
event +
'" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
);
}
});
} | [
"function",
"Suite",
"(",
"title",
",",
"parentContext",
",",
"isRoot",
")",
"{",
"if",
"(",
"!",
"utils",
".",
"isString",
"(",
"title",
")",
")",
"{",
"throw",
"createInvalidArgumentTypeError",
"(",
"'Suite argument \"title\" must be a string. Received type \"'",
... | Constructs a new `Suite` instance with the given `title`, `ctx`, and `isRoot`.
@public
@class
@extends EventEmitter
@see {@link https://nodejs.org/api/events.html#events_class_eventemitter|EventEmitter}
@param {string} title - Suite title.
@param {Context} parentContext - Parent context instance.
@param {boolean} [isRoot=false] - Whether this is the root suite. | [
"Constructs",
"a",
"new",
"Suite",
"instance",
"with",
"the",
"given",
"title",
"ctx",
"and",
"isRoot",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/suite.js#L48-L88 | train | Suite constructor. | [
30522,
3853,
7621,
1006,
2516,
1010,
6687,
8663,
18209,
1010,
2003,
3217,
4140,
1007,
1063,
2065,
1006,
999,
21183,
12146,
1012,
26354,
18886,
3070,
1006,
2516,
1007,
1007,
1063,
5466,
3443,
2378,
10175,
8524,
10623,
27417,
15353,
28084,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
statsd/statsd | backends/graphite.js | Metric | function Metric(key, value, ts) {
var m = this;
this.key = key;
this.value = value;
this.ts = ts;
// return a string representation of this metric appropriate
// for sending to the graphite collector. does not include
// a trailing newline.
this.toText = function() {
return m.key + " " + m.value + " " + m.ts;
};
this.toPickle = function() {
return MARK + STRING + '\'' + m.key + '\'\n' + MARK + LONG + m.ts + 'L\n' + STRING + '\'' + m.value + '\'\n' + TUPLE + TUPLE + APPEND;
};
} | javascript | function Metric(key, value, ts) {
var m = this;
this.key = key;
this.value = value;
this.ts = ts;
// return a string representation of this metric appropriate
// for sending to the graphite collector. does not include
// a trailing newline.
this.toText = function() {
return m.key + " " + m.value + " " + m.ts;
};
this.toPickle = function() {
return MARK + STRING + '\'' + m.key + '\'\n' + MARK + LONG + m.ts + 'L\n' + STRING + '\'' + m.value + '\'\n' + TUPLE + TUPLE + APPEND;
};
} | [
"function",
"Metric",
"(",
"key",
",",
"value",
",",
"ts",
")",
"{",
"var",
"m",
"=",
"this",
";",
"this",
".",
"key",
"=",
"key",
";",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"ts",
"=",
"ts",
";",
"// return a string representation of ... | A single measurement for sending to graphite. | [
"A",
"single",
"measurement",
"for",
"sending",
"to",
"graphite",
"."
] | ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9 | https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/backends/graphite.js#L105-L121 | train | A metric object | [
30522,
3853,
12046,
1006,
3145,
1010,
3643,
1010,
24529,
1007,
1063,
13075,
1049,
1027,
2023,
1025,
2023,
1012,
3145,
1027,
3145,
1025,
2023,
1012,
3643,
1027,
3643,
1025,
2023,
1012,
24529,
1027,
24529,
1025,
1013,
1013,
2709,
1037,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (real_x) {
if (this.options.type === "single") {
return "single";
} else {
var m_point = this.coords.p_from_real + ((this.coords.p_to_real - this.coords.p_from_real) / 2);
if (real_x >= m_point) {
return this.options.to_fixed ? "from" : "to";
} else {
return this.options.from_fixed ? "to" : "from";
}
}
} | javascript | function (real_x) {
if (this.options.type === "single") {
return "single";
} else {
var m_point = this.coords.p_from_real + ((this.coords.p_to_real - this.coords.p_from_real) / 2);
if (real_x >= m_point) {
return this.options.to_fixed ? "from" : "to";
} else {
return this.options.from_fixed ? "to" : "from";
}
}
} | [
"function",
"(",
"real_x",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"type",
"===",
"\"single\"",
")",
"{",
"return",
"\"single\"",
";",
"}",
"else",
"{",
"var",
"m_point",
"=",
"this",
".",
"coords",
".",
"p_from_real",
"+",
"(",
"(",
"this"... | Find closest handle to pointer click
@param real_x {Number}
@returns {String} | [
"Find",
"closest",
"handle",
"to",
"pointer",
"click"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1258-L1269 | train | returns the type of the file | [
30522,
3853,
1006,
2613,
1035,
1060,
1007,
1063,
2065,
1006,
2023,
1012,
7047,
1012,
2828,
1027,
1027,
1027,
1000,
2309,
1000,
1007,
1063,
2709,
1000,
2309,
1000,
1025,
1065,
2842,
1063,
13075,
1049,
1035,
2391,
1027,
2023,
1012,
2522,
85... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/editor/EditorStatusBar.js | _changeIndentWidth | function _changeIndentWidth(fullPath, value) {
$indentWidthLabel.removeClass("hidden");
$indentWidthInput.addClass("hidden");
// remove all event handlers from the input field
$indentWidthInput.off("blur keyup");
// restore focus to the editor
MainViewManager.focusActivePane();
var valInt = parseInt(value, 10);
if (Editor.getUseTabChar(fullPath)) {
if (!Editor.setTabSize(valInt, fullPath)) {
return; // validation failed
}
} else {
if (!Editor.setSpaceUnits(valInt, fullPath)) {
return; // validation failed
}
}
// update indicator
_updateIndentSize(fullPath);
// column position may change when tab size changes
_updateCursorInfo();
} | javascript | function _changeIndentWidth(fullPath, value) {
$indentWidthLabel.removeClass("hidden");
$indentWidthInput.addClass("hidden");
// remove all event handlers from the input field
$indentWidthInput.off("blur keyup");
// restore focus to the editor
MainViewManager.focusActivePane();
var valInt = parseInt(value, 10);
if (Editor.getUseTabChar(fullPath)) {
if (!Editor.setTabSize(valInt, fullPath)) {
return; // validation failed
}
} else {
if (!Editor.setSpaceUnits(valInt, fullPath)) {
return; // validation failed
}
}
// update indicator
_updateIndentSize(fullPath);
// column position may change when tab size changes
_updateCursorInfo();
} | [
"function",
"_changeIndentWidth",
"(",
"fullPath",
",",
"value",
")",
"{",
"$indentWidthLabel",
".",
"removeClass",
"(",
"\"hidden\"",
")",
";",
"$indentWidthInput",
".",
"addClass",
"(",
"\"hidden\"",
")",
";",
"// remove all event handlers from the input field",
"$ind... | Change indent size
@param {string} fullPath Path to file in current editor
@param {string} value Size entered into status bar | [
"Change",
"indent",
"size"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorStatusBar.js#L207-L233 | train | change indent width | [
30522,
3853,
1035,
2689,
22254,
4765,
9148,
11927,
2232,
1006,
2440,
15069,
1010,
3643,
1007,
1063,
1002,
27427,
4765,
9148,
11927,
7317,
16336,
2140,
1012,
6366,
26266,
1006,
1000,
5023,
1000,
1007,
1025,
1002,
27427,
4765,
9148,
11927,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | src/ol/format/TopoJSON.js | readMultiPolygonGeometry | function readMultiPolygonGeometry(object, arcs) {
const coordinates = [];
for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {
// for each polygon
const polyArray = object['arcs'][i];
const ringCoords = [];
for (let j = 0, jj = polyArray.length; j < jj; ++j) {
// for each ring
ringCoords[j] = concatenateArcs(polyArray[j], arcs);
}
coordinates[i] = ringCoords;
}
return new MultiPolygon(coordinates);
} | javascript | function readMultiPolygonGeometry(object, arcs) {
const coordinates = [];
for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {
// for each polygon
const polyArray = object['arcs'][i];
const ringCoords = [];
for (let j = 0, jj = polyArray.length; j < jj; ++j) {
// for each ring
ringCoords[j] = concatenateArcs(polyArray[j], arcs);
}
coordinates[i] = ringCoords;
}
return new MultiPolygon(coordinates);
} | [
"function",
"readMultiPolygonGeometry",
"(",
"object",
",",
"arcs",
")",
"{",
"const",
"coordinates",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"ii",
"=",
"object",
"[",
"'arcs'",
"]",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",... | Create a multi-polygon from a TopoJSON geometry object.
@param {TopoJSONMultiPolygon} object TopoJSON object.
@param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
@return {MultiPolygon} Geometry. | [
"Create",
"a",
"multi",
"-",
"polygon",
"from",
"a",
"TopoJSON",
"geometry",
"object",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/TopoJSON.js#L277-L290 | train | Read a multi - polygon geometry from an object | [
30522,
3853,
3191,
12274,
7096,
11514,
4747,
2100,
17036,
8780,
24327,
1006,
4874,
1010,
29137,
1007,
1063,
9530,
3367,
12093,
1027,
1031,
1033,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1010,
2462,
1027,
4874,
1031,
1005,
29137,
1005,
1033... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | downloadInstaller | function downloadInstaller(requester, isInitialAttempt, updateParams) {
updateParams = updateParams || _updateParams;
var currentRequester = requester || "";
try {
var ext = path.extname(updateParams.installerName);
var localInstallerPath = path.resolve(updateDir, Date.now().toString() + ext),
localInstallerFile = fs.createWriteStream(localInstallerPath),
requestCompleted = true,
readTimeOut = 180000;
progress(request(updateParams.downloadURL, {timeout: readTimeOut}), {})
.on('progress', function (state) {
var target = "retry-download";
if (isInitialAttempt) {
target = "initial-download";
}
var info = Math.floor(parseFloat(state.percent) * 100).toString() + '%';
var status = {
target: target,
spans: [{
id: "percent",
val: info
}]
};
postMessageToBrackets(MessageIds.SHOW_STATUS_INFO, currentRequester, status);
})
.on('error', function (err) {
console.log("AutoUpdate : Download failed. Error occurred : " + err.toString());
requestCompleted = false;
localInstallerFile.end();
var error = err.code === 'ESOCKETTIMEDOUT' || err.code === 'ENOTFOUND' ?
nodeErrorMessages.NETWORK_SLOW_OR_DISCONNECTED :
nodeErrorMessages.DOWNLOAD_ERROR;
postMessageToBrackets(MessageIds.NOTIFY_DOWNLOAD_FAILURE, currentRequester, error);
})
.pipe(localInstallerFile)
.on('close', function () {
if (requestCompleted) {
try {
fs.renameSync(localInstallerPath, installerPath);
postMessageToBrackets(MessageIds.NOTIFY_DOWNLOAD_SUCCESS, currentRequester);
} catch (e) {
console.log("AutoUpdate : Download failed. Exception occurred : " + e.toString());
postMessageToBrackets(MessageIds.NOTIFY_DOWNLOAD_FAILURE,
currentRequester, nodeErrorMessages.DOWNLOAD_ERROR);
}
}
});
} catch (e) {
console.log("AutoUpdate : Download failed. Exception occurred : " + e.toString());
postMessageToBrackets(MessageIds.NOTIFY_DOWNLOAD_FAILURE,
currentRequester, nodeErrorMessages.DOWNLOAD_ERROR);
}
} | javascript | function downloadInstaller(requester, isInitialAttempt, updateParams) {
updateParams = updateParams || _updateParams;
var currentRequester = requester || "";
try {
var ext = path.extname(updateParams.installerName);
var localInstallerPath = path.resolve(updateDir, Date.now().toString() + ext),
localInstallerFile = fs.createWriteStream(localInstallerPath),
requestCompleted = true,
readTimeOut = 180000;
progress(request(updateParams.downloadURL, {timeout: readTimeOut}), {})
.on('progress', function (state) {
var target = "retry-download";
if (isInitialAttempt) {
target = "initial-download";
}
var info = Math.floor(parseFloat(state.percent) * 100).toString() + '%';
var status = {
target: target,
spans: [{
id: "percent",
val: info
}]
};
postMessageToBrackets(MessageIds.SHOW_STATUS_INFO, currentRequester, status);
})
.on('error', function (err) {
console.log("AutoUpdate : Download failed. Error occurred : " + err.toString());
requestCompleted = false;
localInstallerFile.end();
var error = err.code === 'ESOCKETTIMEDOUT' || err.code === 'ENOTFOUND' ?
nodeErrorMessages.NETWORK_SLOW_OR_DISCONNECTED :
nodeErrorMessages.DOWNLOAD_ERROR;
postMessageToBrackets(MessageIds.NOTIFY_DOWNLOAD_FAILURE, currentRequester, error);
})
.pipe(localInstallerFile)
.on('close', function () {
if (requestCompleted) {
try {
fs.renameSync(localInstallerPath, installerPath);
postMessageToBrackets(MessageIds.NOTIFY_DOWNLOAD_SUCCESS, currentRequester);
} catch (e) {
console.log("AutoUpdate : Download failed. Exception occurred : " + e.toString());
postMessageToBrackets(MessageIds.NOTIFY_DOWNLOAD_FAILURE,
currentRequester, nodeErrorMessages.DOWNLOAD_ERROR);
}
}
});
} catch (e) {
console.log("AutoUpdate : Download failed. Exception occurred : " + e.toString());
postMessageToBrackets(MessageIds.NOTIFY_DOWNLOAD_FAILURE,
currentRequester, nodeErrorMessages.DOWNLOAD_ERROR);
}
} | [
"function",
"downloadInstaller",
"(",
"requester",
",",
"isInitialAttempt",
",",
"updateParams",
")",
"{",
"updateParams",
"=",
"updateParams",
"||",
"_updateParams",
";",
"var",
"currentRequester",
"=",
"requester",
"||",
"\"\"",
";",
"try",
"{",
"var",
"ext",
... | Downloads the installer for latest Brackets release
@param {boolean} sendInfo - true if download status info needs to be
sent back to Brackets, false otherwise
@param {object} [updateParams=_updateParams] - json containing update parameters | [
"Downloads",
"the",
"installer",
"for",
"latest",
"Brackets",
"release"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js#L272-L324 | train | Download the installer | [
30522,
3853,
8816,
7076,
9080,
3917,
1006,
5227,
2121,
1010,
2003,
5498,
20925,
19321,
6633,
13876,
1010,
10651,
28689,
5244,
1007,
1063,
10651,
28689,
5244,
1027,
10651,
28689,
5244,
1064,
1064,
1035,
10651,
28689,
5244,
1025,
13075,
2783,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jhipster/generator-jhipster | generators/docker-prompts.js | askForDockerRepositoryName | function askForDockerRepositoryName() {
if (this.regenerate) return;
const done = this.async();
const prompts = [
{
type: 'input',
name: 'dockerRepositoryName',
message: 'What should we use for the base Docker repository name?',
default: this.dockerRepositoryName
}
];
this.prompt(prompts).then(props => {
this.dockerRepositoryName = props.dockerRepositoryName;
done();
});
} | javascript | function askForDockerRepositoryName() {
if (this.regenerate) return;
const done = this.async();
const prompts = [
{
type: 'input',
name: 'dockerRepositoryName',
message: 'What should we use for the base Docker repository name?',
default: this.dockerRepositoryName
}
];
this.prompt(prompts).then(props => {
this.dockerRepositoryName = props.dockerRepositoryName;
done();
});
} | [
"function",
"askForDockerRepositoryName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"regenerate",
")",
"return",
";",
"const",
"done",
"=",
"this",
".",
"async",
"(",
")",
";",
"const",
"prompts",
"=",
"[",
"{",
"type",
":",
"'input'",
",",
"name",
":",
... | Ask For Docker Repository Name | [
"Ask",
"For",
"Docker",
"Repository",
"Name"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-prompts.js#L401-L419 | train | Ask For Docker Repository Name | [
30522,
3853,
3198,
3877,
7432,
28849,
6873,
28307,
18279,
4168,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
19723,
24454,
3686,
1007,
2709,
1025,
9530,
3367,
2589,
1027,
2023,
1012,
2004,
6038,
2278,
1006,
1007,
1025,
9530,
3367,
25732,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc-node | packages/grpc-native-core/src/client_interceptors.js | _areBatchRequirementsMet | function _areBatchRequirementsMet(batch_ops, completed_ops) {
var dependencies = common.flatMap(batch_ops, function(op) {
return OP_DEPENDENCIES[op] || [];
});
for (var i = 0; i < dependencies.length; i++) {
var required_dep = dependencies[i];
if (batch_ops.indexOf(required_dep) === -1 &&
completed_ops.indexOf(required_dep) === -1) {
return false;
}
}
return true;
} | javascript | function _areBatchRequirementsMet(batch_ops, completed_ops) {
var dependencies = common.flatMap(batch_ops, function(op) {
return OP_DEPENDENCIES[op] || [];
});
for (var i = 0; i < dependencies.length; i++) {
var required_dep = dependencies[i];
if (batch_ops.indexOf(required_dep) === -1 &&
completed_ops.indexOf(required_dep) === -1) {
return false;
}
}
return true;
} | [
"function",
"_areBatchRequirementsMet",
"(",
"batch_ops",
",",
"completed_ops",
")",
"{",
"var",
"dependencies",
"=",
"common",
".",
"flatMap",
"(",
"batch_ops",
",",
"function",
"(",
"op",
")",
"{",
"return",
"OP_DEPENDENCIES",
"[",
"op",
"]",
"||",
"[",
"]... | Tests whether a batch can be started.
@private
@param {number[]} batch_ops The operations in the batch we are checking.
@param {number[]} completed_ops Previously completed operations.
@return {boolean} | [
"Tests",
"whether",
"a",
"batch",
"can",
"be",
"started",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L717-L729 | train | Check if the batch_ops are met | [
30522,
3853,
1035,
2024,
14479,
2818,
2890,
15549,
28578,
11187,
11368,
1006,
14108,
1035,
23092,
1010,
2949,
1035,
23092,
1007,
1063,
13075,
12530,
15266,
1027,
2691,
1012,
4257,
2863,
2361,
1006,
14108,
1035,
23092,
1010,
3853,
1006,
6728,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tabs/js/tabsController.js | updateInkBarStyles | function updateInkBarStyles (previousTotalWidth, previousWidthOfTabItems) {
if (ctrl.noInkBar) {
return;
}
var elements = getElements();
if (!elements.tabs[ ctrl.selectedIndex ]) {
angular.element(elements.inkBar).css({ left: 'auto', right: 'auto' });
return;
}
if (!ctrl.tabs.length) {
queue.push(ctrl.updateInkBarStyles);
return;
}
// If the element is not visible, we will not be able to calculate sizes until it becomes
// visible. We should treat that as a resize event rather than just updating the ink bar.
if (!$element.prop('offsetParent')) {
handleResizeWhenVisible();
return;
}
var index = ctrl.selectedIndex,
totalWidth = elements.paging.offsetWidth,
tab = elements.tabs[ index ],
left = tab.offsetLeft,
right = totalWidth - left - tab.offsetWidth;
if (ctrl.shouldCenterTabs) {
// We need to use the same calculate process as in the pagination wrapper, to avoid rounding
// deviations.
var totalWidthOfTabItems = calcTabsWidth(elements.tabs);
if (totalWidth > totalWidthOfTabItems &&
previousTotalWidth !== totalWidth &&
previousWidthOfTabItems !== totalWidthOfTabItems) {
$timeout(updateInkBarStyles, 0, true, totalWidth, totalWidthOfTabItems);
}
}
updateInkBarClassName();
angular.element(elements.inkBar).css({ left: left + 'px', right: right + 'px' });
} | javascript | function updateInkBarStyles (previousTotalWidth, previousWidthOfTabItems) {
if (ctrl.noInkBar) {
return;
}
var elements = getElements();
if (!elements.tabs[ ctrl.selectedIndex ]) {
angular.element(elements.inkBar).css({ left: 'auto', right: 'auto' });
return;
}
if (!ctrl.tabs.length) {
queue.push(ctrl.updateInkBarStyles);
return;
}
// If the element is not visible, we will not be able to calculate sizes until it becomes
// visible. We should treat that as a resize event rather than just updating the ink bar.
if (!$element.prop('offsetParent')) {
handleResizeWhenVisible();
return;
}
var index = ctrl.selectedIndex,
totalWidth = elements.paging.offsetWidth,
tab = elements.tabs[ index ],
left = tab.offsetLeft,
right = totalWidth - left - tab.offsetWidth;
if (ctrl.shouldCenterTabs) {
// We need to use the same calculate process as in the pagination wrapper, to avoid rounding
// deviations.
var totalWidthOfTabItems = calcTabsWidth(elements.tabs);
if (totalWidth > totalWidthOfTabItems &&
previousTotalWidth !== totalWidth &&
previousWidthOfTabItems !== totalWidthOfTabItems) {
$timeout(updateInkBarStyles, 0, true, totalWidth, totalWidthOfTabItems);
}
}
updateInkBarClassName();
angular.element(elements.inkBar).css({ left: left + 'px', right: right + 'px' });
} | [
"function",
"updateInkBarStyles",
"(",
"previousTotalWidth",
",",
"previousWidthOfTabItems",
")",
"{",
"if",
"(",
"ctrl",
".",
"noInkBar",
")",
"{",
"return",
";",
"}",
"var",
"elements",
"=",
"getElements",
"(",
")",
";",
"if",
"(",
"!",
"elements",
".",
... | Repositions the ink bar to the selected tab.
Parameters are used when calling itself recursively when md-center-tabs is used as we need to
run two passes to properly center the tabs. These parameters ensure that we only run two passes
and that we don't run indefinitely.
@param {number=} previousTotalWidth previous width of pagination wrapper
@param {number=} previousWidthOfTabItems previous width of all tab items | [
"Repositions",
"the",
"ink",
"bar",
"to",
"the",
"selected",
"tab",
".",
"Parameters",
"are",
"used",
"when",
"calling",
"itself",
"recursively",
"when",
"md",
"-",
"center",
"-",
"tabs",
"is",
"used",
"as",
"we",
"need",
"to",
"run",
"two",
"passes",
"t... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L861-L902 | train | Updates the ink bar s style based on the current tab and tab items. | [
30522,
3853,
10651,
19839,
8237,
21756,
4244,
1006,
3025,
3406,
9080,
9148,
11927,
2232,
1010,
3025,
9148,
11927,
14586,
2696,
16313,
6633,
2015,
1007,
1063,
2065,
1006,
14931,
12190,
1012,
2053,
19839,
8237,
1007,
1063,
2709,
1025,
1065,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/material-design-lite | src/mdlComponentHandler.js | downgradeNodesInternal | function downgradeNodesInternal(nodes) {
/**
* Auxiliary function to downgrade a single node.
* @param {!Node} node the node to be downgraded
*/
var downgradeNode = function(node) {
createdComponents_.filter(function(item) {
return item.element_ === node;
}).forEach(deconstructComponentInternal);
};
if (nodes instanceof Array || nodes instanceof NodeList) {
for (var n = 0; n < nodes.length; n++) {
downgradeNode(nodes[n]);
}
} else if (nodes instanceof Node) {
downgradeNode(nodes);
} else {
throw new Error('Invalid argument provided to downgrade MDL nodes.');
}
} | javascript | function downgradeNodesInternal(nodes) {
/**
* Auxiliary function to downgrade a single node.
* @param {!Node} node the node to be downgraded
*/
var downgradeNode = function(node) {
createdComponents_.filter(function(item) {
return item.element_ === node;
}).forEach(deconstructComponentInternal);
};
if (nodes instanceof Array || nodes instanceof NodeList) {
for (var n = 0; n < nodes.length; n++) {
downgradeNode(nodes[n]);
}
} else if (nodes instanceof Node) {
downgradeNode(nodes);
} else {
throw new Error('Invalid argument provided to downgrade MDL nodes.');
}
} | [
"function",
"downgradeNodesInternal",
"(",
"nodes",
")",
"{",
"/**\n * Auxiliary function to downgrade a single node.\n * @param {!Node} node the node to be downgraded\n */",
"var",
"downgradeNode",
"=",
"function",
"(",
"node",
")",
"{",
"createdComponents_",
".",
"fi... | Downgrade either a given node, an array of nodes, or a NodeList.
@param {!Node|!Array<!Node>|!NodeList} nodes | [
"Downgrade",
"either",
"a",
"given",
"node",
"an",
"array",
"of",
"nodes",
"or",
"a",
"NodeList",
"."
] | 60f441a22ed98ed2c03f6179adf460d888bf459f | https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/src/mdlComponentHandler.js#L390-L409 | train | downgrade nodes from the MDL to the top of the MDL | [
30522,
3853,
2091,
24170,
3630,
6155,
18447,
11795,
2389,
1006,
14164,
1007,
1063,
1013,
1008,
1008,
1008,
9830,
3853,
2000,
2091,
30524,
3853,
1006,
8875,
1007,
1063,
2709,
8875,
1012,
5783,
1035,
1027,
1027,
1027,
13045,
1025,
1065,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/editor/ImageViewer.js | _createImageView | function _createImageView(file, pane) {
var view = pane.getViewForPath(file.fullPath);
if (view) {
pane.showView(view);
} else {
view = new ImageView(file, pane.$content);
pane.addView(view, true);
}
return new $.Deferred().resolve().promise();
} | javascript | function _createImageView(file, pane) {
var view = pane.getViewForPath(file.fullPath);
if (view) {
pane.showView(view);
} else {
view = new ImageView(file, pane.$content);
pane.addView(view, true);
}
return new $.Deferred().resolve().promise();
} | [
"function",
"_createImageView",
"(",
"file",
",",
"pane",
")",
"{",
"var",
"view",
"=",
"pane",
".",
"getViewForPath",
"(",
"file",
".",
"fullPath",
")",
";",
"if",
"(",
"view",
")",
"{",
"pane",
".",
"showView",
"(",
"view",
")",
";",
"}",
"else",
... | /*
Creates an image view object and adds it to the specified pane
@param {!File} file - the file to create an image of
@param {!Pane} pane - the pane in which to host the view
@return {jQuery.Promise} | [
"/",
"*",
"Creates",
"an",
"image",
"view",
"object",
"and",
"adds",
"it",
"to",
"the",
"specified",
"pane"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/ImageViewer.js#L417-L427 | train | Create ImageView | [
30522,
3853,
1035,
3443,
9581,
3351,
8584,
1006,
5371,
1010,
6090,
2063,
1007,
1063,
13075,
3193,
1027,
6090,
2063,
1012,
2131,
8584,
29278,
15069,
1006,
5371,
1012,
2440,
15069,
1007,
1025,
2065,
1006,
3193,
1007,
1063,
6090,
2063,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/mvc/View.js | alignPreprocessorStructure | function alignPreprocessorStructure(oPreprocessor) {
oPreprocessor._settings = {};
for (var sProp in oPreprocessor) {
// copy all relevant settings to the internal settings object which gets passed to the preprocessor function
if (sProp.indexOf("_") !== 0) {
oPreprocessor._settings[sProp] = oPreprocessor[sProp];
}
}
} | javascript | function alignPreprocessorStructure(oPreprocessor) {
oPreprocessor._settings = {};
for (var sProp in oPreprocessor) {
// copy all relevant settings to the internal settings object which gets passed to the preprocessor function
if (sProp.indexOf("_") !== 0) {
oPreprocessor._settings[sProp] = oPreprocessor[sProp];
}
}
} | [
"function",
"alignPreprocessorStructure",
"(",
"oPreprocessor",
")",
"{",
"oPreprocessor",
".",
"_settings",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"sProp",
"in",
"oPreprocessor",
")",
"{",
"// copy all relevant settings to the internal settings object which gets passed to ... | align object structure to internal preprocessor format to be able to store internal settings without conflicts
external view: { preprocessor: ("my.Preprocessor" || function), settings: {everythingElse: ... , ...} }
internal view: { _settings:{ preprocessor: ("my.Preprocessor" || function), settings: {everythingElse: ... , ...}}, _internalFoo: "bar"}
@param {sap.ui.core.mvc.View.Preprocessor} oPreprocessor Preprocessor config object
@private | [
"align",
"object",
"structure",
"to",
"internal",
"preprocessor",
"format",
"to",
"be",
"able",
"to",
"store",
"internal",
"settings",
"without",
"conflicts",
"external",
"view",
":",
"{",
"preprocessor",
":",
"(",
"my",
".",
"Preprocessor",
"||",
"function",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/View.js#L212-L220 | train | align the preprocessor structure with the internal settings object | [
30522,
3853,
25705,
28139,
21572,
9623,
21748,
3367,
6820,
14890,
1006,
6728,
2890,
21572,
9623,
21748,
1007,
1063,
6728,
2890,
21572,
9623,
21748,
1012,
1035,
10906,
1027,
1063,
1065,
1025,
2005,
1006,
13075,
11867,
18981,
1999,
6728,
2890,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.