repo stringclasses 195 values | path stringlengths 4 99 | func_name stringlengths 0 41 | original_string stringlengths 72 56.1k | language stringclasses 1 value | code stringlengths 72 56.1k | code_tokens listlengths 25 8.12k | docstring stringlengths 2 12.5k | docstring_tokens listlengths 1 449 | sha stringclasses 197 values | url stringlengths 88 186 | partition stringclasses 1 value | summary stringlengths 8 338 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
adobe/brackets | src/search/QuickOpen.js | QuickOpenPlugin | function QuickOpenPlugin(name, languageIds, done, search, match, itemFocus, itemSelect, resultsFormatter, matcherOptions, label) {
this.name = name;
this.languageIds = languageIds;
this.done = done;
this.search = search;
this.match = match;
this.itemFocus = itemFocus;
this.itemSelect = itemSelect;
this.resultsFormatter = resultsFormatter;
this.matcherOptions = matcherOptions;
this.label = label;
} | javascript | function QuickOpenPlugin(name, languageIds, done, search, match, itemFocus, itemSelect, resultsFormatter, matcherOptions, label) {
this.name = name;
this.languageIds = languageIds;
this.done = done;
this.search = search;
this.match = match;
this.itemFocus = itemFocus;
this.itemSelect = itemSelect;
this.resultsFormatter = resultsFormatter;
this.matcherOptions = matcherOptions;
this.label = label;
} | [
"function",
"QuickOpenPlugin",
"(",
"name",
",",
"languageIds",
",",
"done",
",",
"search",
",",
"match",
",",
"itemFocus",
",",
"itemSelect",
",",
"resultsFormatter",
",",
"matcherOptions",
",",
"label",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"t... | Defines API for new QuickOpen plug-ins | [
"Defines",
"API",
"for",
"new",
"QuickOpen",
"plug",
"-",
"ins"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/QuickOpen.js#L125-L136 | train | QuickOpenPlugin constructor. | [
30522,
3853,
4248,
26915,
24759,
15916,
2378,
1006,
2171,
1010,
2653,
9821,
1010,
2589,
1010,
30524,
10624,
16790,
2015,
1010,
3830,
1007,
1063,
2023,
1012,
2171,
1027,
2171,
1025,
2023,
1012,
2653,
9821,
1027,
2653,
9821,
1025,
2023,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GoogleChrome/workbox | packages/workbox-webpack-plugin/src/lib/get-manifest-entries-from-compilation.js | getManifestEntriesFromCompilation | function getManifestEntriesFromCompilation(compilation, config) {
const blacklistedChunkNames = config.excludeChunks;
const whitelistedChunkNames = config.chunks;
const {assets, chunks} = compilation;
const {publicPath} = compilation.options.output;
const assetMetadata = generateMetadataForAssets(assets, chunks);
const filteredAssetMetadata = filterAssets(assetMetadata,
whitelistedChunkNames, blacklistedChunkNames);
const knownHashes = [
compilation.hash,
compilation.fullHash,
...getKnownHashesFromAssets(filteredAssetMetadata),
].filter((hash) => !!hash);
const manifestEntries = [];
for (const [file, metadata] of Object.entries(filteredAssetMetadata)) {
// Filter based on test/include/exclude options set in the config,
// following webpack's conventions.
// This matches the behavior of, e.g., UglifyJS's webpack plugin.
if (!ModuleFilenameHelpers.matchObject(config, file)) {
continue;
}
const publicURL = resolveWebpackURL(publicPath, file);
const manifestEntry = getEntry(knownHashes, publicURL, metadata.hash);
manifestEntries.push(manifestEntry);
}
return manifestEntries;
} | javascript | function getManifestEntriesFromCompilation(compilation, config) {
const blacklistedChunkNames = config.excludeChunks;
const whitelistedChunkNames = config.chunks;
const {assets, chunks} = compilation;
const {publicPath} = compilation.options.output;
const assetMetadata = generateMetadataForAssets(assets, chunks);
const filteredAssetMetadata = filterAssets(assetMetadata,
whitelistedChunkNames, blacklistedChunkNames);
const knownHashes = [
compilation.hash,
compilation.fullHash,
...getKnownHashesFromAssets(filteredAssetMetadata),
].filter((hash) => !!hash);
const manifestEntries = [];
for (const [file, metadata] of Object.entries(filteredAssetMetadata)) {
// Filter based on test/include/exclude options set in the config,
// following webpack's conventions.
// This matches the behavior of, e.g., UglifyJS's webpack plugin.
if (!ModuleFilenameHelpers.matchObject(config, file)) {
continue;
}
const publicURL = resolveWebpackURL(publicPath, file);
const manifestEntry = getEntry(knownHashes, publicURL, metadata.hash);
manifestEntries.push(manifestEntry);
}
return manifestEntries;
} | [
"function",
"getManifestEntriesFromCompilation",
"(",
"compilation",
",",
"config",
")",
"{",
"const",
"blacklistedChunkNames",
"=",
"config",
".",
"excludeChunks",
";",
"const",
"whitelistedChunkNames",
"=",
"config",
".",
"chunks",
";",
"const",
"{",
"assets",
","... | Generate an array of manifest entries using webpack's compilation data.
@param {Object} compilation webpack compilation
@param {Object} config
@return {Array<workbox.build.ManifestEntry>}
@private | [
"Generate",
"an",
"array",
"of",
"manifest",
"entries",
"using",
"webpack",
"s",
"compilation",
"data",
"."
] | 8379c51b6deaf52faed5879206fe84579cae41f0 | https://github.com/GoogleChrome/workbox/blob/8379c51b6deaf52faed5879206fe84579cae41f0/packages/workbox-webpack-plugin/src/lib/get-manifest-entries-from-compilation.js#L156-L186 | train | Get manifest entries from compilation | [
30522,
3853,
2131,
20799,
14081,
4765,
5134,
19699,
5358,
9006,
8197,
13490,
1006,
6268,
1010,
9530,
8873,
2290,
1007,
1063,
9530,
3367,
2304,
9863,
2098,
20760,
8950,
18442,
2015,
1027,
9530,
8873,
2290,
1012,
23329,
20760,
8950,
2015,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | dist/howler.js | function(id) {
var self = this;
// Loop through all sounds and find the one with this ID.
for (var i=0; i<self._sounds.length; i++) {
if (id === self._sounds[i]._id) {
return self._sounds[i];
}
}
return null;
} | javascript | function(id) {
var self = this;
// Loop through all sounds and find the one with this ID.
for (var i=0; i<self._sounds.length; i++) {
if (id === self._sounds[i]._id) {
return self._sounds[i];
}
}
return null;
} | [
"function",
"(",
"id",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Loop through all sounds and find the one with this ID.",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"self",
".",
"_sounds",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
... | Return the sound identified by this ID, or return null.
@param {Number} id Sound ID
@return {Object} Sound object or null. | [
"Return",
"the",
"sound",
"identified",
"by",
"this",
"ID",
"or",
"return",
"null",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L1992-L2003 | train | Returns the object with the given ID | [
30522,
3853,
1006,
8909,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
7077,
2083,
2035,
4165,
1998,
2424,
1996,
2028,
2007,
2023,
8909,
1012,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
2969,
1012,
1035,
4165,
1012,
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... | |
eslint/eslint | lib/rules/no-unexpected-multiline.js | checkForBreakAfter | function checkForBreakAfter(node, messageId) {
const openParen = sourceCode.getTokenAfter(node, astUtils.isNotClosingParenToken);
const nodeExpressionEnd = sourceCode.getTokenBefore(openParen);
if (openParen.loc.start.line !== nodeExpressionEnd.loc.end.line) {
context.report({ node, loc: openParen.loc.start, messageId, data: { char: openParen.value } });
}
} | javascript | function checkForBreakAfter(node, messageId) {
const openParen = sourceCode.getTokenAfter(node, astUtils.isNotClosingParenToken);
const nodeExpressionEnd = sourceCode.getTokenBefore(openParen);
if (openParen.loc.start.line !== nodeExpressionEnd.loc.end.line) {
context.report({ node, loc: openParen.loc.start, messageId, data: { char: openParen.value } });
}
} | [
"function",
"checkForBreakAfter",
"(",
"node",
",",
"messageId",
")",
"{",
"const",
"openParen",
"=",
"sourceCode",
".",
"getTokenAfter",
"(",
"node",
",",
"astUtils",
".",
"isNotClosingParenToken",
")",
";",
"const",
"nodeExpressionEnd",
"=",
"sourceCode",
".",
... | Check to see if there is a newline between the node and the following open bracket
line's expression
@param {ASTNode} node The node to check.
@param {string} messageId The error messageId to use.
@returns {void}
@private | [
"Check",
"to",
"see",
"if",
"there",
"is",
"a",
"newline",
"between",
"the",
"node",
"and",
"the",
"following",
"open",
"bracket",
"line",
"s",
"expression"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-unexpected-multiline.js#L51-L58 | train | Check if a break is after a break | [
30522,
3853,
4638,
29278,
23890,
10354,
3334,
1006,
13045,
1010,
4471,
3593,
1007,
1063,
9530,
3367,
2330,
19362,
2368,
1027,
3120,
16044,
1012,
2131,
18715,
8189,
6199,
2121,
1006,
13045,
1010,
2004,
8525,
3775,
4877,
1012,
3475,
4140,
204... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js | _setDateInDatesRow | function _setDateInDatesRow(oDate) {
var oDatesRow = this.getAggregation("datesRow");
var oHeader = this.getAggregation("header");
if (!this.getPickerPopup()) {
// set number of days - but max number of days of this month
var oLastDayOfMonth = new UniversalDate(oDate.getTime());
oLastDayOfMonth.setUTCDate(1);
oLastDayOfMonth.setUTCMonth(oLastDayOfMonth.getUTCMonth() + 1);
oLastDayOfMonth.setUTCDate(0);
var iDays = oDatesRow.getDays();
// set start day and selected day
var oStartDate = new UniversalDate(oDate.getTime());
oStartDate.setUTCDate( 1 + (Math.ceil(oDate.getUTCDate() / iDays) - 1) * iDays );
if (oLastDayOfMonth.getUTCDate() - oStartDate.getUTCDate() < iDays) {
oStartDate.setUTCDate(oLastDayOfMonth.getUTCDate() - iDays + 1);
}
oDatesRow.setStartDate(CalendarUtils._createLocalDate(oStartDate, true));
var iYear = oStartDate.getJSDate().getUTCFullYear();
var iYearMax = this._oMaxDate.getJSDate().getUTCFullYear();
var iYearMin = this._oMinDate.getJSDate().getUTCFullYear();
var iMonth = oStartDate.getJSDate().getUTCMonth();
var iMonthMax = this._oMaxDate.getJSDate().getUTCMonth();
var iMonthMin = this._oMinDate.getJSDate().getUTCMonth();
var iDate = oStartDate.getJSDate().getUTCDate();
var iDateMax = this._oMaxDate.getJSDate().getUTCDate();
var iDateMin = this._oMinDate.getJSDate().getUTCDate();
if (iDate <= 1 || (iYear == iYearMin && iMonth == iMonthMin && iDate <= iDateMin)) {
oHeader.setEnabledPrevious(false);
} else {
oHeader.setEnabledPrevious(true);
}
if ((iDate + iDays) >= oLastDayOfMonth.getUTCDate() || (iYear == iYearMax && iMonth == iMonthMax && iDate >= iDateMax)) {
oHeader.setEnabledNext(false);
} else {
oHeader.setEnabledNext(true);
}
} else {
oHeader.setEnabledPrevious(false);
oHeader.setEnabledNext(false);
}
oDatesRow.setDate(CalendarUtils._createLocalDate(oDate, true));
} | javascript | function _setDateInDatesRow(oDate) {
var oDatesRow = this.getAggregation("datesRow");
var oHeader = this.getAggregation("header");
if (!this.getPickerPopup()) {
// set number of days - but max number of days of this month
var oLastDayOfMonth = new UniversalDate(oDate.getTime());
oLastDayOfMonth.setUTCDate(1);
oLastDayOfMonth.setUTCMonth(oLastDayOfMonth.getUTCMonth() + 1);
oLastDayOfMonth.setUTCDate(0);
var iDays = oDatesRow.getDays();
// set start day and selected day
var oStartDate = new UniversalDate(oDate.getTime());
oStartDate.setUTCDate( 1 + (Math.ceil(oDate.getUTCDate() / iDays) - 1) * iDays );
if (oLastDayOfMonth.getUTCDate() - oStartDate.getUTCDate() < iDays) {
oStartDate.setUTCDate(oLastDayOfMonth.getUTCDate() - iDays + 1);
}
oDatesRow.setStartDate(CalendarUtils._createLocalDate(oStartDate, true));
var iYear = oStartDate.getJSDate().getUTCFullYear();
var iYearMax = this._oMaxDate.getJSDate().getUTCFullYear();
var iYearMin = this._oMinDate.getJSDate().getUTCFullYear();
var iMonth = oStartDate.getJSDate().getUTCMonth();
var iMonthMax = this._oMaxDate.getJSDate().getUTCMonth();
var iMonthMin = this._oMinDate.getJSDate().getUTCMonth();
var iDate = oStartDate.getJSDate().getUTCDate();
var iDateMax = this._oMaxDate.getJSDate().getUTCDate();
var iDateMin = this._oMinDate.getJSDate().getUTCDate();
if (iDate <= 1 || (iYear == iYearMin && iMonth == iMonthMin && iDate <= iDateMin)) {
oHeader.setEnabledPrevious(false);
} else {
oHeader.setEnabledPrevious(true);
}
if ((iDate + iDays) >= oLastDayOfMonth.getUTCDate() || (iYear == iYearMax && iMonth == iMonthMax && iDate >= iDateMax)) {
oHeader.setEnabledNext(false);
} else {
oHeader.setEnabledNext(true);
}
} else {
oHeader.setEnabledPrevious(false);
oHeader.setEnabledNext(false);
}
oDatesRow.setDate(CalendarUtils._createLocalDate(oDate, true));
} | [
"function",
"_setDateInDatesRow",
"(",
"oDate",
")",
"{",
"var",
"oDatesRow",
"=",
"this",
".",
"getAggregation",
"(",
"\"datesRow\"",
")",
";",
"var",
"oHeader",
"=",
"this",
".",
"getAggregation",
"(",
"\"header\"",
")",
";",
"if",
"(",
"!",
"this",
".",... | Sets date in the embedded day Picker.
This function assumes there is a "datesRow" aggregation.
So callers must take care.
@param oDate
@return {void}
@private | [
"Sets",
"date",
"in",
"the",
"embedded",
"day",
"Picker",
".",
"This",
"function",
"assumes",
"there",
"is",
"a",
"datesRow",
"aggregation",
".",
"So",
"callers",
"must",
"take",
"care",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L2012-L2061 | train | Sets the date in the dates row | [
30522,
3853,
1035,
2275,
13701,
23938,
4570,
10524,
1006,
1051,
13701,
1007,
1063,
13075,
1051,
27122,
10524,
1027,
2023,
1012,
2131,
8490,
17603,
12540,
1006,
1000,
5246,
10524,
1000,
1007,
1025,
13075,
2821,
13775,
2121,
1027,
2023,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onFetchSignInMethodsForEmail | function onFetchSignInMethodsForEmail() {
var email = $('#fetch-sign-in-methods-email').val();
auth.fetchSignInMethodsForEmail(email).then(function(signInMethods) {
log('Sign in methods for ' + email + ' :');
log(signInMethods);
if (signInMethods.length == 0) {
alertSuccess('Sign In Methods for ' + email + ': N/A');
} else {
alertSuccess(
'Sign In Methods for ' + email +': ' + signInMethods.join(', '));
}
}, onAuthError);
} | javascript | function onFetchSignInMethodsForEmail() {
var email = $('#fetch-sign-in-methods-email').val();
auth.fetchSignInMethodsForEmail(email).then(function(signInMethods) {
log('Sign in methods for ' + email + ' :');
log(signInMethods);
if (signInMethods.length == 0) {
alertSuccess('Sign In Methods for ' + email + ': N/A');
} else {
alertSuccess(
'Sign In Methods for ' + email +': ' + signInMethods.join(', '));
}
}, onAuthError);
} | [
"function",
"onFetchSignInMethodsForEmail",
"(",
")",
"{",
"var",
"email",
"=",
"$",
"(",
"'#fetch-sign-in-methods-email'",
")",
".",
"val",
"(",
")",
";",
"auth",
".",
"fetchSignInMethodsForEmail",
"(",
"email",
")",
".",
"then",
"(",
"function",
"(",
"signIn... | Gets the list of possible sign in methods for the given email address. | [
"Gets",
"the",
"list",
"of",
"possible",
"sign",
"in",
"methods",
"for",
"the",
"given",
"email",
"address",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L721-L733 | train | Fetch the sign in methods for an email | [
30522,
3853,
2006,
7959,
10649,
5332,
29076,
2078,
11368,
6806,
5104,
29278,
14545,
4014,
1006,
1007,
1063,
13075,
10373,
1027,
1002,
1006,
1005,
1001,
18584,
1011,
3696,
1011,
30524,
3696,
2378,
11368,
6806,
5104,
1007,
1063,
8833,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/world-map.js | function(scale, centerX, centerY){
var bbox,
itemBbox,
newBbox,
codes,
i;
if (jvm.$.isArray(scale) || this.regions[scale]) {
if (jvm.$.isArray(scale)) {
codes = scale;
} else {
codes = [scale]
}
for (i = 0; i < codes.length; i++) {
if (this.regions[codes[i]]) {
itemBbox = this.regions[codes[i]].element.getBBox();
if (itemBbox) {
if (typeof bbox == 'undefined') {
bbox = itemBbox;
} else {
newBbox = {
x: Math.min(bbox.x, itemBbox.x),
y: Math.min(bbox.y, itemBbox.y),
width: Math.max(bbox.x + bbox.width, itemBbox.x + itemBbox.width) - Math.min(bbox.x, itemBbox.x),
height: Math.max(bbox.y + bbox.height, itemBbox.y + itemBbox.height) - Math.min(bbox.y, itemBbox.y)
}
bbox = newBbox;
}
}
}
}
this.setScale(
Math.min(this.width / bbox.width, this.height / bbox.height),
- (bbox.x + bbox.width / 2),
- (bbox.y + bbox.height / 2),
true
);
} else {
scale = scale * this.baseScale;
this.setScale(scale, - centerX * this.defaultWidth, - centerY * this.defaultHeight, true);
}
} | javascript | function(scale, centerX, centerY){
var bbox,
itemBbox,
newBbox,
codes,
i;
if (jvm.$.isArray(scale) || this.regions[scale]) {
if (jvm.$.isArray(scale)) {
codes = scale;
} else {
codes = [scale]
}
for (i = 0; i < codes.length; i++) {
if (this.regions[codes[i]]) {
itemBbox = this.regions[codes[i]].element.getBBox();
if (itemBbox) {
if (typeof bbox == 'undefined') {
bbox = itemBbox;
} else {
newBbox = {
x: Math.min(bbox.x, itemBbox.x),
y: Math.min(bbox.y, itemBbox.y),
width: Math.max(bbox.x + bbox.width, itemBbox.x + itemBbox.width) - Math.min(bbox.x, itemBbox.x),
height: Math.max(bbox.y + bbox.height, itemBbox.y + itemBbox.height) - Math.min(bbox.y, itemBbox.y)
}
bbox = newBbox;
}
}
}
}
this.setScale(
Math.min(this.width / bbox.width, this.height / bbox.height),
- (bbox.x + bbox.width / 2),
- (bbox.y + bbox.height / 2),
true
);
} else {
scale = scale * this.baseScale;
this.setScale(scale, - centerX * this.defaultWidth, - centerY * this.defaultHeight, true);
}
} | [
"function",
"(",
"scale",
",",
"centerX",
",",
"centerY",
")",
"{",
"var",
"bbox",
",",
"itemBbox",
",",
"newBbox",
",",
"codes",
",",
"i",
";",
"if",
"(",
"jvm",
".",
"$",
".",
"isArray",
"(",
"scale",
")",
"||",
"this",
".",
"regions",
"[",
"sc... | Set the map's viewport to the specific point and set zoom of the map to the specific level. Point and zoom level could be defined in two ways: using the code of some region to focus on or a central point and zoom level as numbers.
@param {Number|String|Array} scale|regionCode|regionCodes If the first parameter of this method is a string or array of strings and there are regions with the these codes, the viewport will be set to show all these regions. Otherwise if the first parameter is a number, the viewport will be set to show the map with provided scale.
@param {Number} centerX Number from 0 to 1 specifying the horizontal coordinate of the central point of the viewport.
@param {Number} centerY Number from 0 to 1 specifying the vertical coordinate of the central point of the viewport. | [
"Set",
"the",
"map",
"s",
"viewport",
"to",
"the",
"specific",
"point",
"and",
"set",
"zoom",
"of",
"the",
"map",
"to",
"the",
"specific",
"level",
".",
"Point",
"and",
"zoom",
"level",
"could",
"be",
"defined",
"in",
"two",
"ways",
":",
"using",
"the"... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L518-L559 | train | Sets the scale of the image to the given center and center. | [
30522,
3853,
1006,
4094,
1010,
2415,
2595,
1010,
2415,
2100,
1007,
1063,
13075,
22861,
11636,
1010,
8875,
10322,
11636,
1010,
2047,
10322,
11636,
1010,
9537,
1010,
1045,
1025,
2065,
1006,
1046,
2615,
2213,
1012,
1002,
1012,
18061,
11335,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onApplyAuthSettingsChange | function onApplyAuthSettingsChange() {
try {
auth.settings.appVerificationDisabledForTesting =
$("input[name=enable-app-verification]:checked").val() == 'No';
alertSuccess('Auth settings changed');
} catch (error) {
alertError('Error: ' + error.code);
}
} | javascript | function onApplyAuthSettingsChange() {
try {
auth.settings.appVerificationDisabledForTesting =
$("input[name=enable-app-verification]:checked").val() == 'No';
alertSuccess('Auth settings changed');
} catch (error) {
alertError('Error: ' + error.code);
}
} | [
"function",
"onApplyAuthSettingsChange",
"(",
")",
"{",
"try",
"{",
"auth",
".",
"settings",
".",
"appVerificationDisabledForTesting",
"=",
"$",
"(",
"\"input[name=enable-app-verification]:checked\"",
")",
".",
"val",
"(",
")",
"==",
"'No'",
";",
"alertSuccess",
"("... | Applies selected auth settings change. | [
"Applies",
"selected",
"auth",
"settings",
"change",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L1300-L1308 | train | Apply auth settings change | [
30522,
3853,
2006,
29098,
2135,
4887,
26830,
18319,
3070,
11624,
22043,
1006,
1007,
1063,
3046,
1063,
8740,
2705,
1012,
10906,
1012,
10439,
6299,
9031,
10521,
3085,
20952,
11589,
4355,
2075,
1027,
1002,
1006,
1000,
7953,
1031,
2171,
1027,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
badges/shields | services/version.js | compareDottedVersion | function compareDottedVersion(v1, v2) {
const parts1 = /([0-9.]+)(.*)$/.exec(v1)
const parts2 = /([0-9.]+)(.*)$/.exec(v2)
if (parts1 != null && parts2 != null) {
const numbers1 = parts1[1]
const numbers2 = parts2[1]
const distinguisher1 = parts1[2]
const distinguisher2 = parts2[2]
const numlist1 = numbers1.split('.').map(e => +e)
const numlist2 = numbers2.split('.').map(e => +e)
const cmp = listCompare(numlist1, numlist2)
if (cmp !== 0) {
return cmp
} else {
return distinguisher1 < distinguisher2
? -1
: distinguisher1 > distinguisher2
? 1
: 0
}
}
return v1 < v2 ? -1 : v1 > v2 ? 1 : 0
} | javascript | function compareDottedVersion(v1, v2) {
const parts1 = /([0-9.]+)(.*)$/.exec(v1)
const parts2 = /([0-9.]+)(.*)$/.exec(v2)
if (parts1 != null && parts2 != null) {
const numbers1 = parts1[1]
const numbers2 = parts2[1]
const distinguisher1 = parts1[2]
const distinguisher2 = parts2[2]
const numlist1 = numbers1.split('.').map(e => +e)
const numlist2 = numbers2.split('.').map(e => +e)
const cmp = listCompare(numlist1, numlist2)
if (cmp !== 0) {
return cmp
} else {
return distinguisher1 < distinguisher2
? -1
: distinguisher1 > distinguisher2
? 1
: 0
}
}
return v1 < v2 ? -1 : v1 > v2 ? 1 : 0
} | [
"function",
"compareDottedVersion",
"(",
"v1",
",",
"v2",
")",
"{",
"const",
"parts1",
"=",
"/",
"([0-9.]+)(.*)$",
"/",
".",
"exec",
"(",
"v1",
")",
"const",
"parts2",
"=",
"/",
"([0-9.]+)(.*)$",
"/",
".",
"exec",
"(",
"v2",
")",
"if",
"(",
"parts1",
... | Take string versions. -1 if v1 < v2, 1 if v1 > v2, 0 otherwise. | [
"Take",
"string",
"versions",
".",
"-",
"1",
"if",
"v1",
"<",
"v2",
"1",
"if",
"v1",
">",
"v2",
"0",
"otherwise",
"."
] | 283601423f3d1a19aae83bf62032d40683948636 | https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/services/version.js#L81-L103 | train | Compare two dotted versions | [
30522,
3853,
4102,
26174,
27774,
1006,
1058,
2487,
1010,
1058,
2475,
1007,
1063,
9530,
3367,
3033,
2487,
1027,
1013,
1006,
1031,
1014,
1011,
1023,
1012,
1033,
1009,
1007,
1006,
1012,
1008,
1007,
1002,
1013,
1012,
4654,
8586,
1006,
1058,
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... |
GoogleChrome/puppeteer | examples/custom-event.js | listenFor | function listenFor(type) {
return page.evaluateOnNewDocument(type => {
document.addEventListener(type, e => {
window.onCustomEvent({type, detail: e.detail});
});
}, type);
} | javascript | function listenFor(type) {
return page.evaluateOnNewDocument(type => {
document.addEventListener(type, e => {
window.onCustomEvent({type, detail: e.detail});
});
}, type);
} | [
"function",
"listenFor",
"(",
"type",
")",
"{",
"return",
"page",
".",
"evaluateOnNewDocument",
"(",
"type",
"=>",
"{",
"document",
".",
"addEventListener",
"(",
"type",
",",
"e",
"=>",
"{",
"window",
".",
"onCustomEvent",
"(",
"{",
"type",
",",
"detail",
... | Attach an event listener to page to capture a custom event on page load/navigation.
@param {string} type Event name.
@return {!Promise} | [
"Attach",
"an",
"event",
"listener",
"to",
"page",
"to",
"capture",
"a",
"custom",
"event",
"on",
"page",
"load",
"/",
"navigation",
"."
] | 13f73b5b3a279f18313630e0f58c3c17fb0cef66 | https://github.com/GoogleChrome/puppeteer/blob/13f73b5b3a279f18313630e0f58c3c17fb0cef66/examples/custom-event.js#L35-L41 | train | Listen for a custom event | [
30522,
3853,
4952,
29278,
1006,
2828,
1007,
1063,
2709,
3931,
1012,
16157,
18256,
21724,
10085,
27417,
2102,
1006,
2828,
1027,
1028,
1063,
6254,
1012,
5587,
18697,
3372,
9863,
24454,
1006,
2828,
1010,
1041,
1027,
1028,
1063,
3332,
1012,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vuex | src/helpers.js | normalizeMap | function normalizeMap (map) {
return Array.isArray(map)
? map.map(key => ({ key, val: key }))
: Object.keys(map).map(key => ({ key, val: map[key] }))
} | javascript | function normalizeMap (map) {
return Array.isArray(map)
? map.map(key => ({ key, val: key }))
: Object.keys(map).map(key => ({ key, val: map[key] }))
} | [
"function",
"normalizeMap",
"(",
"map",
")",
"{",
"return",
"Array",
".",
"isArray",
"(",
"map",
")",
"?",
"map",
".",
"map",
"(",
"key",
"=>",
"(",
"{",
"key",
",",
"val",
":",
"key",
"}",
")",
")",
":",
"Object",
".",
"keys",
"(",
"map",
")",... | Normalize the map
normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
@param {Array|Object} map
@return {Object} | [
"Normalize",
"the",
"map",
"normalizeMap",
"(",
"[",
"1",
"2",
"3",
"]",
")",
"=",
">",
"[",
"{",
"key",
":",
"1",
"val",
":",
"1",
"}",
"{",
"key",
":",
"2",
"val",
":",
"2",
"}",
"{",
"key",
":",
"3",
"val",
":",
"3",
"}",
"]",
"normali... | d7c7f9844831f98c5c9aaca213746c4ccc5d6929 | https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/src/helpers.js#L131-L135 | train | Normalize a map to be a key - value array | [
30522,
3853,
3671,
4697,
2863,
2361,
1006,
4949,
1007,
1063,
2709,
9140,
1012,
18061,
11335,
2100,
1006,
4949,
1007,
1029,
4949,
1012,
4949,
1006,
3145,
1027,
1028,
1006,
1063,
3145,
1010,
11748,
1024,
3145,
1065,
1007,
1007,
1024,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/services/settings/index.js | getAll | function getAll() {
const knownSettings = this.knownSettings(),
settingsToReturn = {};
_.each(knownSettings, function (setting) {
settingsToReturn[setting] = SettingsLoader(setting);
});
return settingsToReturn;
} | javascript | function getAll() {
const knownSettings = this.knownSettings(),
settingsToReturn = {};
_.each(knownSettings, function (setting) {
settingsToReturn[setting] = SettingsLoader(setting);
});
return settingsToReturn;
} | [
"function",
"getAll",
"(",
")",
"{",
"const",
"knownSettings",
"=",
"this",
".",
"knownSettings",
"(",
")",
",",
"settingsToReturn",
"=",
"{",
"}",
";",
"_",
".",
"each",
"(",
"knownSettings",
",",
"function",
"(",
"setting",
")",
"{",
"settingsToReturn",
... | Getter for all YAML settings.
Example: `settings.getAll().then(...)`
will return an Object like this (assuming we're supporting `routes`
and `globals`):
{
routes: {
routes: null,
collections: { '/': [Object] },
resources: { tag: '/tag/{slug}/', author: '/author/{slug}/' }
},
globals: {
config: { url: 'testblog.com' }
}
}
@returns {Object} settingsObject
@description Returns all settings object as defined per YAML files in
`/content/settings` directory. | [
"Getter",
"for",
"all",
"YAML",
"settings",
".",
"Example",
":",
"settings",
".",
"getAll",
"()",
".",
"then",
"(",
"...",
")",
"will",
"return",
"an",
"Object",
"like",
"this",
"(",
"assuming",
"we",
"re",
"supporting",
"routes",
"and",
"globals",
")",
... | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/settings/index.js#L84-L93 | train | Get all the settings | [
30522,
3853,
2131,
8095,
1006,
1007,
1063,
9530,
3367,
2124,
21678,
8613,
1027,
2023,
1012,
2124,
21678,
8613,
1006,
1007,
1010,
10906,
19277,
22299,
1027,
1063,
1065,
1025,
1035,
1012,
2169,
1006,
2124,
21678,
8613,
1010,
3853,
1006,
4292,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | signInOrLinkCredential | function signInOrLinkCredential(credential) {
if (currentTab == '#user-section') {
if (!activeUser()) {
alertError('You need to sign in before linking an account.');
return;
}
activeUser().linkWithCredential(credential)
.then(function(result) {
logAdditionalUserInfo(result);
refreshUserData();
alertSuccess('Provider linked!');
}, onAuthError);
} else {
auth.signInWithCredential(credential)
.then(onAuthUserCredentialSuccess, onAuthError);
}
} | javascript | function signInOrLinkCredential(credential) {
if (currentTab == '#user-section') {
if (!activeUser()) {
alertError('You need to sign in before linking an account.');
return;
}
activeUser().linkWithCredential(credential)
.then(function(result) {
logAdditionalUserInfo(result);
refreshUserData();
alertSuccess('Provider linked!');
}, onAuthError);
} else {
auth.signInWithCredential(credential)
.then(onAuthUserCredentialSuccess, onAuthError);
}
} | [
"function",
"signInOrLinkCredential",
"(",
"credential",
")",
"{",
"if",
"(",
"currentTab",
"==",
"'#user-section'",
")",
"{",
"if",
"(",
"!",
"activeUser",
"(",
")",
")",
"{",
"alertError",
"(",
"'You need to sign in before linking an account.'",
")",
";",
"retur... | Signs in or links a provider's credential, based on current tab opened.
@param {!firebase.auth.AuthCredential} credential The provider's credential. | [
"Signs",
"in",
"or",
"links",
"a",
"provider",
"s",
"credential",
"based",
"on",
"current",
"tab",
"opened",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L541-L557 | train | Signs in or links the given credential | [
30522,
3853,
3696,
5740,
19403,
2243,
16748,
16454,
4818,
1006,
13675,
14728,
19909,
1007,
1063,
2065,
1006,
2783,
2696,
2497,
1027,
1027,
1005,
1001,
5310,
1011,
2930,
1005,
1007,
1063,
2065,
1006,
999,
3161,
20330,
1006,
1007,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | src/ol/source/Source.js | adaptAttributions | function adaptAttributions(attributionLike) {
if (!attributionLike) {
return null;
}
if (Array.isArray(attributionLike)) {
return function(frameState) {
return attributionLike;
};
}
if (typeof attributionLike === 'function') {
return attributionLike;
}
return function(frameState) {
return [attributionLike];
};
} | javascript | function adaptAttributions(attributionLike) {
if (!attributionLike) {
return null;
}
if (Array.isArray(attributionLike)) {
return function(frameState) {
return attributionLike;
};
}
if (typeof attributionLike === 'function') {
return attributionLike;
}
return function(frameState) {
return [attributionLike];
};
} | [
"function",
"adaptAttributions",
"(",
"attributionLike",
")",
"{",
"if",
"(",
"!",
"attributionLike",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"attributionLike",
")",
")",
"{",
"return",
"function",
"(",
"frameState",
... | Turns the attributions option into an attributions function.
@param {AttributionLike|undefined} attributionLike The attribution option.
@return {?Attribution} An attribution function (or null). | [
"Turns",
"the",
"attributions",
"option",
"into",
"an",
"attributions",
"function",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/source/Source.js#L184-L201 | train | adapt attribution like to a function | [
30522,
3853,
15581,
19321,
3089,
29446,
2015,
1006,
2012,
18886,
29446,
10359,
1007,
1063,
2065,
1006,
999,
2012,
18886,
29446,
10359,
1007,
1063,
2709,
19701,
1025,
1065,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
2012,
18886,
29446,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var editor = this;
$.map(this.toolbar.commandMapping, function(value) {
return [value];
}).filter(function(commandObj) {
return commandObj.dialog;
}).map(function(commandObj) {
return commandObj.dialog;
}).forEach(function(dialog) {
dialog.on('show', function() {
$(this.container).modal('show');
});
dialog.on('hide', function() {
$(this.container).modal('hide');
setTimeout(editor.composer.focus, 0);
});
$(dialog.container).on('shown.bs.modal', function () {
$(this).find('input, select, textarea').first().focus();
});
});
this.on('change_view', function() {
$(this.toolbar.container.children).find('a.btn').not('[data-wysihtml5-action="change_view"]').toggleClass('disabled');
});
} | javascript | function() {
var editor = this;
$.map(this.toolbar.commandMapping, function(value) {
return [value];
}).filter(function(commandObj) {
return commandObj.dialog;
}).map(function(commandObj) {
return commandObj.dialog;
}).forEach(function(dialog) {
dialog.on('show', function() {
$(this.container).modal('show');
});
dialog.on('hide', function() {
$(this.container).modal('hide');
setTimeout(editor.composer.focus, 0);
});
$(dialog.container).on('shown.bs.modal', function () {
$(this).find('input, select, textarea').first().focus();
});
});
this.on('change_view', function() {
$(this.toolbar.container.children).find('a.btn').not('[data-wysihtml5-action="change_view"]').toggleClass('disabled');
});
} | [
"function",
"(",
")",
"{",
"var",
"editor",
"=",
"this",
";",
"$",
".",
"map",
"(",
"this",
".",
"toolbar",
".",
"commandMapping",
",",
"function",
"(",
"value",
")",
"{",
"return",
"[",
"value",
"]",
";",
"}",
")",
".",
"filter",
"(",
"function",
... | sync wysihtml5 events for dialogs with bootstrap events | [
"sync",
"wysihtml5",
"events",
"for",
"dialogs",
"with",
"bootstrap",
"events"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L14691-L14714 | train | Initialize event handlers | [
30522,
3853,
1006,
1007,
1063,
13075,
3559,
1027,
2023,
1025,
1002,
1012,
4949,
1006,
2023,
1012,
6994,
8237,
1012,
3094,
2863,
14853,
1010,
3853,
1006,
3643,
1007,
1063,
2709,
1031,
3643,
1033,
1025,
1065,
1007,
1012,
11307,
1006,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jgraph/mxgraph | javascript/mxClient.js | function(rect, rotation, cx)
{
var result = null;
if (rect != null && rotation != null && rotation != 0)
{
var rad = mxUtils.toRadians(rotation);
var cos = Math.cos(rad);
var sin = Math.sin(rad);
cx = (cx != null) ? cx : new mxPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
var p1 = new mxPoint(rect.x, rect.y);
var p2 = new mxPoint(rect.x + rect.width, rect.y);
var p3 = new mxPoint(p2.x, rect.y + rect.height);
var p4 = new mxPoint(rect.x, p3.y);
p1 = mxUtils.getRotatedPoint(p1, cos, sin, cx);
p2 = mxUtils.getRotatedPoint(p2, cos, sin, cx);
p3 = mxUtils.getRotatedPoint(p3, cos, sin, cx);
p4 = mxUtils.getRotatedPoint(p4, cos, sin, cx);
result = new mxRectangle(p1.x, p1.y, 0, 0);
result.add(new mxRectangle(p2.x, p2.y, 0, 0));
result.add(new mxRectangle(p3.x, p3.y, 0, 0));
result.add(new mxRectangle(p4.x, p4.y, 0, 0));
}
return result;
} | javascript | function(rect, rotation, cx)
{
var result = null;
if (rect != null && rotation != null && rotation != 0)
{
var rad = mxUtils.toRadians(rotation);
var cos = Math.cos(rad);
var sin = Math.sin(rad);
cx = (cx != null) ? cx : new mxPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
var p1 = new mxPoint(rect.x, rect.y);
var p2 = new mxPoint(rect.x + rect.width, rect.y);
var p3 = new mxPoint(p2.x, rect.y + rect.height);
var p4 = new mxPoint(rect.x, p3.y);
p1 = mxUtils.getRotatedPoint(p1, cos, sin, cx);
p2 = mxUtils.getRotatedPoint(p2, cos, sin, cx);
p3 = mxUtils.getRotatedPoint(p3, cos, sin, cx);
p4 = mxUtils.getRotatedPoint(p4, cos, sin, cx);
result = new mxRectangle(p1.x, p1.y, 0, 0);
result.add(new mxRectangle(p2.x, p2.y, 0, 0));
result.add(new mxRectangle(p3.x, p3.y, 0, 0));
result.add(new mxRectangle(p4.x, p4.y, 0, 0));
}
return result;
} | [
"function",
"(",
"rect",
",",
"rotation",
",",
"cx",
")",
"{",
"var",
"result",
"=",
"null",
";",
"if",
"(",
"rect",
"!=",
"null",
"&&",
"rotation",
"!=",
"null",
"&&",
"rotation",
"!=",
"0",
")",
"{",
"var",
"rad",
"=",
"mxUtils",
".",
"toRadians"... | Function: getBoundingBox
Returns the bounding box for the rotated rectangle.
Parameters:
rect - <mxRectangle> to be rotated.
angle - Number that represents the angle (in degrees).
cx - Optional <mxPoint> that represents the rotation center. If no
rotation center is given then the center of rect is used. | [
"Function",
":",
"getBoundingBox"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L4212-L4241 | train | Returns a rectangle that is a rectangle with the given rotation | [
30522,
3853,
1006,
28667,
2102,
1010,
9963,
1010,
1039,
2595,
1007,
1063,
13075,
2765,
1027,
19701,
1025,
2065,
1006,
28667,
2102,
999,
1027,
19701,
1004,
1004,
9963,
999,
1027,
19701,
1004,
1004,
9963,
999,
1027,
1014,
1007,
1063,
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... | |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableAccExtension.js | function(oColumn) {
if (!oColumn) {
return null;
}
var sTooltip = oColumn.getTooltip_AsString();
if (sTooltip) {
return sTooltip;
}
var oLabel = oColumn.getLabel();
if (oLabel instanceof Control) {
sTooltip = oLabel.getTooltip_AsString();
}
if (sTooltip) {
return sTooltip;
}
return null;
} | javascript | function(oColumn) {
if (!oColumn) {
return null;
}
var sTooltip = oColumn.getTooltip_AsString();
if (sTooltip) {
return sTooltip;
}
var oLabel = oColumn.getLabel();
if (oLabel instanceof Control) {
sTooltip = oLabel.getTooltip_AsString();
}
if (sTooltip) {
return sTooltip;
}
return null;
} | [
"function",
"(",
"oColumn",
")",
"{",
"if",
"(",
"!",
"oColumn",
")",
"{",
"return",
"null",
";",
"}",
"var",
"sTooltip",
"=",
"oColumn",
".",
"getTooltip_AsString",
"(",
")",
";",
"if",
"(",
"sTooltip",
")",
"{",
"return",
"sTooltip",
";",
"}",
"var... | /*
Returns the tooltip of the column or the contained label, if any. | [
"/",
"*",
"Returns",
"the",
"tooltip",
"of",
"the",
"column",
"or",
"the",
"contained",
"label",
"if",
"any",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L216-L235 | train | Returns the tooltip of the given column | [
30522,
3853,
1006,
1051,
25778,
2819,
2078,
1007,
1063,
2065,
1006,
999,
1051,
25778,
2819,
2078,
1007,
1063,
2709,
19701,
1025,
1065,
13075,
14708,
25101,
1027,
1051,
25778,
2819,
2078,
1012,
2131,
3406,
27914,
11514,
1035,
4632,
18886,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_closeTab | function tabView_closeTab(aSpec) {
var spec = aSpec || {};
var tab = spec.tab;
if (!tab) {
throw new Error(arguments.callee.name + ": Tab not specified.");
}
var button = this.getElement({
type: "tab_closeButton",
value: tab}
);
this._controller.click(button);
} | javascript | function tabView_closeTab(aSpec) {
var spec = aSpec || {};
var tab = spec.tab;
if (!tab) {
throw new Error(arguments.callee.name + ": Tab not specified.");
}
var button = this.getElement({
type: "tab_closeButton",
value: tab}
);
this._controller.click(button);
} | [
"function",
"tabView_closeTab",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"var",
"tab",
"=",
"spec",
".",
"tab",
";",
"if",
"(",
"!",
"tab",
")",
"{",
"throw",
"new",
"Error",
"(",
"arguments",
".",
"callee",
".",
... | Close a tab
@param {object} aSpec
Information about the element to operate on
Elements: tab - Tab to close | [
"Close",
"a",
"tab"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabview.js#L348-L361 | train | Close a tab | [
30522,
3853,
21628,
8584,
1035,
9346,
7875,
1006,
2004,
5051,
2278,
1007,
1063,
13075,
28699,
1027,
2004,
5051,
2278,
1064,
1064,
1063,
1065,
1025,
13075,
21628,
1027,
28699,
1012,
21628,
1025,
2065,
1006,
999,
21628,
1007,
1063,
5466,
2047... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
transloadit/uppy | packages/@uppy/golden-retriever/src/MetaDataStore.js | findUppyInstances | function findUppyInstances () {
const instances = []
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i)
if (/^uppyState:/.test(key)) {
instances.push(key.slice('uppyState:'.length))
}
}
return instances
} | javascript | function findUppyInstances () {
const instances = []
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i)
if (/^uppyState:/.test(key)) {
instances.push(key.slice('uppyState:'.length))
}
}
return instances
} | [
"function",
"findUppyInstances",
"(",
")",
"{",
"const",
"instances",
"=",
"[",
"]",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"localStorage",
".",
"length",
";",
"i",
"++",
")",
"{",
"const",
"key",
"=",
"localStorage",
".",
"key",
"(",
"i"... | Get uppy instance IDs for which state is stored. | [
"Get",
"uppy",
"instance",
"IDs",
"for",
"which",
"state",
"is",
"stored",
"."
] | 7ae18bf992d544a64da998f033258ec09a3de275 | https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/packages/@uppy/golden-retriever/src/MetaDataStore.js#L4-L13 | train | Find uppy instances from localStorage | [
30522,
3853,
2424,
6279,
7685,
7076,
26897,
2015,
1006,
1007,
1063,
9530,
3367,
12107,
1027,
1031,
1033,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026,
10575,
4263,
4270,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
9530,
3367,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(node) {
var cssStyleMatch;
while (node) {
cssStyleMatch = this.cssStyle ? hasStyleAttr(node, this.similarStyleRegExp) : false;
if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssStyleMatch) {
return node;
}
node = node.parentNode;
}
return false;
} | javascript | function(node) {
var cssStyleMatch;
while (node) {
cssStyleMatch = this.cssStyle ? hasStyleAttr(node, this.similarStyleRegExp) : false;
if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssStyleMatch) {
return node;
}
node = node.parentNode;
}
return false;
} | [
"function",
"(",
"node",
")",
"{",
"var",
"cssStyleMatch",
";",
"while",
"(",
"node",
")",
"{",
"cssStyleMatch",
"=",
"this",
".",
"cssStyle",
"?",
"hasStyleAttr",
"(",
"node",
",",
"this",
".",
"similarStyleRegExp",
")",
":",
"false",
";",
"if",
"(",
... | returns parents of node with given style attribute | [
"returns",
"parents",
"of",
"node",
"with",
"given",
"style",
"attribute"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L9823-L9834 | train | Returns the parent element of the given node | [
30522,
3853,
1006,
13045,
1007,
1063,
13075,
20116,
4757,
27983,
18900,
2818,
1025,
2096,
1006,
13045,
1007,
1063,
20116,
4757,
27983,
18900,
2818,
1027,
2023,
1012,
20116,
4757,
27983,
1029,
2038,
21756,
19738,
4779,
2099,
1006,
13045,
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... | |
dequelabs/axe-core | lib/core/utils/respondable.js | _getSource | function _getSource() {
var application = 'axeAPI',
version = '',
src;
if (typeof axe !== 'undefined' && axe._audit && axe._audit.application) {
application = axe._audit.application;
}
if (typeof axe !== 'undefined') {
version = axe.version;
}
src = application + '.' + version;
return src;
} | javascript | function _getSource() {
var application = 'axeAPI',
version = '',
src;
if (typeof axe !== 'undefined' && axe._audit && axe._audit.application) {
application = axe._audit.application;
}
if (typeof axe !== 'undefined') {
version = axe.version;
}
src = application + '.' + version;
return src;
} | [
"function",
"_getSource",
"(",
")",
"{",
"var",
"application",
"=",
"'axeAPI'",
",",
"version",
"=",
"''",
",",
"src",
";",
"if",
"(",
"typeof",
"axe",
"!==",
"'undefined'",
"&&",
"axe",
".",
"_audit",
"&&",
"axe",
".",
"_audit",
".",
"application",
")... | get the unique string to be used to identify our instance of axe
@private | [
"get",
"the",
"unique",
"string",
"to",
"be",
"used",
"to",
"identify",
"our",
"instance",
"of",
"axe"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/respondable.js#L19-L31 | train | Get the source of the current audit request | [
30522,
3853,
1035,
4152,
8162,
3401,
1006,
1007,
1063,
13075,
4646,
1027,
1005,
12946,
9331,
2072,
1005,
1010,
2544,
1027,
1005,
1005,
1010,
5034,
2278,
1025,
2065,
1006,
2828,
11253,
12946,
999,
1027,
1027,
1005,
6151,
28344,
1005,
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... |
wuchangming/spy-debugger | buildin_modules/weinre/web/modjewel.js | require_define | function require_define(moduleId, prereqs, factory) {
var rem = ["require", "exports", "module"]
if (typeof moduleId != "string") {
console.log("modjewel.define(): first parameter must be a string; was: " + moduleId)
return
}
if (arguments.length == 2) {
factory = prereqs
prereqs = null
}
if (!prereqs || prereqs.length == 0) {
prereqs = rem
}
if (typeof factory != "function") {
if (factory) {
ModulePreloadStore[moduleId] = [factory, prereqs]
return
}
console.log("modjewel.define(): factory was falsy: " + factory)
return
}
if (moduleId.match(/^\./)) {
console.log("modjewel.define(): moduleId must not start with '.': '" + moduleName + "'")
return
}
if (hop(ModulePreloadStore, moduleId)) {
console.log("modjewel.define(): module '" + moduleId + "' has already been defined")
return
}
ModulePreloadStore[moduleId] = [factory, prereqs]
} | javascript | function require_define(moduleId, prereqs, factory) {
var rem = ["require", "exports", "module"]
if (typeof moduleId != "string") {
console.log("modjewel.define(): first parameter must be a string; was: " + moduleId)
return
}
if (arguments.length == 2) {
factory = prereqs
prereqs = null
}
if (!prereqs || prereqs.length == 0) {
prereqs = rem
}
if (typeof factory != "function") {
if (factory) {
ModulePreloadStore[moduleId] = [factory, prereqs]
return
}
console.log("modjewel.define(): factory was falsy: " + factory)
return
}
if (moduleId.match(/^\./)) {
console.log("modjewel.define(): moduleId must not start with '.': '" + moduleName + "'")
return
}
if (hop(ModulePreloadStore, moduleId)) {
console.log("modjewel.define(): module '" + moduleId + "' has already been defined")
return
}
ModulePreloadStore[moduleId] = [factory, prereqs]
} | [
"function",
"require_define",
"(",
"moduleId",
",",
"prereqs",
",",
"factory",
")",
"{",
"var",
"rem",
"=",
"[",
"\"require\"",
",",
"\"exports\"",
",",
"\"module\"",
"]",
"if",
"(",
"typeof",
"moduleId",
"!=",
"\"string\"",
")",
"{",
"console",
".",
"log"... | ---------------------------------------------------------------------------- used by pre-built modules that can be included via <script src=> a simplification of http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition where id is required ---------------------------------------------------------------------------- | [
"----------------------------------------------------------------------------",
"used",
"by",
"pre",
"-",
"built",
"modules",
"that",
"can",
"be",
"included",
"via",
"<script",
"src",
"=",
">",
"a",
"simplification",
"of",
"http",
":",
"//",
"wiki",
".",
"commonjs",
... | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/modjewel.js#L190-L228 | train | Require define function | [
30522,
3853,
5478,
1035,
9375,
1006,
11336,
3593,
1010,
3653,
2890,
4160,
2015,
1010,
4713,
1007,
1063,
13075,
2128,
2213,
1027,
1031,
1000,
5478,
1000,
1010,
1000,
14338,
1000,
1010,
1000,
11336,
1000,
1033,
2065,
1006,
2828,
11253,
11336,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | source/internal/_Set.js | hasOrAdd | function hasOrAdd(item, shouldAdd, set) {
var type = typeof item;
var prevSize, newSize;
switch (type) {
case 'string':
case 'number':
// distinguish between +0 and -0
if (item === 0 && 1 / item === -Infinity) {
if (set._items['-0']) {
return true;
} else {
if (shouldAdd) {
set._items['-0'] = true;
}
return false;
}
}
// these types can all utilise the native Set
if (set._nativeSet !== null) {
if (shouldAdd) {
prevSize = set._nativeSet.size;
set._nativeSet.add(item);
newSize = set._nativeSet.size;
return newSize === prevSize;
} else {
return set._nativeSet.has(item);
}
} else {
if (!(type in set._items)) {
if (shouldAdd) {
set._items[type] = {};
set._items[type][item] = true;
}
return false;
} else if (item in set._items[type]) {
return true;
} else {
if (shouldAdd) {
set._items[type][item] = true;
}
return false;
}
}
case 'boolean':
// set._items['boolean'] holds a two element array
// representing [ falseExists, trueExists ]
if (type in set._items) {
var bIdx = item ? 1 : 0;
if (set._items[type][bIdx]) {
return true;
} else {
if (shouldAdd) {
set._items[type][bIdx] = true;
}
return false;
}
} else {
if (shouldAdd) {
set._items[type] = item ? [false, true] : [true, false];
}
return false;
}
case 'function':
// compare functions for reference equality
if (set._nativeSet !== null) {
if (shouldAdd) {
prevSize = set._nativeSet.size;
set._nativeSet.add(item);
newSize = set._nativeSet.size;
return newSize === prevSize;
} else {
return set._nativeSet.has(item);
}
} else {
if (!(type in set._items)) {
if (shouldAdd) {
set._items[type] = [item];
}
return false;
}
if (!_includes(item, set._items[type])) {
if (shouldAdd) {
set._items[type].push(item);
}
return false;
}
return true;
}
case 'undefined':
if (set._items[type]) {
return true;
} else {
if (shouldAdd) {
set._items[type] = true;
}
return false;
}
case 'object':
if (item === null) {
if (!set._items['null']) {
if (shouldAdd) {
set._items['null'] = true;
}
return false;
}
return true;
}
/* falls through */
default:
// reduce the search size of heterogeneous sets by creating buckets
// for each type.
type = Object.prototype.toString.call(item);
if (!(type in set._items)) {
if (shouldAdd) {
set._items[type] = [item];
}
return false;
}
// scan through all previously applied items
if (!_includes(item, set._items[type])) {
if (shouldAdd) {
set._items[type].push(item);
}
return false;
}
return true;
}
} | javascript | function hasOrAdd(item, shouldAdd, set) {
var type = typeof item;
var prevSize, newSize;
switch (type) {
case 'string':
case 'number':
// distinguish between +0 and -0
if (item === 0 && 1 / item === -Infinity) {
if (set._items['-0']) {
return true;
} else {
if (shouldAdd) {
set._items['-0'] = true;
}
return false;
}
}
// these types can all utilise the native Set
if (set._nativeSet !== null) {
if (shouldAdd) {
prevSize = set._nativeSet.size;
set._nativeSet.add(item);
newSize = set._nativeSet.size;
return newSize === prevSize;
} else {
return set._nativeSet.has(item);
}
} else {
if (!(type in set._items)) {
if (shouldAdd) {
set._items[type] = {};
set._items[type][item] = true;
}
return false;
} else if (item in set._items[type]) {
return true;
} else {
if (shouldAdd) {
set._items[type][item] = true;
}
return false;
}
}
case 'boolean':
// set._items['boolean'] holds a two element array
// representing [ falseExists, trueExists ]
if (type in set._items) {
var bIdx = item ? 1 : 0;
if (set._items[type][bIdx]) {
return true;
} else {
if (shouldAdd) {
set._items[type][bIdx] = true;
}
return false;
}
} else {
if (shouldAdd) {
set._items[type] = item ? [false, true] : [true, false];
}
return false;
}
case 'function':
// compare functions for reference equality
if (set._nativeSet !== null) {
if (shouldAdd) {
prevSize = set._nativeSet.size;
set._nativeSet.add(item);
newSize = set._nativeSet.size;
return newSize === prevSize;
} else {
return set._nativeSet.has(item);
}
} else {
if (!(type in set._items)) {
if (shouldAdd) {
set._items[type] = [item];
}
return false;
}
if (!_includes(item, set._items[type])) {
if (shouldAdd) {
set._items[type].push(item);
}
return false;
}
return true;
}
case 'undefined':
if (set._items[type]) {
return true;
} else {
if (shouldAdd) {
set._items[type] = true;
}
return false;
}
case 'object':
if (item === null) {
if (!set._items['null']) {
if (shouldAdd) {
set._items['null'] = true;
}
return false;
}
return true;
}
/* falls through */
default:
// reduce the search size of heterogeneous sets by creating buckets
// for each type.
type = Object.prototype.toString.call(item);
if (!(type in set._items)) {
if (shouldAdd) {
set._items[type] = [item];
}
return false;
}
// scan through all previously applied items
if (!_includes(item, set._items[type])) {
if (shouldAdd) {
set._items[type].push(item);
}
return false;
}
return true;
}
} | [
"function",
"hasOrAdd",
"(",
"item",
",",
"shouldAdd",
",",
"set",
")",
"{",
"var",
"type",
"=",
"typeof",
"item",
";",
"var",
"prevSize",
",",
"newSize",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"'string'",
":",
"case",
"'number'",
":",
"// disti... | Combines the logic for checking whether an item is a member of the set and for adding a new item to the set. @param item The item to check or add to the Set instance. @param shouldAdd If true, the item will be added to the set if it doesn't already exist. @param set The set instance to check or add to. @return {boolean} true if the item already existed, otherwise false. | [
"Combines",
"the",
"logic",
"for",
"checking",
"whether",
"an",
"item",
"is",
"a",
"member",
"of",
"the",
"set",
"and",
"for",
"adding",
"a",
"new",
"item",
"to",
"the",
"set",
"."
] | 072d417a345e7087a95466a9825d43b6ca3a4941 | https://github.com/ramda/ramda/blob/072d417a345e7087a95466a9825d43b6ca3a4941/source/internal/_Set.js#L36-L167 | train | Check if an item is present in the set. | [
30522,
3853,
2038,
6525,
14141,
1006,
8875,
1010,
2323,
4215,
2094,
1010,
2275,
1007,
1063,
13075,
2828,
1027,
2828,
11253,
8875,
1025,
13075,
3653,
15088,
4697,
1010,
2739,
4697,
1025,
6942,
1006,
2828,
1007,
1063,
2553,
1005,
5164,
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... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function(bodyWrap) {
var error = this._check_streamerror(bodyWrap, Strophe.Status.CONNFAIL);
if (error) {
return Strophe.Status.CONNFAIL;
}
} | javascript | function(bodyWrap) {
var error = this._check_streamerror(bodyWrap, Strophe.Status.CONNFAIL);
if (error) {
return Strophe.Status.CONNFAIL;
}
} | [
"function",
"(",
"bodyWrap",
")",
"{",
"var",
"error",
"=",
"this",
".",
"_check_streamerror",
"(",
"bodyWrap",
",",
"Strophe",
".",
"Status",
".",
"CONNFAIL",
")",
";",
"if",
"(",
"error",
")",
"{",
"return",
"Strophe",
".",
"Status",
".",
"CONNFAIL",
... | PrivateFunction: _connect_cb
_Private_ function called by Strophe.Connection._connect_cb
checks for stream:error
Parameters:
(Strophe.Request) bodyWrap - The received stanza. | [
"PrivateFunction",
":",
"_connect_cb",
"_Private_",
"function",
"called",
"by",
"Strophe",
".",
"Connection",
".",
"_connect_cb"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L4882-L4887 | train | Returns the status of the last segment of the sequence | [
30522,
3853,
1006,
2303,
13088,
9331,
1007,
1063,
13075,
7561,
1027,
2023,
1012,
1035,
4638,
1035,
5460,
2121,
29165,
1006,
2303,
13088,
9331,
1010,
2358,
18981,
5369,
1012,
3570,
1012,
9530,
2078,
7011,
4014,
1007,
1025,
2065,
1006,
7561,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | lib/jsdoc/ui5/plugin.js | unwrap | function unwrap(docletSrc) {
if (!docletSrc) { return ''; }
// note: keep trailing whitespace for @examples
// extra opening/closing stars are ignored
// left margin is considered a star and a space
// use the /m flag on regex to avoid having to guess what this platform's newline is
docletSrc =
docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars
.replace(/\**\*\/$/, "\\Z") // replace closing star slash with end-marker
.replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker
.replace(/\s*\\Z$/g, ''); // remove end-marker
return docletSrc;
} | javascript | function unwrap(docletSrc) {
if (!docletSrc) { return ''; }
// note: keep trailing whitespace for @examples
// extra opening/closing stars are ignored
// left margin is considered a star and a space
// use the /m flag on regex to avoid having to guess what this platform's newline is
docletSrc =
docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars
.replace(/\**\*\/$/, "\\Z") // replace closing star slash with end-marker
.replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker
.replace(/\s*\\Z$/g, ''); // remove end-marker
return docletSrc;
} | [
"function",
"unwrap",
"(",
"docletSrc",
")",
"{",
"if",
"(",
"!",
"docletSrc",
")",
"{",
"return",
"''",
";",
"}",
"// note: keep trailing whitespace for @examples",
"// extra opening/closing stars are ignored",
"// left margin is considered a star and a space",
"// use the /m ... | Removes the mandatory comment markers and the optional but common asterisks at the beginning of each JSDoc comment line.
The result is easier to parse/analyze.
Implementation is a 1:1 copy from JSDoc's lib/jsdoc/doclet.js (closure function, not directly reusable)
@param {string} docletSrc the source comment with or without block comment markers
@returns {string} the unwrapped content of the JSDoc comment | [
"Removes",
"the",
"mandatory",
"comment",
"markers",
"and",
"the",
"optional",
"but",
"common",
"asterisks",
"at",
"the",
"beginning",
"of",
"each",
"JSDoc",
"comment",
"line",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L1874-L1888 | train | Unwraps the given doclet source | [
30522,
3853,
4895,
13088,
9331,
1006,
9986,
13461,
11890,
1007,
1063,
2065,
1006,
999,
9986,
13461,
11890,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
1013,
1013,
3602,
1024,
2562,
12542,
12461,
15327,
2005,
1030,
4973,
1013,
1013,
4469,
3098... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-mixed-spaces-and-tabs.js | beforeLoc | function beforeLoc(loc, line, column) {
if (line < loc.start.line) {
return true;
}
return line === loc.start.line && column < loc.start.column;
} | javascript | function beforeLoc(loc, line, column) {
if (line < loc.start.line) {
return true;
}
return line === loc.start.line && column < loc.start.column;
} | [
"function",
"beforeLoc",
"(",
"loc",
",",
"line",
",",
"column",
")",
"{",
"if",
"(",
"line",
"<",
"loc",
".",
"start",
".",
"line",
")",
"{",
"return",
"true",
";",
"}",
"return",
"line",
"===",
"loc",
".",
"start",
".",
"line",
"&&",
"column",
... | Determines if a given line and column are before a location.
@param {Location} loc The location object from an AST node.
@param {int} line The line to check.
@param {int} column The column to check.
@returns {boolean} True if the line and column are before the location, false if not.
@private | [
"Determines",
"if",
"a",
"given",
"line",
"and",
"column",
"are",
"before",
"a",
"location",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-mixed-spaces-and-tabs.js#L52-L57 | train | returns true if loc is before loc. start | [
30522,
3853,
2077,
4135,
2278,
1006,
8840,
2278,
1010,
2240,
1010,
5930,
1007,
1063,
2065,
1006,
2240,
1026,
8840,
2278,
1012,
2707,
1012,
2240,
1007,
1063,
2709,
2995,
1025,
1065,
2709,
2240,
1027,
1027,
1027,
8840,
2278,
1012,
2707,
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... |
aws/aws-sdk-js | dist-tools/client-creator.js | ClientCreator | function ClientCreator() {
this._metadata = require('../apis/metadata');
this._apisFolderPath = path.join(__dirname, '..', 'apis');
this._clientFolderPath = path.join(__dirname, '..', 'clients');
this._serviceCustomizationsFolderPath = path.join(__dirname, '..', 'lib', 'services');
this._packageJsonPath = path.join(__dirname, '..', 'package.json');
this._apiFileNames = null;
} | javascript | function ClientCreator() {
this._metadata = require('../apis/metadata');
this._apisFolderPath = path.join(__dirname, '..', 'apis');
this._clientFolderPath = path.join(__dirname, '..', 'clients');
this._serviceCustomizationsFolderPath = path.join(__dirname, '..', 'lib', 'services');
this._packageJsonPath = path.join(__dirname, '..', 'package.json');
this._apiFileNames = null;
} | [
"function",
"ClientCreator",
"(",
")",
"{",
"this",
".",
"_metadata",
"=",
"require",
"(",
"'../apis/metadata'",
")",
";",
"this",
".",
"_apisFolderPath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'..'",
",",
"'apis'",
")",
";",
"this",
".",
"_cl... | Generate service clients | [
"Generate",
"service",
"clients"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/dist-tools/client-creator.js#L5-L12 | train | Creates a new ClientCreator instance. | [
30522,
3853,
7396,
16748,
8844,
1006,
1007,
1063,
2023,
1012,
1035,
27425,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
17928,
2015,
1013,
27425,
1005,
1007,
1025,
2023,
1012,
1035,
17928,
22747,
11614,
2121,
15069,
1027,
4130,
1012,
3693,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(mCurrencies) {
check(typeof mCurrencies === "object" || mCurrencies == null, "mCurrencyDigits must be an object");
Object.keys(mCurrencies || {}).forEach(function(sCurrencyDigit) {
check(typeof sCurrencyDigit === "string");
check(typeof mCurrencies[sCurrencyDigit] === "object");
});
this._set("currency", mCurrencies);
return this;
} | javascript | function(mCurrencies) {
check(typeof mCurrencies === "object" || mCurrencies == null, "mCurrencyDigits must be an object");
Object.keys(mCurrencies || {}).forEach(function(sCurrencyDigit) {
check(typeof sCurrencyDigit === "string");
check(typeof mCurrencies[sCurrencyDigit] === "object");
});
this._set("currency", mCurrencies);
return this;
} | [
"function",
"(",
"mCurrencies",
")",
"{",
"check",
"(",
"typeof",
"mCurrencies",
"===",
"\"object\"",
"||",
"mCurrencies",
"==",
"null",
",",
"\"mCurrencyDigits must be an object\"",
")",
";",
"Object",
".",
"keys",
"(",
"mCurrencies",
"||",
"{",
"}",
")",
"."... | Sets custom currencies and replaces existing entries.
There is a special currency code named "DEFAULT" that is optional.
In case it is set it will be used for all currencies not contained
in the list, otherwise currency digits as defined by the CLDR will
be used as a fallback.
Example:
To use CLDR, but override single currencies
<code>
{
"KWD": {"digits": 3},
"TND" : {"digits": 3}
}
</code>
To replace the CLDR currency digits completely
<code>
{
"DEFAULT": {"digits": 2},
"ADP": {"digits": 0},
...
"XPF": {"digits": 0}
}
</code>
Note: To unset the custom currencies: call with <code>undefined</code>
@public
@param {object} mCurrencies currency map which is set
@returns {sap.ui.core.Configuration.FormatSettings} | [
"Sets",
"custom",
"currencies",
"and",
"replaces",
"existing",
"entries",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1967-L1975 | train | Sets the currency of the currency | [
30522,
3853,
1006,
11338,
3126,
7389,
9243,
1007,
1063,
4638,
1006,
2828,
11253,
11338,
3126,
7389,
9243,
1027,
1027,
1027,
1000,
4874,
1000,
1064,
1064,
11338,
3126,
7389,
9243,
1027,
1027,
19701,
1010,
1000,
11338,
3126,
7389,
5666,
4305,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
zeit/pkg | prelude/bootstrap.js | closeFromSnapshot | function closeFromSnapshot (fd, cb) {
delete docks[fd];
if (cb) {
ancestor.close.call(fs, fd, cb);
} else {
return ancestor.closeSync.call(fs, fd);
}
} | javascript | function closeFromSnapshot (fd, cb) {
delete docks[fd];
if (cb) {
ancestor.close.call(fs, fd, cb);
} else {
return ancestor.closeSync.call(fs, fd);
}
} | [
"function",
"closeFromSnapshot",
"(",
"fd",
",",
"cb",
")",
"{",
"delete",
"docks",
"[",
"fd",
"]",
";",
"if",
"(",
"cb",
")",
"{",
"ancestor",
".",
"close",
".",
"call",
"(",
"fs",
",",
"fd",
",",
"cb",
")",
";",
"}",
"else",
"{",
"return",
"a... | /////////////////////////////////////////////////////////////// close ///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// | [
"///////////////////////////////////////////////////////////////",
"close",
"/////////////////////////////////////////////////////////",
"///////////////////////////////////////////////////////////////"
] | 3775ab6decc2f8f013142e1282934c12fbd1881e | https://github.com/zeit/pkg/blob/3775ab6decc2f8f013142e1282934c12fbd1881e/prelude/bootstrap.js#L600-L607 | train | Close a file descriptor from snapshot | [
30522,
3853,
2485,
19699,
22225,
2532,
4523,
12326,
1006,
1042,
2094,
1010,
17324,
1007,
1063,
3972,
12870,
15093,
1031,
1042,
2094,
1033,
1025,
2065,
1006,
17324,
1007,
1063,
13032,
1012,
2485,
1012,
2655,
1006,
1042,
2015,
1010,
1042,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_Window2 | function parse_Window2(blob, length, opts) {
if(opts && opts.biff >= 2 && opts.biff < 8) return {};
var f = blob.read_shift(2);
return { RTL: f & 0x40 };
} | javascript | function parse_Window2(blob, length, opts) {
if(opts && opts.biff >= 2 && opts.biff < 8) return {};
var f = blob.read_shift(2);
return { RTL: f & 0x40 };
} | [
"function",
"parse_Window2",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"if",
"(",
"opts",
"&&",
"opts",
".",
"biff",
">=",
"2",
"&&",
"opts",
".",
"biff",
"<",
"8",
")",
"return",
"{",
"}",
";",
"var",
"f",
"=",
"blob",
".",
"read_shift"... | /* [MS-XLS] 2.4.346 TODO | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"346",
"TODO"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5921-L5925 | train | Parse a window2 entry | [
30522,
3853,
11968,
3366,
1035,
3332,
2475,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
2065,
1006,
23569,
2015,
1004,
1004,
23569,
2015,
1012,
12170,
4246,
1028,
1027,
1016,
1004,
1004,
23569,
2015,
1012,
12170,
4246... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/models/post.js | permissible | function permissible(postModel, action, context, unsafeAttrs, loadedPermissions, hasUserPermission, hasAppPermission, hasApiKeyPermission) {
let isContributor, isEdit, isAdd, isDestroy;
function isChanging(attr) {
return unsafeAttrs[attr] && unsafeAttrs[attr] !== postModel.get(attr);
}
function isPublished() {
return unsafeAttrs.status && unsafeAttrs.status !== 'draft';
}
function isDraft() {
return postModel.get('status') === 'draft';
}
isContributor = loadedPermissions.user && _.some(loadedPermissions.user.roles, {name: 'Contributor'});
isEdit = (action === 'edit');
isAdd = (action === 'add');
isDestroy = (action === 'destroy');
if (isContributor && isEdit) {
// Only allow contributor edit if status is changing, and the post is a draft post
hasUserPermission = !isChanging('status') && isDraft();
} else if (isContributor && isAdd) {
// If adding, make sure it's a draft post and has the correct ownership
hasUserPermission = !isPublished();
} else if (isContributor && isDestroy) {
// If destroying, only allow contributor to destroy their own draft posts
hasUserPermission = isDraft();
}
const excludedAttrs = [];
if (isContributor) {
// Note: at the moment primary_tag is a computed field,
// meaning we don't add it to this list. However, if the primary_tag/primary_author
// ever becomes a db field rather than a computed field, add it to this list
// TODO: once contributors are able to edit existing tags, this can be removed
// @TODO: we need a concept for making a diff between incoming tags and existing tags
excludedAttrs.push('tags');
}
if (hasUserPermission && hasApiKeyPermission && hasAppPermission) {
return Promise.resolve({excludedAttrs});
}
return Promise.reject(new common.errors.NoPermissionError({
message: common.i18n.t('errors.models.post.notEnoughPermission')
}));
} | javascript | function permissible(postModel, action, context, unsafeAttrs, loadedPermissions, hasUserPermission, hasAppPermission, hasApiKeyPermission) {
let isContributor, isEdit, isAdd, isDestroy;
function isChanging(attr) {
return unsafeAttrs[attr] && unsafeAttrs[attr] !== postModel.get(attr);
}
function isPublished() {
return unsafeAttrs.status && unsafeAttrs.status !== 'draft';
}
function isDraft() {
return postModel.get('status') === 'draft';
}
isContributor = loadedPermissions.user && _.some(loadedPermissions.user.roles, {name: 'Contributor'});
isEdit = (action === 'edit');
isAdd = (action === 'add');
isDestroy = (action === 'destroy');
if (isContributor && isEdit) {
// Only allow contributor edit if status is changing, and the post is a draft post
hasUserPermission = !isChanging('status') && isDraft();
} else if (isContributor && isAdd) {
// If adding, make sure it's a draft post and has the correct ownership
hasUserPermission = !isPublished();
} else if (isContributor && isDestroy) {
// If destroying, only allow contributor to destroy their own draft posts
hasUserPermission = isDraft();
}
const excludedAttrs = [];
if (isContributor) {
// Note: at the moment primary_tag is a computed field,
// meaning we don't add it to this list. However, if the primary_tag/primary_author
// ever becomes a db field rather than a computed field, add it to this list
// TODO: once contributors are able to edit existing tags, this can be removed
// @TODO: we need a concept for making a diff between incoming tags and existing tags
excludedAttrs.push('tags');
}
if (hasUserPermission && hasApiKeyPermission && hasAppPermission) {
return Promise.resolve({excludedAttrs});
}
return Promise.reject(new common.errors.NoPermissionError({
message: common.i18n.t('errors.models.post.notEnoughPermission')
}));
} | [
"function",
"permissible",
"(",
"postModel",
",",
"action",
",",
"context",
",",
"unsafeAttrs",
",",
"loadedPermissions",
",",
"hasUserPermission",
",",
"hasAppPermission",
",",
"hasApiKeyPermission",
")",
"{",
"let",
"isContributor",
",",
"isEdit",
",",
"isAdd",
... | NOTE: the `authors` extension is the parent of the post model. It also has a permissible function. | [
"NOTE",
":",
"the",
"authors",
"extension",
"is",
"the",
"parent",
"of",
"the",
"post",
"model",
".",
"It",
"also",
"has",
"a",
"permissible",
"function",
"."
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/post.js#L862-L910 | train | Checks if postModel is permitted to be used | [
30522,
3853,
2566,
26770,
1006,
2695,
5302,
9247,
1010,
2895,
1010,
6123,
1010,
25135,
19321,
2869,
1010,
8209,
4842,
25481,
2015,
1010,
2038,
20330,
4842,
25481,
1010,
2038,
29098,
4842,
25481,
1010,
2038,
9331,
17339,
18863,
28550,
28231,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-plugin-proposal-object-rest-spread/src/index.js | createObjectSpread | function createObjectSpread(path, file, objRef) {
const props = path.get("properties");
const last = props[props.length - 1];
t.assertRestElement(last.node);
const restElement = t.cloneNode(last.node);
last.remove();
const impureComputedPropertyDeclarators = replaceImpureComputedKeys(path);
const { keys, allLiteral } = extractNormalizedKeys(path);
if (keys.length === 0) {
return [
impureComputedPropertyDeclarators,
restElement.argument,
t.callExpression(getExtendsHelper(file), [
t.objectExpression([]),
t.cloneNode(objRef),
]),
];
}
let keyExpression;
if (!allLiteral) {
// map to toPropertyKey to handle the possible non-string values
keyExpression = t.callExpression(
t.memberExpression(t.arrayExpression(keys), t.identifier("map")),
[file.addHelper("toPropertyKey")],
);
} else {
keyExpression = t.arrayExpression(keys);
}
return [
impureComputedPropertyDeclarators,
restElement.argument,
t.callExpression(
file.addHelper(`objectWithoutProperties${loose ? "Loose" : ""}`),
[t.cloneNode(objRef), keyExpression],
),
];
} | javascript | function createObjectSpread(path, file, objRef) {
const props = path.get("properties");
const last = props[props.length - 1];
t.assertRestElement(last.node);
const restElement = t.cloneNode(last.node);
last.remove();
const impureComputedPropertyDeclarators = replaceImpureComputedKeys(path);
const { keys, allLiteral } = extractNormalizedKeys(path);
if (keys.length === 0) {
return [
impureComputedPropertyDeclarators,
restElement.argument,
t.callExpression(getExtendsHelper(file), [
t.objectExpression([]),
t.cloneNode(objRef),
]),
];
}
let keyExpression;
if (!allLiteral) {
// map to toPropertyKey to handle the possible non-string values
keyExpression = t.callExpression(
t.memberExpression(t.arrayExpression(keys), t.identifier("map")),
[file.addHelper("toPropertyKey")],
);
} else {
keyExpression = t.arrayExpression(keys);
}
return [
impureComputedPropertyDeclarators,
restElement.argument,
t.callExpression(
file.addHelper(`objectWithoutProperties${loose ? "Loose" : ""}`),
[t.cloneNode(objRef), keyExpression],
),
];
} | [
"function",
"createObjectSpread",
"(",
"path",
",",
"file",
",",
"objRef",
")",
"{",
"const",
"props",
"=",
"path",
".",
"get",
"(",
"\"properties\"",
")",
";",
"const",
"last",
"=",
"props",
"[",
"props",
".",
"length",
"-",
"1",
"]",
";",
"t",
".",... | expects path to an object pattern | [
"expects",
"path",
"to",
"an",
"object",
"pattern"
] | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-plugin-proposal-object-rest-spread/src/index.js#L124-L164 | train | Creates an object spread | [
30522,
3853,
3443,
16429,
20614,
13102,
16416,
2094,
1006,
4130,
1010,
5371,
1010,
27885,
3501,
2890,
2546,
1007,
1063,
9530,
3367,
24387,
1027,
4130,
1012,
2131,
1006,
1000,
5144,
1000,
1007,
1025,
9530,
3367,
2197,
1027,
24387,
1031,
2438... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/hello-mui/js/mui.imageViewer.js | function(selector, options) {
var self = this;
self.options = options || {};
self.selector = selector || 'img';
if (self.options.dbl) {
enterEventName = touchSupport ? 'doubletap' : 'dblclick';
}
self.findAllImage();
self.createViewer();
self.bindEvent();
} | javascript | function(selector, options) {
var self = this;
self.options = options || {};
self.selector = selector || 'img';
if (self.options.dbl) {
enterEventName = touchSupport ? 'doubletap' : 'dblclick';
}
self.findAllImage();
self.createViewer();
self.bindEvent();
} | [
"function",
"(",
"selector",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"self",
".",
"selector",
"=",
"selector",
"||",
"'img'",
";",
"if",
"(",
"self",
".",
"options",
".... | 构造函数 | [
"构造函数"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.imageViewer.js#L40-L50 | train | Creates a new image viewer | [
30522,
3853,
1006,
27000,
1010,
7047,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2969,
1012,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
1025,
2969,
1012,
27000,
1027,
27000,
1064,
1064,
1005,
10047,
2290,
1005,
1025,
2065,
1006,
2969,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js | function(oList, bArrow){
function getPrevOnSameLevel(oLst){
var oParentRef = oLst.getParent();
var aParentSubLists = oParentRef.getSubLists();
var idx = oParentRef.indexOfSubList(oLst) - 1;
if (idx >= 0) {
return aParentSubLists[idx];
}
return null;
}
function getListOrLastChild(oLst){
var aSubLists = oLst.getSubLists();
if (aSubLists.length > 0) {
return getListOrLastChild(aSubLists[aSubLists.length - 1]);
}
return oLst;
}
if (oList._iLevel == 0) {
return null;
} else if (oList._iLevel == 1) {
if (bArrow) {
return null;
}
var oPrevList = getPrevOnSameLevel(oList);
if (oPrevList) {
return oPrevList;
}
return oList.getParent();
} else if (oList._iLevel > 1) {
var oPrevList = getPrevOnSameLevel(oList);
if (oPrevList) {
return getListOrLastChild(oPrevList);
}
var oParent = oList.getParent();
if (oParent._iLevel >= 1) {
return oParent;
}
}
return null;
} | javascript | function(oList, bArrow){
function getPrevOnSameLevel(oLst){
var oParentRef = oLst.getParent();
var aParentSubLists = oParentRef.getSubLists();
var idx = oParentRef.indexOfSubList(oLst) - 1;
if (idx >= 0) {
return aParentSubLists[idx];
}
return null;
}
function getListOrLastChild(oLst){
var aSubLists = oLst.getSubLists();
if (aSubLists.length > 0) {
return getListOrLastChild(aSubLists[aSubLists.length - 1]);
}
return oLst;
}
if (oList._iLevel == 0) {
return null;
} else if (oList._iLevel == 1) {
if (bArrow) {
return null;
}
var oPrevList = getPrevOnSameLevel(oList);
if (oPrevList) {
return oPrevList;
}
return oList.getParent();
} else if (oList._iLevel > 1) {
var oPrevList = getPrevOnSameLevel(oList);
if (oPrevList) {
return getListOrLastChild(oPrevList);
}
var oParent = oList.getParent();
if (oParent._iLevel >= 1) {
return oParent;
}
}
return null;
} | [
"function",
"(",
"oList",
",",
"bArrow",
")",
"{",
"function",
"getPrevOnSameLevel",
"(",
"oLst",
")",
"{",
"var",
"oParentRef",
"=",
"oLst",
".",
"getParent",
"(",
")",
";",
"var",
"aParentSubLists",
"=",
"oParentRef",
".",
"getSubLists",
"(",
")",
";",
... | ********* LOCAL HELPERS ********* Returns the predecessor of the given list based on the level and whether TAB or the arrow keys are used | [
"*********",
"LOCAL",
"HELPERS",
"*********",
"Returns",
"the",
"predecessor",
"of",
"the",
"given",
"list",
"based",
"on",
"the",
"level",
"and",
"whether",
"TAB",
"or",
"the",
"arrow",
"keys",
"are",
"used"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js#L916-L957 | train | Returns the previous list or last child of the list | [
30522,
3853,
1006,
19330,
2923,
1010,
15355,
1007,
1063,
3853,
2131,
28139,
17789,
21559,
12260,
15985,
1006,
19330,
3367,
1007,
1063,
13075,
6728,
12069,
3372,
2890,
2546,
1027,
19330,
3367,
1012,
2131,
19362,
4765,
1006,
1007,
1025,
13075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
lovell/sharp | lib/input.js | limitInputPixels | function limitInputPixels (limit) {
// if we pass in false we represent the integer as 0 to disable
if (limit === false) {
limit = 0;
} else if (limit === true) {
limit = Math.pow(0x3FFF, 2);
}
if (is.integer(limit) && limit >= 0) {
this.options.limitInputPixels = limit;
} else {
throw is.invalidParameterError('limitInputPixels', 'integer', limit);
}
return this;
} | javascript | function limitInputPixels (limit) {
// if we pass in false we represent the integer as 0 to disable
if (limit === false) {
limit = 0;
} else if (limit === true) {
limit = Math.pow(0x3FFF, 2);
}
if (is.integer(limit) && limit >= 0) {
this.options.limitInputPixels = limit;
} else {
throw is.invalidParameterError('limitInputPixels', 'integer', limit);
}
return this;
} | [
"function",
"limitInputPixels",
"(",
"limit",
")",
"{",
"// if we pass in false we represent the integer as 0 to disable",
"if",
"(",
"limit",
"===",
"false",
")",
"{",
"limit",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"limit",
"===",
"true",
")",
"{",
"limit",
... | Do not process input images where the number of pixels (width x height) exceeds this limit.
Assumes image dimensions contained in the input metadata can be trusted.
The default limit is 268402689 (0x3FFF x 0x3FFF) pixels.
@param {(Number|Boolean)} limit - an integral Number of pixels, zero or false to remove limit, true to use default limit.
@returns {Sharp}
@throws {Error} Invalid limit | [
"Do",
"not",
"process",
"input",
"images",
"where",
"the",
"number",
"of",
"pixels",
"(",
"width",
"x",
"height",
")",
"exceeds",
"this",
"limit",
".",
"Assumes",
"image",
"dimensions",
"contained",
"in",
"the",
"input",
"metadata",
"can",
"be",
"trusted",
... | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/input.js#L342-L355 | train | Sets the limit of input pixels for the image. | [
30522,
3853,
5787,
2378,
18780,
8197,
2595,
9050,
1006,
5787,
1007,
1063,
1013,
1013,
2065,
2057,
3413,
1999,
6270,
2057,
5050,
1996,
16109,
2004,
1014,
2000,
4487,
19150,
2065,
1006,
5787,
1027,
1027,
1027,
6270,
1007,
1063,
5787,
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.table/src/sap/ui/table/TablePointerExtension.js | function() {
this._ExtensionHelper = ExtensionHelper;
this._ColumnResizeHelper = ColumnResizeHelper;
this._InteractiveResizeHelper = InteractiveResizeHelper;
this._ReorderHelper = ReorderHelper;
this._ExtensionDelegate = ExtensionDelegate;
this._RowHoverHandler = RowHoverHandler;
this._KNOWNCLICKABLECONTROLS = KNOWNCLICKABLECONTROLS;
} | javascript | function() {
this._ExtensionHelper = ExtensionHelper;
this._ColumnResizeHelper = ColumnResizeHelper;
this._InteractiveResizeHelper = InteractiveResizeHelper;
this._ReorderHelper = ReorderHelper;
this._ExtensionDelegate = ExtensionDelegate;
this._RowHoverHandler = RowHoverHandler;
this._KNOWNCLICKABLECONTROLS = KNOWNCLICKABLECONTROLS;
} | [
"function",
"(",
")",
"{",
"this",
".",
"_ExtensionHelper",
"=",
"ExtensionHelper",
";",
"this",
".",
"_ColumnResizeHelper",
"=",
"ColumnResizeHelper",
";",
"this",
".",
"_InteractiveResizeHelper",
"=",
"InteractiveResizeHelper",
";",
"this",
".",
"_ReorderHelper",
... | Enables debugging for the extension. Internal helper classes become accessible.
@private | [
"Enables",
"debugging",
"for",
"the",
"extension",
".",
"Internal",
"helper",
"classes",
"become",
"accessible",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L979-L987 | train | This is the constructor of the object that is passed to the constructor. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1035,
5331,
16001,
4842,
1027,
5331,
16001,
4842,
1025,
2023,
1012,
1035,
5930,
6072,
4697,
16001,
4842,
1027,
5930,
6072,
4697,
16001,
4842,
1025,
2023,
1012,
1035,
9123,
6072,
4697,
16001,
4842,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dimsemenov/PhotoSwipe | src/js/gestures.js | function(axis, delta) {
var panFriction,
overDiff = 0,
newOffset = _panOffset[axis] + delta[axis],
startOverDiff,
dir = delta[axis] > 0,
newMainScrollPosition = _mainScrollPos.x + delta.x,
mainScrollDiff = _mainScrollPos.x - _startMainScrollPos.x,
newPanPos,
newMainScrollPos;
// calculate fdistance over the bounds and friction
if(newOffset > _currPanBounds.min[axis] || newOffset < _currPanBounds.max[axis]) {
panFriction = _options.panEndFriction;
// Linear increasing of friction, so at 1/4 of viewport it's at max value.
// Looks not as nice as was expected. Left for history.
// panFriction = (1 - (_panOffset[axis] + delta[axis] + panBounds.min[axis]) / (_viewportSize[axis] / 4) );
} else {
panFriction = 1;
}
newOffset = _panOffset[axis] + delta[axis] * panFriction;
// move main scroll or start panning
if(_options.allowPanToNext || _currZoomLevel === self.currItem.initialZoomLevel) {
if(!_currZoomElementStyle) {
newMainScrollPos = newMainScrollPosition;
} else if(_direction === 'h' && axis === 'x' && !_zoomStarted ) {
if(dir) {
if(newOffset > _currPanBounds.min[axis]) {
panFriction = _options.panEndFriction;
overDiff = _currPanBounds.min[axis] - newOffset;
startOverDiff = _currPanBounds.min[axis] - _startPanOffset[axis];
}
// drag right
if( (startOverDiff <= 0 || mainScrollDiff < 0) && _getNumItems() > 1 ) {
newMainScrollPos = newMainScrollPosition;
if(mainScrollDiff < 0 && newMainScrollPosition > _startMainScrollPos.x) {
newMainScrollPos = _startMainScrollPos.x;
}
} else {
if(_currPanBounds.min.x !== _currPanBounds.max.x) {
newPanPos = newOffset;
}
}
} else {
if(newOffset < _currPanBounds.max[axis] ) {
panFriction =_options.panEndFriction;
overDiff = newOffset - _currPanBounds.max[axis];
startOverDiff = _startPanOffset[axis] - _currPanBounds.max[axis];
}
if( (startOverDiff <= 0 || mainScrollDiff > 0) && _getNumItems() > 1 ) {
newMainScrollPos = newMainScrollPosition;
if(mainScrollDiff > 0 && newMainScrollPosition < _startMainScrollPos.x) {
newMainScrollPos = _startMainScrollPos.x;
}
} else {
if(_currPanBounds.min.x !== _currPanBounds.max.x) {
newPanPos = newOffset;
}
}
}
//
}
if(axis === 'x') {
if(newMainScrollPos !== undefined) {
_moveMainScroll(newMainScrollPos, true);
if(newMainScrollPos === _startMainScrollPos.x) {
_mainScrollShifted = false;
} else {
_mainScrollShifted = true;
}
}
if(_currPanBounds.min.x !== _currPanBounds.max.x) {
if(newPanPos !== undefined) {
_panOffset.x = newPanPos;
} else if(!_mainScrollShifted) {
_panOffset.x += delta.x * panFriction;
}
}
return newMainScrollPos !== undefined;
}
}
if(!_mainScrollAnimating) {
if(!_mainScrollShifted) {
if(_currZoomLevel > self.currItem.fitRatio) {
_panOffset[axis] += delta[axis] * panFriction;
}
}
}
} | javascript | function(axis, delta) {
var panFriction,
overDiff = 0,
newOffset = _panOffset[axis] + delta[axis],
startOverDiff,
dir = delta[axis] > 0,
newMainScrollPosition = _mainScrollPos.x + delta.x,
mainScrollDiff = _mainScrollPos.x - _startMainScrollPos.x,
newPanPos,
newMainScrollPos;
// calculate fdistance over the bounds and friction
if(newOffset > _currPanBounds.min[axis] || newOffset < _currPanBounds.max[axis]) {
panFriction = _options.panEndFriction;
// Linear increasing of friction, so at 1/4 of viewport it's at max value.
// Looks not as nice as was expected. Left for history.
// panFriction = (1 - (_panOffset[axis] + delta[axis] + panBounds.min[axis]) / (_viewportSize[axis] / 4) );
} else {
panFriction = 1;
}
newOffset = _panOffset[axis] + delta[axis] * panFriction;
// move main scroll or start panning
if(_options.allowPanToNext || _currZoomLevel === self.currItem.initialZoomLevel) {
if(!_currZoomElementStyle) {
newMainScrollPos = newMainScrollPosition;
} else if(_direction === 'h' && axis === 'x' && !_zoomStarted ) {
if(dir) {
if(newOffset > _currPanBounds.min[axis]) {
panFriction = _options.panEndFriction;
overDiff = _currPanBounds.min[axis] - newOffset;
startOverDiff = _currPanBounds.min[axis] - _startPanOffset[axis];
}
// drag right
if( (startOverDiff <= 0 || mainScrollDiff < 0) && _getNumItems() > 1 ) {
newMainScrollPos = newMainScrollPosition;
if(mainScrollDiff < 0 && newMainScrollPosition > _startMainScrollPos.x) {
newMainScrollPos = _startMainScrollPos.x;
}
} else {
if(_currPanBounds.min.x !== _currPanBounds.max.x) {
newPanPos = newOffset;
}
}
} else {
if(newOffset < _currPanBounds.max[axis] ) {
panFriction =_options.panEndFriction;
overDiff = newOffset - _currPanBounds.max[axis];
startOverDiff = _startPanOffset[axis] - _currPanBounds.max[axis];
}
if( (startOverDiff <= 0 || mainScrollDiff > 0) && _getNumItems() > 1 ) {
newMainScrollPos = newMainScrollPosition;
if(mainScrollDiff > 0 && newMainScrollPosition < _startMainScrollPos.x) {
newMainScrollPos = _startMainScrollPos.x;
}
} else {
if(_currPanBounds.min.x !== _currPanBounds.max.x) {
newPanPos = newOffset;
}
}
}
//
}
if(axis === 'x') {
if(newMainScrollPos !== undefined) {
_moveMainScroll(newMainScrollPos, true);
if(newMainScrollPos === _startMainScrollPos.x) {
_mainScrollShifted = false;
} else {
_mainScrollShifted = true;
}
}
if(_currPanBounds.min.x !== _currPanBounds.max.x) {
if(newPanPos !== undefined) {
_panOffset.x = newPanPos;
} else if(!_mainScrollShifted) {
_panOffset.x += delta.x * panFriction;
}
}
return newMainScrollPos !== undefined;
}
}
if(!_mainScrollAnimating) {
if(!_mainScrollShifted) {
if(_currZoomLevel > self.currItem.fitRatio) {
_panOffset[axis] += delta[axis] * panFriction;
}
}
}
} | [
"function",
"(",
"axis",
",",
"delta",
")",
"{",
"var",
"panFriction",
",",
"overDiff",
"=",
"0",
",",
"newOffset",
"=",
"_panOffset",
"[",
"axis",
"]",
"+",
"delta",
"[",
"axis",
"]",
",",
"startOverDiff",
",",
"dir",
"=",
"delta",
"[",
"axis",
"]",... | amount of pixels to drag to determine direction of swipe | [
"amount",
"of",
"pixels",
"to",
"drag",
"to",
"determine",
"direction",
"of",
"swipe"
] | 80607e12542a1a54ecefa837649e862b35dffd25 | https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L175-L292 | train | Pan the given axis by the given delta. | [
30522,
3853,
1006,
8123,
1010,
7160,
1007,
1063,
13075,
6090,
19699,
28097,
1010,
2058,
4305,
4246,
1027,
1014,
1010,
2047,
27475,
3388,
1027,
1035,
6090,
27475,
3388,
1031,
8123,
1033,
1009,
7160,
1031,
8123,
1033,
1010,
2707,
7840,
4305,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | templateFragment | function templateFragment(oElement, oWithControl) {
var sFragmentName = oElement.getAttribute("fragmentName"),
oPromise = getResolvedBinding(sFragmentName, oElement, oWithControl, true);
if (!oPromise) {
return oSyncPromiseResolved;
}
return oPromise.then(function (sFragmentName) {
var oOldScope = oScope;
oScope = Object.create(oScope);
return insertFragment(sFragmentName, oElement, oWithControl).then(function () {
oScope = oOldScope;
});
}, function (ex) {
warn(oElement, 'Error in formatter:', ex);
});
} | javascript | function templateFragment(oElement, oWithControl) {
var sFragmentName = oElement.getAttribute("fragmentName"),
oPromise = getResolvedBinding(sFragmentName, oElement, oWithControl, true);
if (!oPromise) {
return oSyncPromiseResolved;
}
return oPromise.then(function (sFragmentName) {
var oOldScope = oScope;
oScope = Object.create(oScope);
return insertFragment(sFragmentName, oElement, oWithControl).then(function () {
oScope = oOldScope;
});
}, function (ex) {
warn(oElement, 'Error in formatter:', ex);
});
} | [
"function",
"templateFragment",
"(",
"oElement",
",",
"oWithControl",
")",
"{",
"var",
"sFragmentName",
"=",
"oElement",
".",
"getAttribute",
"(",
"\"fragmentName\"",
")",
",",
"oPromise",
"=",
"getResolvedBinding",
"(",
"sFragmentName",
",",
"oElement",
",",
"oWi... | Loads and inlines the content of a <sap.ui.core:Fragment> element.
@param {Element} oElement
the <sap.ui.core:Fragment> XML DOM element
@param {sap.ui.core.util._with} oWithControl
the parent's "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as the fragment
has been inserted, or is rejected with a corresponding error if loading or visiting
fails. | [
"Loads",
"and",
"inlines",
"the",
"content",
"of",
"a",
"<sap",
".",
"ui",
".",
"core",
":",
"Fragment",
">",
"element",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1468-L1485 | train | templateFragment - template fragment | [
30522,
3853,
23561,
27843,
21693,
4765,
1006,
1051,
12260,
3672,
1010,
27593,
8939,
8663,
13181,
2140,
1007,
1063,
13075,
16420,
29181,
3672,
18442,
1027,
1051,
12260,
3672,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
1000,
15778,
18442,
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.core/src/sap/ui/core/LocaleData.js | function () {
var mCustomCurrencies = this._get("currency") || {},
mCustomCurrencyCodes = {};
Object.keys(mCustomCurrencies).forEach(function (sCurrencyKey) {
mCustomCurrencyCodes[sCurrencyKey] = sCurrencyKey;
});
return mCustomCurrencyCodes;
} | javascript | function () {
var mCustomCurrencies = this._get("currency") || {},
mCustomCurrencyCodes = {};
Object.keys(mCustomCurrencies).forEach(function (sCurrencyKey) {
mCustomCurrencyCodes[sCurrencyKey] = sCurrencyKey;
});
return mCustomCurrencyCodes;
} | [
"function",
"(",
")",
"{",
"var",
"mCustomCurrencies",
"=",
"this",
".",
"_get",
"(",
"\"currency\"",
")",
"||",
"{",
"}",
",",
"mCustomCurrencyCodes",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"mCustomCurrencies",
")",
".",
"forEach",
"(",
"functi... | Returns a map of custom currency codes, defined via global configuration.
@returns {object} map of custom currency codes, e.g.
{
"AUD": "AUD",
"BRL": "BRL",
"EUR": "EUR",
"GBP": "GBP",
}
@sap-restricted sap.ui.core.format.NumberFormat
@private
@since 1.63 | [
"Returns",
"a",
"map",
"of",
"custom",
"currency",
"codes",
"defined",
"via",
"global",
"configuration",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L944-L953 | train | Returns the custom currency codes | [
30522,
3853,
1006,
1007,
1063,
13075,
11338,
19966,
5358,
10841,
14343,
14767,
1027,
2023,
1012,
1035,
2131,
1006,
1000,
9598,
1000,
1007,
1064,
1064,
1063,
1065,
1010,
11338,
19966,
5358,
10841,
14343,
9407,
23237,
1027,
1063,
1065,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/search/FindInFiles.js | getNextPageofSearchResults | function getNextPageofSearchResults() {
var searchDeferred = $.Deferred();
if (searchModel.allResultsAvailable) {
return searchDeferred.resolve().promise();
}
_updateChangedDocs();
FindUtils.notifyNodeSearchStarted();
searchDomain.exec("nextPage")
.done(function (rcvd_object) {
FindUtils.notifyNodeSearchFinished();
if (searchModel.results) {
var resultEntry;
for (resultEntry in rcvd_object.results ) {
if (rcvd_object.results.hasOwnProperty(resultEntry)) {
searchModel.results[resultEntry.toString()] = rcvd_object.results[resultEntry];
}
}
} else {
searchModel.results = rcvd_object.results;
}
searchModel.fireChanged();
searchDeferred.resolve();
})
.fail(function () {
FindUtils.notifyNodeSearchFinished();
console.log('node fails');
FindUtils.setNodeSearchDisabled(true);
searchDeferred.reject();
});
return searchDeferred.promise();
} | javascript | function getNextPageofSearchResults() {
var searchDeferred = $.Deferred();
if (searchModel.allResultsAvailable) {
return searchDeferred.resolve().promise();
}
_updateChangedDocs();
FindUtils.notifyNodeSearchStarted();
searchDomain.exec("nextPage")
.done(function (rcvd_object) {
FindUtils.notifyNodeSearchFinished();
if (searchModel.results) {
var resultEntry;
for (resultEntry in rcvd_object.results ) {
if (rcvd_object.results.hasOwnProperty(resultEntry)) {
searchModel.results[resultEntry.toString()] = rcvd_object.results[resultEntry];
}
}
} else {
searchModel.results = rcvd_object.results;
}
searchModel.fireChanged();
searchDeferred.resolve();
})
.fail(function () {
FindUtils.notifyNodeSearchFinished();
console.log('node fails');
FindUtils.setNodeSearchDisabled(true);
searchDeferred.reject();
});
return searchDeferred.promise();
} | [
"function",
"getNextPageofSearchResults",
"(",
")",
"{",
"var",
"searchDeferred",
"=",
"$",
".",
"Deferred",
"(",
")",
";",
"if",
"(",
"searchModel",
".",
"allResultsAvailable",
")",
"{",
"return",
"searchDeferred",
".",
"resolve",
"(",
")",
".",
"promise",
... | Gets the next page of search results to append to the result set.
@return {object} A promise that's resolved with the search results or rejected when the find competes. | [
"Gets",
"the",
"next",
"page",
"of",
"search",
"results",
"to",
"append",
"to",
"the",
"result",
"set",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindInFiles.js#L951-L981 | train | Get next page of results | [
30522,
3853,
2131,
2638,
18413,
13704,
11253,
17310,
11140,
6072,
11314,
2015,
1006,
1007,
1063,
13075,
3945,
3207,
7512,
5596,
1027,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
2065,
1006,
3945,
5302,
9247,
1012,
2035,
6072,
11314,
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... |
aws/aws-sdk-js | scripts/lib/remove-event-stream-ops.js | removeEventStreamOperations | function removeEventStreamOperations(model) {
var modifiedModel = false;
// loop over all operations
var operations = model.operations;
var operationNames = Object.keys(operations);
for (var i = 0; i < operationNames.length; i++) {
var operationName = operationNames[i];
var operation = operations[operationName];
// check input and output shapes
var inputShapeName = operation.input && operation.input.shape;
var outputShapeName = operation.output && operation.output.shape;
var requiresEventStream = false;
if (inputShapeName && hasEventStream(model.shapes[inputShapeName], model)) {
requiresEventStream = true;
}
if (requiresEventStream) {
modifiedModel = true;
// remove the operation from the model
console.log('Removing ' + operationName + ' because it depends on event streams on input.');
delete model.operations[operationName];
}
}
return modifiedModel;
} | javascript | function removeEventStreamOperations(model) {
var modifiedModel = false;
// loop over all operations
var operations = model.operations;
var operationNames = Object.keys(operations);
for (var i = 0; i < operationNames.length; i++) {
var operationName = operationNames[i];
var operation = operations[operationName];
// check input and output shapes
var inputShapeName = operation.input && operation.input.shape;
var outputShapeName = operation.output && operation.output.shape;
var requiresEventStream = false;
if (inputShapeName && hasEventStream(model.shapes[inputShapeName], model)) {
requiresEventStream = true;
}
if (requiresEventStream) {
modifiedModel = true;
// remove the operation from the model
console.log('Removing ' + operationName + ' because it depends on event streams on input.');
delete model.operations[operationName];
}
}
return modifiedModel;
} | [
"function",
"removeEventStreamOperations",
"(",
"model",
")",
"{",
"var",
"modifiedModel",
"=",
"false",
";",
"// loop over all operations",
"var",
"operations",
"=",
"model",
".",
"operations",
";",
"var",
"operationNames",
"=",
"Object",
".",
"keys",
"(",
"opera... | Removes operations from the model if they require event streams.
Specifically looks at input and output shapes.
@param {Object} model - JSON parsed API model (*.normal.json) | [
"Removes",
"operations",
"from",
"the",
"model",
"if",
"they",
"require",
"event",
"streams",
".",
"Specifically",
"looks",
"at",
"input",
"and",
"output",
"shapes",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/scripts/lib/remove-event-stream-ops.js#L6-L31 | train | Remove event streams from the model | [
30522,
3853,
6366,
18697,
7666,
25379,
25918,
10708,
1006,
2944,
1007,
1063,
13075,
6310,
5302,
9247,
1027,
6270,
1025,
1013,
1013,
7077,
2058,
2035,
3136,
13075,
3136,
1027,
2944,
1012,
3136,
1025,
13075,
3169,
18442,
2015,
1027,
4874,
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... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableUtils.js | function(oTable) {
var iFixedBottomRowCount = oTable.getFixedBottomRowCount();
var oBinding = oTable.getBinding("rows");
var iFirstFixedBottomIndex = -1;
if (oBinding && iFixedBottomRowCount > 0) {
var iVisibleRowCount = oTable.getVisibleRowCount();
var iFirstVisibleRow = oTable.getFirstVisibleRow();
var iTotalRowCount = oTable._getTotalRowCount();
if (iTotalRowCount >= iVisibleRowCount) {
iFirstFixedBottomIndex = iVisibleRowCount - iFixedBottomRowCount;
} else {
var iIdx = iTotalRowCount - iFixedBottomRowCount - iFirstVisibleRow;
if (iIdx >= 0 && (iFirstVisibleRow + iIdx) < iTotalRowCount) {
iFirstFixedBottomIndex = iIdx;
}
}
}
return iFirstFixedBottomIndex;
} | javascript | function(oTable) {
var iFixedBottomRowCount = oTable.getFixedBottomRowCount();
var oBinding = oTable.getBinding("rows");
var iFirstFixedBottomIndex = -1;
if (oBinding && iFixedBottomRowCount > 0) {
var iVisibleRowCount = oTable.getVisibleRowCount();
var iFirstVisibleRow = oTable.getFirstVisibleRow();
var iTotalRowCount = oTable._getTotalRowCount();
if (iTotalRowCount >= iVisibleRowCount) {
iFirstFixedBottomIndex = iVisibleRowCount - iFixedBottomRowCount;
} else {
var iIdx = iTotalRowCount - iFixedBottomRowCount - iFirstVisibleRow;
if (iIdx >= 0 && (iFirstVisibleRow + iIdx) < iTotalRowCount) {
iFirstFixedBottomIndex = iIdx;
}
}
}
return iFirstFixedBottomIndex;
} | [
"function",
"(",
"oTable",
")",
"{",
"var",
"iFixedBottomRowCount",
"=",
"oTable",
".",
"getFixedBottomRowCount",
"(",
")",
";",
"var",
"oBinding",
"=",
"oTable",
".",
"getBinding",
"(",
"\"rows\"",
")",
";",
"var",
"iFirstFixedBottomIndex",
"=",
"-",
"1",
"... | Returns the index of the first fixed bottom row in the <code>rows</code> aggregation.
@param {sap.ui.table.Table} oTable Instance of the table.
@returns {int} The index of the first fixed bottom row in the <code>rows</code> aggregation, or <code>-1</code>. | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"fixed",
"bottom",
"row",
"in",
"the",
"<code",
">",
"rows<",
"/",
"code",
">",
"aggregation",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1119-L1140 | train | Returns the index of the bottom row of the table. | [
30522,
3853,
1006,
27178,
3085,
1007,
1063,
13075,
2065,
7646,
2098,
18384,
20389,
10524,
3597,
16671,
1027,
27178,
3085,
1012,
2131,
23901,
18384,
20389,
10524,
3597,
16671,
1006,
1007,
1025,
13075,
27885,
22254,
2075,
1027,
30524,
20389,
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/extensions/default/JavaScriptRefactoring/RefactoringUtils.js | isStandAloneExpression | function isStandAloneExpression(text) {
var found = ASTWalker.findNodeAt(getAST(text), 0, text.length, function (nodeType, node) {
if (nodeType === "Expression") {
return true;
}
return false;
});
return found && found.node;
} | javascript | function isStandAloneExpression(text) {
var found = ASTWalker.findNodeAt(getAST(text), 0, text.length, function (nodeType, node) {
if (nodeType === "Expression") {
return true;
}
return false;
});
return found && found.node;
} | [
"function",
"isStandAloneExpression",
"(",
"text",
")",
"{",
"var",
"found",
"=",
"ASTWalker",
".",
"findNodeAt",
"(",
"getAST",
"(",
"text",
")",
",",
"0",
",",
"text",
".",
"length",
",",
"function",
"(",
"nodeType",
",",
"node",
")",
"{",
"if",
"(",... | Checks whether the text forms a stand alone expression without considering the context of text
@param {!string} text
@return {boolean} | [
"Checks",
"whether",
"the",
"text",
"forms",
"a",
"stand",
"alone",
"expression",
"without",
"considering",
"the",
"context",
"of",
"text"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js#L187-L195 | train | Check if the given text is a stand alone expression | [
30522,
3853,
26354,
5794,
9305,
5643,
10288,
20110,
3258,
1006,
3793,
1007,
1063,
13075,
2179,
1027,
2004,
2102,
26965,
1012,
2424,
3630,
3207,
4017,
1006,
2131,
14083,
1006,
3793,
1007,
1010,
1014,
1010,
3793,
1012,
3091,
1010,
3853,
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-unused-vars.js | isInside | function isInside(inner, outer) {
return (
inner.range[0] >= outer.range[0] &&
inner.range[1] <= outer.range[1]
);
} | javascript | function isInside(inner, outer) {
return (
inner.range[0] >= outer.range[0] &&
inner.range[1] <= outer.range[1]
);
} | [
"function",
"isInside",
"(",
"inner",
",",
"outer",
")",
"{",
"return",
"(",
"inner",
".",
"range",
"[",
"0",
"]",
">=",
"outer",
".",
"range",
"[",
"0",
"]",
"&&",
"inner",
".",
"range",
"[",
"1",
"]",
"<=",
"outer",
".",
"range",
"[",
"1",
"]... | Checks the position of given nodes.
@param {ASTNode} inner - A node which is expected as inside.
@param {ASTNode} outer - A node which is expected as outside.
@returns {boolean} `true` if the `inner` node exists in the `outer` node.
@private | [
"Checks",
"the",
"position",
"of",
"given",
"nodes",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-unused-vars.js#L261-L266 | train | Check if inner is inside outer | [
30522,
3853,
2003,
7076,
5178,
1006,
5110,
1010,
6058,
1007,
1063,
2709,
1006,
5110,
1012,
2846,
1031,
1014,
1033,
1028,
1027,
6058,
1012,
2846,
1031,
1014,
1033,
1004,
1004,
5110,
1012,
2846,
1031,
1015,
1033,
1026,
1027,
6058,
1012,
284... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | examples/measure.js | createMeasureTooltip | function createMeasureTooltip() {
if (measureTooltipElement) {
measureTooltipElement.parentNode.removeChild(measureTooltipElement);
}
measureTooltipElement = document.createElement('div');
measureTooltipElement.className = 'ol-tooltip ol-tooltip-measure';
measureTooltip = new Overlay({
element: measureTooltipElement,
offset: [0, -15],
positioning: 'bottom-center'
});
map.addOverlay(measureTooltip);
} | javascript | function createMeasureTooltip() {
if (measureTooltipElement) {
measureTooltipElement.parentNode.removeChild(measureTooltipElement);
}
measureTooltipElement = document.createElement('div');
measureTooltipElement.className = 'ol-tooltip ol-tooltip-measure';
measureTooltip = new Overlay({
element: measureTooltipElement,
offset: [0, -15],
positioning: 'bottom-center'
});
map.addOverlay(measureTooltip);
} | [
"function",
"createMeasureTooltip",
"(",
")",
"{",
"if",
"(",
"measureTooltipElement",
")",
"{",
"measureTooltipElement",
".",
"parentNode",
".",
"removeChild",
"(",
"measureTooltipElement",
")",
";",
"}",
"measureTooltipElement",
"=",
"document",
".",
"createElement"... | Creates a new measure tooltip | [
"Creates",
"a",
"new",
"measure",
"tooltip"
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/measure.js#L261-L273 | train | Creates a new measure tooltip element | [
30522,
3853,
3443,
4168,
3022,
5397,
3406,
27914,
11514,
1006,
1007,
1063,
2065,
1006,
5468,
3406,
27914,
15457,
16930,
4765,
1007,
1063,
5468,
3406,
27914,
15457,
16930,
4765,
1012,
6687,
3630,
3207,
1012,
6366,
19339,
1006,
5468,
3406,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/config/config-initializer.js | getModulesList | function getModulesList(config, installESLint) {
const modules = {};
// Create a list of modules which should be installed based on config
if (config.plugins) {
for (const plugin of config.plugins) {
modules[`eslint-plugin-${plugin}`] = "latest";
}
}
if (config.extends && config.extends.indexOf("eslint:") === -1) {
const moduleName = `eslint-config-${config.extends}`;
modules[moduleName] = "latest";
Object.assign(
modules,
getPeerDependencies(`${moduleName}@latest`)
);
}
if (installESLint === false) {
delete modules.eslint;
} else {
const installStatus = npmUtils.checkDevDeps(["eslint"]);
// Mark to show messages if it's new installation of eslint.
if (installStatus.eslint === false) {
log.info("Local ESLint installation not found.");
modules.eslint = modules.eslint || "latest";
config.installedESLint = true;
}
}
return Object.keys(modules).map(name => `${name}@${modules[name]}`);
} | javascript | function getModulesList(config, installESLint) {
const modules = {};
// Create a list of modules which should be installed based on config
if (config.plugins) {
for (const plugin of config.plugins) {
modules[`eslint-plugin-${plugin}`] = "latest";
}
}
if (config.extends && config.extends.indexOf("eslint:") === -1) {
const moduleName = `eslint-config-${config.extends}`;
modules[moduleName] = "latest";
Object.assign(
modules,
getPeerDependencies(`${moduleName}@latest`)
);
}
if (installESLint === false) {
delete modules.eslint;
} else {
const installStatus = npmUtils.checkDevDeps(["eslint"]);
// Mark to show messages if it's new installation of eslint.
if (installStatus.eslint === false) {
log.info("Local ESLint installation not found.");
modules.eslint = modules.eslint || "latest";
config.installedESLint = true;
}
}
return Object.keys(modules).map(name => `${name}@${modules[name]}`);
} | [
"function",
"getModulesList",
"(",
"config",
",",
"installESLint",
")",
"{",
"const",
"modules",
"=",
"{",
"}",
";",
"// Create a list of modules which should be installed based on config",
"if",
"(",
"config",
".",
"plugins",
")",
"{",
"for",
"(",
"const",
"plugin"... | Return necessary plugins, configs, parsers, etc. based on the config
@param {Object} config config object
@param {boolean} [installESLint=true] If `false` is given, it does not install eslint.
@returns {string[]} An array of modules to be installed. | [
"Return",
"necessary",
"plugins",
"configs",
"parsers",
"etc",
".",
"based",
"on",
"the",
"config"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-initializer.js#L94-L127 | train | Get list of modules which should be installed based on config | [
30522,
3853,
2131,
5302,
8566,
4244,
9863,
1006,
9530,
8873,
2290,
1010,
16500,
2229,
4115,
2102,
1007,
1063,
9530,
3367,
14184,
1027,
1063,
1065,
1025,
1013,
1013,
3443,
1037,
2862,
1997,
14184,
2029,
2323,
2022,
5361,
2241,
2006,
9530,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/utils/src-loader.js | validateSrc | function validateSrc (src, isImageCb, isVideoCb) {
checkIsImage(src, function isAnImageUrl (isImage) {
if (isImage) {
isImageCb(src);
return;
}
isVideoCb(src);
});
} | javascript | function validateSrc (src, isImageCb, isVideoCb) {
checkIsImage(src, function isAnImageUrl (isImage) {
if (isImage) {
isImageCb(src);
return;
}
isVideoCb(src);
});
} | [
"function",
"validateSrc",
"(",
"src",
",",
"isImageCb",
",",
"isVideoCb",
")",
"{",
"checkIsImage",
"(",
"src",
",",
"function",
"isAnImageUrl",
"(",
"isImage",
")",
"{",
"if",
"(",
"isImage",
")",
"{",
"isImageCb",
"(",
"src",
")",
";",
"return",
";",
... | Validate a texture, either as a selector or as a URL.
Detects whether `src` is pointing to an image or video and invokes the appropriate
callback.
`src` will be passed into the callback
@params {string|Element} src - URL or media element.
@params {function} isImageCb - callback if texture is an image.
@params {function} isVideoCb - callback if texture is a video. | [
"Validate",
"a",
"texture",
"either",
"as",
"a",
"selector",
"or",
"as",
"a",
"URL",
".",
"Detects",
"whether",
"src",
"is",
"pointing",
"to",
"an",
"image",
"or",
"video",
"and",
"invokes",
"the",
"appropriate",
"callback",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/utils/src-loader.js#L17-L25 | train | Validate src | [
30522,
3853,
9398,
8520,
11890,
1006,
5034,
2278,
1010,
2003,
9581,
3351,
27421,
1010,
2003,
17258,
8780,
27421,
1007,
1063,
4638,
17417,
26860,
1006,
5034,
2278,
1010,
3853,
18061,
3490,
26860,
3126,
2140,
1006,
2003,
9581,
3351,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
catapult-project/catapult | netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js | disableTextSelectAndDrag | function disableTextSelectAndDrag(opt_allowSelectStart, opt_allowDragStart) {
// Disable text selection.
document.onselectstart = function(e) {
if (!(opt_allowSelectStart && opt_allowSelectStart.call(this, e)))
e.preventDefault();
};
// Disable dragging.
document.ondragstart = function(e) {
if (!(opt_allowDragStart && opt_allowDragStart.call(this, e)))
e.preventDefault();
};
} | javascript | function disableTextSelectAndDrag(opt_allowSelectStart, opt_allowDragStart) {
// Disable text selection.
document.onselectstart = function(e) {
if (!(opt_allowSelectStart && opt_allowSelectStart.call(this, e)))
e.preventDefault();
};
// Disable dragging.
document.ondragstart = function(e) {
if (!(opt_allowDragStart && opt_allowDragStart.call(this, e)))
e.preventDefault();
};
} | [
"function",
"disableTextSelectAndDrag",
"(",
"opt_allowSelectStart",
",",
"opt_allowDragStart",
")",
"{",
"// Disable text selection.",
"document",
".",
"onselectstart",
"=",
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"(",
"opt_allowSelectStart",
"&&",
"opt_allow... | Disables text selection and dragging, with optional whitelist callbacks.
@param {function(Event):boolean=} opt_allowSelectStart Unless this function
is defined and returns true, the onselectionstart event will be
surpressed.
@param {function(Event):boolean=} opt_allowDragStart Unless this function
is defined and returns true, the ondragstart event will be surpressed. | [
"Disables",
"text",
"selection",
"and",
"dragging",
"with",
"optional",
"whitelist",
"callbacks",
"."
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L148-L160 | train | Disable text selection and dragging | [
30522,
3853,
4487,
19150,
18209,
11246,
22471,
5685,
7265,
2290,
1006,
23569,
1035,
4473,
12260,
16649,
7559,
2102,
1010,
23569,
1035,
3499,
7265,
5620,
7559,
2102,
1007,
1063,
1013,
1013,
4487,
19150,
3793,
4989,
1012,
6254,
1012,
2006,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js | function (mAnnotations) {
if (mAnnotations.annotationsAtArrays) {
mAnnotations.annotationsAtArrays.forEach(function (aSegments) {
AnnotationParser.syncAnnotationsAtArrays(mAnnotations, aSegments);
});
}
} | javascript | function (mAnnotations) {
if (mAnnotations.annotationsAtArrays) {
mAnnotations.annotationsAtArrays.forEach(function (aSegments) {
AnnotationParser.syncAnnotationsAtArrays(mAnnotations, aSegments);
});
}
} | [
"function",
"(",
"mAnnotations",
")",
"{",
"if",
"(",
"mAnnotations",
".",
"annotationsAtArrays",
")",
"{",
"mAnnotations",
".",
"annotationsAtArrays",
".",
"forEach",
"(",
"function",
"(",
"aSegments",
")",
"{",
"AnnotationParser",
".",
"syncAnnotationsAtArrays",
... | Restores annotations at arrays which might have been lost due to serialization.
@param {object} mAnnotations - The annotation map
@protected
@see AnnotationParser.backupAnnotationAtArray
@see AnnotationParser.syncAnnotationsAtArrays
@static | [
"Restores",
"annotations",
"at",
"arrays",
"which",
"might",
"have",
"been",
"lost",
"due",
"to",
"serialization",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js#L504-L510 | train | Syncs the annotations at arrays. | [
30522,
3853,
1006,
10856,
17287,
9285,
1007,
1063,
2065,
1006,
10856,
17287,
9285,
1012,
5754,
17287,
9285,
6790,
11335,
7274,
1007,
1063,
10856,
17287,
9285,
1012,
5754,
17287,
9285,
6790,
11335,
7274,
1012,
18921,
6776,
1006,
3853,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function() {
if (!this._sLabelText && this._oParameterization._oQueryResult._oModel._oActivatedWorkarounds.CreateLabelsFromTechnicalNames) {
this._sLabelText = odata4analytics.helper.tokenizeNametoLabelText(this.getName());
}
return this._sLabelText;
} | javascript | function() {
if (!this._sLabelText && this._oParameterization._oQueryResult._oModel._oActivatedWorkarounds.CreateLabelsFromTechnicalNames) {
this._sLabelText = odata4analytics.helper.tokenizeNametoLabelText(this.getName());
}
return this._sLabelText;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_sLabelText",
"&&",
"this",
".",
"_oParameterization",
".",
"_oQueryResult",
".",
"_oModel",
".",
"_oActivatedWorkarounds",
".",
"CreateLabelsFromTechnicalNames",
")",
"{",
"this",
".",
"_sLabelText",
"=",... | Get label
@returns {string} The (possibly language-dependent) label text for this
parameter
@public
@function
@name sap.ui.model.analytics.odata4analytics.Parameter#getLabelText | [
"Get",
"label"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L1532-L1537 | train | Returns the label text for the given name. | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
999,
2023,
1012,
1035,
17584,
20042,
10288,
2102,
1004,
1004,
2023,
1012,
1035,
6728,
5400,
22828,
3989,
1012,
1035,
1051,
4226,
2854,
6072,
30524,
1035,
1051,
18908,
21967,
6198,
24490,
2015,
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... | |
muaz-khan/RTCMultiConnection | dev/MediaStreamRecorder.js | WhammyRecorder | function WhammyRecorder(mediaStream) {
// void start(optional long timeSlice)
// timestamp to fire "ondataavailable"
this.start = function(timeSlice) {
timeSlice = timeSlice || 1000;
mediaRecorder = new WhammyRecorderHelper(mediaStream, this);
for (var prop in this) {
if (typeof this[prop] !== 'function') {
mediaRecorder[prop] = this[prop];
}
}
mediaRecorder.record();
timeout = setInterval(function() {
mediaRecorder.requestData();
}, timeSlice);
};
this.stop = function() {
if (mediaRecorder) {
mediaRecorder.stop();
clearTimeout(timeout);
this.onstop();
}
};
this.onstop = function() {};
this.clearOldRecordedFrames = function() {
if (mediaRecorder) {
mediaRecorder.clearOldRecordedFrames();
}
};
this.pause = function() {
if (!mediaRecorder) {
return;
}
mediaRecorder.pause();
};
this.resume = function() {
if (!mediaRecorder) {
return;
}
mediaRecorder.resume();
};
this.ondataavailable = function() {};
// Reference to "WhammyRecorder" object
var mediaRecorder;
var timeout;
} | javascript | function WhammyRecorder(mediaStream) {
// void start(optional long timeSlice)
// timestamp to fire "ondataavailable"
this.start = function(timeSlice) {
timeSlice = timeSlice || 1000;
mediaRecorder = new WhammyRecorderHelper(mediaStream, this);
for (var prop in this) {
if (typeof this[prop] !== 'function') {
mediaRecorder[prop] = this[prop];
}
}
mediaRecorder.record();
timeout = setInterval(function() {
mediaRecorder.requestData();
}, timeSlice);
};
this.stop = function() {
if (mediaRecorder) {
mediaRecorder.stop();
clearTimeout(timeout);
this.onstop();
}
};
this.onstop = function() {};
this.clearOldRecordedFrames = function() {
if (mediaRecorder) {
mediaRecorder.clearOldRecordedFrames();
}
};
this.pause = function() {
if (!mediaRecorder) {
return;
}
mediaRecorder.pause();
};
this.resume = function() {
if (!mediaRecorder) {
return;
}
mediaRecorder.resume();
};
this.ondataavailable = function() {};
// Reference to "WhammyRecorder" object
var mediaRecorder;
var timeout;
} | [
"function",
"WhammyRecorder",
"(",
"mediaStream",
")",
"{",
"// void start(optional long timeSlice)",
"// timestamp to fire \"ondataavailable\"",
"this",
".",
"start",
"=",
"function",
"(",
"timeSlice",
")",
"{",
"timeSlice",
"=",
"timeSlice",
"||",
"1000",
";",
"mediaR... | =================== WhammyRecorder.js | [
"===================",
"WhammyRecorder",
".",
"js"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/MediaStreamRecorder.js#L1695-L1753 | train | WhammyRecorder constructor. | [
30522,
3853,
1059,
3511,
8029,
2890,
27108,
4063,
1006,
2865,
21422,
1007,
1063,
1013,
1013,
11675,
2707,
1006,
11887,
2146,
2335,
13231,
1007,
1013,
1013,
2335,
15464,
2361,
2000,
2543,
1000,
2006,
2850,
2696,
12462,
11733,
3468,
1000,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/WorkingSetView.js | _updateListItemSelection | function _updateListItemSelection(listItem, selectedFile) {
var shouldBeSelected = (selectedFile && $(listItem).data(_FILE_KEY).fullPath === selectedFile.fullPath);
ViewUtils.toggleClass($(listItem), "selected", shouldBeSelected);
} | javascript | function _updateListItemSelection(listItem, selectedFile) {
var shouldBeSelected = (selectedFile && $(listItem).data(_FILE_KEY).fullPath === selectedFile.fullPath);
ViewUtils.toggleClass($(listItem), "selected", shouldBeSelected);
} | [
"function",
"_updateListItemSelection",
"(",
"listItem",
",",
"selectedFile",
")",
"{",
"var",
"shouldBeSelected",
"=",
"(",
"selectedFile",
"&&",
"$",
"(",
"listItem",
")",
".",
"data",
"(",
"_FILE_KEY",
")",
".",
"fullPath",
"===",
"selectedFile",
".",
"full... | Updates the appearance of the list element based on the parameters provided.
@private
@param {!HTMLLIElement} listElement
@param {?File} selectedFile | [
"Updates",
"the",
"appearance",
"of",
"the",
"list",
"element",
"based",
"on",
"the",
"parameters",
"provided",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetView.js#L147-L150 | train | Update the list item selection | [
30522,
3853,
1035,
10651,
9863,
4221,
5244,
12260,
7542,
1006,
2862,
4221,
2213,
1010,
3479,
8873,
2571,
1007,
1063,
13075,
2323,
12681,
12260,
10985,
1027,
1006,
3479,
8873,
2571,
1004,
1004,
1002,
1006,
2862,
4221,
2213,
1007,
1012,
2951,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/editor/EditorCommandHandlers.js | _firstNotWs | function _firstNotWs(doc, lineNum) {
var text = doc.getLine(lineNum);
if (text === null || text === undefined) {
return 0;
}
return text.search(/\S|$/);
} | javascript | function _firstNotWs(doc, lineNum) {
var text = doc.getLine(lineNum);
if (text === null || text === undefined) {
return 0;
}
return text.search(/\S|$/);
} | [
"function",
"_firstNotWs",
"(",
"doc",
",",
"lineNum",
")",
"{",
"var",
"text",
"=",
"doc",
".",
"getLine",
"(",
"lineNum",
")",
";",
"if",
"(",
"text",
"===",
"null",
"||",
"text",
"===",
"undefined",
")",
"{",
"return",
"0",
";",
"}",
"return",
"... | Return the column of the first non whitespace char in the given line.
@private
@param {!Document} doc
@param {number} lineNum
@returns {number} the column index or null | [
"Return",
"the",
"column",
"of",
"the",
"first",
"non",
"whitespace",
"char",
"in",
"the",
"given",
"line",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorCommandHandlers.js#L308-L315 | train | Returns the first non - whitespace character in the line | [
30522,
3853,
1035,
2034,
17048,
9333,
1006,
9986,
1010,
17517,
2819,
1007,
1063,
13075,
3793,
1027,
9986,
1012,
2131,
4179,
1006,
17517,
2819,
1007,
1025,
2065,
1006,
3793,
1027,
1027,
1027,
19701,
1064,
1064,
3793,
1027,
1027,
1027,
6151,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/operator-assignment.js | canBeFixed | function canBeFixed(node) {
return node.type === "Identifier" ||
node.type === "MemberExpression" && node.object.type === "Identifier" && (!node.computed || node.property.type === "Literal");
} | javascript | function canBeFixed(node) {
return node.type === "Identifier" ||
node.type === "MemberExpression" && node.object.type === "Identifier" && (!node.computed || node.property.type === "Literal");
} | [
"function",
"canBeFixed",
"(",
"node",
")",
"{",
"return",
"node",
".",
"type",
"===",
"\"Identifier\"",
"||",
"node",
".",
"type",
"===",
"\"MemberExpression\"",
"&&",
"node",
".",
"object",
".",
"type",
"===",
"\"Identifier\"",
"&&",
"(",
"!",
"node",
".... | Determines if the left side of a node can be safely fixed (i.e. if it activates the same getters/setters and)
toString calls regardless of whether assignment shorthand is used)
@param {ASTNode} node The node on the left side of the expression
@returns {boolean} `true` if the node can be fixed | [
"Determines",
"if",
"the",
"left",
"side",
"of",
"a",
"node",
"can",
"be",
"safely",
"fixed",
"(",
"i",
".",
"e",
".",
"if",
"it",
"activates",
"the",
"same",
"getters",
"/",
"setters",
"and",
")",
"toString",
"calls",
"regardless",
"of",
"whether",
"a... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/operator-assignment.js#L85-L88 | train | Check whether a node can be fixed | [
30522,
3853,
2064,
4783,
23901,
1006,
13045,
1007,
1063,
2709,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
8909,
4765,
18095,
1000,
1064,
1064,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
2266,
10288,
20110,
3258,
1000,
1004,
1004,
13045,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | tools/internal-rules/no-invalid-meta.js | hasMetaDocsDescription | function hasMetaDocsDescription(metaPropertyNode) {
const metaDocs = getPropertyFromObject("docs", metaPropertyNode.value);
return metaDocs && getPropertyFromObject("description", metaDocs.value);
} | javascript | function hasMetaDocsDescription(metaPropertyNode) {
const metaDocs = getPropertyFromObject("docs", metaPropertyNode.value);
return metaDocs && getPropertyFromObject("description", metaDocs.value);
} | [
"function",
"hasMetaDocsDescription",
"(",
"metaPropertyNode",
")",
"{",
"const",
"metaDocs",
"=",
"getPropertyFromObject",
"(",
"\"docs\"",
",",
"metaPropertyNode",
".",
"value",
")",
";",
"return",
"metaDocs",
"&&",
"getPropertyFromObject",
"(",
"\"description\"",
"... | Whether this `meta` ObjectExpression has a `docs.description` property defined or not.
@param {ASTNode} metaPropertyNode The `meta` ObjectExpression for this rule.
@returns {boolean} `true` if a `docs.description` property exists. | [
"Whether",
"this",
"meta",
"ObjectExpression",
"has",
"a",
"docs",
".",
"description",
"property",
"defined",
"or",
"not",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/tools/internal-rules/no-invalid-meta.js#L62-L66 | train | Checks if the metaDocs property has a description property | [
30522,
3853,
2038,
11368,
9365,
6169,
6155,
23235,
3258,
1006,
18804,
21572,
4842,
25680,
10244,
1007,
1063,
9530,
3367,
18804,
3527,
6169,
1027,
2131,
21572,
4842,
3723,
19699,
19506,
2497,
20614,
1006,
1000,
9986,
2015,
1000,
1010,
18804,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/65_fods.js | ods_to_csf_formula | function ods_to_csf_formula(f/*:string*/)/*:string*/ {
if(f.slice(0,3) == "of:") f = f.slice(3);
/* 5.2 Basic Expressions */
if(f.charCodeAt(0) == 61) {
f = f.slice(1);
if(f.charCodeAt(0) == 61) f = f.slice(1);
}
f = f.replace(/COM\.MICROSOFT\./g, "");
/* Part 3 Section 5.8 References */
f = f.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g, function($$, $1) { return $1.replace(/\./g,""); });
/* TODO: something other than this */
f = f.replace(/\[.(#[A-Z]*[?!])\]/g, "$1");
return f.replace(/[;~]/g,",").replace(/\|/g,";");
} | javascript | function ods_to_csf_formula(f/*:string*/)/*:string*/ {
if(f.slice(0,3) == "of:") f = f.slice(3);
/* 5.2 Basic Expressions */
if(f.charCodeAt(0) == 61) {
f = f.slice(1);
if(f.charCodeAt(0) == 61) f = f.slice(1);
}
f = f.replace(/COM\.MICROSOFT\./g, "");
/* Part 3 Section 5.8 References */
f = f.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g, function($$, $1) { return $1.replace(/\./g,""); });
/* TODO: something other than this */
f = f.replace(/\[.(#[A-Z]*[?!])\]/g, "$1");
return f.replace(/[;~]/g,",").replace(/\|/g,";");
} | [
"function",
"ods_to_csf_formula",
"(",
"f",
"/*:string*/",
")",
"/*:string*/",
"{",
"if",
"(",
"f",
".",
"slice",
"(",
"0",
",",
"3",
")",
"==",
"\"of:\"",
")",
"f",
"=",
"f",
".",
"slice",
"(",
"3",
")",
";",
"/* 5.2 Basic Expressions */",
"if",
"(",
... | /* Part 3 TODO: actually parse formulae | [
"/",
"*",
"Part",
"3",
"TODO",
":",
"actually",
"parse",
"formulae"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/65_fods.js#L2-L15 | train | Convert an ODS formula to a CSF formula | [
30522,
3853,
1051,
5104,
1035,
2000,
1035,
20116,
2546,
1035,
5675,
1006,
1042,
1013,
1008,
1024,
5164,
1008,
1013,
1007,
1013,
1008,
1024,
5164,
1008,
1013,
1063,
2065,
1006,
1042,
1012,
14704,
1006,
1014,
1010,
1017,
1007,
1027,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netlify/netlify-cms | packages/netlify-cms-widget-markdown/src/serializers/slateRemark.js | processCodeMark | function processCodeMark(markTypes) {
const isInlineCode = markTypes.includes('inlineCode');
const filteredMarkTypes = isInlineCode ? without(markTypes, 'inlineCode') : markTypes;
const textNodeType = isInlineCode ? 'inlineCode' : 'html';
return { filteredMarkTypes, textNodeType };
} | javascript | function processCodeMark(markTypes) {
const isInlineCode = markTypes.includes('inlineCode');
const filteredMarkTypes = isInlineCode ? without(markTypes, 'inlineCode') : markTypes;
const textNodeType = isInlineCode ? 'inlineCode' : 'html';
return { filteredMarkTypes, textNodeType };
} | [
"function",
"processCodeMark",
"(",
"markTypes",
")",
"{",
"const",
"isInlineCode",
"=",
"markTypes",
".",
"includes",
"(",
"'inlineCode'",
")",
";",
"const",
"filteredMarkTypes",
"=",
"isInlineCode",
"?",
"without",
"(",
"markTypes",
",",
"'inlineCode'",
")",
"... | Slate treats inline code decoration as a standard mark, but MDAST does
not allow inline code nodes to contain children, only a single text
value. An MDAST inline code node can be nested within mark nodes such
as "emphasis" and "strong", but it cannot contain them.
Because of this, if a "code" mark (translated to MDAST "inlineCode") is
in the markTypes array, we make the base text node an "inlineCode" type
instead of a standard text node. | [
"Slate",
"treats",
"inline",
"code",
"decoration",
"as",
"a",
"standard",
"mark",
"but",
"MDAST",
"does",
"not",
"allow",
"inline",
"code",
"nodes",
"to",
"contain",
"children",
"only",
"a",
"single",
"text",
"value",
".",
"An",
"MDAST",
"inline",
"code",
... | 2488556590cbfdcefa626f2f2de01e7a160cf6ee | https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-widget-markdown/src/serializers/slateRemark.js#L142-L147 | train | Process inline code mark | [
30522,
3853,
2832,
16044,
10665,
1006,
2928,
13874,
2015,
1007,
1063,
9530,
3367,
2003,
2378,
4179,
16044,
1027,
2928,
13874,
2015,
1012,
2950,
1006,
1005,
23881,
16044,
1005,
1007,
1025,
9530,
3367,
21839,
10665,
13874,
2015,
1027,
2003,
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... |
SheetJS/js-xlsx | xlsx.js | parse_BOF | function parse_BOF(blob, length) {
var o = {BIFFVer:0, dt:0};
o.BIFFVer = blob.read_shift(2); length -= 2;
if(length >= 2) { o.dt = blob.read_shift(2); blob.l -= 2; }
switch(o.BIFFVer) {
case 0x0600: /* BIFF8 */
case 0x0500: /* BIFF5 */
case 0x0400: /* BIFF4 */
case 0x0300: /* BIFF3 */
case 0x0200: /* BIFF2 */
case 0x0002: case 0x0007: /* BIFF2 */
break;
default: if(length > 6) throw new Error("Unexpected BIFF Ver " + o.BIFFVer);
}
blob.read_shift(length);
return o;
} | javascript | function parse_BOF(blob, length) {
var o = {BIFFVer:0, dt:0};
o.BIFFVer = blob.read_shift(2); length -= 2;
if(length >= 2) { o.dt = blob.read_shift(2); blob.l -= 2; }
switch(o.BIFFVer) {
case 0x0600: /* BIFF8 */
case 0x0500: /* BIFF5 */
case 0x0400: /* BIFF4 */
case 0x0300: /* BIFF3 */
case 0x0200: /* BIFF2 */
case 0x0002: case 0x0007: /* BIFF2 */
break;
default: if(length > 6) throw new Error("Unexpected BIFF Ver " + o.BIFFVer);
}
blob.read_shift(length);
return o;
} | [
"function",
"parse_BOF",
"(",
"blob",
",",
"length",
")",
"{",
"var",
"o",
"=",
"{",
"BIFFVer",
":",
"0",
",",
"dt",
":",
"0",
"}",
";",
"o",
".",
"BIFFVer",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"length",
"-=",
"2",
";",
"if",
... | /* --- 2.4 Records --- /* [MS-XLS] 2.4.21 | [
"/",
"*",
"---",
"2",
".",
"4",
"Records",
"---",
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"21"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5721-L5738 | train | Parse an BIFF object | [
30522,
3853,
11968,
3366,
1035,
8945,
2546,
1006,
1038,
4135,
2497,
1010,
3091,
1007,
1063,
13075,
1051,
1027,
1063,
12170,
4246,
6299,
1024,
1014,
1010,
26718,
1024,
1014,
1065,
1025,
1051,
1012,
12170,
4246,
6299,
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... |
jgraph/mxgraph | javascript/mxClient.js | function(doc)
{
if (mxClient.IS_QUIRKS)
{
return new mxPoint(doc.body.scrollLeft, doc.body.scrollTop);
}
else
{
var wnd = doc.defaultView || doc.parentWindow;
var x = (wnd != null && window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
var y = (wnd != null && window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
return new mxPoint(x, y);
}
} | javascript | function(doc)
{
if (mxClient.IS_QUIRKS)
{
return new mxPoint(doc.body.scrollLeft, doc.body.scrollTop);
}
else
{
var wnd = doc.defaultView || doc.parentWindow;
var x = (wnd != null && window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
var y = (wnd != null && window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
return new mxPoint(x, y);
}
} | [
"function",
"(",
"doc",
")",
"{",
"if",
"(",
"mxClient",
".",
"IS_QUIRKS",
")",
"{",
"return",
"new",
"mxPoint",
"(",
"doc",
".",
"body",
".",
"scrollLeft",
",",
"doc",
".",
"body",
".",
"scrollTop",
")",
";",
"}",
"else",
"{",
"var",
"wnd",
"=",
... | Function: getDocumentScrollOrigin
Returns the scroll origin of the given document or the current document
if no document is given. | [
"Function",
":",
"getDocumentScrollOrigin"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L4801-L4816 | train | Returns the page offset of the document | [
30522,
3853,
1006,
9986,
1007,
1063,
2065,
1006,
25630,
20464,
11638,
1012,
2003,
1035,
21864,
19987,
1007,
1063,
2709,
2047,
25630,
8400,
1006,
9986,
1012,
2303,
1012,
17186,
2571,
6199,
1010,
9986,
1012,
2303,
1012,
17186,
14399,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/LocaleData.js | function(sWidth, sCalendarType) {
assert(sWidth == "narrow" || sWidth == "abbreviated" || sWidth == "wide", "sWidth must be narrow, abbreviated or wide");
return this._get(getCLDRCalendarName(sCalendarType), "dayPeriods", "stand-alone", sWidth);
} | javascript | function(sWidth, sCalendarType) {
assert(sWidth == "narrow" || sWidth == "abbreviated" || sWidth == "wide", "sWidth must be narrow, abbreviated or wide");
return this._get(getCLDRCalendarName(sCalendarType), "dayPeriods", "stand-alone", sWidth);
} | [
"function",
"(",
"sWidth",
",",
"sCalendarType",
")",
"{",
"assert",
"(",
"sWidth",
"==",
"\"narrow\"",
"||",
"sWidth",
"==",
"\"abbreviated\"",
"||",
"sWidth",
"==",
"\"wide\"",
",",
"\"sWidth must be narrow, abbreviated or wide\"",
")",
";",
"return",
"this",
".... | Get standalone day periods in width "narrow", "abbreviated" or "wide".
@param {string} sWidth the required width for the day period names
@param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar. If it's not set, it falls back to the calendar type either set in configuration or calculated from locale.
@returns {array} array of day periods (AM, PM)
@public | [
"Get",
"standalone",
"day",
"periods",
"in",
"width",
"narrow",
"abbreviated",
"or",
"wide",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L194-L197 | train | Get the number of day periods in the specified calendar type. | [
30522,
3853,
1006,
25430,
3593,
2705,
1010,
4094,
8943,
5339,
18863,
1007,
1063,
20865,
1006,
25430,
3593,
2705,
1027,
1027,
1000,
4867,
1000,
1064,
1064,
25430,
3593,
2705,
1027,
1027,
1000,
12066,
1000,
1064,
1064,
25430,
3593,
2705,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ColorlibHQ/AdminLTE | plugins/bootstrap-slider/bootstrap-slider.js | function(ev) {
if (this.touchCapable && (ev.type === 'touchstart' || ev.type === 'touchmove')) {
ev = ev.touches[0];
}
var eventPosition = ev[this.mousePos];
var sliderOffset = this._state.offset[this.stylePos];
var distanceToSlide = eventPosition - sliderOffset;
// Calculate what percent of the length the slider handle has slid
var percentage = (distanceToSlide / this._state.size) * 100;
percentage = Math.round(percentage / this._state.percentage[2]) * this._state.percentage[2];
if (this.options.reversed) {
percentage = 100 - percentage;
}
// Make sure the percent is within the bounds of the slider.
// 0% corresponds to the 'min' value of the slide
// 100% corresponds to the 'max' value of the slide
return Math.max(0, Math.min(100, percentage));
} | javascript | function(ev) {
if (this.touchCapable && (ev.type === 'touchstart' || ev.type === 'touchmove')) {
ev = ev.touches[0];
}
var eventPosition = ev[this.mousePos];
var sliderOffset = this._state.offset[this.stylePos];
var distanceToSlide = eventPosition - sliderOffset;
// Calculate what percent of the length the slider handle has slid
var percentage = (distanceToSlide / this._state.size) * 100;
percentage = Math.round(percentage / this._state.percentage[2]) * this._state.percentage[2];
if (this.options.reversed) {
percentage = 100 - percentage;
}
// Make sure the percent is within the bounds of the slider.
// 0% corresponds to the 'min' value of the slide
// 100% corresponds to the 'max' value of the slide
return Math.max(0, Math.min(100, percentage));
} | [
"function",
"(",
"ev",
")",
"{",
"if",
"(",
"this",
".",
"touchCapable",
"&&",
"(",
"ev",
".",
"type",
"===",
"'touchstart'",
"||",
"ev",
".",
"type",
"===",
"'touchmove'",
")",
")",
"{",
"ev",
"=",
"ev",
".",
"touches",
"[",
"0",
"]",
";",
"}",
... | /*
Credits to Mike Samuel for the following method!
Source: http://stackoverflow.com/questions/10454518/javascript-how-to-retrieve-the-number-of-decimals-of-a-string-number | [
"/",
"*",
"Credits",
"to",
"Mike",
"Samuel",
"for",
"the",
"following",
"method!",
"Source",
":",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"10454518",
"/",
"javascript",
"-",
"how",
"-",
"to",
"-",
"retrieve",
"-",
"the",
... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-slider/bootstrap-slider.js#L1404-L1423 | train | This function is called when the slider is clicked | [
30522,
3853,
1006,
23408,
1007,
1063,
2065,
1006,
2023,
1012,
3543,
17695,
3085,
1004,
1004,
1006,
23408,
1012,
2828,
1027,
1027,
1027,
1005,
3543,
14117,
2102,
1005,
1064,
1064,
23408,
1012,
2828,
1027,
1027,
1027,
1005,
3543,
5302,
3726,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
chartjs/Chart.js | src/scales/scale.time.js | function(label) {
var me = this;
var ticksOpts = me.options.ticks;
var tickLabelWidth = me.ctx.measureText(label).width;
var angle = helpers.toRadians(ticksOpts.maxRotation);
var cosRotation = Math.cos(angle);
var sinRotation = Math.sin(angle);
var tickFontSize = valueOrDefault(ticksOpts.fontSize, defaults.global.defaultFontSize);
return (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation);
} | javascript | function(label) {
var me = this;
var ticksOpts = me.options.ticks;
var tickLabelWidth = me.ctx.measureText(label).width;
var angle = helpers.toRadians(ticksOpts.maxRotation);
var cosRotation = Math.cos(angle);
var sinRotation = Math.sin(angle);
var tickFontSize = valueOrDefault(ticksOpts.fontSize, defaults.global.defaultFontSize);
return (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation);
} | [
"function",
"(",
"label",
")",
"{",
"var",
"me",
"=",
"this",
";",
"var",
"ticksOpts",
"=",
"me",
".",
"options",
".",
"ticks",
";",
"var",
"tickLabelWidth",
"=",
"me",
".",
"ctx",
".",
"measureText",
"(",
"label",
")",
".",
"width",
";",
"var",
"a... | Crude approximation of what the label width might be
@private | [
"Crude",
"approximation",
"of",
"what",
"the",
"label",
"width",
"might",
"be"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/scales/scale.time.js#L759-L769 | train | Calculate the width of the tick label | [
30522,
3853,
1006,
3830,
1007,
1063,
13075,
2033,
1027,
2023,
1025,
13075,
16356,
28793,
3215,
1027,
2033,
1012,
7047,
1012,
16356,
2015,
1025,
13075,
16356,
20470,
2884,
9148,
11927,
2232,
1027,
2033,
1012,
14931,
2595,
1012,
5468,
18209,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | merge | function merge(toAdd) {
var _p = this._private;
var cy = _p.cy;
if (!toAdd) {
return this;
}
if (toAdd && string(toAdd)) {
var selector = toAdd;
toAdd = cy.mutableElements().filter(selector);
}
var map = _p.map;
for (var i = 0; i < toAdd.length; i++) {
var toAddEle = toAdd[i];
var id = toAddEle._private.data.id;
var add = !map.has(id);
if (add) {
var index = this.length++;
this[index] = toAddEle;
map.set(id, {
ele: toAddEle,
index: index
});
} else {
// replace
var _index = map.get(id).index;
this[_index] = toAddEle;
map.set(id, {
ele: toAddEle,
index: _index
});
}
}
return this; // chaining
} | javascript | function merge(toAdd) {
var _p = this._private;
var cy = _p.cy;
if (!toAdd) {
return this;
}
if (toAdd && string(toAdd)) {
var selector = toAdd;
toAdd = cy.mutableElements().filter(selector);
}
var map = _p.map;
for (var i = 0; i < toAdd.length; i++) {
var toAddEle = toAdd[i];
var id = toAddEle._private.data.id;
var add = !map.has(id);
if (add) {
var index = this.length++;
this[index] = toAddEle;
map.set(id, {
ele: toAddEle,
index: index
});
} else {
// replace
var _index = map.get(id).index;
this[_index] = toAddEle;
map.set(id, {
ele: toAddEle,
index: _index
});
}
}
return this; // chaining
} | [
"function",
"merge",
"(",
"toAdd",
")",
"{",
"var",
"_p",
"=",
"this",
".",
"_private",
";",
"var",
"cy",
"=",
"_p",
".",
"cy",
";",
"if",
"(",
"!",
"toAdd",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"toAdd",
"&&",
"string",
"(",
"toAdd"... | in place merge on calling collection | [
"in",
"place",
"merge",
"on",
"calling",
"collection"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L10233-L10272 | train | Merge the elements in this array into another array | [
30522,
3853,
13590,
1006,
21344,
2094,
1007,
1063,
13075,
1035,
1052,
1027,
2023,
1012,
1035,
2797,
1025,
13075,
22330,
1027,
1035,
1052,
1012,
22330,
1025,
2065,
1006,
999,
21344,
2094,
1007,
1063,
2709,
2023,
1025,
1065,
2065,
1006,
21344... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/config/config-initializer.js | askInstallModules | function askInstallModules(modules, packageJsonExists) {
// If no modules, do nothing.
if (modules.length === 0) {
return Promise.resolve();
}
log.info("The config that you've selected requires the following dependencies:\n");
log.info(modules.join(" "));
return inquirer.prompt([
{
type: "confirm",
name: "executeInstallation",
message: "Would you like to install them now with npm?",
default: true,
when() {
return modules.length && packageJsonExists;
}
}
]).then(({ executeInstallation }) => {
if (executeInstallation) {
installModules(modules);
}
});
} | javascript | function askInstallModules(modules, packageJsonExists) {
// If no modules, do nothing.
if (modules.length === 0) {
return Promise.resolve();
}
log.info("The config that you've selected requires the following dependencies:\n");
log.info(modules.join(" "));
return inquirer.prompt([
{
type: "confirm",
name: "executeInstallation",
message: "Would you like to install them now with npm?",
default: true,
when() {
return modules.length && packageJsonExists;
}
}
]).then(({ executeInstallation }) => {
if (executeInstallation) {
installModules(modules);
}
});
} | [
"function",
"askInstallModules",
"(",
"modules",
",",
"packageJsonExists",
")",
"{",
"// If no modules, do nothing.",
"if",
"(",
"modules",
".",
"length",
"===",
"0",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
")",
";",
"}",
"log",
".",
"info",
"(",... | /* istanbul ignore next: no need to test inquirer
Ask user to install modules.
@param {string[]} modules Array of modules to be installed.
@param {boolean} packageJsonExists Indicates if package.json is existed.
@returns {Promise} Answer that indicates if user wants to install. | [
"/",
"*",
"istanbul",
"ignore",
"next",
":",
"no",
"need",
"to",
"test",
"inquirer",
"Ask",
"user",
"to",
"install",
"modules",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-initializer.js#L411-L435 | train | Ask the user to install the specified modules | [
30522,
3853,
3198,
7076,
9080,
13728,
7716,
16308,
1006,
14184,
1010,
7427,
22578,
5643,
9048,
12837,
1007,
1063,
1013,
1013,
2065,
2053,
14184,
1010,
2079,
2498,
1012,
2065,
1006,
14184,
1012,
3091,
1027,
1027,
1027,
1014,
1007,
1063,
2709... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/core/utils/get-selector.js | getAttributeNameValue | function getAttributeNameValue(node, at) {
const name = at.name;
let atnv;
if (name.indexOf('href') !== -1 || name.indexOf('src') !== -1) {
let friendly = axe.utils.getFriendlyUriEnd(node.getAttribute(name));
if (friendly) {
let value = encodeURI(friendly);
if (value) {
atnv = escapeSelector(at.name) + '$="' + escapeSelector(value) + '"';
} else {
return;
}
} else {
atnv =
escapeSelector(at.name) +
'="' +
escapeSelector(node.getAttribute(name)) +
'"';
}
} else {
atnv = escapeSelector(name) + '="' + escapeSelector(at.value) + '"';
}
return atnv;
} | javascript | function getAttributeNameValue(node, at) {
const name = at.name;
let atnv;
if (name.indexOf('href') !== -1 || name.indexOf('src') !== -1) {
let friendly = axe.utils.getFriendlyUriEnd(node.getAttribute(name));
if (friendly) {
let value = encodeURI(friendly);
if (value) {
atnv = escapeSelector(at.name) + '$="' + escapeSelector(value) + '"';
} else {
return;
}
} else {
atnv =
escapeSelector(at.name) +
'="' +
escapeSelector(node.getAttribute(name)) +
'"';
}
} else {
atnv = escapeSelector(name) + '="' + escapeSelector(at.value) + '"';
}
return atnv;
} | [
"function",
"getAttributeNameValue",
"(",
"node",
",",
"at",
")",
"{",
"const",
"name",
"=",
"at",
".",
"name",
";",
"let",
"atnv",
";",
"if",
"(",
"name",
".",
"indexOf",
"(",
"'href'",
")",
"!==",
"-",
"1",
"||",
"name",
".",
"indexOf",
"(",
"'sr... | get the attribute name and value as a string
@param {Element} node The element that has the attribute
@param {Attribute} at The attribute
@return {String} | [
"get",
"the",
"attribute",
"name",
"and",
"value",
"as",
"a",
"string"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/get-selector.js#L30-L54 | train | Get the value of an attribute | [
30522,
3853,
2131,
19321,
3089,
8569,
6528,
14074,
10175,
5657,
1006,
13045,
1010,
2012,
1007,
1063,
9530,
3367,
2171,
1027,
2012,
1012,
2171,
1025,
2292,
2012,
2078,
2615,
1025,
2065,
1006,
2171,
1012,
5950,
11253,
1006,
1005,
17850,
12879... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moment/luxon | src/datetime.js | parseDataToDateTime | function parseDataToDateTime(parsed, parsedZone, opts, format, text) {
const { setZone, zone } = opts;
if (parsed && Object.keys(parsed).length !== 0) {
const interpretationZone = parsedZone || zone,
inst = DateTime.fromObject(
Object.assign(parsed, opts, {
zone: interpretationZone,
// setZone is a valid option in the calling methods, but not in fromObject
setZone: undefined
})
);
return setZone ? inst : inst.setZone(zone);
} else {
return DateTime.invalid(
new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)
);
}
} | javascript | function parseDataToDateTime(parsed, parsedZone, opts, format, text) {
const { setZone, zone } = opts;
if (parsed && Object.keys(parsed).length !== 0) {
const interpretationZone = parsedZone || zone,
inst = DateTime.fromObject(
Object.assign(parsed, opts, {
zone: interpretationZone,
// setZone is a valid option in the calling methods, but not in fromObject
setZone: undefined
})
);
return setZone ? inst : inst.setZone(zone);
} else {
return DateTime.invalid(
new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)
);
}
} | [
"function",
"parseDataToDateTime",
"(",
"parsed",
",",
"parsedZone",
",",
"opts",
",",
"format",
",",
"text",
")",
"{",
"const",
"{",
"setZone",
",",
"zone",
"}",
"=",
"opts",
";",
"if",
"(",
"parsed",
"&&",
"Object",
".",
"keys",
"(",
"parsed",
")",
... | helper useful in turning the results of parsing into real dates by handling the zone options | [
"helper",
"useful",
"in",
"turning",
"the",
"results",
"of",
"parsing",
"into",
"real",
"dates",
"by",
"handling",
"the",
"zone",
"options"
] | 236f2badea297ee73421aa39a83e06177c1be6d0 | https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/datetime.js#L153-L170 | train | Parse the data into a DateTime object | [
30522,
3853,
11968,
6924,
6790,
3406,
13701,
7292,
1006,
11968,
6924,
1010,
11968,
6924,
15975,
1010,
23569,
2015,
1010,
4289,
1010,
3793,
1007,
1063,
9530,
3367,
1063,
2275,
15975,
1010,
4224,
1065,
1027,
23569,
2015,
1025,
2065,
1006,
119... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/MessageBox.js | cell | function cell(oContent) {
return new MatrixLayoutCell({
padding: Padding.None,
vAlign: VAlign.Top,
content: oContent
});
} | javascript | function cell(oContent) {
return new MatrixLayoutCell({
padding: Padding.None,
vAlign: VAlign.Top,
content: oContent
});
} | [
"function",
"cell",
"(",
"oContent",
")",
"{",
"return",
"new",
"MatrixLayoutCell",
"(",
"{",
"padding",
":",
"Padding",
".",
"None",
",",
"vAlign",
":",
"VAlign",
".",
"Top",
",",
"content",
":",
"oContent",
"}",
")",
";",
"}"
] | wraps the given control in a top aligned MatrixLayoutCell with no padding | [
"wraps",
"the",
"given",
"control",
"in",
"a",
"top",
"aligned",
"MatrixLayoutCell",
"with",
"no",
"padding"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MessageBox.js#L234-L240 | train | Creates a cell for a given content | [
30522,
3853,
3526,
1006,
1051,
8663,
6528,
2102,
1007,
1063,
2709,
2047,
8185,
8485,
5833,
29109,
2140,
1006,
1063,
11687,
4667,
1024,
11687,
4667,
1012,
3904,
1010,
11748,
23773,
1024,
11748,
23773,
1012,
2327,
1010,
4180,
1024,
1051,
8663... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vuex | dist/vuex.esm.js | forEachValue | function forEachValue (obj, fn) {
Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
} | javascript | function forEachValue (obj, fn) {
Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
} | [
"function",
"forEachValue",
"(",
"obj",
",",
"fn",
")",
"{",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"return",
"fn",
"(",
"obj",
"[",
"key",
"]",
",",
"key",
")",
";",
"}",
")",
";",
"}"
] | Get the first item that pass the test
by second argument function
@param {Array} list
@param {Function} f
@return {*}
forEach for object | [
"Get",
"the",
"first",
"item",
"that",
"pass",
"the",
"test",
"by",
"second",
"argument",
"function"
] | d7c7f9844831f98c5c9aaca213746c4ccc5d6929 | https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/dist/vuex.esm.js#L74-L76 | train | Iterate over an object s values. | [
30522,
3853,
18921,
6776,
10175,
5657,
1006,
27885,
3501,
1010,
1042,
2078,
1007,
1063,
4874,
1012,
6309,
1006,
27885,
3501,
1007,
1012,
18921,
6776,
1006,
3853,
1006,
3145,
1007,
1063,
2709,
1042,
2078,
1006,
27885,
3501,
1031,
3145,
1033,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js | function (key) {
var pGet,
oMsr = startMeasurements("get", key);
Log.debug("Cache Manager: Getting key [" + key + "]");
pGet = this._callInstanceMethod("get", arguments).then(function callInstanceHandler(v) {
Log.debug("Cache Manager: Getting key [" + key + "] done");
oMsr.endAsync();
return v;
}, function (e) {
Log.debug("Cache Manager: Getting key [" + key + "] failed. Error: " + e);
oMsr.endAsync();
throw e;
});
oMsr.endSync();
return pGet;
} | javascript | function (key) {
var pGet,
oMsr = startMeasurements("get", key);
Log.debug("Cache Manager: Getting key [" + key + "]");
pGet = this._callInstanceMethod("get", arguments).then(function callInstanceHandler(v) {
Log.debug("Cache Manager: Getting key [" + key + "] done");
oMsr.endAsync();
return v;
}, function (e) {
Log.debug("Cache Manager: Getting key [" + key + "] failed. Error: " + e);
oMsr.endAsync();
throw e;
});
oMsr.endSync();
return pGet;
} | [
"function",
"(",
"key",
")",
"{",
"var",
"pGet",
",",
"oMsr",
"=",
"startMeasurements",
"(",
"\"get\"",
",",
"key",
")",
";",
"Log",
".",
"debug",
"(",
"\"Cache Manager: Getting key [\"",
"+",
"key",
"+",
"\"]\"",
")",
";",
"pGet",
"=",
"this",
".",
"_... | Retrieves a value for given key.
@param key the key to retrieve a value for
@returns {Promise} a promise that would be resolved in case of successful operation or rejected with
value of the error message if the operation fails. It resolves with a value that is either:
<ul>
<li>undefined - the entry does not exist</li>
<li>any other - the entry exists and value contains the actually one</li>
</ul>
@public | [
"Retrieves",
"a",
"value",
"for",
"given",
"key",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L152-L169 | train | Get a value from the cache by key | [
30522,
3853,
1006,
3145,
1007,
1063,
13075,
18720,
3388,
1010,
18168,
21338,
1027,
2707,
4168,
3022,
5397,
8163,
1006,
1000,
2131,
30524,
2290,
1006,
1000,
17053,
3208,
1024,
2893,
3145,
1031,
1000,
1009,
3145,
1009,
1000,
1033,
1000,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/performance/trace/FESR.js | format | function format(vField, iLength, bCutFromFront) {
if (!vField) {
vField = vField === 0 ? "0" : "";
} else if (typeof vField === "number") {
var iField = vField;
vField = Math.round(vField).toString();
// Calculation of figures may be erroneous because incomplete performance entries lead to negative
// numbers. In that case we set a -1, so the "dirty" record can be identified as such.
if (vField.length > iLength || iField < 0) {
vField = "-1";
}
} else {
vField = bCutFromFront ? vField.substr(-iLength, iLength) : vField.substr(0, iLength);
}
return vField;
} | javascript | function format(vField, iLength, bCutFromFront) {
if (!vField) {
vField = vField === 0 ? "0" : "";
} else if (typeof vField === "number") {
var iField = vField;
vField = Math.round(vField).toString();
// Calculation of figures may be erroneous because incomplete performance entries lead to negative
// numbers. In that case we set a -1, so the "dirty" record can be identified as such.
if (vField.length > iLength || iField < 0) {
vField = "-1";
}
} else {
vField = bCutFromFront ? vField.substr(-iLength, iLength) : vField.substr(0, iLength);
}
return vField;
} | [
"function",
"format",
"(",
"vField",
",",
"iLength",
",",
"bCutFromFront",
")",
"{",
"if",
"(",
"!",
"vField",
")",
"{",
"vField",
"=",
"vField",
"===",
"0",
"?",
"\"0\"",
":",
"\"\"",
";",
"}",
"else",
"if",
"(",
"typeof",
"vField",
"===",
"\"number... | format string to fesr compliant string | [
"format",
"string",
"to",
"fesr",
"compliant",
"string"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L152-L167 | train | Format a string into a string | [
30522,
3853,
4289,
1006,
1058,
3790,
1010,
17869,
3070,
2705,
1010,
4647,
4904,
19699,
5358,
12792,
1007,
1063,
2065,
1006,
999,
1058,
3790,
1007,
1063,
1058,
3790,
1027,
1058,
3790,
1027,
1027,
1027,
1014,
1029,
1000,
1014,
1000,
1024,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js | function () {
var pInstanceCreation, oMsr = startMeasurements("_getInstance"),
that = this;
pInstanceCreation = new Promise(function (resolve, reject) {
var oInstance;
Log.debug("Cache Manager: Initialization...");
if (!CacheManager._instance) {
oInstance = that._findImplementation();
Measurement.start(S_MSR_INIT_IMPLEMENTATION, "CM", S_MSR_CAT_CACHE_MANAGER);
oInstance.init().then(resolveCacheManager, reject);
Measurement.end(S_MSR_INIT_IMPLEMENTATION, "CM");
} else {
resolveCacheManager(CacheManager._instance);
}
function resolveCacheManager(instance) {
CacheManager._instance = instance;
oMsr.endAsync();
Log.debug("Cache Manager initialized with implementation [" + CacheManager._instance.name + "], resolving _getInstance promise");
resolve(instance);
}
});
oMsr.endSync();
return pInstanceCreation;
} | javascript | function () {
var pInstanceCreation, oMsr = startMeasurements("_getInstance"),
that = this;
pInstanceCreation = new Promise(function (resolve, reject) {
var oInstance;
Log.debug("Cache Manager: Initialization...");
if (!CacheManager._instance) {
oInstance = that._findImplementation();
Measurement.start(S_MSR_INIT_IMPLEMENTATION, "CM", S_MSR_CAT_CACHE_MANAGER);
oInstance.init().then(resolveCacheManager, reject);
Measurement.end(S_MSR_INIT_IMPLEMENTATION, "CM");
} else {
resolveCacheManager(CacheManager._instance);
}
function resolveCacheManager(instance) {
CacheManager._instance = instance;
oMsr.endAsync();
Log.debug("Cache Manager initialized with implementation [" + CacheManager._instance.name + "], resolving _getInstance promise");
resolve(instance);
}
});
oMsr.endSync();
return pInstanceCreation;
} | [
"function",
"(",
")",
"{",
"var",
"pInstanceCreation",
",",
"oMsr",
"=",
"startMeasurements",
"(",
"\"_getInstance\"",
")",
",",
"that",
"=",
"this",
";",
"pInstanceCreation",
"=",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
... | Obtains a concreate implementation according to set of rules.
@returns {Promise}
@private | [
"Obtains",
"a",
"concreate",
"implementation",
"according",
"to",
"set",
"of",
"rules",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L72-L99 | train | Returns a promise that resolves to the cache manager instance | [
30522,
3853,
1006,
1007,
1063,
13075,
16300,
26897,
16748,
3370,
1010,
18168,
21338,
1027,
2707,
4168,
3022,
5397,
8163,
1006,
1000,
1035,
2131,
7076,
26897,
1000,
1007,
1010,
2008,
1027,
2023,
1025,
16300,
26897,
16748,
3370,
1027,
2047,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js | loadInstanceDesignTime | function loadInstanceDesignTime(oInstance) {
var sInstanceSpecificModule =
oInstance instanceof ObjectPath.get('sap.ui.base.ManagedObject')
&& typeof oInstance.data === "function"
&& oInstance.data("sap-ui-custom-settings")
&& oInstance.data("sap-ui-custom-settings")["sap.ui.dt"]
&& oInstance.data("sap-ui-custom-settings")["sap.ui.dt"].designtime;
if (typeof sInstanceSpecificModule === "string") {
sInstanceSpecificModule = mPredefinedDesignTimeModules[sInstanceSpecificModule] || sInstanceSpecificModule;
return new Promise(function(fnResolve) {
sap.ui.require([sInstanceSpecificModule], function(oDesignTime) {
fnResolve(oDesignTime);
});
});
} else {
return Promise.resolve({});
}
} | javascript | function loadInstanceDesignTime(oInstance) {
var sInstanceSpecificModule =
oInstance instanceof ObjectPath.get('sap.ui.base.ManagedObject')
&& typeof oInstance.data === "function"
&& oInstance.data("sap-ui-custom-settings")
&& oInstance.data("sap-ui-custom-settings")["sap.ui.dt"]
&& oInstance.data("sap-ui-custom-settings")["sap.ui.dt"].designtime;
if (typeof sInstanceSpecificModule === "string") {
sInstanceSpecificModule = mPredefinedDesignTimeModules[sInstanceSpecificModule] || sInstanceSpecificModule;
return new Promise(function(fnResolve) {
sap.ui.require([sInstanceSpecificModule], function(oDesignTime) {
fnResolve(oDesignTime);
});
});
} else {
return Promise.resolve({});
}
} | [
"function",
"loadInstanceDesignTime",
"(",
"oInstance",
")",
"{",
"var",
"sInstanceSpecificModule",
"=",
"oInstance",
"instanceof",
"ObjectPath",
".",
"get",
"(",
"'sap.ui.base.ManagedObject'",
")",
"&&",
"typeof",
"oInstance",
".",
"data",
"===",
"\"function\"",
"&&"... | Returns a promise that resolves with the instance specific, unmerged designtime data.
If no instance is provided, the promise will resolve with {}.
@private | [
"Returns",
"a",
"promise",
"that",
"resolves",
"with",
"the",
"instance",
"specific",
"unmerged",
"designtime",
"data",
".",
"If",
"no",
"instance",
"is",
"provided",
"the",
"promise",
"will",
"resolve",
"with",
"{}",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js#L1846-L1865 | train | Loads the designtime module from the given ManagedObject | [
30522,
3853,
7170,
7076,
26897,
6155,
23773,
7292,
1006,
1051,
7076,
26897,
1007,
1063,
13075,
15516,
26897,
13102,
8586,
18513,
5302,
8566,
2571,
1027,
1051,
7076,
26897,
6013,
11253,
4874,
15069,
1012,
2131,
1006,
1005,
20066,
1012,
21318,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 $(tok) {
var tokType = typeof tok,
match, length;
// Either match a single character in the input,
// or match a regexp in the current chunk (`current`).
//
if (tokType === "string") {
if (input.charAt(i) !== tok) {
return null;
}
skipWhitespace(1);
return tok;
}
// regexp
sync ();
if (! (match = tok.exec(current))) {
return null;
}
length = match[0].length;
// The match is confirmed, add the match length to `i`,
// and consume any extra white-space characters (' ' || '\n')
// which come after that. The reason for this is that LeSS's
// grammar is mostly white-space insensitive.
//
skipWhitespace(length);
if(typeof(match) === 'string') {
return match;
} else {
return match.length === 1 ? match[0] : match;
}
} | javascript | function $(tok) {
var tokType = typeof tok,
match, length;
// Either match a single character in the input,
// or match a regexp in the current chunk (`current`).
//
if (tokType === "string") {
if (input.charAt(i) !== tok) {
return null;
}
skipWhitespace(1);
return tok;
}
// regexp
sync ();
if (! (match = tok.exec(current))) {
return null;
}
length = match[0].length;
// The match is confirmed, add the match length to `i`,
// and consume any extra white-space characters (' ' || '\n')
// which come after that. The reason for this is that LeSS's
// grammar is mostly white-space insensitive.
//
skipWhitespace(length);
if(typeof(match) === 'string') {
return match;
} else {
return match.length === 1 ? match[0] : match;
}
} | [
"function",
"$",
"(",
"tok",
")",
"{",
"var",
"tokType",
"=",
"typeof",
"tok",
",",
"match",
",",
"length",
";",
"// Either match a single character in the input,",
"// or match a regexp in the current chunk (`current`).",
"//",
"if",
"(",
"tokType",
"===",
"\"string\""... | Parse from a token, regexp or string, and move forward if match | [
"Parse",
"from",
"a",
"token",
"regexp",
"or",
"string",
"and",
"move",
"forward",
"if",
"match"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L157-L192 | train | Match a token in the input string. | [
30522,
3853,
1002,
1006,
2000,
2243,
1007,
1063,
13075,
2000,
25509,
18863,
1027,
2828,
11253,
2000,
2243,
1010,
2674,
1010,
3091,
1025,
1013,
1013,
2593,
2674,
1037,
2309,
2839,
1999,
1996,
7953,
1010,
1013,
1013,
2030,
2674,
1037,
19723,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moleculerjs/moleculer | src/serializers/proto/packets.proto.js | PacketResponse | function PacketResponse(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function PacketResponse(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"PacketResponse",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
... | Properties of a PacketResponse.
@memberof packets
@interface IPacketResponse
@property {string} ver PacketResponse ver
@property {string} sender PacketResponse sender
@property {string} id PacketResponse id
@property {boolean} success PacketResponse success
@property {Uint8Array|null} [data] PacketResponse data
@property {string|null} [error] PacketResponse error
@property {string} meta PacketResponse meta
@property {boolean|null} [stream] PacketResponse stream
Constructs a new PacketResponse.
@memberof packets
@classdesc Represents a PacketResponse.
@implements IPacketResponse
@constructor
@param {packets.IPacketResponse=} [properties] Properties to set | [
"Properties",
"of",
"a",
"PacketResponse",
"."
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/serializers/proto/packets.proto.js#L800-L805 | train | Properties of a PacketResponse. | [
30522,
3853,
14771,
6072,
26029,
3366,
1006,
5144,
1007,
1063,
2065,
1006,
5144,
1007,
2005,
1006,
13075,
6309,
1027,
4874,
1012,
6309,
1006,
5144,
1007,
1010,
1045,
1027,
1014,
1025,
1045,
1026,
6309,
1012,
3091,
1025,
1009,
1009,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/FileTreeView.js | _sortDirectoryContents | function _sortDirectoryContents(contents, dirsFirst) {
if (dirsFirst) {
return contents.keySeq().sort(_buildDirsFirstComparator(contents));
} else {
return contents.keySeq().sort(FileUtils.compareFilenames);
}
} | javascript | function _sortDirectoryContents(contents, dirsFirst) {
if (dirsFirst) {
return contents.keySeq().sort(_buildDirsFirstComparator(contents));
} else {
return contents.keySeq().sort(FileUtils.compareFilenames);
}
} | [
"function",
"_sortDirectoryContents",
"(",
"contents",
",",
"dirsFirst",
")",
"{",
"if",
"(",
"dirsFirst",
")",
"{",
"return",
"contents",
".",
"keySeq",
"(",
")",
".",
"sort",
"(",
"_buildDirsFirstComparator",
"(",
"contents",
")",
")",
";",
"}",
"else",
... | @private
Sort a directory either alphabetically or with subdirectories listed first.
@param {Immutable.Map} contents the directory's contents
@param {boolean} dirsFirst true to sort subdirectories first
@return {Immutable.Map} sorted mapping | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeView.js#L690-L696 | train | sorts the contents of a directory | [
30522,
3853,
1035,
4066,
4305,
2890,
16761,
2100,
8663,
6528,
3215,
1006,
8417,
1010,
16101,
22747,
18894,
2102,
1007,
1063,
2065,
1006,
16101,
22747,
18894,
2102,
1007,
1063,
2709,
8417,
1012,
6309,
2063,
4160,
1006,
1007,
1012,
4066,
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... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/addons.js | addonsManager_getViews | function addonsManager_getViews(aSpec) {
var spec = aSpec || { };
var attribute = spec.attribute;
var value = spec.value;
return this.getElements({type: "views", subtype: attribute, value: value});
} | javascript | function addonsManager_getViews(aSpec) {
var spec = aSpec || { };
var attribute = spec.attribute;
var value = spec.value;
return this.getElements({type: "views", subtype: attribute, value: value});
} | [
"function",
"addonsManager_getViews",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"var",
"attribute",
"=",
"spec",
".",
"attribute",
";",
"var",
"value",
"=",
"spec",
".",
"value",
";",
"return",
"this",
".",
"getElements",
... | ///////////////////////////// View section /////////////////////////////
Returns the views which match the filter criteria
@param {object} aSpec
Information for getting the views matched by the criteria
Elements: attribute - DOM attribute of the node
[optional - default: ""]
value - Value of the DOM attribute
[optional - default: ""]
@returns Filtered list of views
@type {array of ElemBase} | [
"/////////////////////////////",
"View",
"section",
"/////////////////////////////",
"Returns",
"the",
"views",
"which",
"match",
"the",
"filter",
"criteria"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L1007-L1013 | train | Get all the views | [
30522,
3853,
5587,
5644,
24805,
4590,
1035,
2131,
8584,
2015,
1006,
2004,
5051,
2278,
1007,
1063,
13075,
28699,
1027,
2004,
5051,
2278,
1064,
1064,
1063,
1065,
1025,
13075,
17961,
1027,
28699,
1012,
17961,
1025,
13075,
3643,
1027,
28699,
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 | Makefile.js | generateRelease | function generateRelease() {
ReleaseOps.generateRelease();
const releaseInfo = JSON.parse(cat(".eslint-release-info.json"));
echo("Generating site");
target.gensite();
generateBlogPost(releaseInfo);
commitSiteToGit(`v${releaseInfo.version}`);
} | javascript | function generateRelease() {
ReleaseOps.generateRelease();
const releaseInfo = JSON.parse(cat(".eslint-release-info.json"));
echo("Generating site");
target.gensite();
generateBlogPost(releaseInfo);
commitSiteToGit(`v${releaseInfo.version}`);
} | [
"function",
"generateRelease",
"(",
")",
"{",
"ReleaseOps",
".",
"generateRelease",
"(",
")",
";",
"const",
"releaseInfo",
"=",
"JSON",
".",
"parse",
"(",
"cat",
"(",
"\".eslint-release-info.json\"",
")",
")",
";",
"echo",
"(",
"\"Generating site\"",
")",
";",... | Updates the changelog, bumps the version number in package.json, creates a local git commit and tag,
and generates the site in an adjacent `eslint.github.io` folder.
@returns {void} | [
"Updates",
"the",
"changelog",
"bumps",
"the",
"version",
"number",
"in",
"package",
".",
"json",
"creates",
"a",
"local",
"git",
"commit",
"and",
"tag",
"and",
"generates",
"the",
"site",
"in",
"an",
"adjacent",
"eslint",
".",
"github",
".",
"io",
"folder... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/Makefile.js#L256-L264 | train | Generate the release site | [
30522,
3853,
9699,
16570,
19500,
1006,
1007,
1063,
2713,
11923,
1012,
9699,
16570,
19500,
1006,
1007,
1025,
9530,
3367,
2713,
2378,
14876,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
4937,
1006,
1000,
1012,
9686,
4115,
2102,
1011,
2713,
1011... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/routing/Router.js | function (sName, oParameters, bReplace) {
var sURL = this.getURL(sName, oParameters);
if (sURL === undefined) {
Log.error("Can not navigate to route with name " + sName + " because the route does not exist");
}
if (bReplace) {
this._bLastHashReplaced = true;
this.oHashChanger.replaceHash(sURL);
} else {
this.oHashChanger.setHash(sURL);
}
return this;
} | javascript | function (sName, oParameters, bReplace) {
var sURL = this.getURL(sName, oParameters);
if (sURL === undefined) {
Log.error("Can not navigate to route with name " + sName + " because the route does not exist");
}
if (bReplace) {
this._bLastHashReplaced = true;
this.oHashChanger.replaceHash(sURL);
} else {
this.oHashChanger.setHash(sURL);
}
return this;
} | [
"function",
"(",
"sName",
",",
"oParameters",
",",
"bReplace",
")",
"{",
"var",
"sURL",
"=",
"this",
".",
"getURL",
"(",
"sName",
",",
"oParameters",
")",
";",
"if",
"(",
"sURL",
"===",
"undefined",
")",
"{",
"Log",
".",
"error",
"(",
"\"Can not naviga... | Navigates to a specific route defining a set of parameters. The Parameters will be URI encoded - the characters ; , / ? : @ & = + $ are reserved and will not be encoded.
If you want to use special characters in your oParameters, you have to encode them (encodeURIComponent).
IF the given route name can't be found, an error message is logged to the console and the hash will be changed to empty string.
@param {string} sName Name of the route
@param {object} [oParameters] Parameters for the route
@param {boolean} [bReplace=false] If set to <code>true</code>, the hash is replaced, and there will be no entry in the browser history, if set to <code>false</code>, the hash is set and the entry is stored in the browser history.
@public
@returns {sap.ui.core.routing.Router} this for chaining. | [
"Navigates",
"to",
"a",
"specific",
"route",
"defining",
"a",
"set",
"of",
"parameters",
".",
"The",
"Parameters",
"will",
"be",
"URI",
"encoded",
"-",
"the",
"characters",
";",
"/",
"?",
":",
"@",
"&",
"=",
"+",
"$",
"are",
"reserved",
"and",
"will",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Router.js#L632-L647 | train | Navigates to a route | [
30522,
3853,
1006,
1055,
18442,
1010,
6728,
5400,
22828,
2015,
1010,
7987,
13699,
19217,
1007,
1063,
13075,
7505,
2140,
1027,
2023,
1012,
2131,
3126,
2140,
1006,
1055,
18442,
1010,
6728,
5400,
22828,
2015,
1007,
1025,
2065,
1006,
7505,
2140... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | loadSyncXHR | function loadSyncXHR(oModule) {
var xhr = new XMLHttpRequest();
function enrichXHRError(error) {
error = error || ensureStacktrace(new Error(xhr.status + " - " + xhr.statusText));
error.status = xhr.status;
error.statusText = xhr.statusText;
error.loadError = true;
return error;
}
xhr.addEventListener('load', function(e) {
// File protocol (file://) always has status code 0
if ( xhr.status === 200 || xhr.status === 0 ) {
oModule.state = LOADED;
oModule.data = xhr.responseText;
} else {
oModule.error = enrichXHRError();
}
});
// Note: according to whatwg spec, error event doesn't fire for sync send(), instead an error is thrown
// we register a handler, in case a browser doesn't follow the spec
xhr.addEventListener('error', function(e) {
oModule.error = enrichXHRError();
});
xhr.open('GET', oModule.url, false);
try {
xhr.send();
} catch (error) {
oModule.error = enrichXHRError(error);
}
} | javascript | function loadSyncXHR(oModule) {
var xhr = new XMLHttpRequest();
function enrichXHRError(error) {
error = error || ensureStacktrace(new Error(xhr.status + " - " + xhr.statusText));
error.status = xhr.status;
error.statusText = xhr.statusText;
error.loadError = true;
return error;
}
xhr.addEventListener('load', function(e) {
// File protocol (file://) always has status code 0
if ( xhr.status === 200 || xhr.status === 0 ) {
oModule.state = LOADED;
oModule.data = xhr.responseText;
} else {
oModule.error = enrichXHRError();
}
});
// Note: according to whatwg spec, error event doesn't fire for sync send(), instead an error is thrown
// we register a handler, in case a browser doesn't follow the spec
xhr.addEventListener('error', function(e) {
oModule.error = enrichXHRError();
});
xhr.open('GET', oModule.url, false);
try {
xhr.send();
} catch (error) {
oModule.error = enrichXHRError(error);
}
} | [
"function",
"loadSyncXHR",
"(",
"oModule",
")",
"{",
"var",
"xhr",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"function",
"enrichXHRError",
"(",
"error",
")",
"{",
"error",
"=",
"error",
"||",
"ensureStacktrace",
"(",
"new",
"Error",
"(",
"xhr",
".",
"... | Loads the source for the given module with a sync XHR.
@param {Module} oModule Module to load the source for
@throws {Error} When loading failed for some reason. | [
"Loads",
"the",
"source",
"for",
"the",
"given",
"module",
"with",
"a",
"sync",
"XHR",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L1144-L1175 | train | Loads the data from the remote server and sets the state to LOADED | [
30522,
3853,
15665,
6038,
2278,
2595,
8093,
1006,
18168,
7716,
9307,
1007,
1063,
13075,
1060,
8093,
1027,
2047,
20950,
11039,
25856,
2890,
15500,
1006,
1007,
1025,
3853,
4372,
13149,
2595,
17875,
29165,
1006,
7561,
1007,
1063,
7561,
1027,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ksky521/nodeppt | packages/nodeppt-parser/lib/markdown/prism.js | highlight | function highlight(markdownit, options, text, lang, attrs = []) {
attrs = attrs || [];
let [langToUse, prismLang] = selectLanguage(options, lang);
const code = prismLang ? Prism.highlight(text, prismLang) : markdownit.utils.escapeHtml(text);
let hasClass = false;
let preAttrs = [];
attrs = attrs
.map(([key, value]) => {
if (key === 'class') {
hasClass = true;
value += langToUse ? ` ${markdownit.options.langPrefix}${langToUse}` : '';
} else if (key === 'css-module') {
// 单独提取
preAttrs.push(['class', value]);
return '';
}
preAttrs.push([key, value]);
return `${key}="${value}"`;
})
.join(' ');
if (!hasClass && langToUse) {
attrs += `class="${markdownit.options.langPrefix}${langToUse}"`;
}
langToUse && preAttrs.push(['class', `${markdownit.options.langPrefix}${langToUse}`]);
let rs = {};
preAttrs.forEach(([key, value]) => {
rs[key] = rs[key] ? [rs[key], value].join(' ') : value;
});
preAttrs = Object.keys(rs)
.map(key => {
return `${key}="${rs[key]}"`;
})
.join(' ');
return `<pre ${preAttrs}><code ${attrs}>${code}</code></pre>`;
} | javascript | function highlight(markdownit, options, text, lang, attrs = []) {
attrs = attrs || [];
let [langToUse, prismLang] = selectLanguage(options, lang);
const code = prismLang ? Prism.highlight(text, prismLang) : markdownit.utils.escapeHtml(text);
let hasClass = false;
let preAttrs = [];
attrs = attrs
.map(([key, value]) => {
if (key === 'class') {
hasClass = true;
value += langToUse ? ` ${markdownit.options.langPrefix}${langToUse}` : '';
} else if (key === 'css-module') {
// 单独提取
preAttrs.push(['class', value]);
return '';
}
preAttrs.push([key, value]);
return `${key}="${value}"`;
})
.join(' ');
if (!hasClass && langToUse) {
attrs += `class="${markdownit.options.langPrefix}${langToUse}"`;
}
langToUse && preAttrs.push(['class', `${markdownit.options.langPrefix}${langToUse}`]);
let rs = {};
preAttrs.forEach(([key, value]) => {
rs[key] = rs[key] ? [rs[key], value].join(' ') : value;
});
preAttrs = Object.keys(rs)
.map(key => {
return `${key}="${rs[key]}"`;
})
.join(' ');
return `<pre ${preAttrs}><code ${attrs}>${code}</code></pre>`;
} | [
"function",
"highlight",
"(",
"markdownit",
",",
"options",
",",
"text",
",",
"lang",
",",
"attrs",
"=",
"[",
"]",
")",
"{",
"attrs",
"=",
"attrs",
"||",
"[",
"]",
";",
"let",
"[",
"langToUse",
",",
"prismLang",
"]",
"=",
"selectLanguage",
"(",
"opti... | Highlights the provided text using Prism.
@param {MarkdownIt} markdownit
Instance of MarkdownIt Class. This argument is bound in markdownItPrism().
@param {MarkdownItPrismOptions} options
The options that have been used to initialise the plugin. This argument is bound in markdownItPrism().
@param {String} text
The text to highlight.
@param {String} lang
Code of the language to highlight the text in.
@return {String} {@code text} wrapped in {@code <pre>} and {@code <code>}, both equipped with the appropriate class (markdown-it’s langPrefix + lang). If Prism knows {@code lang}, {@code text} will be highlighted by it. | [
"Highlights",
"the",
"provided",
"text",
"using",
"Prism",
"."
] | ca77e29ef818c08b0522b31e3925b073cf159b9c | https://github.com/ksky521/nodeppt/blob/ca77e29ef818c08b0522b31e3925b073cf159b9c/packages/nodeppt-parser/lib/markdown/prism.js#L106-L141 | train | Highlights text in a language | [
30522,
3853,
12944,
1006,
2928,
7698,
4183,
1010,
7047,
1010,
3793,
1010,
11374,
1010,
2012,
16344,
2015,
1027,
1031,
1033,
1007,
1063,
2012,
16344,
2015,
1027,
2012,
16344,
2015,
1064,
1064,
1031,
1033,
1025,
2292,
1031,
11374,
24826,
3366... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/shaders/flat.js | function (data) {
this.rendererSystem = this.el.sceneEl.systems.renderer;
this.materialData = {color: new THREE.Color()};
this.textureSrc = null;
getMaterialData(data, this.materialData);
this.rendererSystem.applyColorCorrection(this.materialData.color);
this.material = new THREE.MeshBasicMaterial(this.materialData);
utils.material.updateMap(this, data);
} | javascript | function (data) {
this.rendererSystem = this.el.sceneEl.systems.renderer;
this.materialData = {color: new THREE.Color()};
this.textureSrc = null;
getMaterialData(data, this.materialData);
this.rendererSystem.applyColorCorrection(this.materialData.color);
this.material = new THREE.MeshBasicMaterial(this.materialData);
utils.material.updateMap(this, data);
} | [
"function",
"(",
"data",
")",
"{",
"this",
".",
"rendererSystem",
"=",
"this",
".",
"el",
".",
"sceneEl",
".",
"systems",
".",
"renderer",
";",
"this",
".",
"materialData",
"=",
"{",
"color",
":",
"new",
"THREE",
".",
"Color",
"(",
")",
"}",
";",
"... | Initializes the shader.
Adds a reference from the scene to this entity as the camera. | [
"Initializes",
"the",
"shader",
".",
"Adds",
"a",
"reference",
"from",
"the",
"scene",
"to",
"this",
"entity",
"as",
"the",
"camera",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/shaders/flat.js#L25-L33 | train | This is the main function of the material object | [
30522,
3853,
1006,
2951,
1007,
1063,
2023,
1012,
17552,
2545,
27268,
6633,
1027,
2023,
1012,
3449,
1012,
3496,
2884,
1012,
3001,
1012,
17552,
2121,
1025,
2023,
1012,
3430,
2850,
2696,
1027,
1063,
3609,
1024,
2047,
2093,
1012,
3609,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/theming/Parameters.js | loadParameters | function loadParameters(sId) {
// read inline parameters from css style rule
// (can be switched off for testing purposes via private URI parameter "sap-ui-xx-no-inline-theming-parameters=true")
var oLink = document.getElementById(sId);
if (!oLink) {
Log.warning("Could not find stylesheet element with ID", sId, "sap.ui.core.theming.Parameters");
return;
}
var sStyleSheetUrl = oLink.href;
// Remove CSS file name and query to create theme base url (to resolve relative urls)
var sThemeBaseUrl = new URI(sStyleSheetUrl).filename("").query("").toString();
var bThemeApplied = sap.ui.getCore().isThemeApplied();
if (!bThemeApplied) {
Log.warning("Parameters have been requested but theme is not applied, yet.", "sap.ui.core.theming.Parameters");
}
// In some browsers (Safari / Edge) it might happen that after switching the theme or adopting the <link>'s href,
// the parameters from the previous stylesheet are taken. This can be prevented by checking whether the theme is applied.
if (bThemeApplied && bUseInlineParameters) {
var $link = jQuery(oLink);
var sDataUri = $link.css("background-image");
var aParams = /\(["']?data:text\/plain;utf-8,(.*?)['"]?\)$/i.exec(sDataUri);
if (aParams && aParams.length >= 2) {
var sParams = aParams[1];
// decode only if necessary
if (sParams.charAt(0) !== "{" && sParams.charAt(sParams.length - 1) !== "}") {
try {
sParams = decodeURIComponent(sParams);
} catch (ex) {
Log.warning("Could not decode theme parameters URI from " + sStyleSheetUrl);
}
}
try {
var oParams = jQuery.parseJSON(sParams);
mergeParameters(oParams, sThemeBaseUrl);
return;
} catch (ex) {
Log.warning("Could not parse theme parameters from " + sStyleSheetUrl + ". Loading library-parameters.json as fallback solution.");
}
}
}
// load library-parameters.json (as fallback solution)
// derive parameter file URL from CSS file URL
// $1: name of library (incl. variants)
// $2: additional parameters, e.g. for sap-ui-merged, version/sap-ui-dist-version
var sUrl = sStyleSheetUrl.replace(/\/library([^\/.]*)\.(?:css|less)($|[?#])/, function($0, $1, $2) {
return "/library-parameters.json" + ($2 ? $2 : "");
});
if (syncCallBehavior === 2) {
Log.error("[nosync] Loading library-parameters.json ignored", sUrl, "sap.ui.core.theming.Parameters");
return;
} else if (syncCallBehavior === 1) {
Log.error("[nosync] Loading library-parameters.json with sync XHR", sUrl, "sap.ui.core.theming.Parameters");
}
// load and evaluate parameter file
jQuery.ajax({
url: sUrl,
dataType: 'json',
async: false,
success: function(data, textStatus, xhr) {
if (Array.isArray(data)) {
// in the sap-ui-merged use case, multiple JSON files are merged into and transfered as a single JSON array
for (var j = 0; j < data.length; j++) {
var oParams = data[j];
mergeParameters(oParams, sThemeBaseUrl);
}
} else {
mergeParameters(data, sThemeBaseUrl);
}
},
error: function(xhr, textStatus, error) {
// ignore failure at least temporarily as long as there are libraries built using outdated tools which produce no json file
Log.error("Could not load theme parameters from: " + sUrl, error); // could be an error as well, but let's avoid more CSN messages...
}
});
} | javascript | function loadParameters(sId) {
// read inline parameters from css style rule
// (can be switched off for testing purposes via private URI parameter "sap-ui-xx-no-inline-theming-parameters=true")
var oLink = document.getElementById(sId);
if (!oLink) {
Log.warning("Could not find stylesheet element with ID", sId, "sap.ui.core.theming.Parameters");
return;
}
var sStyleSheetUrl = oLink.href;
// Remove CSS file name and query to create theme base url (to resolve relative urls)
var sThemeBaseUrl = new URI(sStyleSheetUrl).filename("").query("").toString();
var bThemeApplied = sap.ui.getCore().isThemeApplied();
if (!bThemeApplied) {
Log.warning("Parameters have been requested but theme is not applied, yet.", "sap.ui.core.theming.Parameters");
}
// In some browsers (Safari / Edge) it might happen that after switching the theme or adopting the <link>'s href,
// the parameters from the previous stylesheet are taken. This can be prevented by checking whether the theme is applied.
if (bThemeApplied && bUseInlineParameters) {
var $link = jQuery(oLink);
var sDataUri = $link.css("background-image");
var aParams = /\(["']?data:text\/plain;utf-8,(.*?)['"]?\)$/i.exec(sDataUri);
if (aParams && aParams.length >= 2) {
var sParams = aParams[1];
// decode only if necessary
if (sParams.charAt(0) !== "{" && sParams.charAt(sParams.length - 1) !== "}") {
try {
sParams = decodeURIComponent(sParams);
} catch (ex) {
Log.warning("Could not decode theme parameters URI from " + sStyleSheetUrl);
}
}
try {
var oParams = jQuery.parseJSON(sParams);
mergeParameters(oParams, sThemeBaseUrl);
return;
} catch (ex) {
Log.warning("Could not parse theme parameters from " + sStyleSheetUrl + ". Loading library-parameters.json as fallback solution.");
}
}
}
// load library-parameters.json (as fallback solution)
// derive parameter file URL from CSS file URL
// $1: name of library (incl. variants)
// $2: additional parameters, e.g. for sap-ui-merged, version/sap-ui-dist-version
var sUrl = sStyleSheetUrl.replace(/\/library([^\/.]*)\.(?:css|less)($|[?#])/, function($0, $1, $2) {
return "/library-parameters.json" + ($2 ? $2 : "");
});
if (syncCallBehavior === 2) {
Log.error("[nosync] Loading library-parameters.json ignored", sUrl, "sap.ui.core.theming.Parameters");
return;
} else if (syncCallBehavior === 1) {
Log.error("[nosync] Loading library-parameters.json with sync XHR", sUrl, "sap.ui.core.theming.Parameters");
}
// load and evaluate parameter file
jQuery.ajax({
url: sUrl,
dataType: 'json',
async: false,
success: function(data, textStatus, xhr) {
if (Array.isArray(data)) {
// in the sap-ui-merged use case, multiple JSON files are merged into and transfered as a single JSON array
for (var j = 0; j < data.length; j++) {
var oParams = data[j];
mergeParameters(oParams, sThemeBaseUrl);
}
} else {
mergeParameters(data, sThemeBaseUrl);
}
},
error: function(xhr, textStatus, error) {
// ignore failure at least temporarily as long as there are libraries built using outdated tools which produce no json file
Log.error("Could not load theme parameters from: " + sUrl, error); // could be an error as well, but let's avoid more CSN messages...
}
});
} | [
"function",
"loadParameters",
"(",
"sId",
")",
"{",
"// read inline parameters from css style rule",
"// (can be switched off for testing purposes via private URI parameter \"sap-ui-xx-no-inline-theming-parameters=true\")",
"var",
"oLink",
"=",
"document",
".",
"getElementById",
"(",
"... | /*
Load parameters for a library/theme combination as identified by the URL of the library.css | [
"/",
"*",
"Load",
"parameters",
"for",
"a",
"library",
"/",
"theme",
"combination",
"as",
"identified",
"by",
"the",
"URL",
"of",
"the",
"library",
".",
"css"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/theming/Parameters.js#L124-L209 | train | Loads the parameters from the CSS stylesheet | [
30522,
3853,
7170,
28689,
22828,
2015,
1006,
15765,
1007,
1063,
1013,
1013,
3191,
23881,
11709,
2013,
20116,
2015,
2806,
3627,
1013,
1013,
1006,
2064,
2022,
7237,
2125,
2005,
5604,
5682,
3081,
2797,
24471,
2072,
16381,
1000,
20066,
1011,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/api/v0.1/posts.js | modelQuery | function modelQuery(options) {
return models.Post.findPage(options)
.then(({data, meta}) => {
return {
posts: data.map(model => urlsForPost(model.id, model.toJSON(options), options)),
meta: meta
};
});
} | javascript | function modelQuery(options) {
return models.Post.findPage(options)
.then(({data, meta}) => {
return {
posts: data.map(model => urlsForPost(model.id, model.toJSON(options), options)),
meta: meta
};
});
} | [
"function",
"modelQuery",
"(",
"options",
")",
"{",
"return",
"models",
".",
"Post",
".",
"findPage",
"(",
"options",
")",
".",
"then",
"(",
"(",
"{",
"data",
",",
"meta",
"}",
")",
"=>",
"{",
"return",
"{",
"posts",
":",
"data",
".",
"map",
"(",
... | ### Model Query
Make the call to the Model layer
@param {Object} options
@returns {Object} options | [
"###",
"Model",
"Query",
"Make",
"the",
"call",
"to",
"the",
"Model",
"layer"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/posts.js#L60-L68 | train | Query for posts | [
30522,
3853,
2944,
4226,
2854,
1006,
7047,
1007,
1063,
2709,
4275,
1012,
2695,
1012,
2424,
13704,
1006,
7047,
1007,
1012,
2059,
1006,
1006,
1063,
2951,
1010,
18804,
1065,
1007,
1027,
1028,
1063,
2709,
1063,
8466,
1024,
2951,
1012,
4949,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | src/ol/pointer/MouseSource.js | mousemove | function mousemove(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
const e = prepareEvent(inEvent, this.dispatcher);
this.dispatcher.move(e, inEvent);
}
} | javascript | function mousemove(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
const e = prepareEvent(inEvent, this.dispatcher);
this.dispatcher.move(e, inEvent);
}
} | [
"function",
"mousemove",
"(",
"inEvent",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isEventSimulatedFromTouch_",
"(",
"inEvent",
")",
")",
"{",
"const",
"e",
"=",
"prepareEvent",
"(",
"inEvent",
",",
"this",
".",
"dispatcher",
")",
";",
"this",
".",
"dispat... | Handler for `mousemove`.
@this {MouseSource}
@param {MouseEvent} inEvent The in event. | [
"Handler",
"for",
"mousemove",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/pointer/MouseSource.js#L82-L87 | train | The mousemove event handler. | [
30522,
3853,
8000,
5302,
3726,
1006,
1999,
18697,
3372,
1007,
1063,
2065,
1006,
999,
2023,
1012,
2003,
18697,
7666,
5714,
8898,
19699,
5358,
24826,
2818,
1035,
1006,
1999,
18697,
3372,
1007,
1007,
1063,
9530,
3367,
1041,
1027,
7374,
18697,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cypress-io/cypress | cli/lib/cli.js | unknownOption | function unknownOption (flag, type = 'option') {
if (this._allowUnknownOption) return
logger.error()
logger.error(` error: unknown ${type}:`, flag)
logger.error()
this.outputHelp()
util.exit(1)
} | javascript | function unknownOption (flag, type = 'option') {
if (this._allowUnknownOption) return
logger.error()
logger.error(` error: unknown ${type}:`, flag)
logger.error()
this.outputHelp()
util.exit(1)
} | [
"function",
"unknownOption",
"(",
"flag",
",",
"type",
"=",
"'option'",
")",
"{",
"if",
"(",
"this",
".",
"_allowUnknownOption",
")",
"return",
"logger",
".",
"error",
"(",
")",
"logger",
".",
"error",
"(",
"`",
"${",
"type",
"}",
"`",
",",
"flag",
"... | patch "commander" method called when a user passed an unknown option we want to print help for the current command and exit with an error | [
"patch",
"commander",
"method",
"called",
"when",
"a",
"user",
"passed",
"an",
"unknown",
"option",
"we",
"want",
"to",
"print",
"help",
"for",
"the",
"current",
"command",
"and",
"exit",
"with",
"an",
"error"
] | bf1a942944f0e99684ff7fe0e18314332e46f83e | https://github.com/cypress-io/cypress/blob/bf1a942944f0e99684ff7fe0e18314332e46f83e/cli/lib/cli.js#L12-L20 | train | Handle unknown option | [
30522,
3853,
4242,
7361,
3508,
1006,
5210,
1010,
2828,
1027,
1005,
5724,
1005,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
3499,
16814,
19779,
3630,
16790,
1007,
2709,
8833,
4590,
1012,
7561,
1006,
1007,
8833,
4590,
1012,
7561,
1006,
1036,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExtractFileContent.js | _readFile | function _readFile(fileName, callback) {
fs.readFile(fileName, "utf8", function (err, data) {
var content = "";
if (!err) {
content = data;
}
callback.apply(null, [fileName, content]);
});
} | javascript | function _readFile(fileName, callback) {
fs.readFile(fileName, "utf8", function (err, data) {
var content = "";
if (!err) {
content = data;
}
callback.apply(null, [fileName, content]);
});
} | [
"function",
"_readFile",
"(",
"fileName",
",",
"callback",
")",
"{",
"fs",
".",
"readFile",
"(",
"fileName",
",",
"\"utf8\"",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"var",
"content",
"=",
"\"\"",
";",
"if",
"(",
"!",
"err",
")",
"{",
"... | Extract content locally from the file system used fs.readFile()
@param {String} fileName - fullpath of the document
@param {Function} callback - callback handle to post the content back | [
"Extract",
"content",
"locally",
"from",
"the",
"file",
"system",
"used",
"fs",
".",
"readFile",
"()"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/node/ExtractFileContent.js#L63-L71 | train | read file content | [
30522,
3853,
1035,
3191,
8873,
2571,
1006,
5371,
18442,
1010,
2655,
5963,
1007,
1063,
1042,
2015,
1012,
3191,
8873,
2571,
1006,
5371,
18442,
1010,
1000,
21183,
2546,
2620,
1000,
1010,
3853,
1006,
9413,
2099,
1010,
2951,
1007,
1063,
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... |
eslint/eslint | lib/rules/object-shorthand.js | isConstructor | function isConstructor(name) {
const match = CTOR_PREFIX_REGEX.exec(name);
// Not a constructor if name has no characters apart from '_', '$' and digits e.g. '_', '$$', '_8'
if (!match) {
return false;
}
const firstChar = name.charAt(match.index);
return firstChar === firstChar.toUpperCase();
} | javascript | function isConstructor(name) {
const match = CTOR_PREFIX_REGEX.exec(name);
// Not a constructor if name has no characters apart from '_', '$' and digits e.g. '_', '$$', '_8'
if (!match) {
return false;
}
const firstChar = name.charAt(match.index);
return firstChar === firstChar.toUpperCase();
} | [
"function",
"isConstructor",
"(",
"name",
")",
"{",
"const",
"match",
"=",
"CTOR_PREFIX_REGEX",
".",
"exec",
"(",
"name",
")",
";",
"// Not a constructor if name has no characters apart from '_', '$' and digits e.g. '_', '$$', '_8'",
"if",
"(",
"!",
"match",
")",
"{",
"... | Determines if the first character of the name is a capital letter.
@param {string} name The name of the node to evaluate.
@returns {boolean} True if the first character of the property name is a capital letter, false if not.
@private | [
"Determines",
"if",
"the",
"first",
"character",
"of",
"the",
"name",
"is",
"a",
"capital",
"letter",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/object-shorthand.js#L124-L135 | train | Check if the name is a constructor | [
30522,
3853,
2003,
8663,
3367,
6820,
16761,
1006,
2171,
1007,
1063,
9530,
3367,
2674,
1027,
14931,
2953,
1035,
17576,
1035,
19723,
10288,
1012,
4654,
8586,
1006,
2171,
1007,
1025,
1013,
1013,
2025,
1037,
9570,
2953,
2065,
2171,
2038,
2053,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_openTab | function tabView_openTab(aSpec) {
var spec = aSpec || {};
var group = spec.group;
if (!group) {
throw new Error(arguments.callee.name + ": Group not specified.");
}
var button = this.getElement({
type: "group_newTabButton",
value: group
});
this._controller.click(button);
this.waitForClosed();
} | javascript | function tabView_openTab(aSpec) {
var spec = aSpec || {};
var group = spec.group;
if (!group) {
throw new Error(arguments.callee.name + ": Group not specified.");
}
var button = this.getElement({
type: "group_newTabButton",
value: group
});
this._controller.click(button);
this.waitForClosed();
} | [
"function",
"tabView_openTab",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"var",
"group",
"=",
"spec",
".",
"group",
";",
"if",
"(",
"!",
"group",
")",
"{",
"throw",
"new",
"Error",
"(",
"arguments",
".",
"callee",
".... | Open a new tab in the specified group
@param {object} aSpec
Information about the element to operate on
Elements: group - Group to create a new tab in | [
"Open",
"a",
"new",
"tab",
"in",
"the",
"specified",
"group"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabview.js#L394-L409 | train | Open a tab in a group | [
30522,
3853,
21628,
8584,
1035,
2330,
2696,
2497,
1006,
2004,
5051,
2278,
1007,
1063,
13075,
28699,
1027,
2004,
5051,
30524,
1006,
999,
2177,
1007,
1063,
5466,
2047,
7561,
1006,
9918,
1012,
2655,
4402,
1012,
2171,
1009,
1000,
1024,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js | function (oNode, oSubtreeHandle) {
var oSubtree = oSubtreeHandle._getSubtree();
if (oSubtreeHandle) {
// subtree is flat
if (Array.isArray(oSubtree)) {
if (oSubtreeHandle._oSubtreeRoot) {
// jump to a certain position in the flat structure and map the nodes
fnTraverseFlatSubtree(oSubtree, oSubtreeHandle._oSubtreeRoot.serverIndex, oSubtreeHandle._oSubtreeRoot, oSubtreeHandle._oSubtreeRoot.originalLevel || 0, oNode.level + 1);
} else {
// newly added nodes
fnTraverseFlatSubtree(oSubtree, null, null, 0, oNode.level + 1);
}
} else {
// subtree is deep
oSubtreeHandle._oSubtreeRoot.level = oNode.level + 1;
fnTraverseDeepSubtree(oSubtreeHandle._oSubtreeRoot, false, oSubtreeHandle._oNewParentNode, -1, oSubtreeHandle._oSubtreeRoot);
}
}
} | javascript | function (oNode, oSubtreeHandle) {
var oSubtree = oSubtreeHandle._getSubtree();
if (oSubtreeHandle) {
// subtree is flat
if (Array.isArray(oSubtree)) {
if (oSubtreeHandle._oSubtreeRoot) {
// jump to a certain position in the flat structure and map the nodes
fnTraverseFlatSubtree(oSubtree, oSubtreeHandle._oSubtreeRoot.serverIndex, oSubtreeHandle._oSubtreeRoot, oSubtreeHandle._oSubtreeRoot.originalLevel || 0, oNode.level + 1);
} else {
// newly added nodes
fnTraverseFlatSubtree(oSubtree, null, null, 0, oNode.level + 1);
}
} else {
// subtree is deep
oSubtreeHandle._oSubtreeRoot.level = oNode.level + 1;
fnTraverseDeepSubtree(oSubtreeHandle._oSubtreeRoot, false, oSubtreeHandle._oNewParentNode, -1, oSubtreeHandle._oSubtreeRoot);
}
}
} | [
"function",
"(",
"oNode",
",",
"oSubtreeHandle",
")",
"{",
"var",
"oSubtree",
"=",
"oSubtreeHandle",
".",
"_getSubtree",
"(",
")",
";",
"if",
"(",
"oSubtreeHandle",
")",
"{",
"// subtree is flat",
"if",
"(",
"Array",
".",
"isArray",
"(",
"oSubtree",
")",
"... | Traverses a re-inserted or newly added subtree.
This can be a combination of flat and deep trees.
Decides if the traversal has to branche over to a flat or a deep part of the tree.
@param {object} oNode the parent node
@param {object} the subtree handle, inside there is either a deep or a flat tree stored | [
"Traverses",
"a",
"re",
"-",
"inserted",
"or",
"newly",
"added",
"subtree",
".",
"This",
"can",
"be",
"a",
"combination",
"of",
"flat",
"and",
"deep",
"trees",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js#L325-L345 | train | Traverse the subtree | [
30522,
3853,
1006,
21058,
3207,
1010,
9808,
12083,
13334,
11774,
2571,
1007,
1063,
13075,
9808,
12083,
13334,
1027,
9808,
12083,
13334,
11774,
2571,
1012,
1035,
4152,
12083,
13334,
1006,
1007,
1025,
2065,
1006,
9808,
12083,
13334,
11774,
2571... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/tabs/js/tabsController.js | insertTab | function insertTab (tabData, index) {
var hasLoaded = loaded;
var proto = {
getIndex: function () { return ctrl.tabs.indexOf(tab); },
isActive: function () { return this.getIndex() === ctrl.selectedIndex; },
isLeft: function () { return this.getIndex() < ctrl.selectedIndex; },
isRight: function () { return this.getIndex() > ctrl.selectedIndex; },
shouldRender: function () { return !ctrl.noDisconnect || this.isActive(); },
hasFocus: function () {
return ctrl.styleTabItemFocus
&& ctrl.hasFocus && this.getIndex() === ctrl.focusIndex;
},
id: $mdUtil.nextUid(),
hasContent: !!(tabData.template && tabData.template.trim())
};
var tab = angular.extend(proto, tabData);
if (angular.isDefined(index)) {
ctrl.tabs.splice(index, 0, tab);
} else {
ctrl.tabs.push(tab);
}
processQueue();
updateHasContent();
$mdUtil.nextTick(function () {
updatePagination();
setAriaControls(tab);
// if autoselect is enabled, select the newly added tab
if (hasLoaded && ctrl.autoselect) {
$mdUtil.nextTick(function () {
$mdUtil.nextTick(function () { select(ctrl.tabs.indexOf(tab)); });
});
}
});
return tab;
} | javascript | function insertTab (tabData, index) {
var hasLoaded = loaded;
var proto = {
getIndex: function () { return ctrl.tabs.indexOf(tab); },
isActive: function () { return this.getIndex() === ctrl.selectedIndex; },
isLeft: function () { return this.getIndex() < ctrl.selectedIndex; },
isRight: function () { return this.getIndex() > ctrl.selectedIndex; },
shouldRender: function () { return !ctrl.noDisconnect || this.isActive(); },
hasFocus: function () {
return ctrl.styleTabItemFocus
&& ctrl.hasFocus && this.getIndex() === ctrl.focusIndex;
},
id: $mdUtil.nextUid(),
hasContent: !!(tabData.template && tabData.template.trim())
};
var tab = angular.extend(proto, tabData);
if (angular.isDefined(index)) {
ctrl.tabs.splice(index, 0, tab);
} else {
ctrl.tabs.push(tab);
}
processQueue();
updateHasContent();
$mdUtil.nextTick(function () {
updatePagination();
setAriaControls(tab);
// if autoselect is enabled, select the newly added tab
if (hasLoaded && ctrl.autoselect) {
$mdUtil.nextTick(function () {
$mdUtil.nextTick(function () { select(ctrl.tabs.indexOf(tab)); });
});
}
});
return tab;
} | [
"function",
"insertTab",
"(",
"tabData",
",",
"index",
")",
"{",
"var",
"hasLoaded",
"=",
"loaded",
";",
"var",
"proto",
"=",
"{",
"getIndex",
":",
"function",
"(",
")",
"{",
"return",
"ctrl",
".",
"tabs",
".",
"indexOf",
"(",
"tab",
")",
";",
"}",
... | Create an entry in the tabs array for a new tab at the specified index.
@param {Object} tabData tab to insert
@param {number} index location to insert the new tab
@returns {Object} the inserted tab | [
"Create",
"an",
"entry",
"in",
"the",
"tabs",
"array",
"for",
"a",
"new",
"tab",
"at",
"the",
"specified",
"index",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L444-L481 | train | Insert a tab at the specified index. | [
30522,
3853,
19274,
2696,
2497,
1006,
21628,
2850,
2696,
1010,
5950,
1007,
1063,
13075,
2038,
17468,
1027,
8209,
1025,
13075,
15053,
1027,
1063,
2131,
22254,
10288,
1024,
3853,
1006,
1007,
1063,
2709,
14931,
12190,
1012,
21628,
2015,
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... |
ecomfe/zrender | src/dom/HandlerProxy.js | initDomHandler | function initDomHandler(instance) {
zrUtil.each(touchHandlerNames, function (name) {
instance._handlers[name] = zrUtil.bind(domHandlers[name], instance);
});
zrUtil.each(pointerHandlerNames, function (name) {
instance._handlers[name] = zrUtil.bind(domHandlers[name], instance);
});
zrUtil.each(mouseHandlerNames, function (name) {
instance._handlers[name] = makeMouseHandler(domHandlers[name], instance);
});
function makeMouseHandler(fn, instance) {
return function () {
if (instance._touching) {
return;
}
return fn.apply(instance, arguments);
};
}
} | javascript | function initDomHandler(instance) {
zrUtil.each(touchHandlerNames, function (name) {
instance._handlers[name] = zrUtil.bind(domHandlers[name], instance);
});
zrUtil.each(pointerHandlerNames, function (name) {
instance._handlers[name] = zrUtil.bind(domHandlers[name], instance);
});
zrUtil.each(mouseHandlerNames, function (name) {
instance._handlers[name] = makeMouseHandler(domHandlers[name], instance);
});
function makeMouseHandler(fn, instance) {
return function () {
if (instance._touching) {
return;
}
return fn.apply(instance, arguments);
};
}
} | [
"function",
"initDomHandler",
"(",
"instance",
")",
"{",
"zrUtil",
".",
"each",
"(",
"touchHandlerNames",
",",
"function",
"(",
"name",
")",
"{",
"instance",
".",
"_handlers",
"[",
"name",
"]",
"=",
"zrUtil",
".",
"bind",
"(",
"domHandlers",
"[",
"name",
... | 为控制类实例初始化dom 事件处理函数
@inner
@param {module:zrender/Handler} instance 控制类实例 | [
"为控制类实例初始化dom",
"事件处理函数"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/dom/HandlerProxy.js#L241-L262 | train | initDomHandler - init dom handlers | [
30522,
3853,
1999,
4183,
9527,
11774,
3917,
1006,
6013,
1007,
1063,
1062,
22134,
4014,
1012,
2169,
1006,
3543,
11774,
3917,
18442,
2015,
1010,
3853,
1006,
2171,
1007,
1063,
6013,
1012,
1035,
28213,
2015,
1031,
2171,
1033,
1027,
1062,
22134,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tableRenderer.js | _createCellHtml | function _createCellHtml(cell) {
let attrs = cell.colspan > 1 ? ` colspan="${cell.colspan}"` : '';
attrs += cell.rowspan > 1 ? ` rowspan="${cell.rowspan}"` : '';
attrs += cell.align ? ` align="${cell.align}"` : '';
return `<${cell.nodeName}${attrs}>${cell.content}</${cell.nodeName}>`;
} | javascript | function _createCellHtml(cell) {
let attrs = cell.colspan > 1 ? ` colspan="${cell.colspan}"` : '';
attrs += cell.rowspan > 1 ? ` rowspan="${cell.rowspan}"` : '';
attrs += cell.align ? ` align="${cell.align}"` : '';
return `<${cell.nodeName}${attrs}>${cell.content}</${cell.nodeName}>`;
} | [
"function",
"_createCellHtml",
"(",
"cell",
")",
"{",
"let",
"attrs",
"=",
"cell",
".",
"colspan",
">",
"1",
"?",
"`",
"${",
"cell",
".",
"colspan",
"}",
"`",
":",
"''",
";",
"attrs",
"+=",
"cell",
".",
"rowspan",
">",
"1",
"?",
"`",
"${",
"cell"... | Create cell html.
@param {object} cell - cell data of table base data
@returns {string}
@private | [
"Create",
"cell",
"html",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRenderer.js#L15-L21 | train | Create HTML for a cell | [
30522,
3853,
1035,
3443,
29109,
2140,
11039,
19968,
1006,
3526,
1007,
1063,
2292,
2012,
16344,
2015,
1027,
3526,
1012,
8902,
13102,
2319,
1028,
1015,
1029,
1036,
8902,
13102,
2319,
1027,
1000,
1002,
1063,
3526,
1012,
8902,
13102,
2319,
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... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/addons.js | addonsManager_enableAddon | function addonsManager_enableAddon(aSpec) {
var spec = aSpec || { };
spec.button = "enable";
var button = this.getAddonButton(spec);
this._controller.click(button);
} | javascript | function addonsManager_enableAddon(aSpec) {
var spec = aSpec || { };
spec.button = "enable";
var button = this.getAddonButton(spec);
this._controller.click(button);
} | [
"function",
"addonsManager_enableAddon",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"spec",
".",
"button",
"=",
"\"enable\"",
";",
"var",
"button",
"=",
"this",
".",
"getAddonButton",
"(",
"spec",
")",
";",
"this",
".",
"... | Enables the specified add-on
@param {object} aSpec
Information on which add-on to operate on
Elements: addon - Add-on element | [
"Enables",
"the",
"specified",
"add",
"-",
"on"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L346-L352 | train | Enable an add - on | [
30522,
3853,
5587,
5644,
24805,
4590,
1035,
9585,
4215,
5280,
1006,
2004,
5051,
2278,
1007,
1063,
13075,
28699,
1027,
2004,
5051,
2278,
1064,
1064,
1063,
1065,
1025,
28699,
1012,
6462,
1027,
1000,
9585,
1000,
1025,
13075,
6462,
1027,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dimsemenov/PhotoSwipe | src/js/gestures.js | function(e) {
e.preventDefault();
if(_pointerEventEnabled) {
var pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id');
if(pointerIndex > -1) {
var p = _currPointers[pointerIndex];
p.x = e.pageX;
p.y = e.pageY;
}
}
if(_isDragging) {
var touchesList = _getTouchPoints(e);
if(!_direction && !_moved && !_isZooming) {
if(_mainScrollPos.x !== _slideSize.x * _currPositionIndex) {
// if main scroll position is shifted – direction is always horizontal
_direction = 'h';
} else {
var diff = Math.abs(touchesList[0].x - _currPoint.x) - Math.abs(touchesList[0].y - _currPoint.y);
// check the direction of movement
if(Math.abs(diff) >= DIRECTION_CHECK_OFFSET) {
_direction = diff > 0 ? 'h' : 'v';
_currentPoints = touchesList;
}
}
} else {
_currentPoints = touchesList;
}
}
} | javascript | function(e) {
e.preventDefault();
if(_pointerEventEnabled) {
var pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id');
if(pointerIndex > -1) {
var p = _currPointers[pointerIndex];
p.x = e.pageX;
p.y = e.pageY;
}
}
if(_isDragging) {
var touchesList = _getTouchPoints(e);
if(!_direction && !_moved && !_isZooming) {
if(_mainScrollPos.x !== _slideSize.x * _currPositionIndex) {
// if main scroll position is shifted – direction is always horizontal
_direction = 'h';
} else {
var diff = Math.abs(touchesList[0].x - _currPoint.x) - Math.abs(touchesList[0].y - _currPoint.y);
// check the direction of movement
if(Math.abs(diff) >= DIRECTION_CHECK_OFFSET) {
_direction = diff > 0 ? 'h' : 'v';
_currentPoints = touchesList;
}
}
} else {
_currentPoints = touchesList;
}
}
} | [
"function",
"(",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"if",
"(",
"_pointerEventEnabled",
")",
"{",
"var",
"pointerIndex",
"=",
"framework",
".",
"arraySearch",
"(",
"_currPointers",
",",
"e",
".",
"pointerId",
",",
"'id'",
")",
";",
... | amount of pixels to drag to determine direction of swipe | [
"amount",
"of",
"pixels",
"to",
"drag",
"to",
"determine",
"direction",
"of",
"swipe"
] | 80607e12542a1a54ecefa837649e862b35dffd25 | https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L410-L443 | train | handle mouse move | [
30522,
3853,
1006,
1041,
1007,
1063,
1041,
1012,
4652,
3207,
7011,
11314,
1006,
1007,
1025,
2065,
1006,
1035,
20884,
18697,
10111,
22966,
2094,
1007,
1063,
13075,
20884,
22254,
10288,
1027,
7705,
1012,
27448,
14644,
2818,
1006,
1035,
12731,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | renderedStyle | function renderedStyle(property) {
var cy = this.cy();
if (!cy.styleEnabled()) {
return this;
}
var ele = this[0];
if (ele) {
return cy.style().getRenderedStyle(ele, property);
}
} | javascript | function renderedStyle(property) {
var cy = this.cy();
if (!cy.styleEnabled()) {
return this;
}
var ele = this[0];
if (ele) {
return cy.style().getRenderedStyle(ele, property);
}
} | [
"function",
"renderedStyle",
"(",
"property",
")",
"{",
"var",
"cy",
"=",
"this",
".",
"cy",
"(",
")",
";",
"if",
"(",
"!",
"cy",
".",
"styleEnabled",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"var",
"ele",
"=",
"this",
"[",
"0",
"]",
";"... | get the specified css property as a rendered value (i.e. on-screen value) or get the whole rendered style if no property specified (NB doesn't allow setting) | [
"get",
"the",
"specified",
"css",
"property",
"as",
"a",
"rendered",
"value",
"(",
"i",
".",
"e",
".",
"on",
"-",
"screen",
"value",
")",
"or",
"get",
"the",
"whole",
"rendered",
"style",
"if",
"no",
"property",
"specified",
"(",
"NB",
"doesn",
"t",
... | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L10949-L10961 | train | Returns the rendered style of the first element in the set of matched elements | [
30522,
3853,
10155,
21756,
2571,
1006,
3200,
1007,
1063,
13075,
22330,
1027,
2023,
1012,
22330,
1006,
1007,
1025,
2065,
1006,
999,
22330,
1012,
2806,
8189,
23242,
1006,
1007,
1007,
1063,
2709,
2023,
1025,
1065,
13075,
3449,
2063,
1027,
2023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/lines-around-comment.js | isCommentAtParentEnd | function isCommentAtParentEnd(token, nodeType) {
const parent = getParentNodeOfToken(token);
return parent && isParentNodeType(parent, nodeType) &&
parent.loc.end.line - token.loc.end.line === 1;
} | javascript | function isCommentAtParentEnd(token, nodeType) {
const parent = getParentNodeOfToken(token);
return parent && isParentNodeType(parent, nodeType) &&
parent.loc.end.line - token.loc.end.line === 1;
} | [
"function",
"isCommentAtParentEnd",
"(",
"token",
",",
"nodeType",
")",
"{",
"const",
"parent",
"=",
"getParentNodeOfToken",
"(",
"token",
")",
";",
"return",
"parent",
"&&",
"isParentNodeType",
"(",
"parent",
",",
"nodeType",
")",
"&&",
"parent",
".",
"loc",
... | Returns whether or not comments are at the parent end or not.
@param {token} token The Comment token.
@param {string} nodeType The parent type to check against.
@returns {boolean} True if the comment is at parent end. | [
"Returns",
"whether",
"or",
"not",
"comments",
"are",
"at",
"the",
"parent",
"end",
"or",
"not",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/lines-around-comment.js#L215-L220 | train | Check if comment is at parent end of node | [
30522,
3853,
2003,
9006,
3672,
4017,
19362,
15781,
4859,
1006,
19204,
1010,
13045,
13874,
1007,
1063,
9530,
3367,
6687,
1027,
2131,
19362,
4765,
3630,
3207,
15794,
11045,
2078,
1006,
19204,
1007,
1025,
2709,
6687,
1004,
1004,
2003,
19362,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/chart/chart.js | _reduceToTSV | function _reduceToTSV(arr) {
// 2D array => quoted TSV row array
// [['a', 'b b'], [1, 2]] => ['a\t"b b"', '1\t2']
return arr.reduce((acc, row) => {
// ['a', 'b b', 'c c'] => ['a', '"b b"', '"c c"']
const quoted = row.map(text => {
if (!isNumeric(text) && text.indexOf(' ') >= 0) {
text = `"${text}"`;
}
return text;
});
// ['a', '"b b"', '"c c"'] => 'a\t"b b"\t"c c"'
acc.push(quoted.join('\t'));
return acc;
}, []);
} | javascript | function _reduceToTSV(arr) {
// 2D array => quoted TSV row array
// [['a', 'b b'], [1, 2]] => ['a\t"b b"', '1\t2']
return arr.reduce((acc, row) => {
// ['a', 'b b', 'c c'] => ['a', '"b b"', '"c c"']
const quoted = row.map(text => {
if (!isNumeric(text) && text.indexOf(' ') >= 0) {
text = `"${text}"`;
}
return text;
});
// ['a', '"b b"', '"c c"'] => 'a\t"b b"\t"c c"'
acc.push(quoted.join('\t'));
return acc;
}, []);
} | [
"function",
"_reduceToTSV",
"(",
"arr",
")",
"{",
"// 2D array => quoted TSV row array",
"// [['a', 'b b'], [1, 2]] => ['a\\t\"b b\"', '1\\t2']",
"return",
"arr",
".",
"reduce",
"(",
"(",
"acc",
",",
"row",
")",
"=>",
"{",
"// ['a', 'b b', 'c c'] => ['a', '\"b b\"', '\"c c\"'... | reduce 2D array to TSV rows
@param {Array.<Array.<string>>} arr - 2d array
@returns {Array.<string>} - TSV row array
@ignore | [
"reduce",
"2D",
"array",
"to",
"TSV",
"rows"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L400-L417 | train | Reduce array to TSV | [
30522,
3853,
1035,
5547,
3406,
3215,
2615,
1006,
12098,
2099,
1007,
1063,
1013,
1013,
14134,
9140,
1027,
1028,
9339,
24529,
2615,
5216,
9140,
1013,
1013,
1031,
1031,
1005,
1037,
1005,
1010,
1005,
1038,
1038,
1005,
1033,
1010,
1031,
1015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DOMHelpers.js | _removeQuotes | function _removeQuotes(src) {
if (_isQuote(src[0]) && src[src.length - 1] === src[0]) {
var q = src[0];
src = src.substr(1, src.length - 2);
src = src.replace("\\" + q, q);
}
return src;
} | javascript | function _removeQuotes(src) {
if (_isQuote(src[0]) && src[src.length - 1] === src[0]) {
var q = src[0];
src = src.substr(1, src.length - 2);
src = src.replace("\\" + q, q);
}
return src;
} | [
"function",
"_removeQuotes",
"(",
"src",
")",
"{",
"if",
"(",
"_isQuote",
"(",
"src",
"[",
"0",
"]",
")",
"&&",
"src",
"[",
"src",
".",
"length",
"-",
"1",
"]",
"===",
"src",
"[",
"0",
"]",
")",
"{",
"var",
"q",
"=",
"src",
"[",
"0",
"]",
"... | Remove quotes from the string and adjust escaped quotes
@param {string} source string | [
"Remove",
"quotes",
"from",
"the",
"string",
"and",
"adjust",
"escaped",
"quotes"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMHelpers.js#L50-L57 | train | Remove quotes from source | [
30522,
3853,
1035,
6366,
28940,
12184,
2015,
1006,
5034,
2278,
1007,
1063,
2065,
1006,
1035,
2003,
28940,
12184,
1006,
5034,
2278,
1031,
1014,
1033,
1007,
1004,
1004,
5034,
2278,
1031,
5034,
2278,
1012,
3091,
1011,
1015,
1033,
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... |
eslint/eslint | lib/rules/operator-assignment.js | prohibit | function prohibit(node) {
if (node.operator !== "=") {
context.report({
node,
messageId: "unexpected",
fix(fixer) {
if (canBeFixed(node.left)) {
const operatorToken = getOperatorToken(node);
const leftText = sourceCode.getText().slice(node.range[0], operatorToken.range[0]);
const newOperator = node.operator.slice(0, -1);
let rightText;
// If this change would modify precedence (e.g. `foo *= bar + 1` => `foo = foo * (bar + 1)`), parenthesize the right side.
if (
astUtils.getPrecedence(node.right) <= astUtils.getPrecedence({ type: "BinaryExpression", operator: newOperator }) &&
!astUtils.isParenthesised(sourceCode, node.right)
) {
rightText = `${sourceCode.text.slice(operatorToken.range[1], node.right.range[0])}(${sourceCode.getText(node.right)})`;
} else {
rightText = sourceCode.text.slice(operatorToken.range[1], node.range[1]);
}
return fixer.replaceText(node, `${leftText}= ${leftText}${newOperator}${rightText}`);
}
return null;
}
});
}
} | javascript | function prohibit(node) {
if (node.operator !== "=") {
context.report({
node,
messageId: "unexpected",
fix(fixer) {
if (canBeFixed(node.left)) {
const operatorToken = getOperatorToken(node);
const leftText = sourceCode.getText().slice(node.range[0], operatorToken.range[0]);
const newOperator = node.operator.slice(0, -1);
let rightText;
// If this change would modify precedence (e.g. `foo *= bar + 1` => `foo = foo * (bar + 1)`), parenthesize the right side.
if (
astUtils.getPrecedence(node.right) <= astUtils.getPrecedence({ type: "BinaryExpression", operator: newOperator }) &&
!astUtils.isParenthesised(sourceCode, node.right)
) {
rightText = `${sourceCode.text.slice(operatorToken.range[1], node.right.range[0])}(${sourceCode.getText(node.right)})`;
} else {
rightText = sourceCode.text.slice(operatorToken.range[1], node.range[1]);
}
return fixer.replaceText(node, `${leftText}= ${leftText}${newOperator}${rightText}`);
}
return null;
}
});
}
} | [
"function",
"prohibit",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"operator",
"!==",
"\"=\"",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
",",
"messageId",
":",
"\"unexpected\"",
",",
"fix",
"(",
"fixer",
")",
"{",
"if",
"(",
"canBeFix... | Warns if an assignment expression uses operator assignment shorthand.
@param {ASTNode} node An AssignmentExpression node.
@returns {void} | [
"Warns",
"if",
"an",
"assignment",
"expression",
"uses",
"operator",
"assignment",
"shorthand",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/operator-assignment.js#L178-L206 | train | Checks whether a BinaryExpression is prohibited by the operator. | [
30522,
3853,
23469,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
6872,
999,
1027,
1027,
1000,
1027,
1000,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1010,
4471,
3593,
1024,
1000,
9223,
1000,
1010,
8081,
1006,
8081,
2121,
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... |
react-bootstrap/react-bootstrap | src/utils/createChainedFunction.js | createChainedFunction | function createChainedFunction(...funcs) {
return funcs
.filter(f => f != null)
.reduce((acc, f) => {
if (typeof f !== 'function') {
throw new Error(
'Invalid Argument Type, must only provide functions, undefined, or null.',
);
}
if (acc === null) return f;
return function chainedFunction(...args) {
acc.apply(this, args);
f.apply(this, args);
};
}, null);
} | javascript | function createChainedFunction(...funcs) {
return funcs
.filter(f => f != null)
.reduce((acc, f) => {
if (typeof f !== 'function') {
throw new Error(
'Invalid Argument Type, must only provide functions, undefined, or null.',
);
}
if (acc === null) return f;
return function chainedFunction(...args) {
acc.apply(this, args);
f.apply(this, args);
};
}, null);
} | [
"function",
"createChainedFunction",
"(",
"...",
"funcs",
")",
"{",
"return",
"funcs",
".",
"filter",
"(",
"f",
"=>",
"f",
"!=",
"null",
")",
".",
"reduce",
"(",
"(",
"acc",
",",
"f",
")",
"=>",
"{",
"if",
"(",
"typeof",
"f",
"!==",
"'function'",
"... | Safe chained function
Will only create a new function if needed,
otherwise will pass back existing functions or null.
@param {function} functions to chain
@returns {function|null} | [
"Safe",
"chained",
"function"
] | f0dc81f91ae90eb54bd1e4c04fa9419872d347dc | https://github.com/react-bootstrap/react-bootstrap/blob/f0dc81f91ae90eb54bd1e4c04fa9419872d347dc/src/utils/createChainedFunction.js#L10-L27 | train | Creates a function that will be called with the passed in functions. | [
30522,
3853,
3443,
24925,
7228,
11263,
27989,
1006,
1012,
1012,
1012,
4569,
6169,
1007,
1063,
2709,
4569,
6169,
1012,
11307,
1006,
1042,
1027,
1028,
1042,
999,
1027,
19701,
1007,
1012,
5547,
1006,
1006,
16222,
1010,
1042,
1007,
1027,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.