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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SeleniumHQ/selenium | third_party/closure/goog/labs/format/csv.js | readQuotedField | function readQuotedField() {
// We've already consumed the first quote by the time we get here.
var start = index;
var end = null;
for (var token = nextToken(); token != EOF; token = nextToken()) {
if (token == '"') {
end = index - 1;
token = nextToken();
// Two double quotes in a row. Keep scanning.
if (token == '"') {
end = null;
continue;
}
// End of field. Break out.
if (token == delimiter || token == EOF || token == NEWLINE) {
if (token == NEWLINE) {
pushBack(token);
}
break;
}
if (!opt_ignoreErrors) {
// Ignoring errors here means keep going in current field after
// closing quote. E.g. "ab"c,d splits into abc,d
throw new goog.labs.format.csv.ParseError(
text, index - 1,
'Unexpected character "' + token + '" after quote mark');
} else {
// Fall back to reading the rest of this field as unquoted.
// Note: the rest is guaranteed not start with ", as that case is
// eliminated above.
var prefix = '"' + text.substring(start, index);
var suffix = readField();
if (suffix == EOR) {
pushBack(NEWLINE);
return prefix;
} else {
return prefix + suffix;
}
}
}
}
if (goog.isNull(end)) {
if (!opt_ignoreErrors) {
throw new goog.labs.format.csv.ParseError(
text, text.length - 1, 'Unexpected end of text after open quote');
} else {
end = text.length;
}
}
// Take substring, combine double quotes.
return text.substring(start, end).replace(/""/g, '"');
} | javascript | function readQuotedField() {
// We've already consumed the first quote by the time we get here.
var start = index;
var end = null;
for (var token = nextToken(); token != EOF; token = nextToken()) {
if (token == '"') {
end = index - 1;
token = nextToken();
// Two double quotes in a row. Keep scanning.
if (token == '"') {
end = null;
continue;
}
// End of field. Break out.
if (token == delimiter || token == EOF || token == NEWLINE) {
if (token == NEWLINE) {
pushBack(token);
}
break;
}
if (!opt_ignoreErrors) {
// Ignoring errors here means keep going in current field after
// closing quote. E.g. "ab"c,d splits into abc,d
throw new goog.labs.format.csv.ParseError(
text, index - 1,
'Unexpected character "' + token + '" after quote mark');
} else {
// Fall back to reading the rest of this field as unquoted.
// Note: the rest is guaranteed not start with ", as that case is
// eliminated above.
var prefix = '"' + text.substring(start, index);
var suffix = readField();
if (suffix == EOR) {
pushBack(NEWLINE);
return prefix;
} else {
return prefix + suffix;
}
}
}
}
if (goog.isNull(end)) {
if (!opt_ignoreErrors) {
throw new goog.labs.format.csv.ParseError(
text, text.length - 1, 'Unexpected end of text after open quote');
} else {
end = text.length;
}
}
// Take substring, combine double quotes.
return text.substring(start, end).replace(/""/g, '"');
} | [
"function",
"readQuotedField",
"(",
")",
"{",
"// We've already consumed the first quote by the time we get here.",
"var",
"start",
"=",
"index",
";",
"var",
"end",
"=",
"null",
";",
"for",
"(",
"var",
"token",
"=",
"nextToken",
"(",
")",
";",
"token",
"!=",
"EO... | Read a quoted field from input.
@return {string} The field, as a string. | [
"Read",
"a",
"quoted",
"field",
"from",
"input",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/labs/format/csv.js#L225-L282 | train | Read a quoted field. | [
30522,
3853,
3191,
28940,
27428,
3790,
1006,
1007,
1063,
1013,
1013,
2057,
1005,
2310,
2525,
10202,
1996,
2034,
14686,
2011,
1996,
2051,
2057,
2131,
2182,
1012,
13075,
2707,
1027,
5950,
1025,
13075,
2203,
1027,
19701,
1025,
2005,
1006,
1307... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/vs/loader.js | function (what) {
moduleManager.getRecorder().record(33 /* NodeBeginNativeRequire */, what);
try {
return _nodeRequire_1(what);
}
finally {
moduleManager.getRecorder().record(34 /* NodeEndNativeRequire */, what);
}
} | javascript | function (what) {
moduleManager.getRecorder().record(33 /* NodeBeginNativeRequire */, what);
try {
return _nodeRequire_1(what);
}
finally {
moduleManager.getRecorder().record(34 /* NodeEndNativeRequire */, what);
}
} | [
"function",
"(",
"what",
")",
"{",
"moduleManager",
".",
"getRecorder",
"(",
")",
".",
"record",
"(",
"33",
"/* NodeBeginNativeRequire */",
",",
"what",
")",
";",
"try",
"{",
"return",
"_nodeRequire_1",
"(",
"what",
")",
";",
"}",
"finally",
"{",
"moduleMa... | re-expose node's require function | [
"re",
"-",
"expose",
"node",
"s",
"require",
"function"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/vs/loader.js#L1705-L1713 | train | NodeRequire wrapper | [
30522,
3853,
1006,
2054,
1007,
1063,
11336,
24805,
4590,
1012,
2131,
2890,
27108,
4063,
1006,
1007,
1012,
2501,
1006,
3943,
1013,
1008,
13045,
4783,
11528,
19833,
16402,
2063,
15549,
2890,
1008,
1013,
1010,
2054,
1007,
1025,
3046,
1063,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/ui5loader.js | visit | function visit(mod) {
if ( !visited[mod] ) {
// log.debug(" ", mod);
visited[mod] = true;
var pending = mModules[mod] && mModules[mod].pending;
return Array.isArray(pending) &&
(pending.indexOf(dependant) >= 0 || pending.some(visit));
}
return false;
} | javascript | function visit(mod) {
if ( !visited[mod] ) {
// log.debug(" ", mod);
visited[mod] = true;
var pending = mModules[mod] && mModules[mod].pending;
return Array.isArray(pending) &&
(pending.indexOf(dependant) >= 0 || pending.some(visit));
}
return false;
} | [
"function",
"visit",
"(",
"mod",
")",
"{",
"if",
"(",
"!",
"visited",
"[",
"mod",
"]",
")",
"{",
"// log.debug(\" \", mod);",
"visited",
"[",
"mod",
"]",
"=",
"true",
";",
"var",
"pending",
"=",
"mModules",
"[",
"mod",
"]",
"&&",
"mModules",
"[",
"m... | log.debug("checking for a cycle between", this.name, "and", dependant); | [
"log",
".",
"debug",
"(",
"checking",
"for",
"a",
"cycle",
"between",
"this",
".",
"name",
"and",
"dependant",
")",
";"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L887-L896 | train | visit a module | [
30522,
3853,
3942,
1006,
16913,
1007,
1063,
2065,
1006,
999,
4716,
1031,
16913,
1033,
1007,
1063,
1013,
1013,
8833,
1012,
2139,
8569,
2290,
1006,
1000,
1000,
1010,
16913,
1007,
1025,
4716,
1031,
16913,
1033,
1027,
2995,
1025,
13075,
14223,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
catapult-project/catapult | netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js | elide | function elide(original, maxLength) {
if (original.length <= maxLength)
return original;
return original.substring(0, maxLength - 1) + '\u2026';
} | javascript | function elide(original, maxLength) {
if (original.length <= maxLength)
return original;
return original.substring(0, maxLength - 1) + '\u2026';
} | [
"function",
"elide",
"(",
"original",
",",
"maxLength",
")",
"{",
"if",
"(",
"original",
".",
"length",
"<=",
"maxLength",
")",
"return",
"original",
";",
"return",
"original",
".",
"substring",
"(",
"0",
",",
"maxLength",
"-",
"1",
")",
"+",
"'\\u2026'"... | Shortens the provided string (if necessary) to a string of length at most
|maxLength|.
@param {string} original The original string.
@param {number} maxLength The maximum length allowed for the string.
@return {string} The original string if its length does not exceed
|maxLength|. Otherwise the first |maxLength| - 1 characters with '...'
appended. | [
"Shortens",
"the",
"provided",
"string",
"(",
"if",
"necessary",
")",
"to",
"a",
"string",
"of",
"length",
"at",
"most",
"|maxLength|",
"."
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L361-L365 | train | Elide the original string | [
30522,
3853,
12005,
3207,
1006,
2434,
1010,
4098,
7770,
13512,
2232,
1007,
1063,
2065,
1006,
2434,
1012,
3091,
1026,
1027,
4098,
7770,
13512,
2232,
1007,
2709,
2434,
1025,
2709,
2434,
1012,
4942,
3367,
4892,
1006,
1014,
1010,
4098,
7770,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/places.js | restoreDefaultBookmarks | function restoreDefaultBookmarks() {
// Set up the observer -- we're only checking for success here, so we'll simply
// time out and throw on failure. It makes the code much clearer than handling
// finished state and success state separately.
var importSuccessful = false;
var importObserver = {
observe: function (aSubject, aTopic, aData) {
if (aTopic == TOPIC_BOOKMARKS_RESTORE_SUCCESS) {
importSuccessful = true;
}
}
}
observerService.addObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS, false);
try {
// Fire off the import
var bookmarksURI = utils.createURI(BOOKMARKS_RESOURCE);
var importer = Cc["@mozilla.org/browser/places/import-export-service;1"].
getService(Ci.nsIPlacesImportExportService);
importer.importHTMLFromURI(bookmarksURI, true);
// Wait for it to be finished--the observer above will flip this flag
mozmill.utils.waitFor(function () {
return importSuccessful;
}, "Default bookmarks have finished importing", BOOKMARKS_TIMEOUT);
}
finally {
// Whatever happens, remove the observer afterwards
observerService.removeObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS);
}
} | javascript | function restoreDefaultBookmarks() {
// Set up the observer -- we're only checking for success here, so we'll simply
// time out and throw on failure. It makes the code much clearer than handling
// finished state and success state separately.
var importSuccessful = false;
var importObserver = {
observe: function (aSubject, aTopic, aData) {
if (aTopic == TOPIC_BOOKMARKS_RESTORE_SUCCESS) {
importSuccessful = true;
}
}
}
observerService.addObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS, false);
try {
// Fire off the import
var bookmarksURI = utils.createURI(BOOKMARKS_RESOURCE);
var importer = Cc["@mozilla.org/browser/places/import-export-service;1"].
getService(Ci.nsIPlacesImportExportService);
importer.importHTMLFromURI(bookmarksURI, true);
// Wait for it to be finished--the observer above will flip this flag
mozmill.utils.waitFor(function () {
return importSuccessful;
}, "Default bookmarks have finished importing", BOOKMARKS_TIMEOUT);
}
finally {
// Whatever happens, remove the observer afterwards
observerService.removeObserver(importObserver, TOPIC_BOOKMARKS_RESTORE_SUCCESS);
}
} | [
"function",
"restoreDefaultBookmarks",
"(",
")",
"{",
"// Set up the observer -- we're only checking for success here, so we'll simply",
"// time out and throw on failure. It makes the code much clearer than handling",
"// finished state and success state separately.",
"var",
"importSuccessful",
... | Restore the default bookmarks for the current profile | [
"Restore",
"the",
"default",
"bookmarks",
"for",
"the",
"current",
"profile"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/places.js#L125-L155 | train | Restore the default bookmarks | [
30522,
3853,
5854,
12879,
23505,
8654,
27373,
1006,
1007,
1063,
1013,
1013,
2275,
2039,
1996,
9718,
1011,
1011,
2057,
1005,
2128,
2069,
9361,
2005,
3112,
2182,
1010,
2061,
2057,
1005,
2222,
3432,
1013,
1013,
2051,
2041,
1998,
5466,
2006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function(sDimensionName, bIncludeKey, bIncludeText, aAttributeName) {
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
var aDimName = [];
if (sDimensionName) {
if (this._oAggregationLevel[sDimensionName] == undefined) {
throw sDimensionName + " is not included in the aggregation level";
}
aDimName.push(sDimensionName);
} else {
for ( var sName in this._oAggregationLevel) {
aDimName.push(sName);
}
aAttributeName = null;
}
for (var i = -1, sDimName; (sDimName = aDimName[++i]) !== undefined;) {
if (bIncludeKey != null) {
this._oAggregationLevel[sDimName].key = bIncludeKey;
}
if (bIncludeText != null) {
this._oAggregationLevel[sDimName].text = bIncludeText;
}
if (aAttributeName != null) {
this._oAggregationLevel[sDimName].attributes = aAttributeName;
}
}
} | javascript | function(sDimensionName, bIncludeKey, bIncludeText, aAttributeName) {
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
var aDimName = [];
if (sDimensionName) {
if (this._oAggregationLevel[sDimensionName] == undefined) {
throw sDimensionName + " is not included in the aggregation level";
}
aDimName.push(sDimensionName);
} else {
for ( var sName in this._oAggregationLevel) {
aDimName.push(sName);
}
aAttributeName = null;
}
for (var i = -1, sDimName; (sDimName = aDimName[++i]) !== undefined;) {
if (bIncludeKey != null) {
this._oAggregationLevel[sDimName].key = bIncludeKey;
}
if (bIncludeText != null) {
this._oAggregationLevel[sDimName].text = bIncludeText;
}
if (aAttributeName != null) {
this._oAggregationLevel[sDimName].attributes = aAttributeName;
}
}
} | [
"function",
"(",
"sDimensionName",
",",
"bIncludeKey",
",",
"bIncludeText",
",",
"aAttributeName",
")",
"{",
"this",
".",
"_oSelectedPropertyNames",
"=",
"null",
";",
"// reset previously compiled list of selected properties",
"var",
"aDimName",
"=",
"[",
"]",
";",
"i... | Specify which dimension components shall be included in the query result.
The settings get applied to the currently defined aggregation level.
@param {string} sDimensionName
Name of the dimension for which the settings get applied.
Specify null to apply the settings to all dimensions in the
aggregation level.
@param {boolean} bIncludeKey
Indicator whether or not to include the dimension key in the
query result. Pass null to keep current setting.
@param {boolean} bIncludeText
Indicator whether or not to include the dimension text (if
available) in the query result. Pass null to keep current
setting.
@param aAttributeName
Array of dimension attribute names to be included in the
result. Pass null to keep current setting. This argument is
ignored if sDimensionName is null.
@public
@function
@name sap.ui.model.analytics.odata4analytics.QueryResultRequest#includeDimensionKeyTextAttributes | [
"Specify",
"which",
"dimension",
"components",
"shall",
"be",
"included",
"in",
"the",
"query",
"result",
".",
"The",
"settings",
"get",
"applied",
"to",
"the",
"currently",
"defined",
"aggregation",
"level",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L4361-L4387 | train | Sets the selected properties in the aggregation level | [
30522,
3853,
1006,
17371,
14428,
3619,
3258,
18442,
1010,
8026,
20464,
12672,
14839,
1010,
8026,
20464,
12672,
18209,
1010,
9779,
4779,
3089,
8569,
6528,
14074,
1007,
1063,
2023,
1012,
1035,
9808,
12260,
10985,
21572,
4842,
25680,
14074,
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... | |
angular/material | src/components/autocomplete/demoInsideDialog/script.js | querySearch | function querySearch (query) {
return query ? self.states.filter(createFilterFor(query)) : self.states;
} | javascript | function querySearch (query) {
return query ? self.states.filter(createFilterFor(query)) : self.states;
} | [
"function",
"querySearch",
"(",
"query",
")",
"{",
"return",
"query",
"?",
"self",
".",
"states",
".",
"filter",
"(",
"createFilterFor",
"(",
"query",
")",
")",
":",
"self",
".",
"states",
";",
"}"
] | ****************************** Internal methods ******************************
Search for states... use $timeout to simulate
remote dataservice call. | [
"******************************",
"Internal",
"methods",
"******************************",
"Search",
"for",
"states",
"...",
"use",
"$timeout",
"to",
"simulate",
"remote",
"dataservice",
"call",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/demoInsideDialog/script.js#L48-L50 | train | Search for states in the current state set | [
30522,
3853,
23032,
17310,
11140,
1006,
23032,
1007,
1063,
2709,
23032,
1029,
2969,
1012,
2163,
1012,
11307,
1006,
3443,
8873,
21928,
29278,
1006,
23032,
1007,
1007,
1024,
2969,
1012,
2163,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/parse/parseConfig.js | parseConfig | function parseConfig(book) {
var fs = book.getFS();
var config = book.getConfig();
return Promise.some(CONFIG_FILES, function(filename) {
// Is this file ignored?
if (book.isFileIgnored(filename)) {
return;
}
// Try loading it
return fs.loadAsObject(filename)
.then(function(cfg) {
return fs.statFile(filename)
.then(function(file) {
return {
file: file,
values: cfg
};
});
})
.fail(function(err) {
if (err.code != 'MODULE_NOT_FOUND') throw(err);
else return Promise(false);
});
})
.then(function(result) {
var values = result? result.values : {};
values = validateConfig(values);
// Set the file
if (result.file) {
config = config.setFile(result.file);
}
// Merge with old values
config = config.mergeValues(values);
return book.setConfig(config);
});
} | javascript | function parseConfig(book) {
var fs = book.getFS();
var config = book.getConfig();
return Promise.some(CONFIG_FILES, function(filename) {
// Is this file ignored?
if (book.isFileIgnored(filename)) {
return;
}
// Try loading it
return fs.loadAsObject(filename)
.then(function(cfg) {
return fs.statFile(filename)
.then(function(file) {
return {
file: file,
values: cfg
};
});
})
.fail(function(err) {
if (err.code != 'MODULE_NOT_FOUND') throw(err);
else return Promise(false);
});
})
.then(function(result) {
var values = result? result.values : {};
values = validateConfig(values);
// Set the file
if (result.file) {
config = config.setFile(result.file);
}
// Merge with old values
config = config.mergeValues(values);
return book.setConfig(config);
});
} | [
"function",
"parseConfig",
"(",
"book",
")",
"{",
"var",
"fs",
"=",
"book",
".",
"getFS",
"(",
")",
";",
"var",
"config",
"=",
"book",
".",
"getConfig",
"(",
")",
";",
"return",
"Promise",
".",
"some",
"(",
"CONFIG_FILES",
",",
"function",
"(",
"file... | Parse configuration from "book.json" or "book.js"
@param {Book} book
@return {Promise<Book>} | [
"Parse",
"configuration",
"from",
"book",
".",
"json",
"or",
"book",
".",
"js"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/parse/parseConfig.js#L12-L53 | train | Parse the config file | [
30522,
3853,
11968,
3366,
8663,
8873,
2290,
1006,
2338,
1007,
1063,
13075,
1042,
2015,
1027,
2338,
1012,
2131,
10343,
1006,
1007,
1025,
13075,
9530,
8873,
2290,
1027,
2338,
1012,
2131,
8663,
8873,
2290,
1006,
1007,
1025,
2709,
4872,
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... |
jquery/jquery | build/release.js | function() {
// origRepo is not defined if dist was skipped
Release.dir.repo = Release.dir.origRepo || Release.dir.repo;
return npmTags();
} | javascript | function() {
// origRepo is not defined if dist was skipped
Release.dir.repo = Release.dir.origRepo || Release.dir.repo;
return npmTags();
} | [
"function",
"(",
")",
"{",
"// origRepo is not defined if dist was skipped",
"Release",
".",
"dir",
".",
"repo",
"=",
"Release",
".",
"dir",
".",
"origRepo",
"||",
"Release",
".",
"dir",
".",
"repo",
";",
"return",
"npmTags",
"(",
")",
";",
"}"
] | Acts as insertion point for restoring Release.dir.repo
It was changed to reuse npm publish code in jquery-release
for publishing the distribution repo instead | [
"Acts",
"as",
"insertion",
"point",
"for",
"restoring",
"Release",
".",
"dir",
".",
"repo",
"It",
"was",
"changed",
"to",
"reuse",
"npm",
"publish",
"code",
"in",
"jquery",
"-",
"release",
"for",
"publishing",
"the",
"distribution",
"repo",
"instead"
] | ccbd6b93424cbdbf86f07a86c2e55cbab497d7a3 | https://github.com/jquery/jquery/blob/ccbd6b93424cbdbf86f07a86c2e55cbab497d7a3/build/release.js#L66-L71 | train | Returns the tags for the current project | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
2030,
8004,
2890,
6873,
2003,
2025,
4225,
2065,
4487,
3367,
2001,
16791,
2713,
1012,
16101,
1012,
16360,
2080,
1027,
2713,
1012,
16101,
1012,
2030,
8004,
2890,
6873,
1064,
1064,
2713,
1012,
16101,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensions/default/NavigationAndHistory/NavigationProvider.js | _captureFrame | function _captureFrame(editor) {
// Capture the active position now if it was not captured earlier
if ((activePosNotSynced || !jumpBackwardStack.length) && !jumpInProgress) {
jumpBackwardStack.push(new NavigationFrame(editor, {ranges: editor._codeMirror.listSelections()}));
}
} | javascript | function _captureFrame(editor) {
// Capture the active position now if it was not captured earlier
if ((activePosNotSynced || !jumpBackwardStack.length) && !jumpInProgress) {
jumpBackwardStack.push(new NavigationFrame(editor, {ranges: editor._codeMirror.listSelections()}));
}
} | [
"function",
"_captureFrame",
"(",
"editor",
")",
"{",
"// Capture the active position now if it was not captured earlier",
"if",
"(",
"(",
"activePosNotSynced",
"||",
"!",
"jumpBackwardStack",
".",
"length",
")",
"&&",
"!",
"jumpInProgress",
")",
"{",
"jumpBackwardStack",... | Function to request a navigation frame creation explicitly.
@private | [
"Function",
"to",
"request",
"a",
"navigation",
"frame",
"creation",
"explicitly",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/NavigationProvider.js#L437-L442 | train | Capture the current frame | [
30522,
3853,
1035,
5425,
15643,
1006,
3559,
1007,
1063,
1013,
1013,
5425,
1996,
3161,
2597,
2085,
2065,
2009,
2001,
2025,
4110,
3041,
2065,
1006,
1006,
3161,
6873,
2015,
17048,
6508,
5897,
2094,
1064,
1064,
999,
5376,
5963,
7652,
9153,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
benweet/stackedit | src/libs/pagedown.js | function (checkListContent) {
var prefix;
if (isNumberedList) {
prefix = " " + num + ". ";
num++;
} else {
prefix = " " + bullet + " ";
if (isCheckList) {
prefix += '[';
prefix += checkListContent || ' ';
prefix += '] ';
}
}
return prefix;
} | javascript | function (checkListContent) {
var prefix;
if (isNumberedList) {
prefix = " " + num + ". ";
num++;
} else {
prefix = " " + bullet + " ";
if (isCheckList) {
prefix += '[';
prefix += checkListContent || ' ';
prefix += '] ';
}
}
return prefix;
} | [
"function",
"(",
"checkListContent",
")",
"{",
"var",
"prefix",
";",
"if",
"(",
"isNumberedList",
")",
"{",
"prefix",
"=",
"\" \"",
"+",
"num",
"+",
"\". \"",
";",
"num",
"++",
";",
"}",
"else",
"{",
"prefix",
"=",
"\" \"",
"+",
"bullet",
"+",
"\" \"... | Get the item prefix - e.g. " 1. " for a numbered list, " - " for a bulleted list. | [
"Get",
"the",
"item",
"prefix",
"-",
"e",
".",
"g",
".",
"1",
".",
"for",
"a",
"numbered",
"list",
"-",
"for",
"a",
"bulleted",
"list",
"."
] | 91f8cf3c10b75df65b69f9181cee8151d65a788d | https://github.com/benweet/stackedit/blob/91f8cf3c10b75df65b69f9181cee8151d65a788d/src/libs/pagedown.js#L1054-L1068 | train | Returns the prefix for the next line of the line | [
30522,
3853,
1006,
4638,
9863,
30524,
1009,
16371,
2213,
1009,
1000,
1012,
1000,
1025,
16371,
2213,
1009,
1009,
1025,
1065,
2842,
1063,
17576,
1027,
1000,
1000,
1009,
7960,
1009,
1000,
1000,
1025,
2065,
1006,
2003,
5403,
3600,
9863,
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... | |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | resolve | function resolve(promise, x) {
/* sanity check arguments */
/* [Promises/A+ 2.3.1] */
if (promise === x || promise.proxy === x) {
promise.reject(new TypeError('cannot resolve promise with itself'));
return;
}
/* surgically check for a "then" method
(mainly to just call the "getter" of "then" only once) */
var then;
if (_typeof(x) === 'object' && x !== null || typeof x === 'function') {
try {
then = x.then;
}
/* [Promises/A+ 2.3.3.1, 3.5] */
catch (e) {
promise.reject(e);
/* [Promises/A+ 2.3.3.2] */
return;
}
}
/* handle own Thenables [Promises/A+ 2.3.2]
and similar "thenables" [Promises/A+ 2.3.3] */
if (typeof then === 'function') {
var resolved = false;
try {
/* call retrieved "then" method */
/* [Promises/A+ 2.3.3.3] */
then.call(x,
/* resolvePromise */
/* [Promises/A+ 2.3.3.3.1] */
function (y) {
if (resolved) return;
resolved = true;
/* [Promises/A+ 2.3.3.3.3] */
if (y === x)
/* [Promises/A+ 3.6] */
promise.reject(new TypeError('circular thenable chain'));else resolve(promise, y);
},
/* rejectPromise */
/* [Promises/A+ 2.3.3.3.2] */
function (r) {
if (resolved) return;
resolved = true;
/* [Promises/A+ 2.3.3.3.3] */
promise.reject(r);
});
} catch (e) {
if (!resolved)
/* [Promises/A+ 2.3.3.3.3] */
promise.reject(e);
/* [Promises/A+ 2.3.3.3.4] */
}
return;
}
/* handle other values */
promise.fulfill(x);
/* [Promises/A+ 2.3.4, 2.3.3.4] */
} | javascript | function resolve(promise, x) {
/* sanity check arguments */
/* [Promises/A+ 2.3.1] */
if (promise === x || promise.proxy === x) {
promise.reject(new TypeError('cannot resolve promise with itself'));
return;
}
/* surgically check for a "then" method
(mainly to just call the "getter" of "then" only once) */
var then;
if (_typeof(x) === 'object' && x !== null || typeof x === 'function') {
try {
then = x.then;
}
/* [Promises/A+ 2.3.3.1, 3.5] */
catch (e) {
promise.reject(e);
/* [Promises/A+ 2.3.3.2] */
return;
}
}
/* handle own Thenables [Promises/A+ 2.3.2]
and similar "thenables" [Promises/A+ 2.3.3] */
if (typeof then === 'function') {
var resolved = false;
try {
/* call retrieved "then" method */
/* [Promises/A+ 2.3.3.3] */
then.call(x,
/* resolvePromise */
/* [Promises/A+ 2.3.3.3.1] */
function (y) {
if (resolved) return;
resolved = true;
/* [Promises/A+ 2.3.3.3.3] */
if (y === x)
/* [Promises/A+ 3.6] */
promise.reject(new TypeError('circular thenable chain'));else resolve(promise, y);
},
/* rejectPromise */
/* [Promises/A+ 2.3.3.3.2] */
function (r) {
if (resolved) return;
resolved = true;
/* [Promises/A+ 2.3.3.3.3] */
promise.reject(r);
});
} catch (e) {
if (!resolved)
/* [Promises/A+ 2.3.3.3.3] */
promise.reject(e);
/* [Promises/A+ 2.3.3.3.4] */
}
return;
}
/* handle other values */
promise.fulfill(x);
/* [Promises/A+ 2.3.4, 2.3.3.4] */
} | [
"function",
"resolve",
"(",
"promise",
",",
"x",
")",
"{",
"/* sanity check arguments */",
"/* [Promises/A+ 2.3.1] */",
"if",
"(",
"promise",
"===",
"x",
"||",
"promise",
".",
"proxy",
"===",
"x",
")",
"{",
"promise",
".",
"reject",
"(",
"new",
"TypeError"... | /* "Promise Resolution Procedure" /* [Promises/A+ 2.3] | [
"/",
"*",
"Promise",
"Resolution",
"Procedure",
"/",
"*",
"[",
"Promises",
"/",
"A",
"+",
"2",
".",
"3",
"]"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L5374-L5448 | train | Resolves a promise with the given value. | [
30522,
3853,
10663,
1006,
4872,
1010,
1060,
1007,
1063,
1013,
1008,
20039,
4638,
9918,
1008,
1013,
1013,
1008,
1031,
10659,
1013,
1037,
1009,
1016,
1012,
1017,
1012,
1015,
1033,
1008,
1013,
2065,
1006,
4872,
1027,
1027,
1027,
1060,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/themeRiver/themeRiverLayout.js | themeRiverLayout | function themeRiverLayout(data, seriesModel, height) {
if (!data.count()) {
return;
}
var coordSys = seriesModel.coordinateSystem;
// the data in each layer are organized into a series.
var layerSeries = seriesModel.getLayerSeries();
// the points in each layer.
var timeDim = data.mapDimension('single');
var valueDim = data.mapDimension('value');
var layerPoints = zrUtil.map(layerSeries, function (singleLayer) {
return zrUtil.map(singleLayer.indices, function (idx) {
var pt = coordSys.dataToPoint(data.get(timeDim, idx));
pt[1] = data.get(valueDim, idx);
return pt;
});
});
var base = computeBaseline(layerPoints);
var baseLine = base.y0;
var ky = height / base.max;
// set layout information for each item.
var n = layerSeries.length;
var m = layerSeries[0].indices.length;
var baseY0;
for (var j = 0; j < m; ++j) {
baseY0 = baseLine[j] * ky;
data.setItemLayout(layerSeries[0].indices[j], {
layerIndex: 0,
x: layerPoints[0][j][0],
y0: baseY0,
y: layerPoints[0][j][1] * ky
});
for (var i = 1; i < n; ++i) {
baseY0 += layerPoints[i - 1][j][1] * ky;
data.setItemLayout(layerSeries[i].indices[j], {
layerIndex: i,
x: layerPoints[i][j][0],
y0: baseY0,
y: layerPoints[i][j][1] * ky
});
}
}
} | javascript | function themeRiverLayout(data, seriesModel, height) {
if (!data.count()) {
return;
}
var coordSys = seriesModel.coordinateSystem;
// the data in each layer are organized into a series.
var layerSeries = seriesModel.getLayerSeries();
// the points in each layer.
var timeDim = data.mapDimension('single');
var valueDim = data.mapDimension('value');
var layerPoints = zrUtil.map(layerSeries, function (singleLayer) {
return zrUtil.map(singleLayer.indices, function (idx) {
var pt = coordSys.dataToPoint(data.get(timeDim, idx));
pt[1] = data.get(valueDim, idx);
return pt;
});
});
var base = computeBaseline(layerPoints);
var baseLine = base.y0;
var ky = height / base.max;
// set layout information for each item.
var n = layerSeries.length;
var m = layerSeries[0].indices.length;
var baseY0;
for (var j = 0; j < m; ++j) {
baseY0 = baseLine[j] * ky;
data.setItemLayout(layerSeries[0].indices[j], {
layerIndex: 0,
x: layerPoints[0][j][0],
y0: baseY0,
y: layerPoints[0][j][1] * ky
});
for (var i = 1; i < n; ++i) {
baseY0 += layerPoints[i - 1][j][1] * ky;
data.setItemLayout(layerSeries[i].indices[j], {
layerIndex: i,
x: layerPoints[i][j][0],
y0: baseY0,
y: layerPoints[i][j][1] * ky
});
}
}
} | [
"function",
"themeRiverLayout",
"(",
"data",
",",
"seriesModel",
",",
"height",
")",
"{",
"if",
"(",
"!",
"data",
".",
"count",
"(",
")",
")",
"{",
"return",
";",
"}",
"var",
"coordSys",
"=",
"seriesModel",
".",
"coordinateSystem",
";",
"// the data in eac... | The layout information about themeriver
@param {module:echarts/data/List} data data in the series
@param {module:echarts/model/Series} seriesModel the model object of themeRiver series
@param {number} height value used to compute every series height | [
"The",
"layout",
"information",
"about",
"themeriver"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/themeRiver/themeRiverLayout.js#L73-L118 | train | Layouts the data in the seriesModel based on the height of the data. | [
30522,
3853,
4323,
24352,
8485,
5833,
1006,
2951,
1010,
2186,
5302,
9247,
1010,
4578,
1007,
1063,
2065,
1006,
999,
2951,
1012,
4175,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
13075,
2522,
8551,
6508,
2015,
1027,
2186,
5302,
9247,
1012,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/EditorManager.js | getInlineEditors | function getInlineEditors(hostEditor) {
var inlineEditors = [];
if (hostEditor) {
hostEditor.getInlineWidgets().forEach(function (widget) {
if (widget instanceof InlineTextEditor && widget.editor) {
inlineEditors.push(widget.editor);
}
});
}
return inlineEditors;
} | javascript | function getInlineEditors(hostEditor) {
var inlineEditors = [];
if (hostEditor) {
hostEditor.getInlineWidgets().forEach(function (widget) {
if (widget instanceof InlineTextEditor && widget.editor) {
inlineEditors.push(widget.editor);
}
});
}
return inlineEditors;
} | [
"function",
"getInlineEditors",
"(",
"hostEditor",
")",
"{",
"var",
"inlineEditors",
"=",
"[",
"]",
";",
"if",
"(",
"hostEditor",
")",
"{",
"hostEditor",
".",
"getInlineWidgets",
"(",
")",
".",
"forEach",
"(",
"function",
"(",
"widget",
")",
"{",
"if",
"... | @private
Given a host editor, return a list of all Editors in all its open inline widgets. (Ignoring
any other inline widgets that might be open but don't contain Editors).
@param {!Editor} hostEditor
@return {Array.<Editor>} | [
"@private",
"Given",
"a",
"host",
"editor",
"return",
"a",
"list",
"of",
"all",
"Editors",
"in",
"all",
"its",
"open",
"inline",
"widgets",
".",
"(",
"Ignoring",
"any",
"other",
"inline",
"widgets",
"that",
"might",
"be",
"open",
"but",
"don",
"t",
"cont... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorManager.js#L426-L438 | train | Get inline editors | [
30522,
3853,
2131,
2378,
4179,
2098,
27287,
1006,
4354,
15660,
1007,
1063,
13075,
23881,
2098,
27287,
1027,
1031,
1033,
1025,
2065,
1006,
4354,
15660,
1007,
1063,
4354,
15660,
1012,
2131,
2378,
4179,
9148,
28682,
1006,
1007,
1012,
18921,
67... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DraftEnabledMockServer.js | function(oEvent) {
var oNewEntity = oEvent.getParameter("oEntity");
oNewEntity.IsActiveEntity = false;
oNewEntity.HasActiveEntity = false;
oNewEntity.HasDraftEntity = false;
} | javascript | function(oEvent) {
var oNewEntity = oEvent.getParameter("oEntity");
oNewEntity.IsActiveEntity = false;
oNewEntity.HasActiveEntity = false;
oNewEntity.HasDraftEntity = false;
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"oNewEntity",
"=",
"oEvent",
".",
"getParameter",
"(",
"\"oEntity\"",
")",
";",
"oNewEntity",
".",
"IsActiveEntity",
"=",
"false",
";",
"oNewEntity",
".",
"HasActiveEntity",
"=",
"false",
";",
"oNewEntity",
".",
"H... | callback function to update draft specific properties post creation | [
"callback",
"function",
"to",
"update",
"draft",
"specific",
"properties",
"post",
"creation"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js#L30-L35 | train | Resets the related properties of the new entity. | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
2028,
12449,
3775,
3723,
1027,
1051,
18697,
3372,
1012,
2131,
28689,
22828,
1006,
1000,
1051,
4765,
3012,
1000,
1007,
1025,
2028,
12449,
3775,
3723,
1012,
18061,
15277,
4765,
3012,
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/util/timing.js | alignRight | function alignRight(str, len, ch) {
return new Array(len - str.length + 1).join(ch || " ") + str;
} | javascript | function alignRight(str, len, ch) {
return new Array(len - str.length + 1).join(ch || " ") + str;
} | [
"function",
"alignRight",
"(",
"str",
",",
"len",
",",
"ch",
")",
"{",
"return",
"new",
"Array",
"(",
"len",
"-",
"str",
".",
"length",
"+",
"1",
")",
".",
"join",
"(",
"ch",
"||",
"\" \"",
")",
"+",
"str",
";",
"}"
] | /* istanbul ignore next
Align the string to right
@param {string} str string to evaluate
@param {int} len length of the string
@param {string} ch delimiter character
@returns {string} modified string
@private | [
"/",
"*",
"istanbul",
"ignore",
"next",
"Align",
"the",
"string",
"to",
"right"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/timing.js#L34-L36 | train | Aligns str right by ch | [
30522,
3853,
25705,
15950,
1006,
2358,
2099,
1010,
18798,
1010,
10381,
1007,
1063,
2709,
2047,
9140,
1006,
18798,
1011,
2358,
2099,
1012,
3091,
1009,
1015,
1007,
1012,
3693,
1006,
10381,
1064,
1064,
1000,
1000,
1007,
1009,
2358,
2099,
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... |
aframevr/aframe | src/components/animation.js | function () {
var config = this.config;
var data = this.data;
var el = this.el;
var from;
var key;
var to;
if (this.waitComponentInitRawProperty(this.updateConfigForRawColor)) {
return;
}
from = data.from === '' ? getRawProperty(el, data.property) : data.from;
to = data.to;
// Use r/g/b vector for color type.
this.setColorConfig(from, to);
from = this.fromColor;
to = this.toColor;
this.targetsArray.length = 0;
this.targetsArray.push(from);
config.targets = this.targetsArray;
for (key in to) { config[key] = to[key]; }
config.update = (function () {
var lastValue = {};
return function (anim) {
var value;
value = anim.animatables[0].target;
// For animation timeline.
if (value.r === lastValue.r &&
value.g === lastValue.g &&
value.b === lastValue.b) { return; }
setRawProperty(el, data.property, value, data.type);
};
})();
} | javascript | function () {
var config = this.config;
var data = this.data;
var el = this.el;
var from;
var key;
var to;
if (this.waitComponentInitRawProperty(this.updateConfigForRawColor)) {
return;
}
from = data.from === '' ? getRawProperty(el, data.property) : data.from;
to = data.to;
// Use r/g/b vector for color type.
this.setColorConfig(from, to);
from = this.fromColor;
to = this.toColor;
this.targetsArray.length = 0;
this.targetsArray.push(from);
config.targets = this.targetsArray;
for (key in to) { config[key] = to[key]; }
config.update = (function () {
var lastValue = {};
return function (anim) {
var value;
value = anim.animatables[0].target;
// For animation timeline.
if (value.r === lastValue.r &&
value.g === lastValue.g &&
value.b === lastValue.b) { return; }
setRawProperty(el, data.property, value, data.type);
};
})();
} | [
"function",
"(",
")",
"{",
"var",
"config",
"=",
"this",
".",
"config",
";",
"var",
"data",
"=",
"this",
".",
"data",
";",
"var",
"el",
"=",
"this",
".",
"el",
";",
"var",
"from",
";",
"var",
"key",
";",
"var",
"to",
";",
"if",
"(",
"this",
"... | rawProperty: true and type: color; | [
"rawProperty",
":",
"true",
"and",
"type",
":",
"color",
";"
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/animation.js#L230-L268 | train | Update the color config | [
30522,
3853,
1006,
1007,
1063,
13075,
9530,
8873,
2290,
1027,
2023,
1012,
9530,
8873,
2290,
1025,
13075,
2951,
1027,
2023,
1012,
2951,
1025,
13075,
3449,
1027,
2023,
1012,
3449,
1025,
13075,
2013,
1025,
13075,
3145,
1025,
13075,
2000,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/LiveDevelopment/Agents/GotoAgent.js | _onRemoteShowGoto | function _onRemoteShowGoto(event, res) {
// res = {nodeId, name, value}
var node = DOMAgent.nodeWithId(res.nodeId);
// get all css rules that apply to the given node
Inspector.CSS.getMatchedStylesForNode(node.nodeId, function onMatchedStyles(res) {
var i, targets = [];
_makeHTMLTarget(targets, node);
for (i in node.trace) {
_makeJSTarget(targets, node.trace[i]);
}
for (i in node.events) {
var trace = node.events[i];
_makeJSTarget(targets, trace.callFrames[0]);
}
for (i in res.matchedCSSRules.reverse()) {
_makeCSSTarget(targets, res.matchedCSSRules[i].rule);
}
RemoteAgent.call("showGoto", targets);
});
} | javascript | function _onRemoteShowGoto(event, res) {
// res = {nodeId, name, value}
var node = DOMAgent.nodeWithId(res.nodeId);
// get all css rules that apply to the given node
Inspector.CSS.getMatchedStylesForNode(node.nodeId, function onMatchedStyles(res) {
var i, targets = [];
_makeHTMLTarget(targets, node);
for (i in node.trace) {
_makeJSTarget(targets, node.trace[i]);
}
for (i in node.events) {
var trace = node.events[i];
_makeJSTarget(targets, trace.callFrames[0]);
}
for (i in res.matchedCSSRules.reverse()) {
_makeCSSTarget(targets, res.matchedCSSRules[i].rule);
}
RemoteAgent.call("showGoto", targets);
});
} | [
"function",
"_onRemoteShowGoto",
"(",
"event",
",",
"res",
")",
"{",
"// res = {nodeId, name, value}",
"var",
"node",
"=",
"DOMAgent",
".",
"nodeWithId",
"(",
"res",
".",
"nodeId",
")",
";",
"// get all css rules that apply to the given node",
"Inspector",
".",
"CSS",... | Gather options where to go to from the given source node | [
"Gather",
"options",
"where",
"to",
"go",
"to",
"from",
"the",
"given",
"source",
"node"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/GotoAgent.js#L114-L134 | train | onRemoteShowGoto - remote show goto | [
30522,
3853,
1035,
2006,
28578,
12184,
22231,
27767,
11439,
1006,
2724,
1010,
24501,
1007,
1063,
1013,
1013,
24501,
1027,
1063,
13045,
3593,
1010,
2171,
1010,
3643,
1065,
13075,
13045,
1027,
14383,
4270,
3372,
1012,
13045,
24415,
3593,
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... |
pagekit/vue-resource | dist/vue-resource.esm.js | Response | function Response(body, ref) {
var url = ref.url;
var headers = ref.headers;
var status = ref.status;
var statusText = ref.statusText;
this.url = url;
this.ok = status >= 200 && status < 300;
this.status = status || 0;
this.statusText = statusText || '';
this.headers = new Headers(headers);
this.body = body;
if (isString(body)) {
this.bodyText = body;
} else if (isBlob(body)) {
this.bodyBlob = body;
if (isBlobText(body)) {
this.bodyText = blobText(body);
}
}
} | javascript | function Response(body, ref) {
var url = ref.url;
var headers = ref.headers;
var status = ref.status;
var statusText = ref.statusText;
this.url = url;
this.ok = status >= 200 && status < 300;
this.status = status || 0;
this.statusText = statusText || '';
this.headers = new Headers(headers);
this.body = body;
if (isString(body)) {
this.bodyText = body;
} else if (isBlob(body)) {
this.bodyBlob = body;
if (isBlobText(body)) {
this.bodyText = blobText(body);
}
}
} | [
"function",
"Response",
"(",
"body",
",",
"ref",
")",
"{",
"var",
"url",
"=",
"ref",
".",
"url",
";",
"var",
"headers",
"=",
"ref",
".",
"headers",
";",
"var",
"status",
"=",
"ref",
".",
"status",
";",
"var",
"statusText",
"=",
"ref",
".",
"statusT... | HTTP Response. | [
"HTTP",
"Response",
"."
] | fe268fa1d6053ede5f34aef9a11e1a424a70446c | https://github.com/pagekit/vue-resource/blob/fe268fa1d6053ede5f34aef9a11e1a424a70446c/dist/vue-resource.esm.js#L1261-L1287 | train | Response object constructor. | [
30522,
3853,
3433,
1006,
2303,
1010,
25416,
1007,
1063,
13075,
24471,
2140,
1027,
25416,
1012,
24471,
2140,
1025,
13075,
20346,
2015,
1027,
25416,
1012,
20346,
2015,
1025,
13075,
3570,
1027,
25416,
1012,
3570,
1025,
13075,
3570,
18209,
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... |
jhipster/generator-jhipster | generators/aws-containers/lib/utils.js | spinner | function spinner(promise, text = 'loading', spinnerIcon = 'monkey') {
const spinner = ora({ spinner: spinnerIcon, text }).start();
return new Promise((resolve, reject) => {
promise
.then(resolved => {
spinner.stop();
resolve(resolved);
})
.catch(err => {
spinner.stop();
reject(err);
});
});
} | javascript | function spinner(promise, text = 'loading', spinnerIcon = 'monkey') {
const spinner = ora({ spinner: spinnerIcon, text }).start();
return new Promise((resolve, reject) => {
promise
.then(resolved => {
spinner.stop();
resolve(resolved);
})
.catch(err => {
spinner.stop();
reject(err);
});
});
} | [
"function",
"spinner",
"(",
"promise",
",",
"text",
"=",
"'loading'",
",",
"spinnerIcon",
"=",
"'monkey'",
")",
"{",
"const",
"spinner",
"=",
"ora",
"(",
"{",
"spinner",
":",
"spinnerIcon",
",",
"text",
"}",
")",
".",
"start",
"(",
")",
";",
"return",
... | eslint-disable-line
Wraps the promise in a CLI spinner
@param promise
@param text
@param spinnerIcon | [
"eslint",
"-",
"disable",
"-",
"line",
"Wraps",
"the",
"promise",
"in",
"a",
"CLI",
"spinner"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/lib/utils.js#L28-L41 | train | Spinner function | [
30522,
3853,
6714,
3678,
1006,
4872,
1010,
3793,
1027,
1005,
10578,
1005,
1010,
6714,
3678,
28524,
1027,
1005,
10608,
1005,
1007,
1063,
9530,
3367,
6714,
3678,
1027,
2030,
2050,
1006,
1063,
6714,
3678,
1024,
6714,
3678,
28524,
1010,
3793,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lovell/sharp | lib/input.js | _write | function _write (chunk, encoding, callback) {
/* istanbul ignore else */
if (Array.isArray(this.options.input.buffer)) {
/* istanbul ignore else */
if (is.buffer(chunk)) {
if (this.options.input.buffer.length === 0) {
const that = this;
this.on('finish', function () {
that.streamInFinished = true;
});
}
this.options.input.buffer.push(chunk);
callback();
} else {
callback(new Error('Non-Buffer data on Writable Stream'));
}
} else {
callback(new Error('Unexpected data on Writable Stream'));
}
} | javascript | function _write (chunk, encoding, callback) {
/* istanbul ignore else */
if (Array.isArray(this.options.input.buffer)) {
/* istanbul ignore else */
if (is.buffer(chunk)) {
if (this.options.input.buffer.length === 0) {
const that = this;
this.on('finish', function () {
that.streamInFinished = true;
});
}
this.options.input.buffer.push(chunk);
callback();
} else {
callback(new Error('Non-Buffer data on Writable Stream'));
}
} else {
callback(new Error('Unexpected data on Writable Stream'));
}
} | [
"function",
"_write",
"(",
"chunk",
",",
"encoding",
",",
"callback",
")",
"{",
"/* istanbul ignore else */",
"if",
"(",
"Array",
".",
"isArray",
"(",
"this",
".",
"options",
".",
"input",
".",
"buffer",
")",
")",
"{",
"/* istanbul ignore else */",
"if",
"("... | Handle incoming Buffer chunk on Writable Stream.
@private
@param {Buffer} chunk
@param {String} encoding - unused
@param {Function} callback | [
"Handle",
"incoming",
"Buffer",
"chunk",
"on",
"Writable",
"Stream",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/input.js#L112-L131 | train | Writes a chunk to the stream | [
30522,
3853,
1035,
4339,
1006,
20000,
1010,
17181,
1010,
2655,
5963,
1007,
1063,
1013,
1008,
9960,
8568,
2842,
1008,
1013,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
2023,
1012,
7047,
1012,
7953,
1012,
17698,
1007,
1007,
1063,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
serverless/serverless | lib/utils/userStatsValidation.js | isValidProject | function isValidProject(project) {
const isValid = VALID_TRACKING_PROJECTS.indexOf(project) !== -1;
if (!isValid) {
console.log(chalk.red('Tracking Error:'));
console.log(`"${project}" is invalid project. Must be one of`, VALID_TRACKING_PROJECTS);
}
return isValid;
} | javascript | function isValidProject(project) {
const isValid = VALID_TRACKING_PROJECTS.indexOf(project) !== -1;
if (!isValid) {
console.log(chalk.red('Tracking Error:'));
console.log(`"${project}" is invalid project. Must be one of`, VALID_TRACKING_PROJECTS);
}
return isValid;
} | [
"function",
"isValidProject",
"(",
"project",
")",
"{",
"const",
"isValid",
"=",
"VALID_TRACKING_PROJECTS",
".",
"indexOf",
"(",
"project",
")",
"!==",
"-",
"1",
";",
"if",
"(",
"!",
"isValid",
")",
"{",
"console",
".",
"log",
"(",
"chalk",
".",
"red",
... | Validate tracking project for clean events | [
"Validate",
"tracking",
"project",
"for",
"clean",
"events"
] | 0626d5b5df06e4ed68969e324f1cb6b1b499c443 | https://github.com/serverless/serverless/blob/0626d5b5df06e4ed68969e324f1cb6b1b499c443/lib/utils/userStatsValidation.js#L31-L38 | train | Check if the project is valid | [
30522,
3853,
2003,
10175,
3593,
21572,
20614,
1006,
2622,
1007,
1063,
9530,
3367,
2003,
10175,
3593,
1027,
9398,
1035,
9651,
1035,
3934,
1012,
5950,
11253,
1006,
2622,
1007,
999,
1027,
1027,
1011,
1015,
1025,
2065,
1006,
999,
2003,
10175,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
BlackrockDigital/startbootstrap-sb-admin-2 | gulpfile.js | css | function css() {
return gulp
.src("./scss/**/*.scss")
.pipe(plumber())
.pipe(sass({
outputStyle: "expanded",
includePaths: "./node_modules",
}))
.on("error", sass.logError)
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(header(banner, {
pkg: pkg
}))
.pipe(gulp.dest("./css"))
.pipe(rename({
suffix: ".min"
}))
.pipe(cleanCSS())
.pipe(gulp.dest("./css"))
.pipe(browsersync.stream());
} | javascript | function css() {
return gulp
.src("./scss/**/*.scss")
.pipe(plumber())
.pipe(sass({
outputStyle: "expanded",
includePaths: "./node_modules",
}))
.on("error", sass.logError)
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(header(banner, {
pkg: pkg
}))
.pipe(gulp.dest("./css"))
.pipe(rename({
suffix: ".min"
}))
.pipe(cleanCSS())
.pipe(gulp.dest("./css"))
.pipe(browsersync.stream());
} | [
"function",
"css",
"(",
")",
"{",
"return",
"gulp",
".",
"src",
"(",
"\"./scss/**/*.scss\"",
")",
".",
"pipe",
"(",
"plumber",
"(",
")",
")",
".",
"pipe",
"(",
"sass",
"(",
"{",
"outputStyle",
":",
"\"expanded\"",
",",
"includePaths",
":",
"\"./node_modu... | CSS task | [
"CSS",
"task"
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/gulpfile.js#L84-L107 | train | CSS - > css | [
30522,
3853,
20116,
2015,
1006,
1007,
1063,
2709,
26546,
1012,
5034,
2278,
1006,
1000,
1012,
1013,
8040,
4757,
1013,
1008,
1008,
1013,
1008,
1012,
8040,
4757,
1000,
1007,
1012,
8667,
1006,
22088,
5677,
1006,
1007,
1007,
1012,
8667,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-loop-func.js | checkForLoops | function checkForLoops(node) {
const loopNode = getContainingLoopNode(node);
if (!loopNode) {
return;
}
const references = context.getScope().through;
const unsafeRefs = references.filter(r => !isSafe(loopNode, r)).map(r => r.identifier.name);
if (unsafeRefs.length > 0) {
context.report({
node,
messageId: "unsafeRefs",
data: { varNames: `'${unsafeRefs.join("', '")}'` }
});
}
} | javascript | function checkForLoops(node) {
const loopNode = getContainingLoopNode(node);
if (!loopNode) {
return;
}
const references = context.getScope().through;
const unsafeRefs = references.filter(r => !isSafe(loopNode, r)).map(r => r.identifier.name);
if (unsafeRefs.length > 0) {
context.report({
node,
messageId: "unsafeRefs",
data: { varNames: `'${unsafeRefs.join("', '")}'` }
});
}
} | [
"function",
"checkForLoops",
"(",
"node",
")",
"{",
"const",
"loopNode",
"=",
"getContainingLoopNode",
"(",
"node",
")",
";",
"if",
"(",
"!",
"loopNode",
")",
"{",
"return",
";",
"}",
"const",
"references",
"=",
"context",
".",
"getScope",
"(",
")",
".",... | Reports functions which match the following condition:
- has a loop node in ancestors.
- has any references which refers to an unsafe variable.
@param {ASTNode} node The AST node to check.
@returns {boolean} Whether or not the node is within a loop. | [
"Reports",
"functions",
"which",
"match",
"the",
"following",
"condition",
":"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-loop-func.js#L184-L201 | train | Check if a node is inside a loop | [
30522,
3853,
4638,
29278,
4135,
11923,
1006,
13045,
1007,
1063,
9530,
3367,
7077,
3630,
3207,
1027,
2131,
8663,
18249,
2075,
4135,
7361,
3630,
3207,
1006,
13045,
1007,
1025,
2065,
1006,
999,
7077,
3630,
3207,
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... |
SheetJS/js-xlsx | bits/75_xlml.js | xlml_format | function xlml_format(format, value)/*:string*/ {
var fmt = XLMLFormatMap[format] || unescapexml(format);
if(fmt === "General") return SSF._general(value);
return SSF.format(fmt, value);
} | javascript | function xlml_format(format, value)/*:string*/ {
var fmt = XLMLFormatMap[format] || unescapexml(format);
if(fmt === "General") return SSF._general(value);
return SSF.format(fmt, value);
} | [
"function",
"xlml_format",
"(",
"format",
",",
"value",
")",
"/*:string*/",
"{",
"var",
"fmt",
"=",
"XLMLFormatMap",
"[",
"format",
"]",
"||",
"unescapexml",
"(",
"format",
")",
";",
"if",
"(",
"fmt",
"===",
"\"General\"",
")",
"return",
"SSF",
".",
"_ge... | ---- | [
"----"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/75_xlml.js#L41-L45 | train | Format value using xlml format | [
30522,
3853,
28712,
19968,
1035,
4289,
1006,
4289,
1010,
3643,
1007,
1013,
1008,
1024,
5164,
1008,
1013,
1063,
13075,
4718,
2102,
1027,
28712,
19968,
14192,
4017,
2863,
2361,
1031,
4289,
1033,
1064,
1064,
16655,
15782,
5051,
2595,
19968,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesImpl.js | _reloadUserPrefs | function _reloadUserPrefs(rootDir) {
var prefsDir = brackets.app.getApplicationSupportDirectory() + "/";
if (prefsDir.indexOf(rootDir.fullPath) === 0) {
manager.fileChanged(userPrefFile);
stateManager.fileChanged(userStateFile);
}
} | javascript | function _reloadUserPrefs(rootDir) {
var prefsDir = brackets.app.getApplicationSupportDirectory() + "/";
if (prefsDir.indexOf(rootDir.fullPath) === 0) {
manager.fileChanged(userPrefFile);
stateManager.fileChanged(userStateFile);
}
} | [
"function",
"_reloadUserPrefs",
"(",
"rootDir",
")",
"{",
"var",
"prefsDir",
"=",
"brackets",
".",
"app",
".",
"getApplicationSupportDirectory",
"(",
")",
"+",
"\"/\"",
";",
"if",
"(",
"prefsDir",
".",
"indexOf",
"(",
"rootDir",
".",
"fullPath",
")",
"===",
... | Listen for times where we might be unwatching a root that contains one of the user-level prefs files, and force a re-read of the file in order to ensure we can write to it later (see #7300). | [
"Listen",
"for",
"times",
"where",
"we",
"might",
"be",
"unwatching",
"a",
"root",
"that",
"contains",
"one",
"of",
"the",
"user",
"-",
"level",
"prefs",
"files",
"and",
"force",
"a",
"re",
"-",
"read",
"of",
"the",
"file",
"in",
"order",
"to",
"ensure... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesImpl.js#L125-L131 | train | Reloads the user preferences | [
30522,
3853,
1035,
2128,
11066,
20330,
28139,
10343,
1006,
7117,
4305,
2099,
1007,
1063,
13075,
3653,
10343,
4305,
2099,
1027,
19719,
1012,
10439,
1012,
2131,
29098,
19341,
9285,
6279,
6442,
4305,
2890,
16761,
2100,
1006,
1007,
1009,
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... |
SAP/openui5 | src/sap.ui.rta/src/sap/ui/rta/ControlTreeModifier.js | function(aUndoStack) {
while (aUndoStack.length) {
var oOperation = aUndoStack.pop();
this[oOperation.name].apply(this, oOperation.properties);
}
} | javascript | function(aUndoStack) {
while (aUndoStack.length) {
var oOperation = aUndoStack.pop();
this[oOperation.name].apply(this, oOperation.properties);
}
} | [
"function",
"(",
"aUndoStack",
")",
"{",
"while",
"(",
"aUndoStack",
".",
"length",
")",
"{",
"var",
"oOperation",
"=",
"aUndoStack",
".",
"pop",
"(",
")",
";",
"this",
"[",
"oOperation",
".",
"name",
"]",
".",
"apply",
"(",
"this",
",",
"oOperation",
... | Execute all recorded undo operations from stack
@param {Array} aUndoStack stack of recorded undo operations | [
"Execute",
"all",
"recorded",
"undo",
"operations",
"from",
"stack"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/ControlTreeModifier.js#L52-L57 | train | Undo the last undo operation in the stack | [
30522,
3853,
1006,
8740,
15482,
9153,
3600,
1007,
1063,
2096,
1006,
8740,
15482,
9153,
3600,
1012,
3091,
1007,
1063,
13075,
1051,
25918,
3370,
1027,
8740,
15482,
9153,
3600,
1012,
3769,
1006,
1007,
1025,
2023,
1031,
1051,
25918,
3370,
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... | |
lovell/sharp | lib/composite.js | composite | function composite (images) {
if (!Array.isArray(images)) {
throw is.invalidParameterError('images to composite', 'array', images);
}
this.options.composite = images.map(image => {
if (!is.object(image)) {
throw is.invalidParameterError('image to composite', 'object', image);
}
const { raw, density } = image;
const inputOptions = (raw || density) ? { raw, density } : undefined;
const composite = {
input: this._createInputDescriptor(image.input, inputOptions, { allowStream: false }),
blend: 'over',
tile: false,
left: -1,
top: -1,
gravity: 0
};
if (is.defined(image.blend)) {
if (is.string(blend[image.blend])) {
composite.blend = blend[image.blend];
} else {
throw is.invalidParameterError('blend', 'valid blend name', image.blend);
}
}
if (is.defined(image.tile)) {
if (is.bool(image.tile)) {
composite.tile = image.tile;
} else {
throw is.invalidParameterError('tile', 'boolean', image.tile);
}
}
if (is.defined(image.left)) {
if (is.integer(image.left) && image.left >= 0) {
composite.left = image.left;
} else {
throw is.invalidParameterError('left', 'positive integer', image.left);
}
}
if (is.defined(image.top)) {
if (is.integer(image.top) && image.top >= 0) {
composite.top = image.top;
} else {
throw is.invalidParameterError('top', 'positive integer', image.top);
}
}
if (composite.left !== composite.top && Math.min(composite.left, composite.top) === -1) {
throw new Error('Expected both left and top to be set');
}
if (is.defined(image.gravity)) {
if (is.integer(image.gravity) && is.inRange(image.gravity, 0, 8)) {
composite.gravity = image.gravity;
} else if (is.string(image.gravity) && is.integer(this.constructor.gravity[image.gravity])) {
composite.gravity = this.constructor.gravity[image.gravity];
} else {
throw is.invalidParameterError('gravity', 'valid gravity', image.gravity);
}
}
return composite;
});
return this;
} | javascript | function composite (images) {
if (!Array.isArray(images)) {
throw is.invalidParameterError('images to composite', 'array', images);
}
this.options.composite = images.map(image => {
if (!is.object(image)) {
throw is.invalidParameterError('image to composite', 'object', image);
}
const { raw, density } = image;
const inputOptions = (raw || density) ? { raw, density } : undefined;
const composite = {
input: this._createInputDescriptor(image.input, inputOptions, { allowStream: false }),
blend: 'over',
tile: false,
left: -1,
top: -1,
gravity: 0
};
if (is.defined(image.blend)) {
if (is.string(blend[image.blend])) {
composite.blend = blend[image.blend];
} else {
throw is.invalidParameterError('blend', 'valid blend name', image.blend);
}
}
if (is.defined(image.tile)) {
if (is.bool(image.tile)) {
composite.tile = image.tile;
} else {
throw is.invalidParameterError('tile', 'boolean', image.tile);
}
}
if (is.defined(image.left)) {
if (is.integer(image.left) && image.left >= 0) {
composite.left = image.left;
} else {
throw is.invalidParameterError('left', 'positive integer', image.left);
}
}
if (is.defined(image.top)) {
if (is.integer(image.top) && image.top >= 0) {
composite.top = image.top;
} else {
throw is.invalidParameterError('top', 'positive integer', image.top);
}
}
if (composite.left !== composite.top && Math.min(composite.left, composite.top) === -1) {
throw new Error('Expected both left and top to be set');
}
if (is.defined(image.gravity)) {
if (is.integer(image.gravity) && is.inRange(image.gravity, 0, 8)) {
composite.gravity = image.gravity;
} else if (is.string(image.gravity) && is.integer(this.constructor.gravity[image.gravity])) {
composite.gravity = this.constructor.gravity[image.gravity];
} else {
throw is.invalidParameterError('gravity', 'valid gravity', image.gravity);
}
}
return composite;
});
return this;
} | [
"function",
"composite",
"(",
"images",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"images",
")",
")",
"{",
"throw",
"is",
".",
"invalidParameterError",
"(",
"'images to composite'",
",",
"'array'",
",",
"images",
")",
";",
"}",
"this",
".",... | Composite image(s) over the processed (resized, extracted etc.) image.
The images to composite must be the same size or smaller than the processed image.
If both `top` and `left` options are provided, they take precedence over `gravity`.
The `blend` option can be one of `clear`, `source`, `over`, `in`, `out`, `atop`,
`dest`, `dest-over`, `dest-in`, `dest-out`, `dest-atop`,
`xor`, `add`, `saturate`, `multiply`, `screen`, `overlay`, `darken`, `lighten`,
`colour-dodge`, `color-dodge`, `colour-burn`,`color-burn`,
`hard-light`, `soft-light`, `difference`, `exclusion`.
More information about blend modes can be found at
https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsBlendMode
and https://www.cairographics.org/operators/
@example
sharp('input.png')
.rotate(180)
.resize(300)
.flatten( { background: '#ff6600' } )
.composite([{ input: 'overlay.png', gravity: 'southeast' }])
.sharpen()
.withMetadata()
.webp( { quality: 90 } )
.toBuffer()
.then(function(outputBuffer) {
// outputBuffer contains upside down, 300px wide, alpha channel flattened
// onto orange background, composited with overlay.png with SE gravity,
// sharpened, with metadata, 90% quality WebP image data. Phew!
});
@param {Object[]} images - Ordered list of images to composite
@param {Buffer|String} [images[].input] - Buffer containing image data, String containing the path to an image file, or Create object (see bellow)
@param {Object} [images[].input.create] - describes a blank overlay to be created.
@param {Number} [images[].input.create.width]
@param {Number} [images[].input.create.height]
@param {Number} [images[].input.create.channels] - 3-4
@param {String|Object} [images[].input.create.background] - parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
@param {String} [images[].blend='over'] - how to blend this image with the image below.
@param {String} [images[].gravity='centre'] - gravity at which to place the overlay.
@param {Number} [images[].top] - the pixel offset from the top edge.
@param {Number} [images[].left] - the pixel offset from the left edge.
@param {Boolean} [images[].tile=false] - set to true to repeat the overlay image across the entire image with the given `gravity`.
@param {Number} [images[].density=72] - number representing the DPI for vector overlay image.
@param {Object} [images[].raw] - describes overlay when using raw pixel data.
@param {Number} [images[].raw.width]
@param {Number} [images[].raw.height]
@param {Number} [images[].raw.channels]
@returns {Sharp}
@throws {Error} Invalid parameters | [
"Composite",
"image",
"(",
"s",
")",
"over",
"the",
"processed",
"(",
"resized",
"extracted",
"etc",
".",
")",
"image",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/composite.js#L94-L155 | train | composite image | [
30522,
3853,
12490,
1006,
4871,
1007,
1063,
2065,
1006,
999,
9140,
1012,
18061,
11335,
2100,
1006,
4871,
1007,
1007,
1063,
5466,
2003,
1012,
19528,
28689,
22828,
2121,
29165,
1006,
1005,
4871,
2000,
12490,
1005,
1010,
1005,
9140,
1005,
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... |
eslint/eslint | lib/cli-engine.js | createIgnoreResult | function createIgnoreResult(filePath, baseDir) {
let message;
const isHidden = /^\./u.test(path.basename(filePath));
const isInNodeModules = baseDir && path.relative(baseDir, filePath).startsWith("node_modules");
const isInBowerComponents = baseDir && path.relative(baseDir, filePath).startsWith("bower_components");
if (isHidden) {
message = "File ignored by default. Use a negated ignore pattern (like \"--ignore-pattern '!<relative/path/to/filename>'\") to override.";
} else if (isInNodeModules) {
message = "File ignored by default. Use \"--ignore-pattern '!node_modules/*'\" to override.";
} else if (isInBowerComponents) {
message = "File ignored by default. Use \"--ignore-pattern '!bower_components/*'\" to override.";
} else {
message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override.";
}
return {
filePath: path.resolve(filePath),
messages: [
{
fatal: false,
severity: 1,
message
}
],
errorCount: 0,
warningCount: 1,
fixableErrorCount: 0,
fixableWarningCount: 0
};
} | javascript | function createIgnoreResult(filePath, baseDir) {
let message;
const isHidden = /^\./u.test(path.basename(filePath));
const isInNodeModules = baseDir && path.relative(baseDir, filePath).startsWith("node_modules");
const isInBowerComponents = baseDir && path.relative(baseDir, filePath).startsWith("bower_components");
if (isHidden) {
message = "File ignored by default. Use a negated ignore pattern (like \"--ignore-pattern '!<relative/path/to/filename>'\") to override.";
} else if (isInNodeModules) {
message = "File ignored by default. Use \"--ignore-pattern '!node_modules/*'\" to override.";
} else if (isInBowerComponents) {
message = "File ignored by default. Use \"--ignore-pattern '!bower_components/*'\" to override.";
} else {
message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override.";
}
return {
filePath: path.resolve(filePath),
messages: [
{
fatal: false,
severity: 1,
message
}
],
errorCount: 0,
warningCount: 1,
fixableErrorCount: 0,
fixableWarningCount: 0
};
} | [
"function",
"createIgnoreResult",
"(",
"filePath",
",",
"baseDir",
")",
"{",
"let",
"message",
";",
"const",
"isHidden",
"=",
"/",
"^\\.",
"/",
"u",
".",
"test",
"(",
"path",
".",
"basename",
"(",
"filePath",
")",
")",
";",
"const",
"isInNodeModules",
"=... | Returns result with warning by ignore settings
@param {string} filePath - File path of checked code
@param {string} baseDir - Absolute path of base directory
@returns {LintResult} Result with single warning
@private | [
"Returns",
"result",
"with",
"warning",
"by",
"ignore",
"settings"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/cli-engine.js#L265-L295 | train | Create ignore result | [
30522,
3853,
3443,
23773,
5686,
6072,
11314,
1006,
5371,
15069,
1010,
2241,
4313,
1007,
1063,
2292,
4471,
1025,
9530,
3367,
2003,
27511,
4181,
1027,
1013,
1034,
1032,
1012,
1013,
1057,
1012,
3231,
1006,
4130,
1012,
2918,
18442,
1006,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Freeboard/freeboard | js/freeboard.thirdparty.js | function(inst, drawMonth, drawYear, minDate, maxDate,
secondary, monthNames, monthNamesShort) {
var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
changeMonth = this._get(inst, "changeMonth"),
changeYear = this._get(inst, "changeYear"),
showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
html = "<div class='ui-datepicker-title'>",
monthHtml = "";
// month selection
if (secondary || !changeMonth) {
monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
} else {
inMinYear = (minDate && minDate.getFullYear() === drawYear);
inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
for ( month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
monthHtml += "<option value='" + month + "'" +
(month === drawMonth ? " selected='selected'" : "") +
">" + monthNamesShort[month] + "</option>";
}
}
monthHtml += "</select>";
}
if (!showMonthAfterYear) {
html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : "");
}
// year selection
if ( !inst.yearshtml ) {
inst.yearshtml = "";
if (secondary || !changeYear) {
html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
} else {
// determine range of years to display
years = this._get(inst, "yearRange").split(":");
thisYear = new Date().getFullYear();
determineYear = function(value) {
var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
(value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
parseInt(value, 10)));
return (isNaN(year) ? thisYear : year);
};
year = determineYear(years[0]);
endYear = Math.max(year, determineYear(years[1] || ""));
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
for (; year <= endYear; year++) {
inst.yearshtml += "<option value='" + year + "'" +
(year === drawYear ? " selected='selected'" : "") +
">" + year + "</option>";
}
inst.yearshtml += "</select>";
html += inst.yearshtml;
inst.yearshtml = null;
}
}
html += this._get(inst, "yearSuffix");
if (showMonthAfterYear) {
html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml;
}
html += "</div>"; // Close datepicker_header
return html;
} | javascript | function(inst, drawMonth, drawYear, minDate, maxDate,
secondary, monthNames, monthNamesShort) {
var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
changeMonth = this._get(inst, "changeMonth"),
changeYear = this._get(inst, "changeYear"),
showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
html = "<div class='ui-datepicker-title'>",
monthHtml = "";
// month selection
if (secondary || !changeMonth) {
monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
} else {
inMinYear = (minDate && minDate.getFullYear() === drawYear);
inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
for ( month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
monthHtml += "<option value='" + month + "'" +
(month === drawMonth ? " selected='selected'" : "") +
">" + monthNamesShort[month] + "</option>";
}
}
monthHtml += "</select>";
}
if (!showMonthAfterYear) {
html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : "");
}
// year selection
if ( !inst.yearshtml ) {
inst.yearshtml = "";
if (secondary || !changeYear) {
html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
} else {
// determine range of years to display
years = this._get(inst, "yearRange").split(":");
thisYear = new Date().getFullYear();
determineYear = function(value) {
var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
(value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
parseInt(value, 10)));
return (isNaN(year) ? thisYear : year);
};
year = determineYear(years[0]);
endYear = Math.max(year, determineYear(years[1] || ""));
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
for (; year <= endYear; year++) {
inst.yearshtml += "<option value='" + year + "'" +
(year === drawYear ? " selected='selected'" : "") +
">" + year + "</option>";
}
inst.yearshtml += "</select>";
html += inst.yearshtml;
inst.yearshtml = null;
}
}
html += this._get(inst, "yearSuffix");
if (showMonthAfterYear) {
html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml;
}
html += "</div>"; // Close datepicker_header
return html;
} | [
"function",
"(",
"inst",
",",
"drawMonth",
",",
"drawYear",
",",
"minDate",
",",
"maxDate",
",",
"secondary",
",",
"monthNames",
",",
"monthNamesShort",
")",
"{",
"var",
"inMinYear",
",",
"inMaxYear",
",",
"month",
",",
"years",
",",
"thisYear",
",",
"dete... | /* Generate the month and year header. | [
"/",
"*",
"Generate",
"the",
"month",
"and",
"year",
"header",
"."
] | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L9381-L9450 | train | Generates the html for the calendar calendar | [
30522,
3853,
1006,
16021,
2102,
1010,
4009,
9629,
2232,
1010,
4009,
29100,
1010,
2568,
3686,
1010,
4098,
13701,
1010,
3905,
1010,
3204,
18442,
2015,
1010,
3204,
18442,
4757,
27794,
1007,
1063,
13075,
1999,
10020,
29100,
1010,
1999,
17848,
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... | |
angular/protractor | website/docgen/processors/add-links.js | function(doc) {
// Heuristic for the custom docs in the lib/selenium-webdriver/ folder.
if (doc.name && doc.name.startsWith('webdriver')) {
return;
}
var template = _.template('https://github.com/angular/protractor/blob/' +
'<%= linksHash %>/lib/<%= fileName %>.ts');
doc.sourceLink = template({
linksHash: linksHash,
fileName: doc.fileName
});
} | javascript | function(doc) {
// Heuristic for the custom docs in the lib/selenium-webdriver/ folder.
if (doc.name && doc.name.startsWith('webdriver')) {
return;
}
var template = _.template('https://github.com/angular/protractor/blob/' +
'<%= linksHash %>/lib/<%= fileName %>.ts');
doc.sourceLink = template({
linksHash: linksHash,
fileName: doc.fileName
});
} | [
"function",
"(",
"doc",
")",
"{",
"// Heuristic for the custom docs in the lib/selenium-webdriver/ folder.",
"if",
"(",
"doc",
".",
"name",
"&&",
"doc",
".",
"name",
".",
"startsWith",
"(",
"'webdriver'",
")",
")",
"{",
"return",
";",
"}",
"var",
"template",
"="... | Add a link to the source code.
@param {!Object} doc Current document. | [
"Add",
"a",
"link",
"to",
"the",
"source",
"code",
"."
] | 4f74a4ec753c97adfe955fe468a39286a0a55837 | https://github.com/angular/protractor/blob/4f74a4ec753c97adfe955fe468a39286a0a55837/website/docgen/processors/add-links.js#L24-L36 | train | This function is used to generate a link to the generated source file. | [
30522,
3853,
1006,
9986,
1007,
1063,
1013,
1013,
2002,
9496,
10074,
2005,
1996,
7661,
9986,
2015,
1999,
1996,
5622,
2497,
1013,
7367,
7770,
5007,
1011,
4773,
23663,
2099,
1013,
19622,
1012,
2065,
1006,
9986,
1012,
2171,
1004,
1004,
9986,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dequelabs/axe-core | lib/core/utils/merge-results.js | pushFrame | function pushFrame(resultSet, options, frameElement, frameSelector) {
'use strict';
var frameXpath = axe.utils.getXpath(frameElement);
var frameSpec = {
element: frameElement,
selector: frameSelector,
xpath: frameXpath
};
resultSet.forEach(function(res) {
res.node = axe.utils.DqElement.fromFrame(res.node, options, frameSpec);
var checks = axe.utils.getAllChecks(res);
if (checks.length) {
checks.forEach(function(check) {
check.relatedNodes = check.relatedNodes.map(node =>
axe.utils.DqElement.fromFrame(node, options, frameSpec)
);
});
}
});
} | javascript | function pushFrame(resultSet, options, frameElement, frameSelector) {
'use strict';
var frameXpath = axe.utils.getXpath(frameElement);
var frameSpec = {
element: frameElement,
selector: frameSelector,
xpath: frameXpath
};
resultSet.forEach(function(res) {
res.node = axe.utils.DqElement.fromFrame(res.node, options, frameSpec);
var checks = axe.utils.getAllChecks(res);
if (checks.length) {
checks.forEach(function(check) {
check.relatedNodes = check.relatedNodes.map(node =>
axe.utils.DqElement.fromFrame(node, options, frameSpec)
);
});
}
});
} | [
"function",
"pushFrame",
"(",
"resultSet",
",",
"options",
",",
"frameElement",
",",
"frameSelector",
")",
"{",
"'use strict'",
";",
"var",
"frameXpath",
"=",
"axe",
".",
"utils",
".",
"getXpath",
"(",
"frameElement",
")",
";",
"var",
"frameSpec",
"=",
"{",
... | Adds the owning frame's CSS selector onto each instance of DqElement
@private
@param {Array} resultSet `nodes` array on a `RuleResult`
@param {HTMLElement} frameElement The frame element
@param {String} frameSelector Unique CSS selector for the frame | [
"Adds",
"the",
"owning",
"frame",
"s",
"CSS",
"selector",
"onto",
"each",
"instance",
"of",
"DqElement"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/merge-results.js#L8-L29 | train | Pushes the frame to the end of the result set | [
30522,
3853,
5245,
15643,
1006,
3463,
3388,
1010,
7047,
1010,
4853,
12260,
3672,
1010,
11048,
12260,
16761,
1007,
1063,
1005,
2224,
9384,
1005,
1025,
13075,
4853,
2595,
15069,
1027,
12946,
1012,
21183,
12146,
30524,
5051,
2278,
1027,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js | function(oEvent) {
var iNewScrollLeft = oEvent.target.scrollLeft;
var iOldScrollLeft = oEvent.target._scrollLeft;
// For interaction detection.
Interaction.notifyScrollEvent && Interaction.notifyScrollEvent(oEvent);
if (iNewScrollLeft !== iOldScrollLeft) {
var aScrollAreas = HorizontalScrollingHelper.getScrollAreas(this);
oEvent.target._scrollLeft = iNewScrollLeft;
// Synchronize the scroll positions.
for (var i = 0; i < aScrollAreas.length; i++) {
var oScrollArea = aScrollAreas[i];
if (oScrollArea !== oEvent.target && oScrollArea.scrollLeft !== iNewScrollLeft) {
oScrollArea.scrollLeft = iNewScrollLeft;
oScrollArea._scrollLeft = iNewScrollLeft;
}
}
internal(this).iHorizontalScrollPosition = iNewScrollLeft;
}
} | javascript | function(oEvent) {
var iNewScrollLeft = oEvent.target.scrollLeft;
var iOldScrollLeft = oEvent.target._scrollLeft;
// For interaction detection.
Interaction.notifyScrollEvent && Interaction.notifyScrollEvent(oEvent);
if (iNewScrollLeft !== iOldScrollLeft) {
var aScrollAreas = HorizontalScrollingHelper.getScrollAreas(this);
oEvent.target._scrollLeft = iNewScrollLeft;
// Synchronize the scroll positions.
for (var i = 0; i < aScrollAreas.length; i++) {
var oScrollArea = aScrollAreas[i];
if (oScrollArea !== oEvent.target && oScrollArea.scrollLeft !== iNewScrollLeft) {
oScrollArea.scrollLeft = iNewScrollLeft;
oScrollArea._scrollLeft = iNewScrollLeft;
}
}
internal(this).iHorizontalScrollPosition = iNewScrollLeft;
}
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"iNewScrollLeft",
"=",
"oEvent",
".",
"target",
".",
"scrollLeft",
";",
"var",
"iOldScrollLeft",
"=",
"oEvent",
".",
"target",
".",
"_scrollLeft",
";",
"// For interaction detection.",
"Interaction",
".",
"notifyScrollEv... | Will be called if scrolled horizontally. Because the table does not render/update the data of all columns (only the visible ones),
we need to update the content of the columns which became visible.
@param {jQuery.Event} oEvent The event object. | [
"Will",
"be",
"called",
"if",
"scrolled",
"horizontally",
".",
"Because",
"the",
"table",
"does",
"not",
"render",
"/",
"update",
"the",
"data",
"of",
"all",
"columns",
"(",
"only",
"the",
"visible",
"ones",
")",
"we",
"need",
"to",
"update",
"the",
"con... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L149-L173 | train | This function is called when the horizontal scroll position changes. | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
1999,
7974,
11020,
28402,
2571,
6199,
1027,
1051,
18697,
3372,
1012,
4539,
1012,
17186,
2571,
6199,
1025,
13075,
22834,
6392,
11020,
28402,
2571,
6199,
1027,
1051,
18697,
3372,
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... | |
goldfire/howler.js | examples/sprite/sprite.js | function() {
var self = this;
// Calculate the scale of our window from "full" size.
var scale = window.innerWidth / 3600;
// Resize and reposition the sprite overlays.
var keys = Object.keys(self._spriteMap);
for (var i=0; i<keys.length; i++) {
var sprite = window[keys[i]];
sprite.style.width = Math.round(self._width[i] * scale) + 'px';
if (self._left[i]) {
sprite.style.left = Math.round(self._left[i] * scale) + 'px';
}
}
} | javascript | function() {
var self = this;
// Calculate the scale of our window from "full" size.
var scale = window.innerWidth / 3600;
// Resize and reposition the sprite overlays.
var keys = Object.keys(self._spriteMap);
for (var i=0; i<keys.length; i++) {
var sprite = window[keys[i]];
sprite.style.width = Math.round(self._width[i] * scale) + 'px';
if (self._left[i]) {
sprite.style.left = Math.round(self._left[i] * scale) + 'px';
}
}
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Calculate the scale of our window from \"full\" size.",
"var",
"scale",
"=",
"window",
".",
"innerWidth",
"/",
"3600",
";",
"// Resize and reposition the sprite overlays.",
"var",
"keys",
"=",
"Object",
"... | Called on window resize to correctly psotion and size the click overlays. | [
"Called",
"on",
"window",
"resize",
"to",
"correctly",
"psotion",
"and",
"size",
"the",
"click",
"overlays",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/sprite/sprite.js#L95-L110 | train | Resize the sprite overlays. | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
18422,
1996,
4094,
1997,
2256,
3332,
2013,
1000,
2440,
1000,
2946,
1012,
13075,
4094,
1027,
3332,
1012,
5110,
9148,
11927,
2232,
1013,
9475,
2692,
1025,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GeekyAnts/vue-native-core | packages/weex-vue-framework/factory.js | renderSlot | function renderSlot (
name,
fallback,
props,
bindObject
) {
var scopedSlotFn = this.$scopedSlots[name];
if (scopedSlotFn) { // scoped slot
props = props || {};
if (bindObject) {
extend(props, bindObject);
}
return scopedSlotFn(props) || fallback
} else {
var slotNodes = this.$slots[name];
// warn duplicate slot usage
if (slotNodes && process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
);
slotNodes._rendered = true;
}
return slotNodes || fallback
}
} | javascript | function renderSlot (
name,
fallback,
props,
bindObject
) {
var scopedSlotFn = this.$scopedSlots[name];
if (scopedSlotFn) { // scoped slot
props = props || {};
if (bindObject) {
extend(props, bindObject);
}
return scopedSlotFn(props) || fallback
} else {
var slotNodes = this.$slots[name];
// warn duplicate slot usage
if (slotNodes && process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
);
slotNodes._rendered = true;
}
return slotNodes || fallback
}
} | [
"function",
"renderSlot",
"(",
"name",
",",
"fallback",
",",
"props",
",",
"bindObject",
")",
"{",
"var",
"scopedSlotFn",
"=",
"this",
".",
"$scopedSlots",
"[",
"name",
"]",
";",
"if",
"(",
"scopedSlotFn",
")",
"{",
"// scoped slot",
"props",
"=",
"props",... | /*
Runtime helper for rendering <slot> | [
"/",
"*",
"Runtime",
"helper",
"for",
"rendering",
"<slot",
">"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-vue-framework/factory.js#L3359-L3385 | train | render slot by name | [
30522,
3853,
17552,
14540,
4140,
1006,
2171,
1010,
2991,
5963,
1010,
24387,
1010,
14187,
16429,
20614,
1007,
1063,
13075,
9531,
5104,
10994,
2546,
2078,
1027,
2023,
1012,
1002,
9531,
5104,
10994,
2015,
1031,
2171,
1033,
1025,
2065,
1006,
95... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/QuickView/main.js | imagePreviewProvider | function imagePreviewProvider(editor, pos, token, line) {
var cm = editor._codeMirror;
// Check for image name
var urlRegEx = /url\(([^\)]*)\)/gi,
tokenString,
urlMatch;
if (token.type === "string") {
tokenString = token.string;
} else {
urlMatch = urlRegEx.exec(line);
while (urlMatch) {
if (pos.ch < urlMatch.index) {
// match is past cursor, so stop looping
break;
} else if (pos.ch <= urlMatch.index + urlMatch[0].length) {
tokenString = urlMatch[1];
break;
}
urlMatch = urlRegEx.exec(line);
}
}
if (!tokenString) {
return null;
}
// Strip leading/trailing quotes, if present
tokenString = tokenString.replace(/(^['"])|(['"]$)/g, "");
var sPos, ePos;
var docPath = editor.document.file.fullPath;
var imgPath;
// Determine whether or not this URL/path is likely to be an image.
var parsed = PathUtils.parseUrl(tokenString);
// If the URL has a protocol, check if it's one of the supported protocols
var hasProtocol = parsed.protocol !== "" && validProtocols.indexOf(parsed.protocol.trim().toLowerCase()) !== -1;
var ext = parsed.filenameExtension.replace(/^\./, '');
var language = LanguageManager.getLanguageForExtension(ext);
var id = language && language.getId();
var isImage = id === "image" || id === "svg";
// Use this URL if this is an absolute URL and either points to a
// filename with a known image extension, or lacks an extension (e.g.,
// a web service that returns an image). Honour the extensionlessImagePreview
// preference as well in the latter case.
if (hasProtocol && (isImage || (!ext && extensionlessImagePreview))) {
imgPath = tokenString;
}
// Use this filename if this is a path with a known image extension.
else if (!hasProtocol && isImage) {
imgPath = "file:///" + FileUtils.getDirectoryPath(docPath) + tokenString;
}
if (!imgPath) {
return null;
}
if (urlMatch) {
sPos = {line: pos.line, ch: urlMatch.index};
ePos = {line: pos.line, ch: urlMatch.index + urlMatch[0].length};
} else {
sPos = {line: pos.line, ch: token.start};
ePos = {line: pos.line, ch: token.end};
}
var imgPreview = "<div class='image-preview'>" +
" <img src=\"" + imgPath + "\">" +
"</div>";
var coord = cm.charCoords(sPos);
var xpos = (cm.charCoords(ePos).left - coord.left) / 2 + coord.left;
var showHandler = function () {
// Hide the preview container until the image is loaded.
$previewContainer.hide();
$previewContainer.find(".image-preview > img").on("load", function () {
$previewContent
.append("<div class='img-size'>" +
this.naturalWidth + " × " + this.naturalHeight + " " + Strings.UNIT_PIXELS +
"</div>"
);
$previewContainer.show();
positionPreview(editor, popoverState.xpos, popoverState.ytop, popoverState.ybot);
}).on("error", function (e) {
e.preventDefault();
hidePreview();
});
};
return {
start: sPos,
end: ePos,
content: imgPreview,
onShow: showHandler,
xpos: xpos,
ytop: coord.top,
ybot: coord.bottom,
_imgPath: imgPath
};
} | javascript | function imagePreviewProvider(editor, pos, token, line) {
var cm = editor._codeMirror;
// Check for image name
var urlRegEx = /url\(([^\)]*)\)/gi,
tokenString,
urlMatch;
if (token.type === "string") {
tokenString = token.string;
} else {
urlMatch = urlRegEx.exec(line);
while (urlMatch) {
if (pos.ch < urlMatch.index) {
// match is past cursor, so stop looping
break;
} else if (pos.ch <= urlMatch.index + urlMatch[0].length) {
tokenString = urlMatch[1];
break;
}
urlMatch = urlRegEx.exec(line);
}
}
if (!tokenString) {
return null;
}
// Strip leading/trailing quotes, if present
tokenString = tokenString.replace(/(^['"])|(['"]$)/g, "");
var sPos, ePos;
var docPath = editor.document.file.fullPath;
var imgPath;
// Determine whether or not this URL/path is likely to be an image.
var parsed = PathUtils.parseUrl(tokenString);
// If the URL has a protocol, check if it's one of the supported protocols
var hasProtocol = parsed.protocol !== "" && validProtocols.indexOf(parsed.protocol.trim().toLowerCase()) !== -1;
var ext = parsed.filenameExtension.replace(/^\./, '');
var language = LanguageManager.getLanguageForExtension(ext);
var id = language && language.getId();
var isImage = id === "image" || id === "svg";
// Use this URL if this is an absolute URL and either points to a
// filename with a known image extension, or lacks an extension (e.g.,
// a web service that returns an image). Honour the extensionlessImagePreview
// preference as well in the latter case.
if (hasProtocol && (isImage || (!ext && extensionlessImagePreview))) {
imgPath = tokenString;
}
// Use this filename if this is a path with a known image extension.
else if (!hasProtocol && isImage) {
imgPath = "file:///" + FileUtils.getDirectoryPath(docPath) + tokenString;
}
if (!imgPath) {
return null;
}
if (urlMatch) {
sPos = {line: pos.line, ch: urlMatch.index};
ePos = {line: pos.line, ch: urlMatch.index + urlMatch[0].length};
} else {
sPos = {line: pos.line, ch: token.start};
ePos = {line: pos.line, ch: token.end};
}
var imgPreview = "<div class='image-preview'>" +
" <img src=\"" + imgPath + "\">" +
"</div>";
var coord = cm.charCoords(sPos);
var xpos = (cm.charCoords(ePos).left - coord.left) / 2 + coord.left;
var showHandler = function () {
// Hide the preview container until the image is loaded.
$previewContainer.hide();
$previewContainer.find(".image-preview > img").on("load", function () {
$previewContent
.append("<div class='img-size'>" +
this.naturalWidth + " × " + this.naturalHeight + " " + Strings.UNIT_PIXELS +
"</div>"
);
$previewContainer.show();
positionPreview(editor, popoverState.xpos, popoverState.ytop, popoverState.ybot);
}).on("error", function (e) {
e.preventDefault();
hidePreview();
});
};
return {
start: sPos,
end: ePos,
content: imgPreview,
onShow: showHandler,
xpos: xpos,
ytop: coord.top,
ybot: coord.bottom,
_imgPath: imgPath
};
} | [
"function",
"imagePreviewProvider",
"(",
"editor",
",",
"pos",
",",
"token",
",",
"line",
")",
"{",
"var",
"cm",
"=",
"editor",
".",
"_codeMirror",
";",
"// Check for image name",
"var",
"urlRegEx",
"=",
"/",
"url\\(([^\\)]*)\\)",
"/",
"gi",
",",
"tokenString"... | Image preview provider ------------------------------------------------- | [
"Image",
"preview",
"provider",
"-------------------------------------------------"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/QuickView/main.js#L447-L549 | train | Image preview provider | [
30522,
3853,
3746,
28139,
8584,
21572,
17258,
2121,
1006,
3559,
1010,
13433,
2015,
1010,
19204,
1010,
2240,
1007,
1063,
13075,
4642,
1027,
3559,
1012,
1035,
3642,
14503,
29165,
1025,
1013,
1013,
4638,
2005,
3746,
2171,
13075,
24471,
20974,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | parseUri | function parseUri (str) {
var o = parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
uri = {},
i = 14;
while (i--) uri[o.key[i]] = m[i] || "";
uri[o.q.name] = {};
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
if ($1) uri[o.q.name][$1] = $2;
});
return uri;
} | javascript | function parseUri (str) {
var o = parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
uri = {},
i = 14;
while (i--) uri[o.key[i]] = m[i] || "";
uri[o.q.name] = {};
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
if ($1) uri[o.q.name][$1] = $2;
});
return uri;
} | [
"function",
"parseUri",
"(",
"str",
")",
"{",
"var",
"o",
"=",
"parseUri",
".",
"options",
",",
"m",
"=",
"o",
".",
"parser",
"[",
"o",
".",
"strictMode",
"?",
"\"strict\"",
":",
"\"loose\"",
"]",
".",
"exec",
"(",
"str",
")",
",",
"uri",
"=",
"{... | ****************************************************************************** parseUri 1.2.1 MIT License /*
Copyright (c) 2007 Steven Levithan <stevenlevithan.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. | [
"******************************************************************************",
"parseUri",
"1",
".",
"2",
".",
"1",
"MIT",
"License",
"/",
"*",
"Copyright",
"(",
"c",
")",
"2007",
"Steven",
"Levithan",
"<stevenlevithan",
".",
"com",
">"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2571-L2585 | train | Parses a URI string. | [
30522,
3853,
11968,
3366,
9496,
1006,
2358,
2099,
1007,
1063,
13075,
1051,
1027,
11968,
3366,
9496,
1012,
7047,
1010,
1049,
1027,
1051,
1012,
11968,
8043,
1031,
1051,
30524,
1027,
1049,
1031,
1045,
1033,
1064,
1064,
1000,
1000,
1025,
24471,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/common/service/sessionService.js | function(session) {
EventEmitter.call(this);
clone(session, this, FRONTEND_SESSION_FIELDS);
// deep copy for settings
this.settings = dclone(session.settings);
this.__session__ = session;
} | javascript | function(session) {
EventEmitter.call(this);
clone(session, this, FRONTEND_SESSION_FIELDS);
// deep copy for settings
this.settings = dclone(session.settings);
this.__session__ = session;
} | [
"function",
"(",
"session",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"clone",
"(",
"session",
",",
"this",
",",
"FRONTEND_SESSION_FIELDS",
")",
";",
"// deep copy for settings",
"this",
".",
"settings",
"=",
"dclone",
"(",
"session",
"."... | Frontend session for frontend server. | [
"Frontend",
"session",
"for",
"frontend",
"server",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/common/service/sessionService.js#L557-L563 | train | The session object | [
30522,
3853,
1006,
5219,
1007,
1063,
2724,
23238,
12079,
1012,
2655,
1006,
2023,
1007,
1025,
17598,
1006,
5219,
1010,
2023,
1010,
2392,
10497,
1035,
5219,
1035,
4249,
1007,
1025,
1013,
1013,
2784,
6100,
2005,
10906,
2023,
1012,
10906,
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... | |
nozzle/react-static | packages/react-static/src/browser/index.js | init | function init() {
// In development, we need to open a socket to listen for changes to data
if (process.env.REACT_STATIC_ENV === 'development') {
const io = require('socket.io-client')
const run = async () => {
try {
const {
data: { port },
} = await axios.get('/__react-static__/getMessagePort')
const socket = io(`http://localhost:${port}`)
socket.on('connect', () => {
// Do nothing
})
socket.on('message', ({ type }) => {
if (type === 'reloadClientData') {
reloadClientData()
}
})
} catch (err) {
console.log(
'React-Static data hot-loader websocket encountered the following error:'
)
console.error(err)
}
}
run()
}
if (process.env.REACT_STATIC_DISABLE_PRELOAD === 'false') {
startPreloader()
}
} | javascript | function init() {
// In development, we need to open a socket to listen for changes to data
if (process.env.REACT_STATIC_ENV === 'development') {
const io = require('socket.io-client')
const run = async () => {
try {
const {
data: { port },
} = await axios.get('/__react-static__/getMessagePort')
const socket = io(`http://localhost:${port}`)
socket.on('connect', () => {
// Do nothing
})
socket.on('message', ({ type }) => {
if (type === 'reloadClientData') {
reloadClientData()
}
})
} catch (err) {
console.log(
'React-Static data hot-loader websocket encountered the following error:'
)
console.error(err)
}
}
run()
}
if (process.env.REACT_STATIC_DISABLE_PRELOAD === 'false') {
startPreloader()
}
} | [
"function",
"init",
"(",
")",
"{",
"// In development, we need to open a socket to listen for changes to data",
"if",
"(",
"process",
".",
"env",
".",
"REACT_STATIC_ENV",
"===",
"'development'",
")",
"{",
"const",
"io",
"=",
"require",
"(",
"'socket.io-client'",
")",
... | When in development, init a socket to listen for data changes When the data changes, we invalidate and reload all of the route data | [
"When",
"in",
"development",
"init",
"a",
"socket",
"to",
"listen",
"for",
"data",
"changes",
"When",
"the",
"data",
"changes",
"we",
"invalidate",
"and",
"reload",
"all",
"of",
"the",
"route",
"data"
] | 045a0e119974f46f68c633ff65116f9d74807caf | https://github.com/nozzle/react-static/blob/045a0e119974f46f68c633ff65116f9d74807caf/packages/react-static/src/browser/index.js#L106-L137 | train | Initialize the data hot - loader | [
30522,
3853,
1999,
4183,
1006,
1007,
1063,
1013,
1013,
1999,
2458,
1010,
2057,
2342,
2000,
2330,
1037,
22278,
2000,
4952,
2005,
3431,
2000,
2951,
2065,
1006,
2832,
1012,
4372,
2615,
1012,
10509,
1035,
10763,
1035,
4372,
2615,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | bits/50_styxls.js | parse_ExtProp | function parse_ExtProp(blob/*::, length*/)/*:Array<any>*/ {
var extType = blob.read_shift(2);
var cb = blob.read_shift(2) - 4;
var o = [extType];
switch(extType) {
case 0x04: case 0x05: case 0x07: case 0x08:
case 0x09: case 0x0A: case 0x0B: case 0x0D:
o[1] = parse_FullColorExt(blob, cb); break;
case 0x06: o[1] = parse_XFExtGradient(blob, cb); break;
case 0x0E: case 0x0F: o[1] = blob.read_shift(cb === 1 ? 1 : 2); break;
default: throw new Error("Unrecognized ExtProp type: " + extType + " " + cb);
}
return o;
} | javascript | function parse_ExtProp(blob/*::, length*/)/*:Array<any>*/ {
var extType = blob.read_shift(2);
var cb = blob.read_shift(2) - 4;
var o = [extType];
switch(extType) {
case 0x04: case 0x05: case 0x07: case 0x08:
case 0x09: case 0x0A: case 0x0B: case 0x0D:
o[1] = parse_FullColorExt(blob, cb); break;
case 0x06: o[1] = parse_XFExtGradient(blob, cb); break;
case 0x0E: case 0x0F: o[1] = blob.read_shift(cb === 1 ? 1 : 2); break;
default: throw new Error("Unrecognized ExtProp type: " + extType + " " + cb);
}
return o;
} | [
"function",
"parse_ExtProp",
"(",
"blob",
"/*::, length*/",
")",
"/*:Array<any>*/",
"{",
"var",
"extType",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"var",
"cb",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
"-",
"4",
";",
"var",
"o",
"=",
... | /* [MS-XLS] 2.5.108 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"108"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/50_styxls.js#L45-L58 | train | Parse ExtProp | [
30522,
3853,
11968,
3366,
1035,
4654,
25856,
18981,
1006,
1038,
4135,
2497,
1013,
1008,
1024,
1024,
1010,
3091,
1008,
1013,
1007,
1013,
1008,
1024,
9140,
1026,
2151,
1028,
1008,
1013,
1063,
13075,
4654,
15353,
5051,
1027,
1038,
4135,
2497,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ipfs/js-ipfs | src/core/utils.js | parseIpfsPath | function parseIpfsPath (ipfsPath) {
const invalidPathErr = new Error('invalid ipfs ref path')
ipfsPath = ipfsPath.replace(/^\/ipfs\//, '')
const matched = ipfsPath.match(/([^/]+(?:\/[^/]+)*)\/?$/)
if (!matched) {
throw invalidPathErr
}
const [hash, ...links] = matched[1].split('/')
// check that a CID can be constructed with the hash
if (isIpfs.cid(hash)) {
return { hash, links }
} else {
throw invalidPathErr
}
} | javascript | function parseIpfsPath (ipfsPath) {
const invalidPathErr = new Error('invalid ipfs ref path')
ipfsPath = ipfsPath.replace(/^\/ipfs\//, '')
const matched = ipfsPath.match(/([^/]+(?:\/[^/]+)*)\/?$/)
if (!matched) {
throw invalidPathErr
}
const [hash, ...links] = matched[1].split('/')
// check that a CID can be constructed with the hash
if (isIpfs.cid(hash)) {
return { hash, links }
} else {
throw invalidPathErr
}
} | [
"function",
"parseIpfsPath",
"(",
"ipfsPath",
")",
"{",
"const",
"invalidPathErr",
"=",
"new",
"Error",
"(",
"'invalid ipfs ref path'",
")",
"ipfsPath",
"=",
"ipfsPath",
".",
"replace",
"(",
"/",
"^\\/ipfs\\/",
"/",
",",
"''",
")",
"const",
"matched",
"=",
"... | Break an ipfs-path down into it's hash and an array of links.
examples:
b58Hash -> { hash: 'b58Hash', links: [] }
b58Hash/mercury/venus -> { hash: 'b58Hash', links: ['mercury', 'venus']}
/ipfs/b58Hash/links/by/name -> { hash: 'b58Hash', links: ['links', 'by', 'name'] }
@param {String} ipfsPath An ipfs-path
@return {Object} { hash: base58 string, links: [string], ?err: Error }
@throws on an invalid @param ipfsPath | [
"Break",
"an",
"ipfs",
"-",
"path",
"down",
"into",
"it",
"s",
"hash",
"and",
"an",
"array",
"of",
"links",
"."
] | 97e67601094acda3906549ecb0248fd09f1a8cc3 | https://github.com/ipfs/js-ipfs/blob/97e67601094acda3906549ecb0248fd09f1a8cc3/src/core/utils.js#L23-L39 | train | Parse the ipfs ref path | [
30522,
3853,
11968,
20240,
14376,
13102,
8988,
1006,
12997,
10343,
15069,
1007,
1063,
9530,
3367,
19528,
15069,
2121,
2099,
1027,
2047,
7561,
1006,
1005,
19528,
12997,
10343,
25416,
4130,
1005,
1007,
12997,
10343,
15069,
1027,
12997,
10343,
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... |
shipshapecode/shepherd | src/js/utils/general.js | _makeAttachedTippyOptions | function _makeAttachedTippyOptions(attachToOptions) {
const resultingTippyOptions = {
content: this.el,
flipOnUpdate: true,
placement: attachToOptions.on || 'right'
};
Object.assign(resultingTippyOptions, this.options.tippyOptions);
if (this.options.title) {
const existingTheme = resultingTippyOptions.theme;
resultingTippyOptions.theme = existingTheme ? `${existingTheme} shepherd-has-title` : 'shepherd-has-title';
}
if (this.options.tippyOptions && this.options.tippyOptions.popperOptions) {
Object.assign(defaultPopperOptions, this.options.tippyOptions.popperOptions);
}
resultingTippyOptions.popperOptions = defaultPopperOptions;
return resultingTippyOptions;
} | javascript | function _makeAttachedTippyOptions(attachToOptions) {
const resultingTippyOptions = {
content: this.el,
flipOnUpdate: true,
placement: attachToOptions.on || 'right'
};
Object.assign(resultingTippyOptions, this.options.tippyOptions);
if (this.options.title) {
const existingTheme = resultingTippyOptions.theme;
resultingTippyOptions.theme = existingTheme ? `${existingTheme} shepherd-has-title` : 'shepherd-has-title';
}
if (this.options.tippyOptions && this.options.tippyOptions.popperOptions) {
Object.assign(defaultPopperOptions, this.options.tippyOptions.popperOptions);
}
resultingTippyOptions.popperOptions = defaultPopperOptions;
return resultingTippyOptions;
} | [
"function",
"_makeAttachedTippyOptions",
"(",
"attachToOptions",
")",
"{",
"const",
"resultingTippyOptions",
"=",
"{",
"content",
":",
"this",
".",
"el",
",",
"flipOnUpdate",
":",
"true",
",",
"placement",
":",
"attachToOptions",
".",
"on",
"||",
"'right'",
"}",... | Generates the hash of options that will be passed to `Tippy` instances
target an element in the DOM.
@param {Object} attachToOptions The local `attachTo` options
@return {Object} The final tippy options object
@private | [
"Generates",
"the",
"hash",
"of",
"options",
"that",
"will",
"be",
"passed",
"to",
"Tippy",
"instances",
"target",
"an",
"element",
"in",
"the",
"DOM",
"."
] | 0cb1c63fb07b58796358f6d33da5f6405e2b05f4 | https://github.com/shipshapecode/shepherd/blob/0cb1c63fb07b58796358f6d33da5f6405e2b05f4/src/js/utils/general.js#L210-L231 | train | Make the options needed to attach to the tippy element | [
30522,
3853,
1035,
2191,
19321,
15395,
11927,
11514,
7685,
7361,
9285,
1006,
22476,
3406,
7361,
9285,
1007,
1063,
9530,
3367,
4525,
25101,
7685,
7361,
9285,
1027,
1063,
4180,
1024,
2023,
1012,
3449,
1010,
11238,
2239,
6279,
13701,
1024,
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... |
adobe/brackets | src/utils/UpdateNotification.js | _showUpdateNotificationDialog | function _showUpdateNotificationDialog(updates, force) {
Dialogs.showModalDialogUsingTemplate(Mustache.render(UpdateDialogTemplate, Strings))
.done(function (id) {
if (id === Dialogs.DIALOG_BTN_DOWNLOAD) {
HealthLogger.sendAnalyticsData(
eventNames.AUTOUPDATE_UPDATENOW_CLICK,
"autoUpdate",
"updateNotification",
"updateNow",
"click"
);
handleUpdateProcess(updates);
} else {
HealthLogger.sendAnalyticsData(
eventNames.AUTOUPDATE_CANCEL_CLICK,
"autoUpdate",
"updateNotification",
"cancel",
"click"
);
}
});
// Populate the update data
var $dlg = $(".update-dialog.instance"),
$updateList = $dlg.find(".update-info"),
subTypeString = force ? "userAction" : "auto";
// Make the update notification icon clickable again
_addedClickHandler = false;
updates.Strings = Strings;
$updateList.html(Mustache.render(UpdateListTemplate, updates));
HealthLogger.sendAnalyticsData(
eventNames.AUTOUPDATE_UPDATE_AVAILABLE_DIALOG_BOX_RENDERED,
"autoUpdate",
"updateNotification",
"render",
subTypeString
);
} | javascript | function _showUpdateNotificationDialog(updates, force) {
Dialogs.showModalDialogUsingTemplate(Mustache.render(UpdateDialogTemplate, Strings))
.done(function (id) {
if (id === Dialogs.DIALOG_BTN_DOWNLOAD) {
HealthLogger.sendAnalyticsData(
eventNames.AUTOUPDATE_UPDATENOW_CLICK,
"autoUpdate",
"updateNotification",
"updateNow",
"click"
);
handleUpdateProcess(updates);
} else {
HealthLogger.sendAnalyticsData(
eventNames.AUTOUPDATE_CANCEL_CLICK,
"autoUpdate",
"updateNotification",
"cancel",
"click"
);
}
});
// Populate the update data
var $dlg = $(".update-dialog.instance"),
$updateList = $dlg.find(".update-info"),
subTypeString = force ? "userAction" : "auto";
// Make the update notification icon clickable again
_addedClickHandler = false;
updates.Strings = Strings;
$updateList.html(Mustache.render(UpdateListTemplate, updates));
HealthLogger.sendAnalyticsData(
eventNames.AUTOUPDATE_UPDATE_AVAILABLE_DIALOG_BOX_RENDERED,
"autoUpdate",
"updateNotification",
"render",
subTypeString
);
} | [
"function",
"_showUpdateNotificationDialog",
"(",
"updates",
",",
"force",
")",
"{",
"Dialogs",
".",
"showModalDialogUsingTemplate",
"(",
"Mustache",
".",
"render",
"(",
"UpdateDialogTemplate",
",",
"Strings",
")",
")",
".",
"done",
"(",
"function",
"(",
"id",
"... | Show a dialog that shows the update | [
"Show",
"a",
"dialog",
"that",
"shows",
"the",
"update"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/UpdateNotification.js#L302-L342 | train | Show the update notification dialog | [
30522,
3853,
1035,
2265,
6279,
13701,
17048,
9031,
27184,
8649,
1006,
14409,
1010,
2486,
1007,
1063,
13764,
8649,
2015,
1012,
2265,
5302,
9305,
27184,
8649,
18161,
18532,
15725,
1006,
28786,
1012,
17552,
1006,
7172,
4818,
8649,
18532,
15725,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesBase.js | function (data, context) {
if (!data) {
return;
}
// do not upset other layers if context for the this one is not specified
if (!_.isEmpty(context)) {
if (data[context.language]) {
return _.keys(data[context.language]);
} else {
return [];
}
} else {
return _.union.apply(null, _.map(_.values(data), _.keys));
}
} | javascript | function (data, context) {
if (!data) {
return;
}
// do not upset other layers if context for the this one is not specified
if (!_.isEmpty(context)) {
if (data[context.language]) {
return _.keys(data[context.language]);
} else {
return [];
}
} else {
return _.union.apply(null, _.map(_.values(data), _.keys));
}
} | [
"function",
"(",
"data",
",",
"context",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"return",
";",
"}",
"// do not upset other layers if context for the this one is not specified",
"if",
"(",
"!",
"_",
".",
"isEmpty",
"(",
"context",
")",
")",
"{",
"if",
"(... | Retrieves the keys provided by this layer object. If the context is
empty, it will return all the keys provided in all the layerIDs
(languages).
@param {Object} data the preference data from the Scope
@param {{language: string}} context Context to operate with
@return {Array<{string}>|undefined} An array of pref ids | [
"Retrieves",
"the",
"keys",
"provided",
"by",
"this",
"layer",
"object",
".",
"If",
"the",
"context",
"is",
"empty",
"it",
"will",
"return",
"all",
"the",
"keys",
"provided",
"in",
"all",
"the",
"layerIDs",
"(",
"languages",
")",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L765-L780 | train | get the language of the current language | [
30522,
3853,
1006,
2951,
1010,
6123,
1007,
1063,
2065,
1006,
999,
2951,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
2079,
2025,
6314,
2060,
9014,
2065,
6123,
2005,
1996,
2023,
2028,
2003,
2025,
9675,
2065,
1006,
999,
1035,
1012,
2003,
6633,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dcloudio/mui | examples/hello-mui/js/mui.listpicker.js | function() {
var self = this;
if (self.options.enabledH5) {
self.options.fiexdDur *= 2;
self.boxInner.classList.add($.className('scroll-wrapper'));
self.list.classList.add($.className('scroll'));
self._scrollerApi = $(self.boxInner).scroll({
deceleration: 0.002
});
//增加惯性滚动时的 scroll 触发处理
//shimTetTranslate(self._scrollerApi);
//--
self.setScrollTop = function(y, dur, callback) {
self._scrollerApi.scrollTo(0, -y, dur);
};
self.getScrollTop = function() {
var self = this;
if (self._scrollerApi.lastY > 0) {
return 0
} else {
return Math.abs(self._scrollerApi.lastY);
}
};
} else {
//alert(0);
//为 boxInner 增加 scrollend 事件 (没有原生 scrollend 事件)
self.boxInner.addEventListener('scroll', function(event) {
if (self.disabledScroll) return;
self.isScrolling = true;
if (self.scrollTimer) {
clearTimeout(self.scrollTimer);
}
self.scrollTimer = setTimeout(function() {
self.isScrolling = false;
if (!self.isTouchDown || !$.os.ios) {
$.trigger(self.boxInner, 'scrollend');
}
}, 150);
}, false);
self.aniScrollTop = function(y, dur, callback) {
self.disabledScroll = true;
var stepNum = dur > 0 ? dur / 10 : 1;
var stepSize = (y - self.boxInner.scrollTop) / stepNum;
self._lastScrollTop = self.boxInner.scrollTop; //记录最后的位置
self._aniScrollTop(y, 0, stepNum, stepSize, callback);
};
self._aniScrollTop = function(y, stepIndex, stepNum, stepSize, callback) {
self.boxInner.scrollTop = self._lastScrollTop + stepSize * stepIndex;
if (stepIndex < stepNum) {
setTimeout(function() {
self._aniScrollTop(y, ++stepIndex, stepNum, stepSize);
}, 10);
} else {
//self.boxInner.scrollTop = y;
self.disabledScroll = false;
if (callback) callback();
}
};
self.setScrollTop = function(y, dur, callback) {
self.aniScrollTop(y, dur);
};
self.getScrollTop = function() {
var self = this;
return self.boxInner.scrollTop;
};
//在 ios 上手指不弹起时,防止定位抖动开始
if ($.os.ios) {
self.boxInner.addEventListener('touchstart', function(event) {
var self = this;
self.isTouchDown = true;
}, false);
self.boxInner.addEventListener('touchend', function(event) {
self.isTouchDown = false;
if (!self.isScrolling) {
setTimeout(function() {
$.trigger(self.boxInner, 'scrollend');
}, 0);
}
}, false);
}
//在 ios 上手指不弹起时,防止定位抖动结束
}
} | javascript | function() {
var self = this;
if (self.options.enabledH5) {
self.options.fiexdDur *= 2;
self.boxInner.classList.add($.className('scroll-wrapper'));
self.list.classList.add($.className('scroll'));
self._scrollerApi = $(self.boxInner).scroll({
deceleration: 0.002
});
//增加惯性滚动时的 scroll 触发处理
//shimTetTranslate(self._scrollerApi);
//--
self.setScrollTop = function(y, dur, callback) {
self._scrollerApi.scrollTo(0, -y, dur);
};
self.getScrollTop = function() {
var self = this;
if (self._scrollerApi.lastY > 0) {
return 0
} else {
return Math.abs(self._scrollerApi.lastY);
}
};
} else {
//alert(0);
//为 boxInner 增加 scrollend 事件 (没有原生 scrollend 事件)
self.boxInner.addEventListener('scroll', function(event) {
if (self.disabledScroll) return;
self.isScrolling = true;
if (self.scrollTimer) {
clearTimeout(self.scrollTimer);
}
self.scrollTimer = setTimeout(function() {
self.isScrolling = false;
if (!self.isTouchDown || !$.os.ios) {
$.trigger(self.boxInner, 'scrollend');
}
}, 150);
}, false);
self.aniScrollTop = function(y, dur, callback) {
self.disabledScroll = true;
var stepNum = dur > 0 ? dur / 10 : 1;
var stepSize = (y - self.boxInner.scrollTop) / stepNum;
self._lastScrollTop = self.boxInner.scrollTop; //记录最后的位置
self._aniScrollTop(y, 0, stepNum, stepSize, callback);
};
self._aniScrollTop = function(y, stepIndex, stepNum, stepSize, callback) {
self.boxInner.scrollTop = self._lastScrollTop + stepSize * stepIndex;
if (stepIndex < stepNum) {
setTimeout(function() {
self._aniScrollTop(y, ++stepIndex, stepNum, stepSize);
}, 10);
} else {
//self.boxInner.scrollTop = y;
self.disabledScroll = false;
if (callback) callback();
}
};
self.setScrollTop = function(y, dur, callback) {
self.aniScrollTop(y, dur);
};
self.getScrollTop = function() {
var self = this;
return self.boxInner.scrollTop;
};
//在 ios 上手指不弹起时,防止定位抖动开始
if ($.os.ios) {
self.boxInner.addEventListener('touchstart', function(event) {
var self = this;
self.isTouchDown = true;
}, false);
self.boxInner.addEventListener('touchend', function(event) {
self.isTouchDown = false;
if (!self.isScrolling) {
setTimeout(function() {
$.trigger(self.boxInner, 'scrollend');
}, 0);
}
}, false);
}
//在 ios 上手指不弹起时,防止定位抖动结束
}
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"options",
".",
"enabledH5",
")",
"{",
"self",
".",
"options",
".",
"fiexdDur",
"*=",
"2",
";",
"self",
".",
"boxInner",
".",
"classList",
".",
"add",
"(",
"$",
"... | 根据 options 处理不同平台兼容问题 | [
"根据",
"options",
"处理不同平台兼容问题"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.listpicker.js#L91-L173 | train | scroll to top of the list | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2065,
1006,
2969,
1012,
7047,
1012,
9124,
2232,
2629,
1007,
1063,
2969,
1012,
7047,
1012,
10882,
10288,
14141,
3126,
1008,
1027,
1016,
1025,
2969,
1012,
3482,
23111,
2121,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/view/MainViewManager.js | _mergePanes | function _mergePanes() {
if (_panes.hasOwnProperty(SECOND_PANE)) {
var firstPane = _panes[FIRST_PANE],
secondPane = _panes[SECOND_PANE],
fileList = secondPane.getViewList(),
lastViewed = getCurrentlyViewedFile();
Resizer.removeSizable(firstPane.$el);
firstPane.mergeFrom(secondPane);
exports.trigger("workingSetRemoveList", fileList, secondPane.id);
setActivePaneId(firstPane.id);
secondPane.$el.off(".mainview");
secondPane.off(".mainview");
secondPane.destroy();
delete _panes[SECOND_PANE];
exports.trigger("paneDestroy", secondPane.id);
exports.trigger("workingSetAddList", fileList, firstPane.id);
_mruList.forEach(function (record) {
if (record.paneId === secondPane.id) {
record.paneId = firstPane.id;
}
});
_$el.removeClass("split-" + _orientation.toLowerCase());
_orientation = null;
// this will set the remaining pane to 100%
_initialLayout();
exports.trigger("paneLayoutChange", _orientation);
// if the current view before the merger was in the pane
// that went away then reopen it so that it's now the current view again
if (lastViewed && getCurrentlyViewedFile() !== lastViewed) {
exports._open(firstPane.id, lastViewed);
}
}
} | javascript | function _mergePanes() {
if (_panes.hasOwnProperty(SECOND_PANE)) {
var firstPane = _panes[FIRST_PANE],
secondPane = _panes[SECOND_PANE],
fileList = secondPane.getViewList(),
lastViewed = getCurrentlyViewedFile();
Resizer.removeSizable(firstPane.$el);
firstPane.mergeFrom(secondPane);
exports.trigger("workingSetRemoveList", fileList, secondPane.id);
setActivePaneId(firstPane.id);
secondPane.$el.off(".mainview");
secondPane.off(".mainview");
secondPane.destroy();
delete _panes[SECOND_PANE];
exports.trigger("paneDestroy", secondPane.id);
exports.trigger("workingSetAddList", fileList, firstPane.id);
_mruList.forEach(function (record) {
if (record.paneId === secondPane.id) {
record.paneId = firstPane.id;
}
});
_$el.removeClass("split-" + _orientation.toLowerCase());
_orientation = null;
// this will set the remaining pane to 100%
_initialLayout();
exports.trigger("paneLayoutChange", _orientation);
// if the current view before the merger was in the pane
// that went away then reopen it so that it's now the current view again
if (lastViewed && getCurrentlyViewedFile() !== lastViewed) {
exports._open(firstPane.id, lastViewed);
}
}
} | [
"function",
"_mergePanes",
"(",
")",
"{",
"if",
"(",
"_panes",
".",
"hasOwnProperty",
"(",
"SECOND_PANE",
")",
")",
"{",
"var",
"firstPane",
"=",
"_panes",
"[",
"FIRST_PANE",
"]",
",",
"secondPane",
"=",
"_panes",
"[",
"SECOND_PANE",
"]",
",",
"fileList",
... | Merges second pane into first pane and opens the current file
@private | [
"Merges",
"second",
"pane",
"into",
"first",
"pane",
"and",
"opens",
"the",
"current",
"file"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1300-L1342 | train | merges the pane s content into the first pane | [
30522,
3853,
1035,
13590,
9739,
2229,
1006,
1007,
1063,
2065,
1006,
1035,
6090,
2229,
1012,
2038,
12384,
21572,
4842,
3723,
1006,
2117,
1035,
6090,
2063,
1007,
1007,
1063,
13075,
2034,
9739,
2063,
1027,
1035,
6090,
2229,
1031,
30524,
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... |
GitbookIO/gitbook | lib/utils/error.js | enforce | function enforce(err) {
if (is.string(err)) err = new Error(err);
err.message = err.message.replace(/^Error: /, '');
return err;
} | javascript | function enforce(err) {
if (is.string(err)) err = new Error(err);
err.message = err.message.replace(/^Error: /, '');
return err;
} | [
"function",
"enforce",
"(",
"err",
")",
"{",
"if",
"(",
"is",
".",
"string",
"(",
"err",
")",
")",
"err",
"=",
"new",
"Error",
"(",
"err",
")",
";",
"err",
".",
"message",
"=",
"err",
".",
"message",
".",
"replace",
"(",
"/",
"^Error: ",
"/",
"... | Enforce as an Error object, and cleanup message | [
"Enforce",
"as",
"an",
"Error",
"object",
"and",
"cleanup",
"message"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/error.js#L8-L13 | train | Enforce an error to be a valid
| [
30522,
3853,
16306,
1006,
9413,
2099,
1007,
1063,
2065,
1006,
2003,
1012,
5164,
1006,
9413,
2099,
1007,
1007,
9413,
2099,
1027,
2047,
7561,
1006,
9413,
2099,
1007,
1025,
9413,
2099,
1012,
4471,
1027,
9413,
2099,
1012,
4471,
1012,
5672,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/file/FileUtils.js | sniffLineEndings | function sniffLineEndings(text) {
var subset = text.substr(0, 1000); // (length is clipped to text.length)
var hasCRLF = /\r\n/.test(subset);
var hasLF = /[^\r]\n/.test(subset);
if ((hasCRLF && hasLF) || (!hasCRLF && !hasLF)) {
return null;
} else {
return hasCRLF ? LINE_ENDINGS_CRLF : LINE_ENDINGS_LF;
}
} | javascript | function sniffLineEndings(text) {
var subset = text.substr(0, 1000); // (length is clipped to text.length)
var hasCRLF = /\r\n/.test(subset);
var hasLF = /[^\r]\n/.test(subset);
if ((hasCRLF && hasLF) || (!hasCRLF && !hasLF)) {
return null;
} else {
return hasCRLF ? LINE_ENDINGS_CRLF : LINE_ENDINGS_LF;
}
} | [
"function",
"sniffLineEndings",
"(",
"text",
")",
"{",
"var",
"subset",
"=",
"text",
".",
"substr",
"(",
"0",
",",
"1000",
")",
";",
"// (length is clipped to text.length)",
"var",
"hasCRLF",
"=",
"/",
"\\r\\n",
"/",
".",
"test",
"(",
"subset",
")",
";",
... | Scans the first 1000 chars of the text to determine how it encodes line endings. Returns
null if usage is mixed or if no line endings found.
@param {!string} text
@return {null|LINE_ENDINGS_CRLF|LINE_ENDINGS_LF} | [
"Scans",
"the",
"first",
"1000",
"chars",
"of",
"the",
"text",
"to",
"determine",
"how",
"it",
"encodes",
"line",
"endings",
".",
"Returns",
"null",
"if",
"usage",
"is",
"mixed",
"or",
"if",
"no",
"line",
"endings",
"found",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/file/FileUtils.js#L141-L151 | train | sniff line endings | [
30522,
3853,
27907,
4179,
18537,
2015,
1006,
3793,
1007,
1063,
13075,
16745,
1027,
3793,
1012,
4942,
3367,
2099,
1006,
1014,
1010,
6694,
1007,
1025,
1013,
1013,
1006,
3091,
2003,
20144,
2000,
3793,
1012,
3091,
1007,
13075,
2038,
26775,
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... |
nfarina/homebridge | website/scripts/custom.js | initialise | function initialise() {
DOMReady(function () {
for (var i = 0; i < 10; i++) {
createCommandHtml(true);
}
// var rellax = new Rellax('.rellax');
});
document.addEventListener('webkitAnimationEnd', onAnimationEnded);
} | javascript | function initialise() {
DOMReady(function () {
for (var i = 0; i < 10; i++) {
createCommandHtml(true);
}
// var rellax = new Rellax('.rellax');
});
document.addEventListener('webkitAnimationEnd', onAnimationEnded);
} | [
"function",
"initialise",
"(",
")",
"{",
"DOMReady",
"(",
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"10",
";",
"i",
"++",
")",
"{",
"createCommandHtml",
"(",
"true",
")",
";",
"}",
"// var rellax = new Rellax('.rellax'... | //////////////// | [
"////////////////"
] | 724125dc1b500dfd81048a30a1e3229ff122189a | https://github.com/nfarina/homebridge/blob/724125dc1b500dfd81048a30a1e3229ff122189a/website/scripts/custom.js#L100-L114 | train | initialise the application | [
30522,
3853,
3988,
5562,
1006,
1007,
1063,
14383,
30524,
1025,
1065,
1013,
1013,
13075,
2128,
4571,
2595,
1027,
2047,
2128,
4571,
2595,
1006,
1005,
1012,
2128,
4571,
2595,
1005,
1007,
1025,
1065,
1007,
1025,
6254,
1012,
5587,
18697,
3372,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/encodeConfig.js | encodeConfig | function encodeConfig(output, config) {
var result = {
values: config.getValues().toJS(),
get: function(key, defaultValue) {
return objectPath.get(result.values, key, defaultValue);
},
set: function(key, value) {
return objectPath.set(result.values, key, value);
}
};
deprecate.field(output, 'config.options', result, 'options',
result.values, '"config.options" property is deprecated, use "config.get(key)" instead');
deprecate.field(output, 'config.options.generator', result.values, 'generator',
output.getGenerator(), '"options.generator" property is deprecated, use "output.name" instead');
deprecate.field(output, 'config.options.generator', result.values, 'output',
output.getRoot(), '"options.output" property is deprecated, use "output.root()" instead');
return result;
} | javascript | function encodeConfig(output, config) {
var result = {
values: config.getValues().toJS(),
get: function(key, defaultValue) {
return objectPath.get(result.values, key, defaultValue);
},
set: function(key, value) {
return objectPath.set(result.values, key, value);
}
};
deprecate.field(output, 'config.options', result, 'options',
result.values, '"config.options" property is deprecated, use "config.get(key)" instead');
deprecate.field(output, 'config.options.generator', result.values, 'generator',
output.getGenerator(), '"options.generator" property is deprecated, use "output.name" instead');
deprecate.field(output, 'config.options.generator', result.values, 'output',
output.getRoot(), '"options.output" property is deprecated, use "output.root()" instead');
return result;
} | [
"function",
"encodeConfig",
"(",
"output",
",",
"config",
")",
"{",
"var",
"result",
"=",
"{",
"values",
":",
"config",
".",
"getValues",
"(",
")",
".",
"toJS",
"(",
")",
",",
"get",
":",
"function",
"(",
"key",
",",
"defaultValue",
")",
"{",
"return... | Encode a config object into a JS config api
@param {Output} output
@param {Config} config
@return {Object} | [
"Encode",
"a",
"config",
"object",
"into",
"a",
"JS",
"config",
"api"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/api/encodeConfig.js#L11-L34 | train | Encode a config object | [
30522,
3853,
4372,
16044,
8663,
8873,
2290,
1006,
6434,
1010,
9530,
8873,
2290,
1007,
1063,
13075,
2765,
1027,
1063,
5300,
1024,
9530,
8873,
2290,
1012,
2131,
10175,
15808,
1006,
1007,
1012,
2000,
22578,
1006,
1007,
1010,
2131,
1024,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/XMLUtils.js | _createTagInfo | function _createTagInfo(token, tokenType, offset, exclusionList, tagName, attrName, shouldReplace) {
return {
token: token || null,
tokenType: tokenType || null,
offset: offset || 0,
exclusionList: exclusionList || [],
tagName: tagName || "",
attrName: attrName || "",
shouldReplace: shouldReplace || false
};
} | javascript | function _createTagInfo(token, tokenType, offset, exclusionList, tagName, attrName, shouldReplace) {
return {
token: token || null,
tokenType: tokenType || null,
offset: offset || 0,
exclusionList: exclusionList || [],
tagName: tagName || "",
attrName: attrName || "",
shouldReplace: shouldReplace || false
};
} | [
"function",
"_createTagInfo",
"(",
"token",
",",
"tokenType",
",",
"offset",
",",
"exclusionList",
",",
"tagName",
",",
"attrName",
",",
"shouldReplace",
")",
"{",
"return",
"{",
"token",
":",
"token",
"||",
"null",
",",
"tokenType",
":",
"tokenType",
"||",
... | Returns an object that represents all its params.
@param {!Token} token CodeMirror token at the current pos
@param {number} tokenType Type of current token
@param {number} offset Offset in current token
@param {Array.<string>} exclusionList List of attributes of a tag or attribute options used by an attribute
@param {string} tagName Name of the current tag
@param {string} attrName Name of the current attribute
@param {boolean} shouldReplace true if we don't want to append ="" to an attribute
@return {!{token: Token, tokenType: int, offset: int, exclusionList: Array.<string>, tagName: string, attrName: string, shouldReplace: boolean}} | [
"Returns",
"an",
"object",
"that",
"represents",
"all",
"its",
"params",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/XMLUtils.js#L50-L60 | train | Create tag info | [
30522,
3853,
1035,
3443,
15900,
2378,
14876,
1006,
19204,
1010,
19204,
13874,
1010,
16396,
1010,
15945,
9863,
1010,
6415,
18442,
1010,
2012,
16344,
18442,
1010,
2323,
2890,
24759,
10732,
1007,
1063,
2709,
1063,
19204,
1024,
19204,
1064,
1064,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/XMLTemplateProcessor.js | parseChildren | function parseChildren(xmlNode, bRoot, bIgnoreToplevelTextNodes) {
var children = xmlNode.childNodes;
for (var i = 0; i < children.length; i++) {
parseNode(children[i], bRoot, bIgnoreToplevelTextNodes);
}
} | javascript | function parseChildren(xmlNode, bRoot, bIgnoreToplevelTextNodes) {
var children = xmlNode.childNodes;
for (var i = 0; i < children.length; i++) {
parseNode(children[i], bRoot, bIgnoreToplevelTextNodes);
}
} | [
"function",
"parseChildren",
"(",
"xmlNode",
",",
"bRoot",
",",
"bIgnoreToplevelTextNodes",
")",
"{",
"var",
"children",
"=",
"xmlNode",
".",
"childNodes",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
... | Parses the children of an XML node.
@param {Element} xmlNode the xml node which will be parsed
@param {boolean} bRoot
@param {boolean} bIgnoreToplevelTextNodes
@returns {Promise[]} each resolving to the according child nodes content | [
"Parses",
"the",
"children",
"of",
"an",
"XML",
"node",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L454-L459 | train | Parses the children of an XML node | [
30522,
3853,
11968,
3366,
19339,
7389,
1006,
20950,
3630,
3207,
1010,
22953,
4140,
1010,
2502,
12131,
18903,
10814,
15985,
18209,
3630,
6155,
1007,
1063,
13075,
2336,
1027,
20950,
3630,
3207,
1012,
2775,
3630,
6155,
1025,
2005,
1006,
13075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | dist/js/materialize.js | Modal | function Modal(el, options) {
_classCallCheck(this, Modal);
var _this13 = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
_this13.el.M_Modal = _this13;
/**
* Options for the modal
* @member Modal#options
* @prop {Number} [opacity=0.5] - Opacity of the modal overlay
* @prop {Number} [inDuration=250] - Length in ms of enter transition
* @prop {Number} [outDuration=250] - Length in ms of exit transition
* @prop {Function} onOpenStart - Callback function called before modal is opened
* @prop {Function} onOpenEnd - Callback function called after modal is opened
* @prop {Function} onCloseStart - Callback function called before modal is closed
* @prop {Function} onCloseEnd - Callback function called after modal is closed
* @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
* @prop {String} [startingTop='4%'] - startingTop
* @prop {String} [endingTop='10%'] - endingTop
*/
_this13.options = $.extend({}, Modal.defaults, options);
/**
* Describes open/close state of modal
* @type {Boolean}
*/
_this13.isOpen = false;
_this13.id = _this13.$el.attr('id');
_this13._openingTrigger = undefined;
_this13.$overlay = $('<div class="modal-overlay"></div>');
_this13.el.tabIndex = 0;
_this13._nthModalOpened = 0;
Modal._count++;
_this13._setupEventHandlers();
return _this13;
} | javascript | function Modal(el, options) {
_classCallCheck(this, Modal);
var _this13 = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
_this13.el.M_Modal = _this13;
/**
* Options for the modal
* @member Modal#options
* @prop {Number} [opacity=0.5] - Opacity of the modal overlay
* @prop {Number} [inDuration=250] - Length in ms of enter transition
* @prop {Number} [outDuration=250] - Length in ms of exit transition
* @prop {Function} onOpenStart - Callback function called before modal is opened
* @prop {Function} onOpenEnd - Callback function called after modal is opened
* @prop {Function} onCloseStart - Callback function called before modal is closed
* @prop {Function} onCloseEnd - Callback function called after modal is closed
* @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
* @prop {String} [startingTop='4%'] - startingTop
* @prop {String} [endingTop='10%'] - endingTop
*/
_this13.options = $.extend({}, Modal.defaults, options);
/**
* Describes open/close state of modal
* @type {Boolean}
*/
_this13.isOpen = false;
_this13.id = _this13.$el.attr('id');
_this13._openingTrigger = undefined;
_this13.$overlay = $('<div class="modal-overlay"></div>');
_this13.el.tabIndex = 0;
_this13._nthModalOpened = 0;
Modal._count++;
_this13._setupEventHandlers();
return _this13;
} | [
"function",
"Modal",
"(",
"el",
",",
"options",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"Modal",
")",
";",
"var",
"_this13",
"=",
"_possibleConstructorReturn",
"(",
"this",
",",
"(",
"Modal",
".",
"__proto__",
"||",
"Object",
".",
"getPrototypeOf",
... | Construct Modal instance and set up overlay
@constructor
@param {Element} el
@param {Object} options | [
"Construct",
"Modal",
"instance",
"and",
"set",
"up",
"overlay"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L2893-L2931 | train | Constructor for Modal | [
30522,
3853,
16913,
2389,
1006,
3449,
1010,
7047,
1007,
1063,
1035,
2465,
9289,
29358,
11012,
1006,
2023,
1010,
16913,
2389,
1007,
1025,
13075,
1035,
2023,
17134,
1027,
1035,
2825,
8663,
3367,
6820,
16761,
13465,
14287,
1006,
2023,
1010,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/Async.js | firstSequentially | function firstSequentially(items, beginProcessItem) {
var masterDeferred = new $.Deferred();
function doItem(i) {
if (i >= items.length) {
masterDeferred.reject();
return;
}
beginProcessItem(items[i], i)
.fail(function () {
doItem(i + 1);
})
.done(function () {
masterDeferred.resolve(items[i]);
});
}
doItem(0);
return masterDeferred.promise();
} | javascript | function firstSequentially(items, beginProcessItem) {
var masterDeferred = new $.Deferred();
function doItem(i) {
if (i >= items.length) {
masterDeferred.reject();
return;
}
beginProcessItem(items[i], i)
.fail(function () {
doItem(i + 1);
})
.done(function () {
masterDeferred.resolve(items[i]);
});
}
doItem(0);
return masterDeferred.promise();
} | [
"function",
"firstSequentially",
"(",
"items",
",",
"beginProcessItem",
")",
"{",
"var",
"masterDeferred",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
";",
"function",
"doItem",
"(",
"i",
")",
"{",
"if",
"(",
"i",
">=",
"items",
".",
"length",
")",
"{"... | Executes a series of tasks in serial (task N does not begin until task N-1 has completed).
Returns a "master" Promise that is resolved when the first task has resolved. If all tasks
fail, the master Promise is rejected.
@param {!Array.<*>} items
@param {!function(*, number):Promise} beginProcessItem
@return {$.Promise} | [
"Executes",
"a",
"series",
"of",
"tasks",
"in",
"serial",
"(",
"task",
"N",
"does",
"not",
"begin",
"until",
"task",
"N",
"-",
"1",
"has",
"completed",
")",
".",
"Returns",
"a",
"master",
"Promise",
"that",
"is",
"resolved",
"when",
"the",
"first",
"ta... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/Async.js#L246-L267 | train | firstSequentially - processes the items in the array | [
30522,
3853,
2034,
3366,
15417,
4818,
2135,
1006,
5167,
1010,
4088,
21572,
9623,
28032,
6633,
1007,
1063,
13075,
3040,
3207,
7512,
5596,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
3853,
9193,
18532,
1006,
1045,
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... |
adobe/brackets | src/JSUtils/node/TernNodeDomain.js | buildRequest | function buildRequest(fileInfo, query, offset) {
query = {type: query};
query.start = offset;
query.end = offset;
query.file = (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) ? "#0" : fileInfo.name;
query.filter = false;
query.sort = false;
query.depths = true;
query.guess = true;
query.origins = true;
query.types = true;
query.expandWordForward = false;
query.lineCharPositions = true;
query.docs = true;
query.urls = true;
var request = {query: query, files: [], offset: offset, timeout: inferenceTimeout};
if (fileInfo.type !== MessageIds.TERN_FILE_INFO_TYPE_EMPTY) {
// Create a copy to mutate ahead
var fileInfoCopy = JSON.parse(JSON.stringify(fileInfo));
request.files.push(fileInfoCopy);
}
return request;
} | javascript | function buildRequest(fileInfo, query, offset) {
query = {type: query};
query.start = offset;
query.end = offset;
query.file = (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) ? "#0" : fileInfo.name;
query.filter = false;
query.sort = false;
query.depths = true;
query.guess = true;
query.origins = true;
query.types = true;
query.expandWordForward = false;
query.lineCharPositions = true;
query.docs = true;
query.urls = true;
var request = {query: query, files: [], offset: offset, timeout: inferenceTimeout};
if (fileInfo.type !== MessageIds.TERN_FILE_INFO_TYPE_EMPTY) {
// Create a copy to mutate ahead
var fileInfoCopy = JSON.parse(JSON.stringify(fileInfo));
request.files.push(fileInfoCopy);
}
return request;
} | [
"function",
"buildRequest",
"(",
"fileInfo",
",",
"query",
",",
"offset",
")",
"{",
"query",
"=",
"{",
"type",
":",
"query",
"}",
";",
"query",
".",
"start",
"=",
"offset",
";",
"query",
".",
"end",
"=",
"offset",
";",
"query",
".",
"file",
"=",
"(... | Build an object that can be used as a request to tern.
@param {{type: string, name: string, offsetLines: number, text: string}} fileInfo
- type of update, name of file, and the text of the update.
For "full" updates, the whole text of the file is present. For "part" updates,
the changed portion of the text. For "empty" updates, the file has not been modified
and the text is empty.
@param {string} query - the type of request being made
@param {{line: number, ch: number}} offset - | [
"Build",
"an",
"object",
"that",
"can",
"be",
"used",
"as",
"a",
"request",
"to",
"tern",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/node/TernNodeDomain.js#L215-L239 | train | Build a request object from the file info | [
30522,
3853,
3857,
2890,
15500,
1006,
5371,
2378,
14876,
1010,
23032,
1010,
16396,
1007,
1063,
23032,
1027,
1063,
2828,
1024,
23032,
1065,
1025,
23032,
1012,
2707,
30524,
28774,
2078,
1035,
5371,
1035,
18558,
1035,
2828,
1035,
2112,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js | function (oEvent) {
// open field ext ui
var oUshellContainer = FlUtils.getUshellContainer();
var oCrossAppNav = oUshellContainer.getService("CrossApplicationNavigation");
var sHrefForFieldExtensionUi = (oCrossAppNav && oCrossAppNav.hrefForExternal({
target : {
semanticObject : "CustomField",
action : "develop"
},
params : {
businessContexts : this._oCurrentFieldExtInfo.BusinessContexts.map( function( oBusinessContext){
return oBusinessContext.BusinessContext;
}),
serviceName : this._oCurrentFieldExtInfo.ServiceName,
serviceVersion : this._oCurrentFieldExtInfo.ServiceVersion,
entityType : this._oCurrentFieldExtInfo.EntityType
}
}));
Utils.openNewWindow(sHrefForFieldExtensionUi);
} | javascript | function (oEvent) {
// open field ext ui
var oUshellContainer = FlUtils.getUshellContainer();
var oCrossAppNav = oUshellContainer.getService("CrossApplicationNavigation");
var sHrefForFieldExtensionUi = (oCrossAppNav && oCrossAppNav.hrefForExternal({
target : {
semanticObject : "CustomField",
action : "develop"
},
params : {
businessContexts : this._oCurrentFieldExtInfo.BusinessContexts.map( function( oBusinessContext){
return oBusinessContext.BusinessContext;
}),
serviceName : this._oCurrentFieldExtInfo.ServiceName,
serviceVersion : this._oCurrentFieldExtInfo.ServiceVersion,
entityType : this._oCurrentFieldExtInfo.EntityType
}
}));
Utils.openNewWindow(sHrefForFieldExtensionUi);
} | [
"function",
"(",
"oEvent",
")",
"{",
"// open field ext ui",
"var",
"oUshellContainer",
"=",
"FlUtils",
".",
"getUshellContainer",
"(",
")",
";",
"var",
"oCrossAppNav",
"=",
"oUshellContainer",
".",
"getService",
"(",
"\"CrossApplicationNavigation\"",
")",
";",
"var... | Function called when custom field button was pressed
@param {sap.ui.base.Event}
oEvent event object | [
"Function",
"called",
"when",
"custom",
"field",
"button",
"was",
"pressed"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js#L598-L617 | train | open the field ext UI | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
1013,
1013,
2330,
2492,
4654,
2102,
21318,
13075,
15068,
4095,
5349,
8663,
18249,
2121,
1027,
19857,
3775,
4877,
1012,
2131,
20668,
5349,
8663,
18249,
2121,
1006,
1007,
1025,
13075,
1051,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/interfaces/interfaces.js | showInterfaceIdl | function showInterfaceIdl(intf, html) {
html.push("<div class='show-Idl'><h3>IDL</h3><pre>")
html.push("interface {")
intf.methods.forEach(function(method){
showInterfaceIdlMethod(method, html)
})
if (intf.attributes.length > 0) html.push("<table>")
intf.attributes.forEach(function(attribute){
showInterfaceIdlAttribute(attribute, html)
})
if (intf.attributes.length > 0) html.push("</table>")
html.push("};")
html.push("</pre></div>")
} | javascript | function showInterfaceIdl(intf, html) {
html.push("<div class='show-Idl'><h3>IDL</h3><pre>")
html.push("interface {")
intf.methods.forEach(function(method){
showInterfaceIdlMethod(method, html)
})
if (intf.attributes.length > 0) html.push("<table>")
intf.attributes.forEach(function(attribute){
showInterfaceIdlAttribute(attribute, html)
})
if (intf.attributes.length > 0) html.push("</table>")
html.push("};")
html.push("</pre></div>")
} | [
"function",
"showInterfaceIdl",
"(",
"intf",
",",
"html",
")",
"{",
"html",
".",
"push",
"(",
"\"<div class='show-Idl'><h3>IDL</h3><pre>\"",
")",
"html",
".",
"push",
"(",
"\"interface {\"",
")",
"intf",
".",
"methods",
".",
"forEach",
"(",
"function",
"(",
"m... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L160-L176 | train | show interface idl | [
30522,
3853,
2265,
18447,
2121,
12172,
3593,
2140,
1006,
20014,
2546,
1010,
16129,
1007,
1063,
16129,
1012,
5245,
1006,
1000,
1026,
4487,
2615,
2465,
1027,
1005,
2265,
1011,
8909,
2140,
1005,
1028,
1026,
1044,
2509,
1028,
8909,
2140,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/api/v0.1/slugs.js | checkAllowedTypes | function checkAllowedTypes(options) {
if (allowedTypes[options.type] === undefined) {
return Promise.reject(new common.errors.BadRequestError({message: common.i18n.t('errors.api.slugs.unknownSlugType', {type: options.type})}));
}
return options;
} | javascript | function checkAllowedTypes(options) {
if (allowedTypes[options.type] === undefined) {
return Promise.reject(new common.errors.BadRequestError({message: common.i18n.t('errors.api.slugs.unknownSlugType', {type: options.type})}));
}
return options;
} | [
"function",
"checkAllowedTypes",
"(",
"options",
")",
"{",
"if",
"(",
"allowedTypes",
"[",
"options",
".",
"type",
"]",
"===",
"undefined",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",
"new",
"common",
".",
"errors",
".",
"BadRequestError",
"(",
"{",... | ### Check allowed types
check if options.type contains an allowed type
@param {Object} options
@returns {Object} options | [
"###",
"Check",
"allowed",
"types",
"check",
"if",
"options",
".",
"type",
"contains",
"an",
"allowed",
"type"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/slugs.js#L46-L51 | train | Check if the slug type is valid | [
30522,
3853,
4638,
8095,
15096,
13874,
2015,
1006,
7047,
1007,
1063,
2065,
1006,
3039,
13874,
2015,
1031,
7047,
1012,
2828,
1033,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
2709,
4872,
1012,
15454,
1006,
2047,
2691,
1012,
10697,
1012,
2919,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/variants/VariantModel.js | function() {
var aVariantManagementReferences = Object.keys(this.oData);
aVariantManagementReferences.forEach(function(sVariantManagementReference) {
var mPropertyBag = {
variantManagementReference: sVariantManagementReference,
currentVariantReference: this.oData[sVariantManagementReference].currentVariant || this.oData[sVariantManagementReference].defaultVariant ,
newVariantReference: true // since new variant is not known - true will lead to no new changes for variant switch
};
var mChangesToBeSwitched = this.oChangePersistence.loadSwitchChangesMapForComponent(mPropertyBag);
this._oVariantSwitchPromise = this._oVariantSwitchPromise
.then(this.oFlexController.revertChangesOnControl.bind(this.oFlexController, mChangesToBeSwitched.changesToBeReverted, this.oAppComponent))
.then(function() {
delete this.oData[sVariantManagementReference];
delete this.oVariantController.getChangeFileContent()[sVariantManagementReference];
this._ensureStandardVariantExists(sVariantManagementReference);
}.bind(this));
}.bind(this));
//re-initialize hash register and remove existing parameters
VariantUtil.initializeHashRegister.call(this);
this.updateHasherEntry({
parameters: []
});
return this._oVariantSwitchPromise;
} | javascript | function() {
var aVariantManagementReferences = Object.keys(this.oData);
aVariantManagementReferences.forEach(function(sVariantManagementReference) {
var mPropertyBag = {
variantManagementReference: sVariantManagementReference,
currentVariantReference: this.oData[sVariantManagementReference].currentVariant || this.oData[sVariantManagementReference].defaultVariant ,
newVariantReference: true // since new variant is not known - true will lead to no new changes for variant switch
};
var mChangesToBeSwitched = this.oChangePersistence.loadSwitchChangesMapForComponent(mPropertyBag);
this._oVariantSwitchPromise = this._oVariantSwitchPromise
.then(this.oFlexController.revertChangesOnControl.bind(this.oFlexController, mChangesToBeSwitched.changesToBeReverted, this.oAppComponent))
.then(function() {
delete this.oData[sVariantManagementReference];
delete this.oVariantController.getChangeFileContent()[sVariantManagementReference];
this._ensureStandardVariantExists(sVariantManagementReference);
}.bind(this));
}.bind(this));
//re-initialize hash register and remove existing parameters
VariantUtil.initializeHashRegister.call(this);
this.updateHasherEntry({
parameters: []
});
return this._oVariantSwitchPromise;
} | [
"function",
"(",
")",
"{",
"var",
"aVariantManagementReferences",
"=",
"Object",
".",
"keys",
"(",
"this",
".",
"oData",
")",
";",
"aVariantManagementReferences",
".",
"forEach",
"(",
"function",
"(",
"sVariantManagementReference",
")",
"{",
"var",
"mPropertyBag",... | When VariantController map is reset at runtime, this listener is called.
It reverts all applied changes and resets all variant management controls to default state.
@returns {Promise} Promise which resolves when all applied changes have been reverted | [
"When",
"VariantController",
"map",
"is",
"reset",
"at",
"runtime",
"this",
"listener",
"is",
"called",
".",
"It",
"reverts",
"all",
"applied",
"changes",
"and",
"resets",
"all",
"variant",
"management",
"controls",
"to",
"default",
"state",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/variants/VariantModel.js#L38-L61 | train | revert all changes to the variant management | [
30522,
3853,
1006,
1007,
1063,
13075,
10927,
6862,
22942,
4270,
3672,
2890,
25523,
2015,
1027,
4874,
1012,
6309,
1006,
2023,
1012,
1051,
2850,
2696,
1007,
1025,
10927,
6862,
22942,
4270,
30524,
1006,
17917,
12199,
22942,
4270,
3672,
2890,
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... | |
KaTeX/KaTeX | src/functions/delimsizing.js | checkDelimiter | function checkDelimiter(
delim: AnyParseNode,
context: FunctionContext,
): SymbolParseNode {
const symDelim = checkSymbolNodeType(delim);
if (symDelim && utils.contains(delimiters, symDelim.text)) {
return symDelim;
} else {
throw new ParseError(
"Invalid delimiter: '" +
(symDelim ? symDelim.text : JSON.stringify(delim)) +
"' after '" + context.funcName + "'", delim);
}
} | javascript | function checkDelimiter(
delim: AnyParseNode,
context: FunctionContext,
): SymbolParseNode {
const symDelim = checkSymbolNodeType(delim);
if (symDelim && utils.contains(delimiters, symDelim.text)) {
return symDelim;
} else {
throw new ParseError(
"Invalid delimiter: '" +
(symDelim ? symDelim.text : JSON.stringify(delim)) +
"' after '" + context.funcName + "'", delim);
}
} | [
"function",
"checkDelimiter",
"(",
"delim",
":",
"AnyParseNode",
",",
"context",
":",
"FunctionContext",
",",
")",
":",
"SymbolParseNode",
"{",
"const",
"symDelim",
"=",
"checkSymbolNodeType",
"(",
"delim",
")",
";",
"if",
"(",
"symDelim",
"&&",
"utils",
".",
... | Delimiter functions | [
"Delimiter",
"functions"
] | 17bfb247b88070267f3e5c7b21fe4a360fdf49d9 | https://github.com/KaTeX/KaTeX/blob/17bfb247b88070267f3e5c7b21fe4a360fdf49d9/src/functions/delimsizing.js#L58-L71 | train | Check if the delimiter is valid | [
30522,
3853,
4638,
9247,
27605,
3334,
1006,
3972,
5714,
1024,
2151,
19362,
5054,
10244,
1010,
6123,
1024,
3853,
8663,
18209,
1010,
1007,
1024,
6454,
19362,
5054,
10244,
1063,
9530,
3367,
25353,
26876,
20806,
2213,
1027,
14148,
24335,
14956,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | examples/player/player.js | function() {
// Display the duration.
duration.innerHTML = self.formatTime(Math.round(sound.duration()));
// Start upating the progress of the track.
requestAnimationFrame(self.step.bind(self));
// Start the wave animation if we have already loaded
wave.container.style.display = 'block';
bar.style.display = 'none';
pauseBtn.style.display = 'block';
} | javascript | function() {
// Display the duration.
duration.innerHTML = self.formatTime(Math.round(sound.duration()));
// Start upating the progress of the track.
requestAnimationFrame(self.step.bind(self));
// Start the wave animation if we have already loaded
wave.container.style.display = 'block';
bar.style.display = 'none';
pauseBtn.style.display = 'block';
} | [
"function",
"(",
")",
"{",
"// Display the duration.",
"duration",
".",
"innerHTML",
"=",
"self",
".",
"formatTime",
"(",
"Math",
".",
"round",
"(",
"sound",
".",
"duration",
"(",
")",
")",
")",
";",
"// Start upating the progress of the track.",
"requestAnimation... | Force to HTML5 so that the audio can stream in (best for large files). | [
"Force",
"to",
"HTML5",
"so",
"that",
"the",
"audio",
"can",
"stream",
"in",
"(",
"best",
"for",
"large",
"files",
")",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/player/player.js#L60-L71 | train | Update the duration and wave | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
4653,
1996,
9367,
1012,
9367,
1012,
5110,
11039,
19968,
1027,
2969,
1012,
4289,
7292,
1006,
8785,
1012,
2461,
1006,
2614,
1012,
9367,
1006,
1007,
1007,
1007,
1025,
1013,
1013,
2707,
2039,
5844,
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... | |
babel/babel | packages/babel-highlight/src/index.js | highlightTokens | function highlightTokens(defs: Object, text: string) {
return text.replace(jsTokens, function(...args) {
const type = getTokenType(args);
const colorize = defs[type];
if (colorize) {
return args[0]
.split(NEWLINE)
.map(str => colorize(str))
.join("\n");
} else {
return args[0];
}
});
} | javascript | function highlightTokens(defs: Object, text: string) {
return text.replace(jsTokens, function(...args) {
const type = getTokenType(args);
const colorize = defs[type];
if (colorize) {
return args[0]
.split(NEWLINE)
.map(str => colorize(str))
.join("\n");
} else {
return args[0];
}
});
} | [
"function",
"highlightTokens",
"(",
"defs",
":",
"Object",
",",
"text",
":",
"string",
")",
"{",
"return",
"text",
".",
"replace",
"(",
"jsTokens",
",",
"function",
"(",
"...",
"args",
")",
"{",
"const",
"type",
"=",
"getTokenType",
"(",
"args",
")",
"... | Highlight `text` using the token definitions in `defs`. | [
"Highlight",
"text",
"using",
"the",
"token",
"definitions",
"in",
"defs",
"."
] | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-highlight/src/index.js#L79-L92 | train | Highlights tokens in text | [
30522,
3853,
12944,
18715,
6132,
1006,
13366,
2015,
1024,
4874,
1010,
3793,
1024,
5164,
1007,
1063,
2709,
3793,
1012,
5672,
1006,
1046,
16033,
7520,
2015,
1010,
3853,
1006,
1012,
1012,
1012,
12098,
5620,
1007,
1063,
9530,
3367,
2828,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/less.js | function () {
var e, expressions = [];
do {
e = this.expression();
if (e) {
expressions.push(e);
if (! $char(',')) { break; }
}
} while(e);
if (expressions.length > 0) {
return new(tree.Value)(expressions);
}
} | javascript | function () {
var e, expressions = [];
do {
e = this.expression();
if (e) {
expressions.push(e);
if (! $char(',')) { break; }
}
} while(e);
if (expressions.length > 0) {
return new(tree.Value)(expressions);
}
} | [
"function",
"(",
")",
"{",
"var",
"e",
",",
"expressions",
"=",
"[",
"]",
";",
"do",
"{",
"e",
"=",
"this",
".",
"expression",
"(",
")",
";",
"if",
"(",
"e",
")",
"{",
"expressions",
".",
"push",
"(",
"e",
")",
";",
"if",
"(",
"!",
"$char",
... | A Value is a comma-delimited list of Expressions font-family: Baskerville, Georgia, serif; In a Rule, a Value represents everything after the `:`, and before the `;`. | [
"A",
"Value",
"is",
"a",
"comma",
"-",
"delimited",
"list",
"of",
"Expressions",
"font",
"-",
"family",
":",
"Baskerville",
"Georgia",
"serif",
";",
"In",
"a",
"Rule",
"a",
"Value",
"represents",
"everything",
"after",
"the",
":",
"and",
"before",
"the",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L1782-L1796 | train | Returns the next expression in the expression list. | [
30522,
3853,
1006,
1007,
1063,
13075,
1041,
1010,
11423,
1027,
1031,
1033,
1025,
2079,
1063,
1041,
1027,
2023,
1012,
3670,
1006,
1007,
1025,
2065,
1006,
1041,
1007,
1063,
11423,
1012,
5245,
1006,
1041,
1007,
1025,
2065,
1006,
999,
1002,
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... | |
ramda/ramda | scripts/transpile/esm-to-cjs.js | function(path) {
var importSource = path.node.source.value;
var defaultSpecifier = path.get('specifiers')[0];
defaultSpecifier.assertImportDefaultSpecifier();
path.replaceWith(
buildImportAssignment(
defaultSpecifier.get('local').get('name').node,
importSource
)
);
} | javascript | function(path) {
var importSource = path.node.source.value;
var defaultSpecifier = path.get('specifiers')[0];
defaultSpecifier.assertImportDefaultSpecifier();
path.replaceWith(
buildImportAssignment(
defaultSpecifier.get('local').get('name').node,
importSource
)
);
} | [
"function",
"(",
"path",
")",
"{",
"var",
"importSource",
"=",
"path",
".",
"node",
".",
"source",
".",
"value",
";",
"var",
"defaultSpecifier",
"=",
"path",
".",
"get",
"(",
"'specifiers'",
")",
"[",
"0",
"]",
";",
"defaultSpecifier",
".",
"assertImport... | /*
before
import curryN from './curryN';
after
var curryN = require('./curryN'); | [
"/",
"*",
"before",
"import",
"curryN",
"from",
".",
"/",
"curryN",
";"
] | 072d417a345e7087a95466a9825d43b6ca3a4941 | https://github.com/ramda/ramda/blob/072d417a345e7087a95466a9825d43b6ca3a4941/scripts/transpile/esm-to-cjs.js#L46-L57 | train | Add an import to the end of the path | [
30522,
3853,
1006,
4130,
1007,
1063,
13075,
17589,
8162,
3401,
1027,
4130,
1012,
13045,
1012,
3120,
1012,
3643,
1025,
13075,
12398,
13102,
8586,
18095,
1027,
4130,
1012,
2131,
1006,
1005,
28699,
28295,
1005,
1007,
1031,
1014,
1033,
1025,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | javascript/selenium-core/scripts/htmlutils.js | getText | function getText(element) {
var text = "";
var isRecentFirefox = (browserVersion.isFirefox && browserVersion.firefoxVersion >= "1.5");
if (isRecentFirefox || browserVersion.isKonqueror || browserVersion.isSafari || browserVersion.isOpera) {
text = getTextContent(element);
} else if (element.textContent) {
text = element.textContent;
} else if (element.innerText) {
text = element.innerText;
}
text = normalizeNewlines(text);
text = normalizeSpaces(text);
return text.trim();
} | javascript | function getText(element) {
var text = "";
var isRecentFirefox = (browserVersion.isFirefox && browserVersion.firefoxVersion >= "1.5");
if (isRecentFirefox || browserVersion.isKonqueror || browserVersion.isSafari || browserVersion.isOpera) {
text = getTextContent(element);
} else if (element.textContent) {
text = element.textContent;
} else if (element.innerText) {
text = element.innerText;
}
text = normalizeNewlines(text);
text = normalizeSpaces(text);
return text.trim();
} | [
"function",
"getText",
"(",
"element",
")",
"{",
"var",
"text",
"=",
"\"\"",
";",
"var",
"isRecentFirefox",
"=",
"(",
"browserVersion",
".",
"isFirefox",
"&&",
"browserVersion",
".",
"firefoxVersion",
">=",
"\"1.5\"",
")",
";",
"if",
"(",
"isRecentFirefox",
... | Returns the text in this element | [
"Returns",
"the",
"text",
"in",
"this",
"element"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L161-L177 | train | Get the text of an element | [
30522,
3853,
2131,
18209,
1006,
5783,
1007,
1063,
13075,
3793,
1027,
1000,
1000,
1025,
13075,
2003,
2890,
13013,
10273,
14876,
2595,
1027,
1006,
16602,
27774,
1012,
2003,
10273,
14876,
2595,
1004,
1004,
16602,
27774,
1012,
2543,
14876,
2595,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zloirock/core-js | packages/core-js/internals/collection-strong.js | function (key) {
var that = this;
var state = getInternalState(that);
var entry = getEntry(that, key);
if (entry) {
var next = entry.next;
var prev = entry.previous;
delete state.index[entry.index];
entry.removed = true;
if (prev) prev.next = next;
if (next) next.previous = prev;
if (state.first == entry) state.first = next;
if (state.last == entry) state.last = prev;
if (DESCRIPTORS) state.size--;
else that.size--;
} return !!entry;
} | javascript | function (key) {
var that = this;
var state = getInternalState(that);
var entry = getEntry(that, key);
if (entry) {
var next = entry.next;
var prev = entry.previous;
delete state.index[entry.index];
entry.removed = true;
if (prev) prev.next = next;
if (next) next.previous = prev;
if (state.first == entry) state.first = next;
if (state.last == entry) state.last = prev;
if (DESCRIPTORS) state.size--;
else that.size--;
} return !!entry;
} | [
"function",
"(",
"key",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"state",
"=",
"getInternalState",
"(",
"that",
")",
";",
"var",
"entry",
"=",
"getEntry",
"(",
"that",
",",
"key",
")",
";",
"if",
"(",
"entry",
")",
"{",
"var",
"next",
"=... | 23.1.3.3 Map.prototype.delete(key) 23.2.3.4 Set.prototype.delete(value) | [
"23",
".",
"1",
".",
"3",
".",
"3",
"Map",
".",
"prototype",
".",
"delete",
"(",
"key",
")",
"23",
".",
"2",
".",
"3",
".",
"4",
"Set",
".",
"prototype",
".",
"delete",
"(",
"value",
")"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/internals/collection-strong.js#L91-L107 | train | Removes the entry for the given key. | [
30522,
3853,
1006,
3145,
1007,
1063,
13075,
2008,
1027,
2023,
1025,
13075,
2110,
1027,
2131,
18447,
11795,
9777,
12259,
1006,
2008,
1007,
1025,
13075,
4443,
1027,
2131,
4765,
2854,
1006,
2008,
1010,
3145,
1007,
1025,
2065,
1006,
4443,
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... | |
daneden/animate.css | gulpfile.js | activateAnimations | function activateAnimations() {
var categories = JSON.parse(fs.readFileSync('animate-config.json')),
category,
files,
file,
target = [],
count = 0;
for (category in categories) {
if (categories.hasOwnProperty(category)) {
files = categories[category];
for (file in files) {
if (files[file]) {
// marked as true
target.push('source/' + category + '/' + file + '.css');
count += 1;
}
}
}
}
// prepend base CSS
target.push('source/_base.css');
if (!count) {
gutil.log('No animations activated.');
} else {
gutil.log(count + (count > 1 ? ' animations' : ' animation') + ' activated.');
}
return target;
} | javascript | function activateAnimations() {
var categories = JSON.parse(fs.readFileSync('animate-config.json')),
category,
files,
file,
target = [],
count = 0;
for (category in categories) {
if (categories.hasOwnProperty(category)) {
files = categories[category];
for (file in files) {
if (files[file]) {
// marked as true
target.push('source/' + category + '/' + file + '.css');
count += 1;
}
}
}
}
// prepend base CSS
target.push('source/_base.css');
if (!count) {
gutil.log('No animations activated.');
} else {
gutil.log(count + (count > 1 ? ' animations' : ' animation') + ' activated.');
}
return target;
} | [
"function",
"activateAnimations",
"(",
")",
"{",
"var",
"categories",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"'animate-config.json'",
")",
")",
",",
"category",
",",
"files",
",",
"file",
",",
"target",
"=",
"[",
"]",
",",
"count... | ---------------------------- Helpers/functions ---------------------------- Read the config file and return an array of the animations to be activated | [
"----------------------------",
"Helpers",
"/",
"functions",
"----------------------------",
"Read",
"the",
"config",
"file",
"and",
"return",
"an",
"array",
"of",
"the",
"animations",
"to",
"be",
"activated"
] | 0ca8f2dc7c74c9e76b93bc378dad8b1cc1590dad | https://github.com/daneden/animate.css/blob/0ca8f2dc7c74c9e76b93bc378dad8b1cc1590dad/gulpfile.js#L76-L107 | train | activate animations | [
30522,
3853,
20544,
7088,
28649,
2015,
1006,
1007,
1063,
13075,
7236,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
1042,
2015,
1012,
3191,
8873,
4244,
6038,
2278,
1006,
1005,
2019,
21499,
1011,
9530,
8873,
2290,
1012,
1046,
3385,
1005,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/JSLint/main.js | lintOneFile | function lintOneFile(text, fullPath) {
// If a line contains only whitespace (here spaces or tabs), remove the whitespace
text = text.replace(/^[ \t]+$/gm, "");
var options = prefs.get("options");
_lastRunOptions = _.clone(options);
if (!options) {
options = {};
} else {
options = _.clone(options);
}
if (!options.indent) {
// default to using the same indentation value that the editor is using
options.indent = _getIndentSize(fullPath);
}
// If the user has not defined the environment, we use browser by default.
var hasEnvironment = _.some(ENVIRONMENTS, function (env) {
return options[env] !== undefined;
});
if (!hasEnvironment) {
options.browser = true;
}
var jslintResult = JSLINT(text, options);
if (!jslintResult) {
// Remove any trailing null placeholder (early-abort indicator)
var errors = JSLINT.errors.filter(function (err) { return err !== null; });
errors = errors.map(function (jslintError) {
return {
// JSLint returns 1-based line/col numbers
pos: { line: jslintError.line - 1, ch: jslintError.character - 1 },
message: jslintError.reason,
type: CodeInspection.Type.WARNING
};
});
var result = { errors: errors };
// If array terminated in a null it means there was a stop notice
if (errors.length !== JSLINT.errors.length) {
result.aborted = true;
errors[errors.length - 1].type = CodeInspection.Type.META;
}
return result;
}
return null;
} | javascript | function lintOneFile(text, fullPath) {
// If a line contains only whitespace (here spaces or tabs), remove the whitespace
text = text.replace(/^[ \t]+$/gm, "");
var options = prefs.get("options");
_lastRunOptions = _.clone(options);
if (!options) {
options = {};
} else {
options = _.clone(options);
}
if (!options.indent) {
// default to using the same indentation value that the editor is using
options.indent = _getIndentSize(fullPath);
}
// If the user has not defined the environment, we use browser by default.
var hasEnvironment = _.some(ENVIRONMENTS, function (env) {
return options[env] !== undefined;
});
if (!hasEnvironment) {
options.browser = true;
}
var jslintResult = JSLINT(text, options);
if (!jslintResult) {
// Remove any trailing null placeholder (early-abort indicator)
var errors = JSLINT.errors.filter(function (err) { return err !== null; });
errors = errors.map(function (jslintError) {
return {
// JSLint returns 1-based line/col numbers
pos: { line: jslintError.line - 1, ch: jslintError.character - 1 },
message: jslintError.reason,
type: CodeInspection.Type.WARNING
};
});
var result = { errors: errors };
// If array terminated in a null it means there was a stop notice
if (errors.length !== JSLINT.errors.length) {
result.aborted = true;
errors[errors.length - 1].type = CodeInspection.Type.META;
}
return result;
}
return null;
} | [
"function",
"lintOneFile",
"(",
"text",
",",
"fullPath",
")",
"{",
"// If a line contains only whitespace (here spaces or tabs), remove the whitespace",
"text",
"=",
"text",
".",
"replace",
"(",
"/",
"^[ \\t]+$",
"/",
"gm",
",",
"\"\"",
")",
";",
"var",
"options",
"... | Run JSLint on the current document. Reports results to the main UI. Displays
a gold star when no errors are found. | [
"Run",
"JSLint",
"on",
"the",
"current",
"document",
".",
"Reports",
"results",
"to",
"the",
"main",
"UI",
".",
"Displays",
"a",
"gold",
"star",
"when",
"no",
"errors",
"are",
"found",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JSLint/main.js#L218-L272 | train | Lint one file | [
30522,
3853,
11409,
5524,
8873,
2571,
1006,
3793,
1010,
2440,
15069,
1007,
1063,
1013,
1013,
2065,
1037,
2240,
3397,
2069,
12461,
15327,
1006,
2182,
7258,
2030,
21628,
2015,
1007,
1010,
6366,
1996,
12461,
15327,
3793,
1027,
3793,
1012,
5672... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/services/gesture/gesture.js | function (node) {
var current = node;
while (current) {
if ((current.$mdGesture || {})[this.name]) {
return current;
}
current = current.parentNode;
}
return null;
} | javascript | function (node) {
var current = node;
while (current) {
if ((current.$mdGesture || {})[this.name]) {
return current;
}
current = current.parentNode;
}
return null;
} | [
"function",
"(",
"node",
")",
"{",
"var",
"current",
"=",
"node",
";",
"while",
"(",
"current",
")",
"{",
"if",
"(",
"(",
"current",
".",
"$mdGesture",
"||",
"{",
"}",
")",
"[",
"this",
".",
"name",
"]",
")",
"{",
"return",
"current",
";",
"}",
... | Find and return the nearest parent element that has been registered to listen for this handler via $mdGesture.register(element, 'handlerName'). | [
"Find",
"and",
"return",
"the",
"nearest",
"parent",
"element",
"that",
"has",
"been",
"registered",
"to",
"listen",
"for",
"this",
"handler",
"via",
"$mdGesture",
".",
"register",
"(",
"element",
"handlerName",
")",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L445-L454 | train | Returns the parent of the given node | [
30522,
3853,
1006,
13045,
1007,
1063,
13075,
2783,
1027,
13045,
1025,
2096,
1006,
2783,
1007,
1063,
2065,
1006,
1006,
2783,
1012,
1002,
9108,
8449,
11244,
1064,
1064,
1063,
1065,
1007,
1031,
2023,
1012,
2171,
1033,
1007,
1063,
2709,
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... | |
TryGhost/Ghost | core/server/lib/common/i18n.js | findString | function findString(msgPath, opts) {
const options = merge({log: true}, opts || {});
let candidateString, matchingString, path;
// no path? no string
if (msgPath.length === 0 || !isString(msgPath)) {
chalk.yellow('i18n.t() - received an empty path.');
return '';
}
// If not in memory, load translations for core
if (coreStrings === undefined) {
I18n.init();
}
if (options.isThemeString) {
// If not in memory, load translations for theme
if (themeStrings === undefined) {
I18n.loadThemeTranslations();
}
// Both jsonpath's dot-notation and bracket-notation start with '$'
// E.g.: $.store.book.title or $['store']['book']['title']
// The {{t}} translation helper passes the default English text
// The full Unicode jsonpath with '$' is built here
// jp.stringify and jp.value are jsonpath methods
// Info: https://www.npmjs.com/package/jsonpath
path = jp.stringify(['$', msgPath]);
candidateString = jp.value(themeStrings, path) || msgPath;
} else {
// Backend messages use dot-notation, and the '$.' prefix is added here
// While bracket-notation allows any Unicode characters in keys for themes,
// dot-notation allows only word characters in keys for backend messages
// (that is \w or [A-Za-z0-9_] in RegExp)
path = `$.${msgPath}`;
candidateString = jp.value(coreStrings, path);
}
matchingString = candidateString || {};
if (isObject(matchingString) || isEqual(matchingString, {})) {
if (options.log) {
logging.error(new errors.IncorrectUsageError({
message: `i18n error: path "${msgPath}" was not found`
}));
}
matchingString = coreStrings.errors.errors.anErrorOccurred;
}
return matchingString;
} | javascript | function findString(msgPath, opts) {
const options = merge({log: true}, opts || {});
let candidateString, matchingString, path;
// no path? no string
if (msgPath.length === 0 || !isString(msgPath)) {
chalk.yellow('i18n.t() - received an empty path.');
return '';
}
// If not in memory, load translations for core
if (coreStrings === undefined) {
I18n.init();
}
if (options.isThemeString) {
// If not in memory, load translations for theme
if (themeStrings === undefined) {
I18n.loadThemeTranslations();
}
// Both jsonpath's dot-notation and bracket-notation start with '$'
// E.g.: $.store.book.title or $['store']['book']['title']
// The {{t}} translation helper passes the default English text
// The full Unicode jsonpath with '$' is built here
// jp.stringify and jp.value are jsonpath methods
// Info: https://www.npmjs.com/package/jsonpath
path = jp.stringify(['$', msgPath]);
candidateString = jp.value(themeStrings, path) || msgPath;
} else {
// Backend messages use dot-notation, and the '$.' prefix is added here
// While bracket-notation allows any Unicode characters in keys for themes,
// dot-notation allows only word characters in keys for backend messages
// (that is \w or [A-Za-z0-9_] in RegExp)
path = `$.${msgPath}`;
candidateString = jp.value(coreStrings, path);
}
matchingString = candidateString || {};
if (isObject(matchingString) || isEqual(matchingString, {})) {
if (options.log) {
logging.error(new errors.IncorrectUsageError({
message: `i18n error: path "${msgPath}" was not found`
}));
}
matchingString = coreStrings.errors.errors.anErrorOccurred;
}
return matchingString;
} | [
"function",
"findString",
"(",
"msgPath",
",",
"opts",
")",
"{",
"const",
"options",
"=",
"merge",
"(",
"{",
"log",
":",
"true",
"}",
",",
"opts",
"||",
"{",
"}",
")",
";",
"let",
"candidateString",
",",
"matchingString",
",",
"path",
";",
"// no path?... | Parse JSON file for matching locale, returns string giving path.
@param {string} msgPath Path with in the JSON language file to desired string (ie: "errors.init.jsNotBuilt")
@returns {string} | [
"Parse",
"JSON",
"file",
"for",
"matching",
"locale",
"returns",
"string",
"giving",
"path",
"."
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/lib/common/i18n.js#L114-L164 | train | Find a string from the i18n file | [
30522,
3853,
4858,
18886,
3070,
1006,
5796,
21600,
8988,
1010,
23569,
2015,
1007,
1063,
9530,
3367,
7047,
1027,
13590,
1006,
1063,
8833,
1024,
2995,
1065,
1010,
23569,
2015,
1064,
1064,
1063,
1065,
1007,
1025,
2292,
5347,
18886,
3070,
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... |
eslint/eslint | lib/linter.js | normalizeVerifyOptions | function normalizeVerifyOptions(providedOptions) {
const isObjectOptions = typeof providedOptions === "object";
const providedFilename = isObjectOptions ? providedOptions.filename : providedOptions;
return {
filename: typeof providedFilename === "string" ? providedFilename : "<input>",
allowInlineConfig: !isObjectOptions || providedOptions.allowInlineConfig !== false,
reportUnusedDisableDirectives: isObjectOptions && !!providedOptions.reportUnusedDisableDirectives
};
} | javascript | function normalizeVerifyOptions(providedOptions) {
const isObjectOptions = typeof providedOptions === "object";
const providedFilename = isObjectOptions ? providedOptions.filename : providedOptions;
return {
filename: typeof providedFilename === "string" ? providedFilename : "<input>",
allowInlineConfig: !isObjectOptions || providedOptions.allowInlineConfig !== false,
reportUnusedDisableDirectives: isObjectOptions && !!providedOptions.reportUnusedDisableDirectives
};
} | [
"function",
"normalizeVerifyOptions",
"(",
"providedOptions",
")",
"{",
"const",
"isObjectOptions",
"=",
"typeof",
"providedOptions",
"===",
"\"object\"",
";",
"const",
"providedFilename",
"=",
"isObjectOptions",
"?",
"providedOptions",
".",
"filename",
":",
"providedOp... | Normalizes the possible options for `linter.verify` and `linter.verifyAndFix` to a
consistent shape.
@param {(string|{reportUnusedDisableDirectives: boolean, filename: string, allowInlineConfig: boolean})} providedOptions Options
@returns {{reportUnusedDisableDirectives: boolean, filename: string, allowInlineConfig: boolean}} Normalized options | [
"Normalizes",
"the",
"possible",
"options",
"for",
"linter",
".",
"verify",
"and",
"linter",
".",
"verifyAndFix",
"to",
"a",
"consistent",
"shape",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/linter.js#L339-L348 | train | Normalize options for verify | [
30522,
3853,
3671,
4697,
6299,
8757,
7361,
9285,
1006,
3024,
7361,
9285,
1007,
1063,
9530,
3367,
11163,
2497,
20614,
7361,
9285,
1027,
2828,
11253,
3024,
7361,
9285,
1027,
1027,
1027,
1000,
4874,
1000,
1025,
9530,
3367,
3024,
8873,
20844,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
radare/radare2 | shlr/www/graph/js-graph-it.js | calculateOffsetTop | function calculateOffsetTop(obj) {
var curtop = 0;
if (obj.offsetParent) {
curtop = obj.offsetTop
while (obj = obj.offsetParent)
curtop += obj.offsetTop
} else if (obj.y)
curtop += obj.y;
return curtop;
} | javascript | function calculateOffsetTop(obj) {
var curtop = 0;
if (obj.offsetParent) {
curtop = obj.offsetTop
while (obj = obj.offsetParent)
curtop += obj.offsetTop
} else if (obj.y)
curtop += obj.y;
return curtop;
} | [
"function",
"calculateOffsetTop",
"(",
"obj",
")",
"{",
"var",
"curtop",
"=",
"0",
";",
"if",
"(",
"obj",
".",
"offsetParent",
")",
"{",
"curtop",
"=",
"obj",
".",
"offsetTop",
"while",
"(",
"obj",
"=",
"obj",
".",
"offsetParent",
")",
"curtop",
"+=",
... | /*
This function calculates the absolute 'top' value for a html node | [
"/",
"*",
"This",
"function",
"calculates",
"the",
"absolute",
"top",
"value",
"for",
"a",
"html",
"node"
] | bf5e3028810a0ec7c267c6fe4bfad639b4819e35 | https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/js-graph-it.js#L1213-L1222 | train | Calculates the top offset of an object | [
30522,
3853,
18422,
27475,
20082,
2361,
1006,
27885,
3501,
1007,
1063,
13075,
20099,
7361,
1027,
1014,
1025,
2065,
1006,
27885,
3501,
1012,
16396,
19362,
4765,
1007,
1063,
20099,
7361,
1027,
27885,
3501,
1012,
16396,
14399,
2096,
1006,
27885,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tabview.js | tabView | function tabView(aController) {
this._controller = aController;
this._tabView = null;
this._tabViewDoc = this._controller.window.document;
} | javascript | function tabView(aController) {
this._controller = aController;
this._tabView = null;
this._tabViewDoc = this._controller.window.document;
} | [
"function",
"tabView",
"(",
"aController",
")",
"{",
"this",
".",
"_controller",
"=",
"aController",
";",
"this",
".",
"_tabView",
"=",
"null",
";",
"this",
".",
"_tabViewDoc",
"=",
"this",
".",
"_controller",
".",
"window",
".",
"document",
";",
"}"
] | Constructor | [
"Constructor"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabview.js#L47-L51 | train | TabView constructor. | [
30522,
3853,
21628,
8584,
1006,
9353,
12162,
26611,
1007,
1063,
2023,
1012,
1035,
11486,
1027,
9353,
12162,
26611,
1025,
2023,
1012,
1035,
21628,
8584,
1027,
19701,
1025,
2023,
1012,
1035,
21628,
8584,
3527,
2278,
1027,
2023,
1012,
1035,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GoogleChrome/workbox | packages/workbox-build/src/lib/runtime-caching-converter.js | getOptionsString | function getOptionsString(options = {}) {
let plugins = [];
if (options.plugins) {
// Using libs because JSON.stringify won't handle functions.
plugins = options.plugins.map(stringifyWithoutComments);
delete options.plugins;
}
// Pull handler-specific config from the options object, since they are
// not directly used to construct a Plugin instance. If set, need to be
// passed as options to the handler constructor instead.
const handlerOptionKeys = [
'cacheName',
'networkTimeoutSeconds',
'fetchOptions',
'matchOptions',
];
const handlerOptions = {};
for (const key of handlerOptionKeys) {
if (key in options) {
handlerOptions[key] = options[key];
delete options[key];
}
}
const pluginsMapping = {
backgroundSync: 'workbox.backgroundSync.Plugin',
broadcastUpdate: 'workbox.broadcastUpdate.Plugin',
expiration: 'workbox.expiration.Plugin',
cacheableResponse: 'workbox.cacheableResponse.Plugin',
};
for (const [pluginName, pluginConfig] of Object.entries(options)) {
// Ensure that we have some valid configuration to pass to Plugin().
if (Object.keys(pluginConfig).length === 0) {
continue;
}
const pluginString = pluginsMapping[pluginName];
if (!pluginString) {
throw new Error(`${errors['bad-runtime-caching-config']} ${pluginName}`);
}
let pluginCode;
switch (pluginName) {
// Special case logic for plugins that have a required parameter, and then
// an additional optional config parameter.
case 'backgroundSync': {
const name = pluginConfig.name;
pluginCode = `new ${pluginString}(${JSON.stringify(name)}`;
if ('options' in pluginConfig) {
pluginCode += `, ${stringifyWithoutComments(pluginConfig.options)}`;
}
pluginCode += `)`;
break;
}
case 'broadcastUpdate': {
const channelName = pluginConfig.channelName;
const opts = Object.assign({channelName}, pluginConfig.options);
pluginCode = `new ${pluginString}(${stringifyWithoutComments(opts)})`;
break;
}
// For plugins that just pass in an Object to the constructor, like
// expiration and cacheableResponse
default: {
pluginCode = `new ${pluginString}(${stringifyWithoutComments(
pluginConfig
)})`;
}
}
plugins.push(pluginCode);
}
if (Object.keys(handlerOptions).length > 0 || plugins.length > 0) {
const optionsString = JSON.stringify(handlerOptions).slice(1, -1);
return ol`{
${optionsString ? optionsString + ',' : ''}
plugins: [${plugins.join(', ')}]
}`;
} else {
return '';
}
} | javascript | function getOptionsString(options = {}) {
let plugins = [];
if (options.plugins) {
// Using libs because JSON.stringify won't handle functions.
plugins = options.plugins.map(stringifyWithoutComments);
delete options.plugins;
}
// Pull handler-specific config from the options object, since they are
// not directly used to construct a Plugin instance. If set, need to be
// passed as options to the handler constructor instead.
const handlerOptionKeys = [
'cacheName',
'networkTimeoutSeconds',
'fetchOptions',
'matchOptions',
];
const handlerOptions = {};
for (const key of handlerOptionKeys) {
if (key in options) {
handlerOptions[key] = options[key];
delete options[key];
}
}
const pluginsMapping = {
backgroundSync: 'workbox.backgroundSync.Plugin',
broadcastUpdate: 'workbox.broadcastUpdate.Plugin',
expiration: 'workbox.expiration.Plugin',
cacheableResponse: 'workbox.cacheableResponse.Plugin',
};
for (const [pluginName, pluginConfig] of Object.entries(options)) {
// Ensure that we have some valid configuration to pass to Plugin().
if (Object.keys(pluginConfig).length === 0) {
continue;
}
const pluginString = pluginsMapping[pluginName];
if (!pluginString) {
throw new Error(`${errors['bad-runtime-caching-config']} ${pluginName}`);
}
let pluginCode;
switch (pluginName) {
// Special case logic for plugins that have a required parameter, and then
// an additional optional config parameter.
case 'backgroundSync': {
const name = pluginConfig.name;
pluginCode = `new ${pluginString}(${JSON.stringify(name)}`;
if ('options' in pluginConfig) {
pluginCode += `, ${stringifyWithoutComments(pluginConfig.options)}`;
}
pluginCode += `)`;
break;
}
case 'broadcastUpdate': {
const channelName = pluginConfig.channelName;
const opts = Object.assign({channelName}, pluginConfig.options);
pluginCode = `new ${pluginString}(${stringifyWithoutComments(opts)})`;
break;
}
// For plugins that just pass in an Object to the constructor, like
// expiration and cacheableResponse
default: {
pluginCode = `new ${pluginString}(${stringifyWithoutComments(
pluginConfig
)})`;
}
}
plugins.push(pluginCode);
}
if (Object.keys(handlerOptions).length > 0 || plugins.length > 0) {
const optionsString = JSON.stringify(handlerOptions).slice(1, -1);
return ol`{
${optionsString ? optionsString + ',' : ''}
plugins: [${plugins.join(', ')}]
}`;
} else {
return '';
}
} | [
"function",
"getOptionsString",
"(",
"options",
"=",
"{",
"}",
")",
"{",
"let",
"plugins",
"=",
"[",
"]",
";",
"if",
"(",
"options",
".",
"plugins",
")",
"{",
"// Using libs because JSON.stringify won't handle functions.",
"plugins",
"=",
"options",
".",
"plugin... | Given a set of options that configures `sw-toolbox`'s behavior, convert it
into a string that would configure equivalent `workbox-sw` behavior.
@param {Object} options See
https://googlechromelabs.github.io/sw-toolbox/api.html#options
@return {string} A JSON string representing the equivalent options.
@private | [
"Given",
"a",
"set",
"of",
"options",
"that",
"configures",
"sw",
"-",
"toolbox",
"s",
"behavior",
"convert",
"it",
"into",
"a",
"string",
"that",
"would",
"configure",
"equivalent",
"workbox",
"-",
"sw",
"behavior",
"."
] | 8379c51b6deaf52faed5879206fe84579cae41f0 | https://github.com/GoogleChrome/workbox/blob/8379c51b6deaf52faed5879206fe84579cae41f0/packages/workbox-build/src/lib/runtime-caching-converter.js#L24-L111 | train | Get the options string for the given options object. | [
30522,
3853,
2131,
7361,
9285,
3367,
4892,
1006,
7047,
1027,
1063,
1065,
1007,
1063,
2292,
13354,
7076,
1027,
1031,
1033,
1025,
2065,
1006,
7047,
1012,
13354,
7076,
1007,
1063,
1013,
1013,
2478,
5622,
5910,
2138,
1046,
3385,
1012,
5164,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/table/mergedTableAlignCol.js | _findFocusCell | function _findFocusCell($newTable, $startContainer) {
const elementRowIndex = dataHandler.findElementRowIndex($startContainer);
const elementColIndex = dataHandler.findElementColIndex($startContainer);
return $newTable.find('tr').eq(elementRowIndex).find('td, th')[elementColIndex];
} | javascript | function _findFocusCell($newTable, $startContainer) {
const elementRowIndex = dataHandler.findElementRowIndex($startContainer);
const elementColIndex = dataHandler.findElementColIndex($startContainer);
return $newTable.find('tr').eq(elementRowIndex).find('td, th')[elementColIndex];
} | [
"function",
"_findFocusCell",
"(",
"$newTable",
",",
"$startContainer",
")",
"{",
"const",
"elementRowIndex",
"=",
"dataHandler",
".",
"findElementRowIndex",
"(",
"$startContainer",
")",
";",
"const",
"elementColIndex",
"=",
"dataHandler",
".",
"findElementColIndex",
... | Find focus cell element like td or th.
@param {jQuery} $newTable - changed table jQuery element
@param {jQuery} $startContainer - start container jQuery element of text range
@returns {HTMLElement}
@private | [
"Find",
"focus",
"cell",
"element",
"like",
"td",
"or",
"th",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableAlignCol.js#L77-L82 | train | Find focus cell | [
30522,
3853,
1035,
2424,
14876,
7874,
29109,
2140,
1006,
1002,
25597,
3085,
1010,
1002,
2707,
8663,
18249,
2121,
1007,
1063,
9530,
3367,
5783,
10524,
22254,
10288,
1027,
2951,
11774,
3917,
1012,
2424,
12260,
3672,
10524,
22254,
10288,
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... |
apache/incubator-echarts | src/data/helper/sourceHelper.js | normalizeDimensionsDefine | function normalizeDimensionsDefine(dimensionsDefine) {
if (!dimensionsDefine) {
// The meaning of null/undefined is different from empty array.
return;
}
var nameMap = createHashMap();
return map(dimensionsDefine, function (item, index) {
item = extend({}, isObject(item) ? item : {name: item});
// User can set null in dimensions.
// We dont auto specify name, othewise a given name may
// cause it be refered unexpectedly.
if (item.name == null) {
return item;
}
// Also consider number form like 2012.
item.name += '';
// User may also specify displayName.
// displayName will always exists except user not
// specified or dim name is not specified or detected.
// (A auto generated dim name will not be used as
// displayName).
if (item.displayName == null) {
item.displayName = item.name;
}
var exist = nameMap.get(item.name);
if (!exist) {
nameMap.set(item.name, {count: 1});
}
else {
item.name += '-' + exist.count++;
}
return item;
});
} | javascript | function normalizeDimensionsDefine(dimensionsDefine) {
if (!dimensionsDefine) {
// The meaning of null/undefined is different from empty array.
return;
}
var nameMap = createHashMap();
return map(dimensionsDefine, function (item, index) {
item = extend({}, isObject(item) ? item : {name: item});
// User can set null in dimensions.
// We dont auto specify name, othewise a given name may
// cause it be refered unexpectedly.
if (item.name == null) {
return item;
}
// Also consider number form like 2012.
item.name += '';
// User may also specify displayName.
// displayName will always exists except user not
// specified or dim name is not specified or detected.
// (A auto generated dim name will not be used as
// displayName).
if (item.displayName == null) {
item.displayName = item.name;
}
var exist = nameMap.get(item.name);
if (!exist) {
nameMap.set(item.name, {count: 1});
}
else {
item.name += '-' + exist.count++;
}
return item;
});
} | [
"function",
"normalizeDimensionsDefine",
"(",
"dimensionsDefine",
")",
"{",
"if",
"(",
"!",
"dimensionsDefine",
")",
"{",
"// The meaning of null/undefined is different from empty array.",
"return",
";",
"}",
"var",
"nameMap",
"=",
"createHashMap",
"(",
")",
";",
"retur... | Consider dimensions defined like ['A', 'price', 'B', 'price', 'C', 'price'], which is reasonable. But dimension name is duplicated. Returns undefined or an array contains only object without null/undefiend or string. | [
"Consider",
"dimensions",
"defined",
"like",
"[",
"A",
"price",
"B",
"price",
"C",
"price",
"]",
"which",
"is",
"reasonable",
".",
"But",
"dimension",
"name",
"is",
"duplicated",
".",
"Returns",
"undefined",
"or",
"an",
"array",
"contains",
"only",
"object",... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/helper/sourceHelper.js#L295-L332 | train | Normalizes dimensionsDefine array. | [
30522,
3853,
3671,
3550,
14428,
3619,
8496,
3207,
23460,
1006,
9646,
3207,
23460,
1007,
1063,
2065,
1006,
999,
9646,
3207,
23460,
1007,
1063,
1013,
1013,
1996,
3574,
1997,
19701,
1013,
6151,
28344,
2003,
2367,
2013,
4064,
9140,
1012,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lovell/sharp | lib/colour.js | _setColourOption | function _setColourOption (key, val) {
if (is.object(val) || is.string(val)) {
const colour = color(val);
this.options[key] = [
colour.red(),
colour.green(),
colour.blue(),
Math.round(colour.alpha() * 255)
];
}
} | javascript | function _setColourOption (key, val) {
if (is.object(val) || is.string(val)) {
const colour = color(val);
this.options[key] = [
colour.red(),
colour.green(),
colour.blue(),
Math.round(colour.alpha() * 255)
];
}
} | [
"function",
"_setColourOption",
"(",
"key",
",",
"val",
")",
"{",
"if",
"(",
"is",
".",
"object",
"(",
"val",
")",
"||",
"is",
".",
"string",
"(",
"val",
")",
")",
"{",
"const",
"colour",
"=",
"color",
"(",
"val",
")",
";",
"this",
".",
"options"... | Update a colour attribute of the this.options Object.
@private
@param {String} key
@param {String|Object} val
@throws {Error} Invalid key | [
"Update",
"a",
"colour",
"attribute",
"of",
"the",
"this",
".",
"options",
"Object",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/colour.js#L89-L99 | train | Set colour option | [
30522,
3853,
1035,
2275,
25778,
8162,
7361,
3508,
1006,
3145,
1010,
11748,
1007,
1063,
2065,
1006,
2003,
1012,
4874,
1006,
11748,
1007,
1064,
1064,
2003,
1012,
5164,
1006,
11748,
1007,
1007,
1063,
9530,
3367,
6120,
1027,
3609,
1006,
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... |
adobe/brackets | src/extensions/default/CodeFolding/main.js | collapseCurrent | function collapseCurrent() {
var editor = EditorManager.getFocusedEditor();
if (!editor) {
return;
}
var cm = editor._codeMirror;
var cursor = editor.getCursorPos(), i;
// Move cursor up until a collapsible line is found
for (i = cursor.line; i >= 0; i--) {
if (cm.foldCode(i)) {
editor.setCursorPos(i);
return;
}
}
} | javascript | function collapseCurrent() {
var editor = EditorManager.getFocusedEditor();
if (!editor) {
return;
}
var cm = editor._codeMirror;
var cursor = editor.getCursorPos(), i;
// Move cursor up until a collapsible line is found
for (i = cursor.line; i >= 0; i--) {
if (cm.foldCode(i)) {
editor.setCursorPos(i);
return;
}
}
} | [
"function",
"collapseCurrent",
"(",
")",
"{",
"var",
"editor",
"=",
"EditorManager",
".",
"getFocusedEditor",
"(",
")",
";",
"if",
"(",
"!",
"editor",
")",
"{",
"return",
";",
"}",
"var",
"cm",
"=",
"editor",
".",
"_codeMirror",
";",
"var",
"cursor",
"... | Collapses the code region nearest the current cursor position.
Nearest is found by searching from the current line and moving up the document until an
opening code-folding region is found. | [
"Collapses",
"the",
"code",
"region",
"nearest",
"the",
"current",
"cursor",
"position",
".",
"Nearest",
"is",
"found",
"by",
"searching",
"from",
"the",
"current",
"line",
"and",
"moving",
"up",
"the",
"document",
"until",
"an",
"opening",
"code",
"-",
"fol... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/main.js#L211-L225 | train | Collapse current line | [
30522,
3853,
7859,
10841,
14343,
3372,
1006,
1007,
1063,
13075,
3559,
1027,
3559,
24805,
4590,
1012,
2131,
14876,
7874,
19082,
15660,
1006,
1007,
1025,
2065,
1006,
999,
3559,
1007,
1063,
2709,
1025,
1065,
13075,
4642,
1027,
3559,
1012,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Servers/BaseServer.js | BaseServer | function BaseServer(config) {
this._baseUrl = config.baseUrl;
this._root = config.root; // ProjectManager.getProjectRoot().fullPath
this._pathResolver = config.pathResolver; // ProjectManager.makeProjectRelativeIfPossible(doc.file.fullPath)
this._liveDocuments = {};
} | javascript | function BaseServer(config) {
this._baseUrl = config.baseUrl;
this._root = config.root; // ProjectManager.getProjectRoot().fullPath
this._pathResolver = config.pathResolver; // ProjectManager.makeProjectRelativeIfPossible(doc.file.fullPath)
this._liveDocuments = {};
} | [
"function",
"BaseServer",
"(",
"config",
")",
"{",
"this",
".",
"_baseUrl",
"=",
"config",
".",
"baseUrl",
";",
"this",
".",
"_root",
"=",
"config",
".",
"root",
";",
"// ProjectManager.getProjectRoot().fullPath",
"this",
".",
"_pathResolver",
"=",
"config",
"... | Base class for live preview servers
Configuration parameters for this server:
- baseUrl - Optional base URL (populated by the current project)
- pathResolver - Function to covert absolute native paths to project relative paths
- root - Native path to the project root (and base URL)
@constructor
@param {!{baseUrl: string, root: string, pathResolver: function(string): string}} config | [
"Base",
"class",
"for",
"live",
"preview",
"servers"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Servers/BaseServer.js#L40-L45 | train | Base server class | [
30522,
3853,
7888,
2121,
6299,
1006,
9530,
8873,
2290,
1007,
1063,
2023,
1012,
1035,
2918,
3126,
2140,
1027,
9530,
8873,
2290,
1012,
2918,
3126,
2140,
1025,
2023,
1012,
1035,
7117,
1027,
9530,
8873,
2290,
1012,
7117,
1025,
1013,
1013,
262... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/prefer-const.js | findUp | function findUp(node, type, shouldStop) {
if (!node || shouldStop(node)) {
return null;
}
if (node.type === type) {
return node;
}
return findUp(node.parent, type, shouldStop);
} | javascript | function findUp(node, type, shouldStop) {
if (!node || shouldStop(node)) {
return null;
}
if (node.type === type) {
return node;
}
return findUp(node.parent, type, shouldStop);
} | [
"function",
"findUp",
"(",
"node",
",",
"type",
",",
"shouldStop",
")",
"{",
"if",
"(",
"!",
"node",
"||",
"shouldStop",
"(",
"node",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"node",
".",
"type",
"===",
"type",
")",
"{",
"return",
"n... | Finds the nearest parent of node with a given type.
@param {ASTNode} node – The node to search from.
@param {string} type – The type field of the parent node.
@param {Function} shouldStop – a predicate that returns true if the traversal should stop, and false otherwise.
@returns {ASTNode} The closest ancestor with the specified type; null if no such ancestor exists. | [
"Finds",
"the",
"nearest",
"parent",
"of",
"node",
"with",
"a",
"given",
"type",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-const.js#L317-L325 | train | Find the nearest ancestor of a node of a given type | [
30522,
3853,
2424,
6279,
1006,
13045,
1010,
2828,
1010,
2323,
16033,
2361,
1007,
1063,
2065,
1006,
999,
13045,
1064,
1064,
2323,
16033,
2361,
1006,
13045,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
2065,
1006,
13045,
1012,
2828,
1027,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | lib/jsdoc/transform-apijson-for-sdk.js | extractComponentAndDocuindexUrl | function extractComponentAndDocuindexUrl(oChainObject) {
oChainObject.modules = [];
if (oChainObject.libraryFileData) {
let $ = cheerio.load(oChainObject.libraryFileData, {
ignoreWhitespace: true,
xmlMode: true,
lowerCaseTags: false
});
// Extract documentation URL
oChainObject.docuPath = $("appData documentation").attr("indexUrl");
// Extract components
$("ownership > component").each((i, oComponent) => {
if (oComponent.children) {
if (oComponent.children.length === 1) {
oChainObject.defaultComponent = $(oComponent).text();
} else {
let sCurrentComponentName = $(oComponent).find("name").text();
let aCurrentModules = [];
$(oComponent).find("module").each((a, oC) => {
aCurrentModules.push($(oC).text().replace(/\//g, "."));
});
oChainObject.modules.push({
componentName: sCurrentComponentName,
modules: aCurrentModules
});
}
}
});
}
return oChainObject;
} | javascript | function extractComponentAndDocuindexUrl(oChainObject) {
oChainObject.modules = [];
if (oChainObject.libraryFileData) {
let $ = cheerio.load(oChainObject.libraryFileData, {
ignoreWhitespace: true,
xmlMode: true,
lowerCaseTags: false
});
// Extract documentation URL
oChainObject.docuPath = $("appData documentation").attr("indexUrl");
// Extract components
$("ownership > component").each((i, oComponent) => {
if (oComponent.children) {
if (oComponent.children.length === 1) {
oChainObject.defaultComponent = $(oComponent).text();
} else {
let sCurrentComponentName = $(oComponent).find("name").text();
let aCurrentModules = [];
$(oComponent).find("module").each((a, oC) => {
aCurrentModules.push($(oC).text().replace(/\//g, "."));
});
oChainObject.modules.push({
componentName: sCurrentComponentName,
modules: aCurrentModules
});
}
}
});
}
return oChainObject;
} | [
"function",
"extractComponentAndDocuindexUrl",
"(",
"oChainObject",
")",
"{",
"oChainObject",
".",
"modules",
"=",
"[",
"]",
";",
"if",
"(",
"oChainObject",
".",
"libraryFileData",
")",
"{",
"let",
"$",
"=",
"cheerio",
".",
"load",
"(",
"oChainObject",
".",
... | Extracts components list and docuindex.json relative path from .library file data
@param {object} oChainObject chain object
@returns {object} chain object | [
"Extracts",
"components",
"list",
"and",
"docuindex",
".",
"json",
"relative",
"path",
"from",
".",
"library",
"file",
"data"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L782-L820 | train | Extract component and documentation URL from library file data | [
30522,
3853,
14817,
9006,
29513,
12380,
4859,
3527,
10841,
22254,
10288,
3126,
2140,
1006,
28166,
8113,
16429,
20614,
1007,
1063,
28166,
8113,
16429,
20614,
1012,
14184,
1027,
1031,
1033,
1025,
2065,
1006,
28166,
8113,
16429,
20614,
1012,
307... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/command/KeyBindingManager.js | normalizeKeyDescriptorString | function normalizeKeyDescriptorString(origDescriptor) {
var hasMacCtrl = false,
hasCtrl = false,
hasAlt = false,
hasShift = false,
key = "",
error = false;
function _compareModifierString(left, right) {
if (!left || !right) {
return false;
}
left = left.trim().toLowerCase();
right = right.trim().toLowerCase();
return (left.length > 0 && left === right);
}
origDescriptor.split("-").forEach(function parseDescriptor(ele, i, arr) {
if (_compareModifierString("ctrl", ele)) {
if (brackets.platform === "mac") {
hasMacCtrl = true;
} else {
hasCtrl = true;
}
} else if (_compareModifierString("cmd", ele)) {
if (brackets.platform === "mac") {
hasCtrl = true;
} else {
error = true;
}
} else if (_compareModifierString("alt", ele)) {
hasAlt = true;
} else if (_compareModifierString("opt", ele)) {
if (brackets.platform === "mac") {
hasAlt = true;
} else {
error = true;
}
} else if (_compareModifierString("shift", ele)) {
hasShift = true;
} else if (key.length > 0) {
console.log("KeyBindingManager normalizeKeyDescriptorString() - Multiple keys defined. Using key: " + key + " from: " + origDescriptor);
error = true;
} else {
key = ele;
}
});
if (error) {
return null;
}
// Check to see if the binding is for "-".
if (key === "" && origDescriptor.search(/^.+--$/) !== -1) {
key = "-";
}
// '+' char is valid if it's the only key. Keyboard shortcut strings should use
// unicode characters (unescaped). Keyboard shortcut display strings may use
// unicode escape sequences (e.g. \u20AC euro sign)
if ((key.indexOf("+")) >= 0 && (key.length > 1)) {
return null;
}
// Ensure that the first letter of the key name is in upper case and the rest are
// in lower case. i.e. 'a' => 'A' and 'up' => 'Up'
if (/^[a-z]/i.test(key)) {
key = _.capitalize(key.toLowerCase());
}
// Also make sure that the second word of PageUp/PageDown has the first letter in upper case.
if (/^Page/.test(key)) {
key = key.replace(/(up|down)$/, function (match, p1) {
return _.capitalize(p1);
});
}
// No restriction on single character key yet, but other key names are restricted to either
// Function keys or those listed in _keyNames array.
if (key.length > 1 && !/F\d+/.test(key) &&
_keyNames.indexOf(key) === -1) {
return null;
}
return _buildKeyDescriptor(hasMacCtrl, hasCtrl, hasAlt, hasShift, key);
} | javascript | function normalizeKeyDescriptorString(origDescriptor) {
var hasMacCtrl = false,
hasCtrl = false,
hasAlt = false,
hasShift = false,
key = "",
error = false;
function _compareModifierString(left, right) {
if (!left || !right) {
return false;
}
left = left.trim().toLowerCase();
right = right.trim().toLowerCase();
return (left.length > 0 && left === right);
}
origDescriptor.split("-").forEach(function parseDescriptor(ele, i, arr) {
if (_compareModifierString("ctrl", ele)) {
if (brackets.platform === "mac") {
hasMacCtrl = true;
} else {
hasCtrl = true;
}
} else if (_compareModifierString("cmd", ele)) {
if (brackets.platform === "mac") {
hasCtrl = true;
} else {
error = true;
}
} else if (_compareModifierString("alt", ele)) {
hasAlt = true;
} else if (_compareModifierString("opt", ele)) {
if (brackets.platform === "mac") {
hasAlt = true;
} else {
error = true;
}
} else if (_compareModifierString("shift", ele)) {
hasShift = true;
} else if (key.length > 0) {
console.log("KeyBindingManager normalizeKeyDescriptorString() - Multiple keys defined. Using key: " + key + " from: " + origDescriptor);
error = true;
} else {
key = ele;
}
});
if (error) {
return null;
}
// Check to see if the binding is for "-".
if (key === "" && origDescriptor.search(/^.+--$/) !== -1) {
key = "-";
}
// '+' char is valid if it's the only key. Keyboard shortcut strings should use
// unicode characters (unescaped). Keyboard shortcut display strings may use
// unicode escape sequences (e.g. \u20AC euro sign)
if ((key.indexOf("+")) >= 0 && (key.length > 1)) {
return null;
}
// Ensure that the first letter of the key name is in upper case and the rest are
// in lower case. i.e. 'a' => 'A' and 'up' => 'Up'
if (/^[a-z]/i.test(key)) {
key = _.capitalize(key.toLowerCase());
}
// Also make sure that the second word of PageUp/PageDown has the first letter in upper case.
if (/^Page/.test(key)) {
key = key.replace(/(up|down)$/, function (match, p1) {
return _.capitalize(p1);
});
}
// No restriction on single character key yet, but other key names are restricted to either
// Function keys or those listed in _keyNames array.
if (key.length > 1 && !/F\d+/.test(key) &&
_keyNames.indexOf(key) === -1) {
return null;
}
return _buildKeyDescriptor(hasMacCtrl, hasCtrl, hasAlt, hasShift, key);
} | [
"function",
"normalizeKeyDescriptorString",
"(",
"origDescriptor",
")",
"{",
"var",
"hasMacCtrl",
"=",
"false",
",",
"hasCtrl",
"=",
"false",
",",
"hasAlt",
"=",
"false",
",",
"hasShift",
"=",
"false",
",",
"key",
"=",
"\"\"",
",",
"error",
"=",
"false",
"... | normalizes the incoming key descriptor so the modifier keys are always specified in the correct order
@param {string} The string for a key descriptor, can be in any order, the result will be Ctrl-Alt-Shift-<Key>
@return {string} The normalized key descriptor or null if the descriptor invalid | [
"normalizes",
"the",
"incoming",
"key",
"descriptor",
"so",
"the",
"modifier",
"keys",
"are",
"always",
"specified",
"in",
"the",
"correct",
"order"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L339-L425 | train | Normalizes a key descriptor string. | [
30522,
3853,
3671,
4697,
14839,
6155,
23235,
5668,
18886,
3070,
1006,
2030,
8004,
6155,
23235,
2953,
1007,
1063,
13075,
2038,
22911,
6593,
12190,
1027,
6270,
1010,
2038,
6593,
12190,
1027,
6270,
1010,
2038,
2389,
2102,
1027,
6270,
1010,
203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/text/index.js | function () {
const editor = this.editor
// 禁用 document 拖拽事件
const $document = $(document)
$document.on('dragleave drop dragenter dragover', function (e) {
e.preventDefault()
})
// 添加编辑区域拖拽事件
const $textElem = editor.$textElem
$textElem.on('drop', function (e) {
e.preventDefault()
const files = e.dataTransfer && e.dataTransfer.files
if (!files || !files.length) {
return
}
// 上传图片
const uploadImg = editor.uploadImg
uploadImg.uploadImg(files)
})
} | javascript | function () {
const editor = this.editor
// 禁用 document 拖拽事件
const $document = $(document)
$document.on('dragleave drop dragenter dragover', function (e) {
e.preventDefault()
})
// 添加编辑区域拖拽事件
const $textElem = editor.$textElem
$textElem.on('drop', function (e) {
e.preventDefault()
const files = e.dataTransfer && e.dataTransfer.files
if (!files || !files.length) {
return
}
// 上传图片
const uploadImg = editor.uploadImg
uploadImg.uploadImg(files)
})
} | [
"function",
"(",
")",
"{",
"const",
"editor",
"=",
"this",
".",
"editor",
"// 禁用 document 拖拽事件",
"const",
"$document",
"=",
"$",
"(",
"document",
")",
"$document",
".",
"on",
"(",
"'dragleave drop dragenter dragover'",
",",
"function",
"(",
"e",
")",
"{",
"e... | 拖拽事件 | [
"拖拽事件"
] | b77696f5e81c8ec13d9d341252d6b9fa8a22db18 | https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/text/index.js#L528-L550 | train | upload img file | [
30522,
3853,
1006,
1007,
1063,
9530,
3367,
3559,
1027,
2023,
1012,
3559,
1013,
1013,
100,
100,
6254,
100,
100,
1751,
100,
9530,
3367,
1002,
6254,
1027,
1002,
1006,
6254,
1007,
1002,
6254,
1012,
2006,
1006,
1005,
8011,
19738,
3726,
4530,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.m/src/sap/m/SearchField.js | openSuggestions | function openSuggestions(oSF) {
if (oSF.getEnableSuggestions()) {
if (!oSF._oSuggest) {
oSF._oSuggest = new Suggest(oSF);
}
oSF._oSuggest.open();
}
} | javascript | function openSuggestions(oSF) {
if (oSF.getEnableSuggestions()) {
if (!oSF._oSuggest) {
oSF._oSuggest = new Suggest(oSF);
}
oSF._oSuggest.open();
}
} | [
"function",
"openSuggestions",
"(",
"oSF",
")",
"{",
"if",
"(",
"oSF",
".",
"getEnableSuggestions",
"(",
")",
")",
"{",
"if",
"(",
"!",
"oSF",
".",
"_oSuggest",
")",
"{",
"oSF",
".",
"_oSuggest",
"=",
"new",
"Suggest",
"(",
"oSF",
")",
";",
"}",
"o... | Close the suggestions list.
@param {sap.m.SearchField} oSF a SearchField instance | [
"Close",
"the",
"suggestions",
"list",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/SearchField.js#L883-L890 | train | Opens the suggestions if the user has not disabled | [
30522,
3853,
7480,
15916,
8449,
9285,
1006,
9808,
2546,
1007,
1063,
2065,
1006,
9808,
2546,
1012,
2131,
8189,
13510,
15916,
8449,
9285,
1006,
1007,
1007,
1063,
2065,
1006,
999,
9808,
2546,
1012,
1035,
9808,
15916,
8449,
2102,
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... |
apache/incubator-echarts | src/chart/treemap/TreemapView.js | prepareAnimationWhenNoOld | function prepareAnimationWhenNoOld(lasts, element, storageName) {
var lastCfg = lasts[thisRawIndex] = {};
var parentNode = thisNode.parentNode;
if (parentNode && (!reRoot || reRoot.direction === 'drillDown')) {
var parentOldX = 0;
var parentOldY = 0;
// New nodes appear from right-bottom corner in 'zoomToNode' animation.
// For convenience, get old bounding rect from background.
var parentOldBg = lastsForAnimation.background[parentNode.getRawIndex()];
if (!reRoot && parentOldBg && parentOldBg.old) {
parentOldX = parentOldBg.old.width;
parentOldY = parentOldBg.old.height;
}
// When no parent old shape found, its parent is new too,
// so we can just use {x:0, y:0}.
lastCfg.old = storageName === 'nodeGroup'
? [0, parentOldY]
: {x: parentOldX, y: parentOldY, width: 0, height: 0};
}
// Fade in, user can be aware that these nodes are new.
lastCfg.fadein = storageName !== 'nodeGroup';
} | javascript | function prepareAnimationWhenNoOld(lasts, element, storageName) {
var lastCfg = lasts[thisRawIndex] = {};
var parentNode = thisNode.parentNode;
if (parentNode && (!reRoot || reRoot.direction === 'drillDown')) {
var parentOldX = 0;
var parentOldY = 0;
// New nodes appear from right-bottom corner in 'zoomToNode' animation.
// For convenience, get old bounding rect from background.
var parentOldBg = lastsForAnimation.background[parentNode.getRawIndex()];
if (!reRoot && parentOldBg && parentOldBg.old) {
parentOldX = parentOldBg.old.width;
parentOldY = parentOldBg.old.height;
}
// When no parent old shape found, its parent is new too,
// so we can just use {x:0, y:0}.
lastCfg.old = storageName === 'nodeGroup'
? [0, parentOldY]
: {x: parentOldX, y: parentOldY, width: 0, height: 0};
}
// Fade in, user can be aware that these nodes are new.
lastCfg.fadein = storageName !== 'nodeGroup';
} | [
"function",
"prepareAnimationWhenNoOld",
"(",
"lasts",
",",
"element",
",",
"storageName",
")",
"{",
"var",
"lastCfg",
"=",
"lasts",
"[",
"thisRawIndex",
"]",
"=",
"{",
"}",
";",
"var",
"parentNode",
"=",
"thisNode",
".",
"parentNode",
";",
"if",
"(",
"par... | If a element is new, we need to find the animation start point carefully, otherwise it will looks strange when 'zoomToNode'. | [
"If",
"a",
"element",
"is",
"new",
"we",
"need",
"to",
"find",
"the",
"animation",
"start",
"point",
"carefully",
"otherwise",
"it",
"will",
"looks",
"strange",
"when",
"zoomToNode",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/TreemapView.js#L899-L924 | train | Prepare animation when no old shape found | [
30522,
3853,
7374,
7088,
28649,
2860,
10222,
3630,
11614,
1006,
16180,
1010,
5783,
1010,
5527,
18442,
1007,
1063,
13075,
2197,
2278,
2546,
2290,
1027,
16180,
1031,
2023,
2527,
11101,
10288,
1033,
1027,
1063,
1065,
1025,
13075,
6687,
3630,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NavigationAndHistory/NavigationProvider.js | _reinstateMarkers | function _reinstateMarkers(editor, frames) {
var index, frame;
for (index in frames) {
frame = frames[index];
if (!frame.cm && frame.filePath === editor.document.file._path) {
frame._reinstateMarkers(editor);
}
}
} | javascript | function _reinstateMarkers(editor, frames) {
var index, frame;
for (index in frames) {
frame = frames[index];
if (!frame.cm && frame.filePath === editor.document.file._path) {
frame._reinstateMarkers(editor);
}
}
} | [
"function",
"_reinstateMarkers",
"(",
"editor",
",",
"frames",
")",
"{",
"var",
"index",
",",
"frame",
";",
"for",
"(",
"index",
"in",
"frames",
")",
"{",
"frame",
"=",
"frames",
"[",
"index",
"]",
";",
"if",
"(",
"!",
"frame",
".",
"cm",
"&&",
"fr... | Required to make offline markers alive again to track document mutation
@private | [
"Required",
"to",
"make",
"offline",
"markers",
"alive",
"again",
"to",
"track",
"document",
"mutation"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/NavigationProvider.js#L508-L516 | train | reinstate markers for a file | [
30522,
3853,
1035,
19222,
12259,
10665,
2545,
1006,
3559,
1010,
11048,
1007,
1063,
13075,
5950,
1010,
4853,
1025,
2005,
1006,
5950,
1999,
11048,
1007,
1063,
4853,
1027,
11048,
1031,
5950,
1033,
1025,
2065,
1006,
999,
4853,
1012,
4642,
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... |
quasarframework/quasar | cli/lib/generate.js | renderTemplateFiles | function renderTemplateFiles (skipInterpolation) {
skipInterpolation = typeof skipInterpolation === 'string'
? [skipInterpolation]
: skipInterpolation
return (files, metalsmith, done) => {
const keys = Object.keys(files)
const metalsmithMetadata = metalsmith.metadata()
async.each(keys, (file, next) => {
// skipping files with skipInterpolation option
if (skipInterpolation && multimatch([file], skipInterpolation, { dot: true }).length) {
return next()
}
const str = files[file].contents.toString()
// do not attempt to render files that do not have mustaches
if (!/{{([^{}]+)}}/g.test(str)) {
return next()
}
render(str, metalsmithMetadata, (err, res) => {
if (err) {
err.message = `[${file}] ${err.message}`
return next(err)
}
files[file].contents = Buffer.from(res)
next()
})
}, done)
}
} | javascript | function renderTemplateFiles (skipInterpolation) {
skipInterpolation = typeof skipInterpolation === 'string'
? [skipInterpolation]
: skipInterpolation
return (files, metalsmith, done) => {
const keys = Object.keys(files)
const metalsmithMetadata = metalsmith.metadata()
async.each(keys, (file, next) => {
// skipping files with skipInterpolation option
if (skipInterpolation && multimatch([file], skipInterpolation, { dot: true }).length) {
return next()
}
const str = files[file].contents.toString()
// do not attempt to render files that do not have mustaches
if (!/{{([^{}]+)}}/g.test(str)) {
return next()
}
render(str, metalsmithMetadata, (err, res) => {
if (err) {
err.message = `[${file}] ${err.message}`
return next(err)
}
files[file].contents = Buffer.from(res)
next()
})
}, done)
}
} | [
"function",
"renderTemplateFiles",
"(",
"skipInterpolation",
")",
"{",
"skipInterpolation",
"=",
"typeof",
"skipInterpolation",
"===",
"'string'",
"?",
"[",
"skipInterpolation",
"]",
":",
"skipInterpolation",
"return",
"(",
"files",
",",
"metalsmith",
",",
"done",
"... | Template in place plugin.
@param {Object} files
@param {Metalsmith} metalsmith
@param {Function} done | [
"Template",
"in",
"place",
"plugin",
"."
] | 5d2fb6c96bff6095236f8ca6fe07a037e32e06b3 | https://github.com/quasarframework/quasar/blob/5d2fb6c96bff6095236f8ca6fe07a037e32e06b3/cli/lib/generate.js#L120-L147 | train | render template files | [
30522,
3853,
17552,
18532,
15725,
8873,
4244,
1006,
13558,
18447,
2121,
18155,
3370,
1007,
1063,
13558,
18447,
2121,
18155,
3370,
1027,
2828,
11253,
13558,
18447,
2121,
18155,
3370,
1027,
1027,
1027,
1005,
5164,
1005,
1029,
1031,
13558,
18447... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js | function(oRoadMap, bLast){
var iScrollWidth = oRoadMap.$("steparea").get(0).scrollWidth;
if (sap.ui.getCore().getConfiguration().getRTL() && Device.browser.webkit) {
return bLast ? 0 : ( -1) * iScrollWidth;
}
return bLast ? iScrollWidth : 0;
} | javascript | function(oRoadMap, bLast){
var iScrollWidth = oRoadMap.$("steparea").get(0).scrollWidth;
if (sap.ui.getCore().getConfiguration().getRTL() && Device.browser.webkit) {
return bLast ? 0 : ( -1) * iScrollWidth;
}
return bLast ? iScrollWidth : 0;
} | [
"function",
"(",
"oRoadMap",
",",
"bLast",
")",
"{",
"var",
"iScrollWidth",
"=",
"oRoadMap",
".",
"$",
"(",
"\"steparea\"",
")",
".",
"get",
"(",
"0",
")",
".",
"scrollWidth",
";",
"if",
"(",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getCon... | Calculates the position of the fisrt/last step (with fix for Safari in RTL mode) to make the position and scroll calculations running (see comment on getRTLFactor for RTL behavior) | [
"Calculates",
"the",
"position",
"of",
"the",
"fisrt",
"/",
"last",
"step",
"(",
"with",
"fix",
"for",
"Safari",
"in",
"RTL",
"mode",
")",
"to",
"make",
"the",
"position",
"and",
"scroll",
"calculations",
"running",
"(",
"see",
"comment",
"on",
"getRTLFact... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js#L862-L868 | train | Returns the width of the steparea in the page | [
30522,
3853,
1006,
20298,
4215,
2863,
2361,
1010,
8479,
1007,
1063,
13075,
2003,
26775,
14511,
9148,
11927,
2232,
1027,
20298,
4215,
2863,
2361,
1012,
1002,
1006,
1000,
3357,
12069,
2050,
1000,
1007,
1012,
2131,
1006,
1014,
1007,
1012,
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/extensibility/ExtensionManager.js | getExtensionURL | function getExtensionURL(id, version) {
return StringUtils.format(brackets.config.extension_url, id, version);
} | javascript | function getExtensionURL(id, version) {
return StringUtils.format(brackets.config.extension_url, id, version);
} | [
"function",
"getExtensionURL",
"(",
"id",
",",
"version",
")",
"{",
"return",
"StringUtils",
".",
"format",
"(",
"brackets",
".",
"config",
".",
"extension_url",
",",
"id",
",",
"version",
")",
";",
"}"
] | Given an extension id and version number, returns the URL for downloading that extension from
the repository. Does not guarantee that the extension exists at that URL.
@param {string} id The extension's name from the metadata.
@param {string} version The version to download.
@return {string} The URL to download the extension from. | [
"Given",
"an",
"extension",
"id",
"and",
"version",
"number",
"returns",
"the",
"URL",
"for",
"downloading",
"that",
"extension",
"from",
"the",
"repository",
".",
"Does",
"not",
"guarantee",
"that",
"the",
"extension",
"exists",
"at",
"that",
"URL",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/ExtensionManager.js#L386-L388 | train | Get the extension URL for the given id and version | [
30522,
3853,
2131,
10288,
29048,
3126,
2140,
1006,
8909,
1010,
2544,
1007,
1063,
2709,
5164,
21823,
4877,
1012,
4289,
1006,
19719,
1012,
9530,
8873,
2290,
1012,
5331,
1035,
24471,
2140,
1010,
8909,
1010,
2544,
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.m/src/sap/m/Support.js | onTouchEnd | function onTouchEnd(oEvent) {
var windowsPhoneTouchCondition = Device.browser.mobile &&
(Device.browser.name === Device.browser.BROWSER.INTERNET_EXPLORER ||// TODO remove after 1.62 version
Device.browser.name === Device.browser.BROWSER.EDGE) &&
windowsPhoneTouches == maxFingersAllowed;
document.removeEventListener('touchend', onTouchEnd);
// Check if two fingers are holded for 3 seconds or more and after that it`s tapped with a third finger
if (timeDiff > minHoldTime
&& (oEvent.touches.length === holdFingersNumber || windowsPhoneTouchCondition) // on Windows Phone oEvent.touches.lenght is 0 instead of 2
&& oEvent.changedTouches.length === releasedFingersNumber
&& oEvent.changedTouches[0].identifier === lastTouchUID) {
timeDiff = 0;
startTime = 0;
show();
}
} | javascript | function onTouchEnd(oEvent) {
var windowsPhoneTouchCondition = Device.browser.mobile &&
(Device.browser.name === Device.browser.BROWSER.INTERNET_EXPLORER ||// TODO remove after 1.62 version
Device.browser.name === Device.browser.BROWSER.EDGE) &&
windowsPhoneTouches == maxFingersAllowed;
document.removeEventListener('touchend', onTouchEnd);
// Check if two fingers are holded for 3 seconds or more and after that it`s tapped with a third finger
if (timeDiff > minHoldTime
&& (oEvent.touches.length === holdFingersNumber || windowsPhoneTouchCondition) // on Windows Phone oEvent.touches.lenght is 0 instead of 2
&& oEvent.changedTouches.length === releasedFingersNumber
&& oEvent.changedTouches[0].identifier === lastTouchUID) {
timeDiff = 0;
startTime = 0;
show();
}
} | [
"function",
"onTouchEnd",
"(",
"oEvent",
")",
"{",
"var",
"windowsPhoneTouchCondition",
"=",
"Device",
".",
"browser",
".",
"mobile",
"&&",
"(",
"Device",
".",
"browser",
".",
"name",
"===",
"Device",
".",
"browser",
".",
"BROWSER",
".",
"INTERNET_EXPLORER",
... | function is triggered when a touch is removed e.g. the user’s finger is removed from the touchscreen. | [
"function",
"is",
"triggered",
"when",
"a",
"touch",
"is",
"removed",
"e",
".",
"g",
".",
"the",
"user’s",
"finger",
"is",
"removed",
"from",
"the",
"touchscreen",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/Support.js#L311-L329 | train | This function is called when a touch event is released | [
30522,
3853,
3031,
19140,
4859,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
3645,
9864,
24826,
2818,
8663,
20562,
1027,
5080,
1012,
16602,
1012,
4684,
1004,
1004,
1006,
5080,
1012,
16602,
1012,
2171,
1027,
1027,
1027,
5080,
1012,
16602,
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... |
openlayers/openlayers | config/jsdoc/api/plugins/inline-options.js | function(e) {
if (e.doclet.kind == 'typedef' && e.doclet.properties) {
properties[e.doclet.longname] = e.doclet.properties;
}
} | javascript | function(e) {
if (e.doclet.kind == 'typedef' && e.doclet.properties) {
properties[e.doclet.longname] = e.doclet.properties;
}
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"e",
".",
"doclet",
".",
"kind",
"==",
"'typedef'",
"&&",
"e",
".",
"doclet",
".",
"properties",
")",
"{",
"properties",
"[",
"e",
".",
"doclet",
".",
"longname",
"]",
"=",
"e",
".",
"doclet",
".",
"prop... | Collects all typedefs, keyed by longname
@param {Object} e Event object. | [
"Collects",
"all",
"typedefs",
"keyed",
"by",
"longname"
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/config/jsdoc/api/plugins/inline-options.js#L14-L18 | train | Add the typedef to the properties array | [
30522,
3853,
1006,
1041,
1007,
1063,
2065,
1006,
1041,
1012,
9986,
7485,
1012,
2785,
1027,
1027,
1005,
21189,
12879,
1005,
1004,
1004,
1041,
1012,
9986,
7485,
1012,
5144,
1007,
1063,
5144,
1031,
1041,
1012,
9986,
7485,
1012,
2146,
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... | |
sass/node-sass | lib/index.js | endStats | function endStats(stats) {
stats.end = Date.now();
stats.duration = stats.end - stats.start;
return stats;
} | javascript | function endStats(stats) {
stats.end = Date.now();
stats.duration = stats.end - stats.start;
return stats;
} | [
"function",
"endStats",
"(",
"stats",
")",
"{",
"stats",
".",
"end",
"=",
"Date",
".",
"now",
"(",
")",
";",
"stats",
".",
"duration",
"=",
"stats",
".",
"end",
"-",
"stats",
".",
"start",
";",
"return",
"stats",
";",
"}"
] | End stats
@param {Object} stats
@param {Object} sourceMap
@api private | [
"End",
"stats"
] | 0c1a49eefa37544d16041c5fe5b2e3d9168004b7 | https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/index.js#L85-L90 | train | End stats | [
30522,
3853,
4515,
29336,
2015,
1006,
26319,
1007,
1063,
26319,
1012,
2203,
1027,
3058,
1012,
2085,
1006,
1007,
1025,
26319,
1012,
9367,
1027,
26319,
1012,
2203,
1011,
26319,
1012,
2707,
1025,
2709,
26319,
1025,
1065,
102,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
electron/electron | script/bump-version.js | updatePackageJSON | async function updatePackageJSON (version) {
['package.json'].forEach(async fileName => {
const filePath = path.resolve(__dirname, '..', fileName)
const file = require(filePath)
file.version = version
await writeFile(filePath, JSON.stringify(file, null, 2))
})
} | javascript | async function updatePackageJSON (version) {
['package.json'].forEach(async fileName => {
const filePath = path.resolve(__dirname, '..', fileName)
const file = require(filePath)
file.version = version
await writeFile(filePath, JSON.stringify(file, null, 2))
})
} | [
"async",
"function",
"updatePackageJSON",
"(",
"version",
")",
"{",
"[",
"'package.json'",
"]",
".",
"forEach",
"(",
"async",
"fileName",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'..'",
",",
"fileName",
")",
"con... | update package metadata files with new version | [
"update",
"package",
"metadata",
"files",
"with",
"new",
"version"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/bump-version.js#L113-L120 | train | Update package. json with new version | [
30522,
2004,
6038,
2278,
3853,
10651,
23947,
4270,
22578,
2239,
1006,
2544,
1007,
1063,
1031,
1005,
7427,
1012,
1046,
3385,
1005,
1033,
1012,
18921,
6776,
1006,
2004,
6038,
2278,
5371,
18442,
1027,
1028,
1063,
9530,
3367,
5371,
15069,
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... |
caolan/async | lib/someLimit.js | someLimit | function someLimit(coll, limit, iteratee, callback) {
return createTester(Boolean, res => res)(eachOfLimit(limit), coll, iteratee, callback)
} | javascript | function someLimit(coll, limit, iteratee, callback) {
return createTester(Boolean, res => res)(eachOfLimit(limit), coll, iteratee, callback)
} | [
"function",
"someLimit",
"(",
"coll",
",",
"limit",
",",
"iteratee",
",",
"callback",
")",
"{",
"return",
"createTester",
"(",
"Boolean",
",",
"res",
"=>",
"res",
")",
"(",
"eachOfLimit",
"(",
"limit",
")",
",",
"coll",
",",
"iteratee",
",",
"callback",
... | The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.
@name someLimit
@static
@memberOf module:Collections
@method
@see [async.some]{@link module:Collections.some}
@alias anyLimit
@category Collection
@param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
@param {number} limit - The maximum number of async operations at a time.
@param {AsyncFunction} iteratee - An async truth test to apply to each item
in the collections in parallel.
The iteratee should complete with a boolean `result` value.
Invoked with (item, callback).
@param {Function} [callback] - A callback which is called as soon as any
iteratee returns `true`, or 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",
"[",
"some",
"]",
"{",
"@link",
"module",
":",
"Collections",
".",
"some",
"}",
"but",
"runs",
"a",
"maximum",
"of",
"limit",
"async",
"operations",
"at",
"a",
"time",
"."
] | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/someLimit.js#L27-L29 | train | Returns true if the collection contains at least limit elements. | [
30522,
3853,
2070,
17960,
4183,
1006,
8902,
2140,
1010,
5787,
1010,
2009,
22139,
2063,
1010,
2655,
5963,
1007,
1063,
2709,
3443,
22199,
2121,
1006,
22017,
20898,
1010,
24501,
1027,
1028,
24501,
1007,
1006,
2169,
11253,
17960,
4183,
1006,
57... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
babel/babel | packages/babel-standalone/src/transformScriptTags.js | getPluginsOrPresetsFromScript | function getPluginsOrPresetsFromScript(script, attributeName) {
const rawValue = script.getAttribute(attributeName);
if (rawValue === "") {
// Empty string means to not load ANY presets or plugins
return [];
}
if (!rawValue) {
// Any other falsy value (null, undefined) means we're not overriding this
// setting, and should use the default.
return null;
}
return rawValue.split(",").map(item => item.trim());
} | javascript | function getPluginsOrPresetsFromScript(script, attributeName) {
const rawValue = script.getAttribute(attributeName);
if (rawValue === "") {
// Empty string means to not load ANY presets or plugins
return [];
}
if (!rawValue) {
// Any other falsy value (null, undefined) means we're not overriding this
// setting, and should use the default.
return null;
}
return rawValue.split(",").map(item => item.trim());
} | [
"function",
"getPluginsOrPresetsFromScript",
"(",
"script",
",",
"attributeName",
")",
"{",
"const",
"rawValue",
"=",
"script",
".",
"getAttribute",
"(",
"attributeName",
")",
";",
"if",
"(",
"rawValue",
"===",
"\"\"",
")",
"{",
"// Empty string means to not load AN... | Converts a comma-separated data attribute string into an array of values. If
the string is empty, returns an empty array. If the string is not defined,
returns null. | [
"Converts",
"a",
"comma",
"-",
"separated",
"data",
"attribute",
"string",
"into",
"an",
"array",
"of",
"values",
".",
"If",
"the",
"string",
"is",
"empty",
"returns",
"an",
"empty",
"array",
".",
"If",
"the",
"string",
"is",
"not",
"defined",
"returns",
... | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-standalone/src/transformScriptTags.js#L91-L103 | train | Get the plugins or presets from a script attribute | [
30522,
3853,
2131,
24759,
15916,
7076,
2953,
28994,
8454,
19699,
22225,
23235,
1006,
5896,
1010,
17961,
18442,
1007,
1063,
9530,
3367,
6315,
10175,
5657,
1027,
5896,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
17961,
18442,
1007,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/firefox.js | configureExecutor | function configureExecutor(executor) {
executor.defineCommand(
ExtensionCommand.GET_CONTEXT,
'GET',
'/session/:sessionId/moz/context');
executor.defineCommand(
ExtensionCommand.SET_CONTEXT,
'POST',
'/session/:sessionId/moz/context');
executor.defineCommand(
ExtensionCommand.INSTALL_ADDON,
'POST',
'/session/:sessionId/moz/addon/install');
executor.defineCommand(
ExtensionCommand.UNINSTALL_ADDON,
'POST',
'/session/:sessionId/moz/addon/uninstall');
} | javascript | function configureExecutor(executor) {
executor.defineCommand(
ExtensionCommand.GET_CONTEXT,
'GET',
'/session/:sessionId/moz/context');
executor.defineCommand(
ExtensionCommand.SET_CONTEXT,
'POST',
'/session/:sessionId/moz/context');
executor.defineCommand(
ExtensionCommand.INSTALL_ADDON,
'POST',
'/session/:sessionId/moz/addon/install');
executor.defineCommand(
ExtensionCommand.UNINSTALL_ADDON,
'POST',
'/session/:sessionId/moz/addon/uninstall');
} | [
"function",
"configureExecutor",
"(",
"executor",
")",
"{",
"executor",
".",
"defineCommand",
"(",
"ExtensionCommand",
".",
"GET_CONTEXT",
",",
"'GET'",
",",
"'/session/:sessionId/moz/context'",
")",
";",
"executor",
".",
"defineCommand",
"(",
"ExtensionCommand",
".",... | Configures the given executor with Firefox-specific commands.
@param {!http.Executor} executor the executor to configure. | [
"Configures",
"the",
"given",
"executor",
"with",
"Firefox",
"-",
"specific",
"commands",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/firefox.js#L482-L502 | train | Configure the given executor. | [
30522,
3853,
9530,
8873,
27390,
4402,
2595,
8586,
16161,
2099,
1006,
4654,
8586,
16161,
2099,
1007,
1063,
4654,
8586,
16161,
2099,
1012,
9375,
9006,
2386,
2094,
1006,
5331,
9006,
2386,
2094,
1012,
2131,
1035,
6123,
1010,
1005,
2131,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/data/helper/sourceHelper.js | getDatasetModel | function getDatasetModel(seriesModel) {
var option = seriesModel.option;
// Caution: consider the scenario:
// A dataset is declared and a series is not expected to use the dataset,
// and at the beginning `setOption({series: { noData })` (just prepare other
// option but no data), then `setOption({series: {data: [...]}); In this case,
// the user should set an empty array to avoid that dataset is used by default.
var thisData = option.data;
if (!thisData) {
return seriesModel.ecModel.getComponent('dataset', option.datasetIndex || 0);
}
} | javascript | function getDatasetModel(seriesModel) {
var option = seriesModel.option;
// Caution: consider the scenario:
// A dataset is declared and a series is not expected to use the dataset,
// and at the beginning `setOption({series: { noData })` (just prepare other
// option but no data), then `setOption({series: {data: [...]}); In this case,
// the user should set an empty array to avoid that dataset is used by default.
var thisData = option.data;
if (!thisData) {
return seriesModel.ecModel.getComponent('dataset', option.datasetIndex || 0);
}
} | [
"function",
"getDatasetModel",
"(",
"seriesModel",
")",
"{",
"var",
"option",
"=",
"seriesModel",
".",
"option",
";",
"// Caution: consider the scenario:",
"// A dataset is declared and a series is not expected to use the dataset,",
"// and at the beginning `setOption({series: { noData... | If return null/undefined, indicate that should not use datasetModel. | [
"If",
"return",
"null",
"/",
"undefined",
"indicate",
"that",
"should",
"not",
"use",
"datasetModel",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/helper/sourceHelper.js#L466-L477 | train | Get the dataset model | [
30522,
3853,
2131,
2850,
18260,
21246,
10244,
2140,
1006,
2186,
5302,
9247,
1007,
1063,
13075,
5724,
1027,
2186,
5302,
9247,
1012,
5724,
1025,
1013,
1013,
14046,
1024,
5136,
1996,
11967,
1024,
1013,
1013,
1037,
2951,
13462,
2003,
4161,
1998... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/WorkspaceManager.js | Panel | function Panel($panel, minSize) {
this.$panel = $panel;
Resizer.makeResizable($panel[0], Resizer.DIRECTION_VERTICAL, Resizer.POSITION_TOP, minSize, false, undefined, true);
listenToResize($panel);
} | javascript | function Panel($panel, minSize) {
this.$panel = $panel;
Resizer.makeResizable($panel[0], Resizer.DIRECTION_VERTICAL, Resizer.POSITION_TOP, minSize, false, undefined, true);
listenToResize($panel);
} | [
"function",
"Panel",
"(",
"$panel",
",",
"minSize",
")",
"{",
"this",
".",
"$panel",
"=",
"$panel",
";",
"Resizer",
".",
"makeResizable",
"(",
"$panel",
"[",
"0",
"]",
",",
"Resizer",
".",
"DIRECTION_VERTICAL",
",",
"Resizer",
".",
"POSITION_TOP",
",",
"... | Represents a panel below the editor area (a child of ".content").
@constructor
@param {!jQueryObject} $panel The entire panel, including any chrome, already in the DOM.
@param {number=} minSize Minimum height of panel in px. | [
"Represents",
"a",
"panel",
"below",
"the",
"editor",
"area",
"(",
"a",
"child",
"of",
".",
"content",
")",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/WorkspaceManager.js#L167-L172 | train | Constructor for Panel | [
30522,
3853,
5997,
1006,
1002,
5997,
1010,
8117,
5332,
4371,
1007,
1063,
2023,
1012,
1002,
5997,
1027,
1002,
5997,
1025,
24501,
17629,
1012,
9338,
2229,
21335,
3468,
1006,
1002,
5997,
1031,
1014,
1033,
1010,
24501,
17629,
1012,
3257,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | sortFn | function sortFn(a, b) {
var apct = getWeightedPercent(a);
var bpct = getWeightedPercent(b);
var diff = apct - bpct;
if (diff === 0) {
return ascending(a.id(), b.id()); // make sure sort doesn't have don't-care comparisons
} else {
return diff;
}
} | javascript | function sortFn(a, b) {
var apct = getWeightedPercent(a);
var bpct = getWeightedPercent(b);
var diff = apct - bpct;
if (diff === 0) {
return ascending(a.id(), b.id()); // make sure sort doesn't have don't-care comparisons
} else {
return diff;
}
} | [
"function",
"sortFn",
"(",
"a",
",",
"b",
")",
"{",
"var",
"apct",
"=",
"getWeightedPercent",
"(",
"a",
")",
";",
"var",
"bpct",
"=",
"getWeightedPercent",
"(",
"b",
")",
";",
"var",
"diff",
"=",
"apct",
"-",
"bpct",
";",
"if",
"(",
"diff",
"===",
... | rearrange the indices in each depth level based on connectivity | [
"rearrange",
"the",
"indices",
"in",
"each",
"depth",
"level",
"based",
"on",
"connectivity"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L18322-L18332 | train | sort function for the best guess | [
30522,
3853,
4066,
2546,
2078,
1006,
1037,
1010,
1038,
1007,
1063,
13075,
9706,
6593,
1027,
2131,
11179,
2098,
4842,
13013,
1006,
1037,
1007,
1025,
13075,
17531,
6593,
1027,
2131,
11179,
2098,
4842,
13013,
1006,
1038,
1007,
1025,
13075,
448... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | fetchExpandedTypes | function fetchExpandedTypes(sBaseMetaPath, mQueryOptions) {
if (mQueryOptions && mQueryOptions.$expand) {
Object.keys(mQueryOptions.$expand).forEach(function (sNavigationPath) {
var sMetaPath = sBaseMetaPath;
sNavigationPath.split("/").forEach(function (sSegment) {
sMetaPath += "/" + sSegment;
fetchType(sMetaPath);
});
fetchExpandedTypes(sMetaPath, mQueryOptions.$expand[sNavigationPath]);
});
}
} | javascript | function fetchExpandedTypes(sBaseMetaPath, mQueryOptions) {
if (mQueryOptions && mQueryOptions.$expand) {
Object.keys(mQueryOptions.$expand).forEach(function (sNavigationPath) {
var sMetaPath = sBaseMetaPath;
sNavigationPath.split("/").forEach(function (sSegment) {
sMetaPath += "/" + sSegment;
fetchType(sMetaPath);
});
fetchExpandedTypes(sMetaPath, mQueryOptions.$expand[sNavigationPath]);
});
}
} | [
"function",
"fetchExpandedTypes",
"(",
"sBaseMetaPath",
",",
"mQueryOptions",
")",
"{",
"if",
"(",
"mQueryOptions",
"&&",
"mQueryOptions",
".",
"$expand",
")",
"{",
"Object",
".",
"keys",
"(",
"mQueryOptions",
".",
"$expand",
")",
".",
"forEach",
"(",
"functio... | /*
Recursively calls fetchType for all (sub)paths in $expand.
@param {string} sBaseMetaPath The resource meta path + entity path
@param {object} [mQueryOptions] The corresponding query options | [
"/",
"*",
"Recursively",
"calls",
"fetchType",
"for",
"all",
"(",
"sub",
")",
"paths",
"in",
"$expand",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L529-L541 | train | Fetch all the expanded types | [
30522,
3853,
18584,
10288,
9739,
5732,
13874,
2015,
1006,
24829,
11022,
11368,
22068,
2705,
1010,
1049,
4226,
2854,
7361,
9285,
1007,
1063,
2065,
1006,
1049,
4226,
2854,
7361,
9285,
1004,
1004,
1049,
4226,
2854,
7361,
9285,
1012,
1002,
7818... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.