repo stringclasses 192 values | path stringlengths 4 115 | func_name stringlengths 0 45 | original_string stringlengths 74 24k | language stringclasses 1 value | code stringlengths 74 24k | code_tokens listlengths 23 4.2k | docstring stringlengths 2 23.7k | docstring_tokens listlengths 1 810 | sha stringclasses 192 values | url stringlengths 90 200 | partition stringclasses 1 value | summary stringlengths 6 313 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
goldfire/howler.js | dist/howler.js | function() {
var self = this;
var url = null;
// If no audio is available, quit immediately.
if (Howler.noAudio) {
self._emit('loaderror', null, 'No audio support.');
return;
}
// Make sure our source is in an array.
if (typeof self._src === 'string') {
self._src = [self._src];
}
// Loop through the sources and pick the first one that is compatible.
for (var i=0; i<self._src.length; i++) {
var ext, str;
if (self._format && self._format[i]) {
// If an extension was specified, use that instead.
ext = self._format[i];
} else {
// Make sure the source is a string.
str = self._src[i];
if (typeof str !== 'string') {
self._emit('loaderror', null, 'Non-string found in selected audio sources - ignoring.');
continue;
}
// Extract the file extension from the URL or base64 data URI.
ext = /^data:audio\/([^;,]+);/i.exec(str);
if (!ext) {
ext = /\.([^.]+)$/.exec(str.split('?', 1)[0]);
}
if (ext) {
ext = ext[1].toLowerCase();
}
}
// Log a warning if no extension was found.
if (!ext) {
console.warn('No file extension was found. Consider using the "format" property or specify an extension.');
}
// Check if this extension is available.
if (ext && Howler.codecs(ext)) {
url = self._src[i];
break;
}
}
if (!url) {
self._emit('loaderror', null, 'No codec support for selected audio sources.');
return;
}
self._src = url;
self._state = 'loading';
// If the hosting page is HTTPS and the source isn't,
// drop down to HTML5 Audio to avoid Mixed Content errors.
if (window.location.protocol === 'https:' && url.slice(0, 5) === 'http:') {
self._html5 = true;
self._webAudio = false;
}
// Create a new sound object and add it to the pool.
new Sound(self);
// Load and decode the audio data for playback.
if (self._webAudio) {
loadBuffer(self);
}
return self;
} | javascript | function() {
var self = this;
var url = null;
// If no audio is available, quit immediately.
if (Howler.noAudio) {
self._emit('loaderror', null, 'No audio support.');
return;
}
// Make sure our source is in an array.
if (typeof self._src === 'string') {
self._src = [self._src];
}
// Loop through the sources and pick the first one that is compatible.
for (var i=0; i<self._src.length; i++) {
var ext, str;
if (self._format && self._format[i]) {
// If an extension was specified, use that instead.
ext = self._format[i];
} else {
// Make sure the source is a string.
str = self._src[i];
if (typeof str !== 'string') {
self._emit('loaderror', null, 'Non-string found in selected audio sources - ignoring.');
continue;
}
// Extract the file extension from the URL or base64 data URI.
ext = /^data:audio\/([^;,]+);/i.exec(str);
if (!ext) {
ext = /\.([^.]+)$/.exec(str.split('?', 1)[0]);
}
if (ext) {
ext = ext[1].toLowerCase();
}
}
// Log a warning if no extension was found.
if (!ext) {
console.warn('No file extension was found. Consider using the "format" property or specify an extension.');
}
// Check if this extension is available.
if (ext && Howler.codecs(ext)) {
url = self._src[i];
break;
}
}
if (!url) {
self._emit('loaderror', null, 'No codec support for selected audio sources.');
return;
}
self._src = url;
self._state = 'loading';
// If the hosting page is HTTPS and the source isn't,
// drop down to HTML5 Audio to avoid Mixed Content errors.
if (window.location.protocol === 'https:' && url.slice(0, 5) === 'http:') {
self._html5 = true;
self._webAudio = false;
}
// Create a new sound object and add it to the pool.
new Sound(self);
// Load and decode the audio data for playback.
if (self._webAudio) {
loadBuffer(self);
}
return self;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"url",
"=",
"null",
";",
"// If no audio is available, quit immediately.",
"if",
"(",
"Howler",
".",
"noAudio",
")",
"{",
"self",
".",
"_emit",
"(",
"'loaderror'",
",",
"null",
",",
"'No au... | Load the audio file.
@return {Howler} | [
"Load",
"the",
"audio",
"file",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L624-L701 | train | Load the audio file. | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
13075,
24471,
2140,
1027,
19701,
1025,
1013,
1013,
2065,
2053,
5746,
2003,
2800,
1010,
8046,
3202,
1012,
2065,
1006,
22912,
2121,
1012,
2053,
19513,
3695,
1007,
1063,
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.fl/src/sap/ui/fl/Utils.js | function(sLayer, sCurrentLayer) {
var sCurrent = sCurrentLayer || Utils.getCurrentLayer(false);
// If sLayer is undefined, it is assumed it be on the lowest layer
if ((this.getLayerIndex(sCurrent) > this.getLayerIndex(sLayer)) || !sLayer) {
return -1;
} else if (this.getLayerIndex(sCurrent) === this.getLayerIndex(sLayer)) {
return 0;
} else {
return 1;
}
} | javascript | function(sLayer, sCurrentLayer) {
var sCurrent = sCurrentLayer || Utils.getCurrentLayer(false);
// If sLayer is undefined, it is assumed it be on the lowest layer
if ((this.getLayerIndex(sCurrent) > this.getLayerIndex(sLayer)) || !sLayer) {
return -1;
} else if (this.getLayerIndex(sCurrent) === this.getLayerIndex(sLayer)) {
return 0;
} else {
return 1;
}
} | [
"function",
"(",
"sLayer",
",",
"sCurrentLayer",
")",
"{",
"var",
"sCurrent",
"=",
"sCurrentLayer",
"||",
"Utils",
".",
"getCurrentLayer",
"(",
"false",
")",
";",
"// If sLayer is undefined, it is assumed it be on the lowest layer",
"if",
"(",
"(",
"this",
".",
"get... | Compares current layer with a provided layer
-1: Lower layer, 0: Same layer, 1: Layer above
@param {String} sLayer - Layer name to be evaluated
@param {String} [sCurrentLayer] - Current layer name to be evaluated, if not provided the layer is taken from URL parameter
@returns {int} -1: Lower layer, 0: Same layer, 1: Layer above
@public
@function
@name sap.ui.fl.Utils.isLayerOverCurrentLayer | [
"Compares",
"current",
"layer",
"with",
"a",
"provided",
"layer",
"-",
"1",
":",
"Lower",
"layer",
"0",
":",
"Same",
"layer",
"1",
":",
"Layer",
"above"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L404-L414 | train | Returns the index of the given layer in the list of layers | [
30522,
3853,
1006,
20005,
1010,
8040,
29264,
24314,
1007,
1063,
13075,
8040,
29264,
1027,
8040,
29264,
24314,
1064,
1064,
21183,
12146,
1012,
2131,
10841,
14343,
3372,
24314,
1006,
6270,
1007,
1025,
1013,
1013,
2065,
20005,
2003,
6151,
28344,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | getModuleByNamespace | function getModuleByNamespace (store, helper, namespace) {
const module = store._modulesNamespaceMap[namespace]
if (process.env.NODE_ENV !== 'production' && !module) {
console.error(`[vuex] module namespace not found in ${helper}(): ${namespace}`)
}
return module
} | javascript | function getModuleByNamespace (store, helper, namespace) {
const module = store._modulesNamespaceMap[namespace]
if (process.env.NODE_ENV !== 'production' && !module) {
console.error(`[vuex] module namespace not found in ${helper}(): ${namespace}`)
}
return module
} | [
"function",
"getModuleByNamespace",
"(",
"store",
",",
"helper",
",",
"namespace",
")",
"{",
"const",
"module",
"=",
"store",
".",
"_modulesNamespaceMap",
"[",
"namespace",
"]",
"if",
"(",
"process",
".",
"env",
".",
"NODE_ENV",
"!==",
"'production'",
"&&",
... | Search a special module from store by namespace. if module not exist, print error message.
@param {Object} store
@param {String} helper
@param {String} namespace
@return {Object} | [
"Search",
"a",
"special",
"module",
"from",
"store",
"by",
"namespace",
".",
"if",
"module",
"not",
"exist",
"print",
"error",
"message",
"."
] | d7c7f9844831f98c5c9aaca213746c4ccc5d6929 | https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/src/helpers.js#L161-L167 | train | Get module by namespace | [
30522,
3853,
2131,
5302,
8566,
2571,
3762,
18442,
23058,
1006,
3573,
1010,
2393,
2121,
1010,
3415,
15327,
1007,
1063,
9530,
3367,
11336,
1027,
3573,
1012,
1035,
14184,
18442,
23058,
2863,
2361,
1031,
3415,
15327,
1033,
2065,
1006,
2832,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/function-paren-newline.js | validateNode | function validateNode(node) {
const parens = getParenTokens(node);
if (parens) {
validateParens(parens, astUtils.isFunction(node) ? node.params : node.arguments);
if (multilineArgumentsOption) {
validateArguments(parens, astUtils.isFunction(node) ? node.params : node.arguments);
}
}
} | javascript | function validateNode(node) {
const parens = getParenTokens(node);
if (parens) {
validateParens(parens, astUtils.isFunction(node) ? node.params : node.arguments);
if (multilineArgumentsOption) {
validateArguments(parens, astUtils.isFunction(node) ? node.params : node.arguments);
}
}
} | [
"function",
"validateNode",
"(",
"node",
")",
"{",
"const",
"parens",
"=",
"getParenTokens",
"(",
"node",
")",
";",
"if",
"(",
"parens",
")",
"{",
"validateParens",
"(",
"parens",
",",
"astUtils",
".",
"isFunction",
"(",
"node",
")",
"?",
"node",
".",
... | Validates the parentheses for a node
@param {ASTNode} node The node with parens
@returns {void} | [
"Validates",
"the",
"parentheses",
"for",
"a",
"node"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/function-paren-newline.js#L245-L255 | train | Validate node. | [
30522,
3853,
9398,
3686,
3630,
3207,
1006,
13045,
1007,
1063,
9530,
3367,
11968,
6132,
1027,
2131,
19362,
4765,
11045,
3619,
1006,
13045,
1007,
1025,
2065,
1006,
11968,
6132,
1007,
1063,
9398,
3686,
19362,
6132,
1006,
11968,
6132,
1010,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js | function(mHarFileContent, aEntries, iIndex) {
var sUrlGroup = this.createUrlGroup(aEntries[iIndex].request.method, aEntries[iIndex].request.url);
var customGroupName = aEntries[iIndex]._customGroupName ? aEntries[iIndex]._customGroupName : this.sDefaultCustomGroup;
if (!mHarFileContent._groupedEntries[customGroupName]) {
mHarFileContent._groupedEntries[customGroupName] = {};
}
if (!mHarFileContent._groupedEntries[customGroupName][sUrlGroup]) {
mHarFileContent._groupedEntries[customGroupName][sUrlGroup] = [];
}
mHarFileContent._groupedEntries[customGroupName][sUrlGroup].push(iIndex);
} | javascript | function(mHarFileContent, aEntries, iIndex) {
var sUrlGroup = this.createUrlGroup(aEntries[iIndex].request.method, aEntries[iIndex].request.url);
var customGroupName = aEntries[iIndex]._customGroupName ? aEntries[iIndex]._customGroupName : this.sDefaultCustomGroup;
if (!mHarFileContent._groupedEntries[customGroupName]) {
mHarFileContent._groupedEntries[customGroupName] = {};
}
if (!mHarFileContent._groupedEntries[customGroupName][sUrlGroup]) {
mHarFileContent._groupedEntries[customGroupName][sUrlGroup] = [];
}
mHarFileContent._groupedEntries[customGroupName][sUrlGroup].push(iIndex);
} | [
"function",
"(",
"mHarFileContent",
",",
"aEntries",
",",
"iIndex",
")",
"{",
"var",
"sUrlGroup",
"=",
"this",
".",
"createUrlGroup",
"(",
"aEntries",
"[",
"iIndex",
"]",
".",
"request",
".",
"method",
",",
"aEntries",
"[",
"iIndex",
"]",
".",
"request",
... | Adds an entry to the mapping. The order needs to be prepared and considered when adding the entry.
This is used to add each entry from from a provided har file or to add an entry during runtime when play is already started.
The mapping is created at 1st by a custom group, and 2nd the method and the URL (e.g. "GET/somePath/file.js").
The custom group is optional and determined from a provided callback (e.g. It can determine the name of a test or
can pop from an array of names).
@param {object} mHarFileContent The har file content map.
@param {array} aEntries The entries array. Default location of har files is within mHarFileContent.log.entries.
@param {int} iIndex The index of the entry in the entries array. This is used as the key for the mapping. | [
"Adds",
"an",
"entry",
"to",
"the",
"mapping",
".",
"The",
"order",
"needs",
"to",
"be",
"prepared",
"and",
"considered",
"when",
"adding",
"the",
"entry",
".",
"This",
"is",
"used",
"to",
"add",
"each",
"entry",
"from",
"from",
"a",
"provided",
"har",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L178-L188 | train | Adds an entry to the hierarchical file | [
30522,
3853,
1006,
1049,
8167,
8873,
2571,
8663,
6528,
2102,
1010,
29347,
3372,
5134,
1010,
2462,
13629,
2595,
1007,
1063,
13075,
7505,
2140,
17058,
1027,
2023,
1012,
3443,
3126,
2140,
17058,
1006,
29347,
3372,
5134,
1031,
2462,
13629,
2595... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/LiveDevelopment/LiveDevelopment.js | _onDocumentSaved | function _onDocumentSaved(event, doc) {
if (!Inspector.connected() || !_server) {
return;
}
var absolutePath = doc.file.fullPath,
liveDocument = absolutePath && _server.get(absolutePath),
liveEditingEnabled = liveDocument && liveDocument.isLiveEditingEnabled && liveDocument.isLiveEditingEnabled();
// Skip reload if the saved document has live editing enabled
if (liveEditingEnabled) {
return;
}
var documentUrl = _server.pathToUrl(absolutePath),
wasRequested = agents.network && agents.network.wasURLRequested(documentUrl);
if (wasRequested) {
reload();
}
} | javascript | function _onDocumentSaved(event, doc) {
if (!Inspector.connected() || !_server) {
return;
}
var absolutePath = doc.file.fullPath,
liveDocument = absolutePath && _server.get(absolutePath),
liveEditingEnabled = liveDocument && liveDocument.isLiveEditingEnabled && liveDocument.isLiveEditingEnabled();
// Skip reload if the saved document has live editing enabled
if (liveEditingEnabled) {
return;
}
var documentUrl = _server.pathToUrl(absolutePath),
wasRequested = agents.network && agents.network.wasURLRequested(documentUrl);
if (wasRequested) {
reload();
}
} | [
"function",
"_onDocumentSaved",
"(",
"event",
",",
"doc",
")",
"{",
"if",
"(",
"!",
"Inspector",
".",
"connected",
"(",
")",
"||",
"!",
"_server",
")",
"{",
"return",
";",
"}",
"var",
"absolutePath",
"=",
"doc",
".",
"file",
".",
"fullPath",
",",
"li... | Triggered by a documentSaved event from DocumentManager.
@param {$.Event} event
@param {Document} doc | [
"Triggered",
"by",
"a",
"documentSaved",
"event",
"from",
"DocumentManager",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopment.js#L1468-L1488 | train | The function that is called when a document is saved | [
30522,
3853,
1035,
2006,
3527,
24894,
11187,
10696,
2094,
1006,
2724,
1010,
9986,
1007,
1063,
2065,
1006,
999,
7742,
1012,
4198,
1006,
1007,
1064,
1064,
999,
1035,
8241,
1007,
1063,
2709,
1025,
1065,
13075,
7619,
15069,
1027,
9986,
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... |
postcss/autoprefixer | lib/hacks/grid-utils.js | getMSDecls | function getMSDecls (area, addRowSpan = false, addColumnSpan = false) {
return [].concat(
{
prop: '-ms-grid-row',
value: String(area.row.start)
},
(area.row.span > 1 || addRowSpan) ? {
prop: '-ms-grid-row-span',
value: String(area.row.span)
} : [],
{
prop: '-ms-grid-column',
value: String(area.column.start)
},
(area.column.span > 1 || addColumnSpan) ? {
prop: '-ms-grid-column-span',
value: String(area.column.span)
} : []
)
} | javascript | function getMSDecls (area, addRowSpan = false, addColumnSpan = false) {
return [].concat(
{
prop: '-ms-grid-row',
value: String(area.row.start)
},
(area.row.span > 1 || addRowSpan) ? {
prop: '-ms-grid-row-span',
value: String(area.row.span)
} : [],
{
prop: '-ms-grid-column',
value: String(area.column.start)
},
(area.column.span > 1 || addColumnSpan) ? {
prop: '-ms-grid-column-span',
value: String(area.column.span)
} : []
)
} | [
"function",
"getMSDecls",
"(",
"area",
",",
"addRowSpan",
"=",
"false",
",",
"addColumnSpan",
"=",
"false",
")",
"{",
"return",
"[",
"]",
".",
"concat",
"(",
"{",
"prop",
":",
"'-ms-grid-row'",
",",
"value",
":",
"String",
"(",
"area",
".",
"row",
".",... | Insert parsed grid areas
Get an array of -ms- prefixed props and values
@param {Object} [area] area object with column and row data
@param {Boolean} [addRowSpan] should we add grid-column-row value?
@param {Boolean} [addColumnSpan] should we add grid-column-span value?
@return {Array<Object>} | [
"Insert",
"parsed",
"grid",
"areas",
"Get",
"an",
"array",
"of",
"-",
"ms",
"-",
"prefixed",
"props",
"and",
"values"
] | 24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32 | https://github.com/postcss/autoprefixer/blob/24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32/lib/hacks/grid-utils.js#L276-L295 | train | Get ms - decls from an area | [
30522,
3853,
2131,
5244,
3207,
20464,
2015,
1006,
2181,
1010,
5587,
10524,
13102,
2319,
1027,
6270,
1010,
5587,
25778,
2819,
3619,
9739,
1027,
6270,
1007,
1063,
2709,
1031,
1033,
1012,
9530,
11266,
1006,
1063,
17678,
1024,
30524,
1010,
3643... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
uber/deck.gl | modules/layers/src/icon-layer/icon-manager.js | resizeTexture | function resizeTexture(texture, width, height) {
const oldWidth = texture.width;
const oldHeight = texture.height;
const oldPixels = readPixelsToBuffer(texture, {});
texture.resize({width, height});
texture.setSubImageData({
data: oldPixels,
x: 0,
y: height - oldHeight,
width: oldWidth,
height: oldHeight,
parameters: DEFAULT_TEXTURE_PARAMETERS
});
texture.generateMipmap();
oldPixels.delete();
return texture;
} | javascript | function resizeTexture(texture, width, height) {
const oldWidth = texture.width;
const oldHeight = texture.height;
const oldPixels = readPixelsToBuffer(texture, {});
texture.resize({width, height});
texture.setSubImageData({
data: oldPixels,
x: 0,
y: height - oldHeight,
width: oldWidth,
height: oldHeight,
parameters: DEFAULT_TEXTURE_PARAMETERS
});
texture.generateMipmap();
oldPixels.delete();
return texture;
} | [
"function",
"resizeTexture",
"(",
"texture",
",",
"width",
",",
"height",
")",
"{",
"const",
"oldWidth",
"=",
"texture",
".",
"width",
";",
"const",
"oldHeight",
"=",
"texture",
".",
"height",
";",
"const",
"oldPixels",
"=",
"readPixelsToBuffer",
"(",
"textu... | resize texture without losing original data | [
"resize",
"texture",
"without",
"losing",
"original",
"data"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/layers/src/icon-layer/icon-manager.js#L58-L78 | train | Resizes a texture to the specified size | [
30522,
3853,
24501,
4697,
18209,
5397,
1006,
14902,
1010,
9381,
1010,
4578,
1007,
1063,
9530,
3367,
2214,
9148,
11927,
2232,
1027,
14902,
1012,
9381,
1025,
9530,
3367,
2214,
26036,
13900,
1027,
14902,
1012,
4578,
1025,
9530,
3367,
2214,
819... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(aUI5Filter) {
if (aUI5Filter.length == 0) {
return "";
}
var sOptionString = "";
// 1. Process conditions
aUI5Filter.sort(function(a, b) {
if (a.sPath == b.sPath) {
return 0;
}
if (a.sPath > b.sPath) {
return 1;
} else {
return -1;
}
});
var sPropertyName = aUI5Filter[0].sPath;
var sSubExpression = "";
var aNEFilter = [], aUI5MultiFilter = [];
for ( var i = -1, oUI5Filter; (oUI5Filter = aUI5Filter[++i]) !== undefined;) {
if (oUI5Filter.aFilters != undefined) { // defer processing to the end
aUI5MultiFilter.push(oUI5Filter);
continue;
}
if (sPropertyName != oUI5Filter.sPath) {
if (sSubExpression != "") {
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + sSubExpression + ")";
}
sSubExpression = "";
if (aNEFilter.length > 0) { // handle negated comparisons
for (var j = -1, oNEFilter; (oNEFilter = aNEFilter[++j]) !== undefined;) {
sSubExpression += (sSubExpression == "" ? "" : " and ") + this.renderUI5Filter(oNEFilter);
}
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + sSubExpression + ")";
sSubExpression = "";
}
sPropertyName = oUI5Filter.sPath;
aNEFilter = [];
}
if (oUI5Filter.sOperator == FilterOperator.NE) {
aNEFilter.push(oUI5Filter);
continue;
}
sSubExpression += (sSubExpression == "" ? "" : " or ") + this.renderUI5Filter(oUI5Filter);
}
// add last sub expression
if (sSubExpression != "") {
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + sSubExpression + ")";
}
if (aNEFilter.length > 0) { // handle negated comparisons
sSubExpression = "";
for (var k = -1, oNEFilter2; (oNEFilter2 = aNEFilter[++k]) !== undefined;) {
sSubExpression += (sSubExpression == "" ? "" : " and ") + this.renderUI5Filter(oNEFilter2);
}
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + sSubExpression + ")";
}
// process multi filters if any
if (aUI5MultiFilter.length > 0) {
for (var l = -1, oMultiFilter; (oMultiFilter = aUI5MultiFilter[++l]) !== undefined;) {
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + this.renderUI5MultiFilter(oMultiFilter) + ")";
}
}
return sOptionString;
} | javascript | function(aUI5Filter) {
if (aUI5Filter.length == 0) {
return "";
}
var sOptionString = "";
// 1. Process conditions
aUI5Filter.sort(function(a, b) {
if (a.sPath == b.sPath) {
return 0;
}
if (a.sPath > b.sPath) {
return 1;
} else {
return -1;
}
});
var sPropertyName = aUI5Filter[0].sPath;
var sSubExpression = "";
var aNEFilter = [], aUI5MultiFilter = [];
for ( var i = -1, oUI5Filter; (oUI5Filter = aUI5Filter[++i]) !== undefined;) {
if (oUI5Filter.aFilters != undefined) { // defer processing to the end
aUI5MultiFilter.push(oUI5Filter);
continue;
}
if (sPropertyName != oUI5Filter.sPath) {
if (sSubExpression != "") {
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + sSubExpression + ")";
}
sSubExpression = "";
if (aNEFilter.length > 0) { // handle negated comparisons
for (var j = -1, oNEFilter; (oNEFilter = aNEFilter[++j]) !== undefined;) {
sSubExpression += (sSubExpression == "" ? "" : " and ") + this.renderUI5Filter(oNEFilter);
}
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + sSubExpression + ")";
sSubExpression = "";
}
sPropertyName = oUI5Filter.sPath;
aNEFilter = [];
}
if (oUI5Filter.sOperator == FilterOperator.NE) {
aNEFilter.push(oUI5Filter);
continue;
}
sSubExpression += (sSubExpression == "" ? "" : " or ") + this.renderUI5Filter(oUI5Filter);
}
// add last sub expression
if (sSubExpression != "") {
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + sSubExpression + ")";
}
if (aNEFilter.length > 0) { // handle negated comparisons
sSubExpression = "";
for (var k = -1, oNEFilter2; (oNEFilter2 = aNEFilter[++k]) !== undefined;) {
sSubExpression += (sSubExpression == "" ? "" : " and ") + this.renderUI5Filter(oNEFilter2);
}
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + sSubExpression + ")";
}
// process multi filters if any
if (aUI5MultiFilter.length > 0) {
for (var l = -1, oMultiFilter; (oMultiFilter = aUI5MultiFilter[++l]) !== undefined;) {
sOptionString += (sOptionString == "" ? "" : " and ") + "(" + this.renderUI5MultiFilter(oMultiFilter) + ")";
}
}
return sOptionString;
} | [
"function",
"(",
"aUI5Filter",
")",
"{",
"if",
"(",
"aUI5Filter",
".",
"length",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"var",
"sOptionString",
"=",
"\"\"",
";",
"// 1. Process conditions",
"aUI5Filter",
".",
"sort",
"(",
"function",
"(",
"a",
... | /*
@private | [
"/",
"*"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L3407-L3474 | train | This function is called to process the UI5 filter | [
30522,
3853,
1006,
8740,
2072,
2629,
8873,
21928,
1007,
1063,
2065,
1006,
8740,
2072,
2629,
8873,
21928,
1012,
3091,
1027,
1027,
1014,
1007,
1063,
2709,
1000,
1000,
1025,
1065,
13075,
2061,
16790,
3367,
4892,
1027,
1000,
1000,
1025,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/no-var.js | hasReferenceInTDZ | function hasReferenceInTDZ(node) {
const initStart = node.range[0];
const initEnd = node.range[1];
return variable => {
const id = variable.defs[0].name;
const idStart = id.range[0];
const defaultValue = (id.parent.type === "AssignmentPattern" ? id.parent.right : null);
const defaultStart = defaultValue && defaultValue.range[0];
const defaultEnd = defaultValue && defaultValue.range[1];
return variable.references.some(reference => {
const start = reference.identifier.range[0];
const end = reference.identifier.range[1];
return !reference.init && (
start < idStart ||
(defaultValue !== null && start >= defaultStart && end <= defaultEnd) ||
(start >= initStart && end <= initEnd)
);
});
};
} | javascript | function hasReferenceInTDZ(node) {
const initStart = node.range[0];
const initEnd = node.range[1];
return variable => {
const id = variable.defs[0].name;
const idStart = id.range[0];
const defaultValue = (id.parent.type === "AssignmentPattern" ? id.parent.right : null);
const defaultStart = defaultValue && defaultValue.range[0];
const defaultEnd = defaultValue && defaultValue.range[1];
return variable.references.some(reference => {
const start = reference.identifier.range[0];
const end = reference.identifier.range[1];
return !reference.init && (
start < idStart ||
(defaultValue !== null && start >= defaultStart && end <= defaultEnd) ||
(start >= initStart && end <= initEnd)
);
});
};
} | [
"function",
"hasReferenceInTDZ",
"(",
"node",
")",
"{",
"const",
"initStart",
"=",
"node",
".",
"range",
"[",
"0",
"]",
";",
"const",
"initEnd",
"=",
"node",
".",
"range",
"[",
"1",
"]",
";",
"return",
"variable",
"=>",
"{",
"const",
"id",
"=",
"vari... | Creates the predicate function which checks whether a variable has their references in TDZ.
The predicate function would return `true`:
- if a reference is before the declarator. E.g. (var a = b, b = 1;)(var {a = b, b} = {};)
- if a reference is in the expression of their default value. E.g. (var {a = a} = {};)
- if a reference is in the expression of their initializer. E.g. (var a = a;)
@param {ASTNode} node - The initializer node of VariableDeclarator.
@returns {Function} The predicate function.
@private | [
"Creates",
"the",
"predicate",
"function",
"which",
"checks",
"whether",
"a",
"variable",
"has",
"their",
"references",
"in",
"TDZ",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-var.js#L153-L175 | train | Returns function that checks whether a variable has references in TDZ. | [
30522,
3853,
2038,
2890,
25523,
18447,
2094,
2480,
1006,
13045,
1007,
1063,
9530,
3367,
1999,
12762,
7559,
2102,
1027,
13045,
1012,
2846,
1031,
1014,
1033,
1025,
9530,
3367,
1999,
4221,
4859,
1027,
13045,
1012,
2846,
1031,
1015,
1033,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_EncInfoStd | function parse_EncInfoStd(blob) {
var flags = blob.read_shift(4);
if((flags & 0x3F) != 0x24) throw new Error("EncryptionInfo mismatch");
var sz = blob.read_shift(4);
//var tgt = blob.l + sz;
var hdr = parse_EncryptionHeader(blob, sz);
var verifier = parse_EncryptionVerifier(blob, blob.length - blob.l);
return { t:"Std", h:hdr, v:verifier };
} | javascript | function parse_EncInfoStd(blob) {
var flags = blob.read_shift(4);
if((flags & 0x3F) != 0x24) throw new Error("EncryptionInfo mismatch");
var sz = blob.read_shift(4);
//var tgt = blob.l + sz;
var hdr = parse_EncryptionHeader(blob, sz);
var verifier = parse_EncryptionVerifier(blob, blob.length - blob.l);
return { t:"Std", h:hdr, v:verifier };
} | [
"function",
"parse_EncInfoStd",
"(",
"blob",
")",
"{",
"var",
"flags",
"=",
"blob",
".",
"read_shift",
"(",
"4",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"0x3F",
")",
"!=",
"0x24",
")",
"throw",
"new",
"Error",
"(",
"\"EncryptionInfo mismatch\"",
")",
"... | /* [MS-OFFCRYPTO] 2.3.4.5 EncryptionInfo Stream (Standard Encryption) | [
"/",
"*",
"[",
"MS",
"-",
"OFFCRYPTO",
"]",
"2",
".",
"3",
".",
"4",
".",
"5",
"EncryptionInfo",
"Stream",
"(",
"Standard",
"Encryption",
")"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8244-L8252 | train | Parse the EncryptionInfo | [
30522,
3853,
11968,
3366,
1035,
4372,
15459,
14876,
3367,
2094,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
9245,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1018,
1007,
1025,
2065,
1006,
1006,
9245,
1004,
1014,
2595,
2509,
2546,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js | function(mDelaySettings, iTime) {
if (mDelaySettings) {
if (mDelaySettings.factor !== undefined && typeof mDelaySettings.factor === 'number') {
iTime *= mDelaySettings.factor;
}
if (mDelaySettings.offset !== undefined && typeof mDelaySettings.offset === 'number') {
iTime += mDelaySettings.offset;
}
if (mDelaySettings.max !== undefined && typeof mDelaySettings.max === 'number') {
iTime = Math.min(mDelaySettings.max, iTime);
}
if (mDelaySettings.min !== undefined && typeof mDelaySettings.min === 'number') {
iTime = Math.max(mDelaySettings.min, iTime);
}
}
return iTime;
} | javascript | function(mDelaySettings, iTime) {
if (mDelaySettings) {
if (mDelaySettings.factor !== undefined && typeof mDelaySettings.factor === 'number') {
iTime *= mDelaySettings.factor;
}
if (mDelaySettings.offset !== undefined && typeof mDelaySettings.offset === 'number') {
iTime += mDelaySettings.offset;
}
if (mDelaySettings.max !== undefined && typeof mDelaySettings.max === 'number') {
iTime = Math.min(mDelaySettings.max, iTime);
}
if (mDelaySettings.min !== undefined && typeof mDelaySettings.min === 'number') {
iTime = Math.max(mDelaySettings.min, iTime);
}
}
return iTime;
} | [
"function",
"(",
"mDelaySettings",
",",
"iTime",
")",
"{",
"if",
"(",
"mDelaySettings",
")",
"{",
"if",
"(",
"mDelaySettings",
".",
"factor",
"!==",
"undefined",
"&&",
"typeof",
"mDelaySettings",
".",
"factor",
"===",
"'number'",
")",
"{",
"iTime",
"*=",
"... | Calculates the delay on base of the provided settings.
It is possible to configure an offset, a minimum and a maximum delay.
@param {object} mDelaySettings The settings map.
@param {int} iTime The curreent duration of the request as milliseconds.
@returns {int} The new duration as milliseconds. | [
"Calculates",
"the",
"delay",
"on",
"base",
"of",
"the",
"provided",
"settings",
".",
"It",
"is",
"possible",
"to",
"configure",
"an",
"offset",
"a",
"minimum",
"and",
"a",
"maximum",
"delay",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L338-L354 | train | Set the delay | [
30522,
3853,
1006,
9108,
10581,
23274,
13027,
2015,
1010,
2009,
14428,
1007,
1063,
2065,
1006,
9108,
10581,
23274,
13027,
2015,
1007,
1063,
2065,
1006,
9108,
10581,
23274,
13027,
2015,
1012,
5387,
999,
1027,
1027,
6151,
28344,
1004,
1004,
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... | |
postcss/autoprefixer | lib/hacks/grid-utils.js | insertAreas | function insertAreas (css, isDisabled) {
// parse grid-template declarations
let gridTemplatesData = parseGridTemplatesData(css)
// return undefined if no declarations found
if (gridTemplatesData.length === 0) {
return undefined
}
// we need to store the rules that we will insert later
let rulesToInsert = {}
css.walkDecls('grid-area', gridArea => {
let gridAreaRule = gridArea.parent
let hasPrefixedRow = gridAreaRule.first.prop === '-ms-grid-row'
let gridAreaMedia = getParentMedia(gridAreaRule)
if (isDisabled(gridArea)) {
return undefined
}
let gridAreaRuleIndex =
gridAreaMedia ? css.index(gridAreaMedia) : css.index(gridAreaRule)
let value = gridArea.value
// found the data that matches grid-area identifier
let data = gridTemplatesData.filter(d => d.allAreas.includes(value))[0]
if (!data) {
return true
}
let lastArea = data.allAreas[data.allAreas.length - 1]
let selectorBySpace = list.space(gridAreaRule.selector)
let selectorByComma = list.comma(gridAreaRule.selector)
let selectorIsComplex = (
(selectorBySpace.length > 1) &&
(selectorBySpace.length > selectorByComma.length)
)
// prevent doubling of prefixes
if (hasPrefixedRow) {
return false
}
// create the empty object with the key as the last area name
// e.g if we have templates with "a b c" values, "c" will be the last area
if (!rulesToInsert[lastArea]) {
rulesToInsert[lastArea] = {}
}
let lastRuleIsSet = false
// walk through every grid-template rule data
for (let rule of data.rules) {
let area = rule.areas[value]
let hasDuplicateName = rule.duplicateAreaNames.includes(value)
// if we can't find the area name, update lastRule and continue
if (!area) {
let lastRuleIndex = css.index(rulesToInsert[lastArea].lastRule)
if (gridAreaRuleIndex > lastRuleIndex) {
rulesToInsert[lastArea].lastRule = gridAreaMedia || gridAreaRule
}
continue
}
// for grid-templates inside media rule we need to create empty
// array to push prefixed grid-area rules later
if (rule.params && !rulesToInsert[lastArea][rule.params]) {
rulesToInsert[lastArea][rule.params] = []
}
if ((!rule.hasDuplicates || !hasDuplicateName) && !rule.params) {
// grid-template has no duplicates and not inside media rule
getMSDecls(area, false, false).reverse()
.forEach(i => gridAreaRule.prepend(
Object.assign(i, {
raws: {
between: gridArea.raws.between
}
})
))
rulesToInsert[lastArea].lastRule = gridAreaRule
lastRuleIsSet = true
} else if (rule.hasDuplicates && !rule.params && !selectorIsComplex) {
// grid-template has duplicates and not inside media rule
let cloned = gridAreaRule.clone()
cloned.removeAll()
getMSDecls(area, area.row.updateSpan, area.column.updateSpan).reverse()
.forEach(i => cloned.prepend(
Object.assign(i, {
raws: {
between: gridArea.raws.between
}
})
))
cloned.selectors = (
changeDuplicateAreaSelectors(cloned.selectors, rule.selectors)
)
if (rulesToInsert[lastArea].lastRule) {
rulesToInsert[lastArea].lastRule.after(cloned)
}
rulesToInsert[lastArea].lastRule = cloned
lastRuleIsSet = true
} else if (
rule.hasDuplicates &&
!rule.params &&
selectorIsComplex &&
gridAreaRule.selector.includes(rule.selectors[0])
) {
// grid-template has duplicates and not inside media rule
// and the selector is complex
gridAreaRule.walkDecls(/-ms-grid-(row|column)/, d => d.remove())
getMSDecls(area, area.row.updateSpan, area.column.updateSpan).reverse()
.forEach(i => gridAreaRule.prepend(
Object.assign(i, {
raws: {
between: gridArea.raws.between
}
})
))
} else if (rule.params) {
// grid-template is inside media rule
// if we're inside media rule, we need to store prefixed rules
// inside rulesToInsert object to be able to preserve the order of media
// rules and merge them easily
let cloned = gridAreaRule.clone()
cloned.removeAll()
getMSDecls(area, area.row.updateSpan, area.column.updateSpan).reverse()
.forEach(i => cloned.prepend(
Object.assign(i, {
raws: {
between: gridArea.raws.between
}
})
))
if (rule.hasDuplicates && hasDuplicateName) {
cloned.selectors = (
changeDuplicateAreaSelectors(cloned.selectors, rule.selectors)
)
}
cloned.raws = rule.node.raws
if (css.index(rule.node.parent) > gridAreaRuleIndex) {
// append the prefixed rules right inside media rule
// with grid-template
rule.node.parent.append(cloned)
} else {
// store the rule to insert later
rulesToInsert[lastArea][rule.params].push(cloned)
}
// set new rule as last rule ONLY if we didn't set lastRule for
// this grid-area before
if (!lastRuleIsSet) {
rulesToInsert[lastArea].lastRule = gridAreaMedia || gridAreaRule
}
}
}
return undefined
})
// append stored rules inside the media rules
Object.keys(rulesToInsert).forEach(area => {
let data = rulesToInsert[area]
let lastRule = data.lastRule
Object.keys(data)
.reverse()
.filter(p => p !== 'lastRule')
.forEach(params => {
if (data[params].length > 0 && lastRule) {
lastRule.after({ name: 'media', params })
lastRule.next().append(data[params])
}
})
})
return undefined
} | javascript | function insertAreas (css, isDisabled) {
// parse grid-template declarations
let gridTemplatesData = parseGridTemplatesData(css)
// return undefined if no declarations found
if (gridTemplatesData.length === 0) {
return undefined
}
// we need to store the rules that we will insert later
let rulesToInsert = {}
css.walkDecls('grid-area', gridArea => {
let gridAreaRule = gridArea.parent
let hasPrefixedRow = gridAreaRule.first.prop === '-ms-grid-row'
let gridAreaMedia = getParentMedia(gridAreaRule)
if (isDisabled(gridArea)) {
return undefined
}
let gridAreaRuleIndex =
gridAreaMedia ? css.index(gridAreaMedia) : css.index(gridAreaRule)
let value = gridArea.value
// found the data that matches grid-area identifier
let data = gridTemplatesData.filter(d => d.allAreas.includes(value))[0]
if (!data) {
return true
}
let lastArea = data.allAreas[data.allAreas.length - 1]
let selectorBySpace = list.space(gridAreaRule.selector)
let selectorByComma = list.comma(gridAreaRule.selector)
let selectorIsComplex = (
(selectorBySpace.length > 1) &&
(selectorBySpace.length > selectorByComma.length)
)
// prevent doubling of prefixes
if (hasPrefixedRow) {
return false
}
// create the empty object with the key as the last area name
// e.g if we have templates with "a b c" values, "c" will be the last area
if (!rulesToInsert[lastArea]) {
rulesToInsert[lastArea] = {}
}
let lastRuleIsSet = false
// walk through every grid-template rule data
for (let rule of data.rules) {
let area = rule.areas[value]
let hasDuplicateName = rule.duplicateAreaNames.includes(value)
// if we can't find the area name, update lastRule and continue
if (!area) {
let lastRuleIndex = css.index(rulesToInsert[lastArea].lastRule)
if (gridAreaRuleIndex > lastRuleIndex) {
rulesToInsert[lastArea].lastRule = gridAreaMedia || gridAreaRule
}
continue
}
// for grid-templates inside media rule we need to create empty
// array to push prefixed grid-area rules later
if (rule.params && !rulesToInsert[lastArea][rule.params]) {
rulesToInsert[lastArea][rule.params] = []
}
if ((!rule.hasDuplicates || !hasDuplicateName) && !rule.params) {
// grid-template has no duplicates and not inside media rule
getMSDecls(area, false, false).reverse()
.forEach(i => gridAreaRule.prepend(
Object.assign(i, {
raws: {
between: gridArea.raws.between
}
})
))
rulesToInsert[lastArea].lastRule = gridAreaRule
lastRuleIsSet = true
} else if (rule.hasDuplicates && !rule.params && !selectorIsComplex) {
// grid-template has duplicates and not inside media rule
let cloned = gridAreaRule.clone()
cloned.removeAll()
getMSDecls(area, area.row.updateSpan, area.column.updateSpan).reverse()
.forEach(i => cloned.prepend(
Object.assign(i, {
raws: {
between: gridArea.raws.between
}
})
))
cloned.selectors = (
changeDuplicateAreaSelectors(cloned.selectors, rule.selectors)
)
if (rulesToInsert[lastArea].lastRule) {
rulesToInsert[lastArea].lastRule.after(cloned)
}
rulesToInsert[lastArea].lastRule = cloned
lastRuleIsSet = true
} else if (
rule.hasDuplicates &&
!rule.params &&
selectorIsComplex &&
gridAreaRule.selector.includes(rule.selectors[0])
) {
// grid-template has duplicates and not inside media rule
// and the selector is complex
gridAreaRule.walkDecls(/-ms-grid-(row|column)/, d => d.remove())
getMSDecls(area, area.row.updateSpan, area.column.updateSpan).reverse()
.forEach(i => gridAreaRule.prepend(
Object.assign(i, {
raws: {
between: gridArea.raws.between
}
})
))
} else if (rule.params) {
// grid-template is inside media rule
// if we're inside media rule, we need to store prefixed rules
// inside rulesToInsert object to be able to preserve the order of media
// rules and merge them easily
let cloned = gridAreaRule.clone()
cloned.removeAll()
getMSDecls(area, area.row.updateSpan, area.column.updateSpan).reverse()
.forEach(i => cloned.prepend(
Object.assign(i, {
raws: {
between: gridArea.raws.between
}
})
))
if (rule.hasDuplicates && hasDuplicateName) {
cloned.selectors = (
changeDuplicateAreaSelectors(cloned.selectors, rule.selectors)
)
}
cloned.raws = rule.node.raws
if (css.index(rule.node.parent) > gridAreaRuleIndex) {
// append the prefixed rules right inside media rule
// with grid-template
rule.node.parent.append(cloned)
} else {
// store the rule to insert later
rulesToInsert[lastArea][rule.params].push(cloned)
}
// set new rule as last rule ONLY if we didn't set lastRule for
// this grid-area before
if (!lastRuleIsSet) {
rulesToInsert[lastArea].lastRule = gridAreaMedia || gridAreaRule
}
}
}
return undefined
})
// append stored rules inside the media rules
Object.keys(rulesToInsert).forEach(area => {
let data = rulesToInsert[area]
let lastRule = data.lastRule
Object.keys(data)
.reverse()
.filter(p => p !== 'lastRule')
.forEach(params => {
if (data[params].length > 0 && lastRule) {
lastRule.after({ name: 'media', params })
lastRule.next().append(data[params])
}
})
})
return undefined
} | [
"function",
"insertAreas",
"(",
"css",
",",
"isDisabled",
")",
"{",
"// parse grid-template declarations",
"let",
"gridTemplatesData",
"=",
"parseGridTemplatesData",
"(",
"css",
")",
"// return undefined if no declarations found",
"if",
"(",
"gridTemplatesData",
".",
"lengt... | insert prefixed grid-area declarations
@param {Root} css css root
@param {Function} isDisabled check if the rule is disabled
@return {void} | [
"insert",
"prefixed",
"grid",
"-",
"area",
"declarations"
] | 24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32 | https://github.com/postcss/autoprefixer/blob/24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32/lib/hacks/grid-utils.js#L456-L644 | train | inserts areas in the grid - template | [
30522,
3853,
19274,
12069,
3022,
1006,
20116,
2015,
1010,
2003,
10521,
3085,
2094,
1007,
1063,
1013,
1013,
11968,
3366,
8370,
1011,
23561,
8170,
2015,
2292,
8370,
18532,
15725,
16150,
6790,
1027,
11968,
3366,
16523,
3593,
18532,
15725,
16150,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Targets.js | function(vTargetNames, sProvidedTitleTargetName) {
var oTarget, sTitleTargetName;
sTitleTargetName = sProvidedTitleTargetName || (typeof vTargetNames === "string" && vTargetNames);
if (!sTitleTargetName) {
vTargetNames.some(function(sTargetName) {
oTarget = this.getTarget(sTargetName);
// search the TitleTarget depth first
while (oTarget && oTarget._oParent && oTarget._oParent._oOptions.title) {
oTarget = oTarget._oParent;
}
if (oTarget && oTarget._oOptions.title) {
// we found the TitleTarget
sTitleTargetName = oTarget._oOptions._name;
return true;
}
}.bind(this));
}
return sTitleTargetName;
} | javascript | function(vTargetNames, sProvidedTitleTargetName) {
var oTarget, sTitleTargetName;
sTitleTargetName = sProvidedTitleTargetName || (typeof vTargetNames === "string" && vTargetNames);
if (!sTitleTargetName) {
vTargetNames.some(function(sTargetName) {
oTarget = this.getTarget(sTargetName);
// search the TitleTarget depth first
while (oTarget && oTarget._oParent && oTarget._oParent._oOptions.title) {
oTarget = oTarget._oParent;
}
if (oTarget && oTarget._oOptions.title) {
// we found the TitleTarget
sTitleTargetName = oTarget._oOptions._name;
return true;
}
}.bind(this));
}
return sTitleTargetName;
} | [
"function",
"(",
"vTargetNames",
",",
"sProvidedTitleTargetName",
")",
"{",
"var",
"oTarget",
",",
"sTitleTargetName",
";",
"sTitleTargetName",
"=",
"sProvidedTitleTargetName",
"||",
"(",
"typeof",
"vTargetNames",
"===",
"\"string\"",
"&&",
"vTargetNames",
")",
";",
... | /*
Calculate the name of TitleTarget based on the given parameters | [
"/",
"*",
"Calculate",
"the",
"name",
"of",
"TitleTarget",
"based",
"on",
"the",
"given",
"parameters"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L653-L676 | train | Returns the name of the target that has the title property | [
30522,
3853,
1006,
28879,
2906,
18150,
18442,
2015,
1010,
11867,
12298,
14097,
3775,
9286,
7559,
18150,
18442,
1007,
1063,
13075,
27178,
2906,
18150,
1010,
2358,
4183,
7485,
2906,
18150,
18442,
1025,
2358,
4183,
7485,
2906,
18150,
18442,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SheetJS/js-xlsx | bits/68_wsbin.js | write_BrtSheetProtection | function write_BrtSheetProtection(sp, o) {
if(o == null) o = new_buf(16*4+2);
o.write_shift(2, sp.password ? crypto_CreatePasswordVerifier_Method1(sp.password) : 0);
o.write_shift(4, 1); // this record should not be written if no protection
[
["objects", false], // fObjects
["scenarios", false], // fScenarios
["formatCells", true], // fFormatCells
["formatColumns", true], // fFormatColumns
["formatRows", true], // fFormatRows
["insertColumns", true], // fInsertColumns
["insertRows", true], // fInsertRows
["insertHyperlinks", true], // fInsertHyperlinks
["deleteColumns", true], // fDeleteColumns
["deleteRows", true], // fDeleteRows
["selectLockedCells", false], // fSelLockedCells
["sort", true], // fSort
["autoFilter", true], // fAutoFilter
["pivotTables", true], // fPivotTables
["selectUnlockedCells", false] // fSelUnlockedCells
].forEach(function(n) {
/*:: if(o == null) throw "unreachable"; */
if(n[1]) o.write_shift(4, sp[n[0]] != null && !sp[n[0]] ? 1 : 0);
else o.write_shift(4, sp[n[0]] != null && sp[n[0]] ? 0 : 1);
});
return o;
} | javascript | function write_BrtSheetProtection(sp, o) {
if(o == null) o = new_buf(16*4+2);
o.write_shift(2, sp.password ? crypto_CreatePasswordVerifier_Method1(sp.password) : 0);
o.write_shift(4, 1); // this record should not be written if no protection
[
["objects", false], // fObjects
["scenarios", false], // fScenarios
["formatCells", true], // fFormatCells
["formatColumns", true], // fFormatColumns
["formatRows", true], // fFormatRows
["insertColumns", true], // fInsertColumns
["insertRows", true], // fInsertRows
["insertHyperlinks", true], // fInsertHyperlinks
["deleteColumns", true], // fDeleteColumns
["deleteRows", true], // fDeleteRows
["selectLockedCells", false], // fSelLockedCells
["sort", true], // fSort
["autoFilter", true], // fAutoFilter
["pivotTables", true], // fPivotTables
["selectUnlockedCells", false] // fSelUnlockedCells
].forEach(function(n) {
/*:: if(o == null) throw "unreachable"; */
if(n[1]) o.write_shift(4, sp[n[0]] != null && !sp[n[0]] ? 1 : 0);
else o.write_shift(4, sp[n[0]] != null && sp[n[0]] ? 0 : 1);
});
return o;
} | [
"function",
"write_BrtSheetProtection",
"(",
"sp",
",",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"o",
"=",
"new_buf",
"(",
"16",
"*",
"4",
"+",
"2",
")",
";",
"o",
".",
"write_shift",
"(",
"2",
",",
"sp",
".",
"password",
"?",
"crypto_Cr... | /* [MS-XLSB] 2.4.748 BrtSheetProtection | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"4",
".",
"748",
"BrtSheetProtection"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/68_wsbin.js#L372-L398 | train | Write protection information for BrtSheet | [
30522,
3853,
4339,
1035,
7987,
3215,
21030,
25856,
21709,
18491,
1006,
11867,
1010,
1051,
1007,
1063,
2065,
1006,
1051,
1027,
1027,
19701,
1007,
1051,
1027,
2047,
1035,
20934,
2546,
1006,
2385,
1008,
1018,
1009,
1016,
1007,
1025,
1051,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/object-shorthand.js | makeFunctionShorthand | function makeFunctionShorthand(fixer, node) {
const firstKeyToken = node.computed
? sourceCode.getFirstToken(node, astUtils.isOpeningBracketToken)
: sourceCode.getFirstToken(node.key);
const lastKeyToken = node.computed
? sourceCode.getFirstTokenBetween(node.key, node.value, astUtils.isClosingBracketToken)
: sourceCode.getLastToken(node.key);
const keyText = sourceCode.text.slice(firstKeyToken.range[0], lastKeyToken.range[1]);
let keyPrefix = "";
if (sourceCode.commentsExistBetween(lastKeyToken, node.value)) {
return null;
}
if (node.value.async) {
keyPrefix += "async ";
}
if (node.value.generator) {
keyPrefix += "*";
}
if (node.value.type === "FunctionExpression") {
const functionToken = sourceCode.getTokens(node.value).find(token => token.type === "Keyword" && token.value === "function");
const tokenBeforeParams = node.value.generator ? sourceCode.getTokenAfter(functionToken) : functionToken;
return fixer.replaceTextRange(
[firstKeyToken.range[0], node.range[1]],
keyPrefix + keyText + sourceCode.text.slice(tokenBeforeParams.range[1], node.value.range[1])
);
}
const arrowToken = sourceCode.getTokenBefore(node.value.body, { filter: token => token.value === "=>" });
const tokenBeforeArrow = sourceCode.getTokenBefore(arrowToken);
const hasParensAroundParameters = tokenBeforeArrow.type === "Punctuator" && tokenBeforeArrow.value === ")";
const oldParamText = sourceCode.text.slice(sourceCode.getFirstToken(node.value, node.value.async ? 1 : 0).range[0], tokenBeforeArrow.range[1]);
const newParamText = hasParensAroundParameters ? oldParamText : `(${oldParamText})`;
return fixer.replaceTextRange(
[firstKeyToken.range[0], node.range[1]],
keyPrefix + keyText + newParamText + sourceCode.text.slice(arrowToken.range[1], node.value.range[1])
);
} | javascript | function makeFunctionShorthand(fixer, node) {
const firstKeyToken = node.computed
? sourceCode.getFirstToken(node, astUtils.isOpeningBracketToken)
: sourceCode.getFirstToken(node.key);
const lastKeyToken = node.computed
? sourceCode.getFirstTokenBetween(node.key, node.value, astUtils.isClosingBracketToken)
: sourceCode.getLastToken(node.key);
const keyText = sourceCode.text.slice(firstKeyToken.range[0], lastKeyToken.range[1]);
let keyPrefix = "";
if (sourceCode.commentsExistBetween(lastKeyToken, node.value)) {
return null;
}
if (node.value.async) {
keyPrefix += "async ";
}
if (node.value.generator) {
keyPrefix += "*";
}
if (node.value.type === "FunctionExpression") {
const functionToken = sourceCode.getTokens(node.value).find(token => token.type === "Keyword" && token.value === "function");
const tokenBeforeParams = node.value.generator ? sourceCode.getTokenAfter(functionToken) : functionToken;
return fixer.replaceTextRange(
[firstKeyToken.range[0], node.range[1]],
keyPrefix + keyText + sourceCode.text.slice(tokenBeforeParams.range[1], node.value.range[1])
);
}
const arrowToken = sourceCode.getTokenBefore(node.value.body, { filter: token => token.value === "=>" });
const tokenBeforeArrow = sourceCode.getTokenBefore(arrowToken);
const hasParensAroundParameters = tokenBeforeArrow.type === "Punctuator" && tokenBeforeArrow.value === ")";
const oldParamText = sourceCode.text.slice(sourceCode.getFirstToken(node.value, node.value.async ? 1 : 0).range[0], tokenBeforeArrow.range[1]);
const newParamText = hasParensAroundParameters ? oldParamText : `(${oldParamText})`;
return fixer.replaceTextRange(
[firstKeyToken.range[0], node.range[1]],
keyPrefix + keyText + newParamText + sourceCode.text.slice(arrowToken.range[1], node.value.range[1])
);
} | [
"function",
"makeFunctionShorthand",
"(",
"fixer",
",",
"node",
")",
"{",
"const",
"firstKeyToken",
"=",
"node",
".",
"computed",
"?",
"sourceCode",
".",
"getFirstToken",
"(",
"node",
",",
"astUtils",
".",
"isOpeningBracketToken",
")",
":",
"sourceCode",
".",
... | Fixes a FunctionExpression node by making it into a shorthand property.
@param {SourceCodeFixer} fixer The fixer object
@param {ASTNode} node A `Property` node that has a `FunctionExpression` or `ArrowFunctionExpression` as its value
@returns {Object} A fix for this node | [
"Fixes",
"a",
"FunctionExpression",
"node",
"by",
"making",
"it",
"into",
"a",
"shorthand",
"property",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/object-shorthand.js#L237-L278 | train | Creates a function shorthand | [
30522,
3853,
2191,
11263,
27989,
22231,
15265,
5685,
1006,
8081,
2121,
1010,
13045,
1007,
1063,
9530,
3367,
2034,
14839,
18715,
2368,
1027,
13045,
1012,
24806,
1029,
3120,
16044,
1012,
2131,
8873,
12096,
18715,
2368,
1006,
13045,
1010,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/prefer-const.js | canBecomeVariableDeclaration | function canBecomeVariableDeclaration(identifier) {
let node = identifier.parent;
while (PATTERN_TYPE.test(node.type)) {
node = node.parent;
}
return (
node.type === "VariableDeclarator" ||
(
node.type === "AssignmentExpression" &&
node.parent.type === "ExpressionStatement" &&
DECLARATION_HOST_TYPE.test(node.parent.parent.type)
)
);
} | javascript | function canBecomeVariableDeclaration(identifier) {
let node = identifier.parent;
while (PATTERN_TYPE.test(node.type)) {
node = node.parent;
}
return (
node.type === "VariableDeclarator" ||
(
node.type === "AssignmentExpression" &&
node.parent.type === "ExpressionStatement" &&
DECLARATION_HOST_TYPE.test(node.parent.parent.type)
)
);
} | [
"function",
"canBecomeVariableDeclaration",
"(",
"identifier",
")",
"{",
"let",
"node",
"=",
"identifier",
".",
"parent",
";",
"while",
"(",
"PATTERN_TYPE",
".",
"test",
"(",
"node",
".",
"type",
")",
")",
"{",
"node",
"=",
"node",
".",
"parent",
";",
"}... | Checks whether a given Identifier node becomes a VariableDeclaration or not.
@param {ASTNode} identifier - An Identifier node to check.
@returns {boolean} `true` if the node can become a VariableDeclaration. | [
"Checks",
"whether",
"a",
"given",
"Identifier",
"node",
"becomes",
"a",
"VariableDeclaration",
"or",
"not",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-const.js#L34-L49 | train | Check whether the given identifier is a variable declaration | [
30522,
3853,
2064,
4783,
9006,
13331,
4360,
23242,
8586,
8017,
3370,
1006,
8909,
4765,
18095,
1007,
1063,
2292,
13045,
1027,
8909,
4765,
18095,
1012,
6687,
1025,
2096,
1006,
5418,
1035,
2828,
1012,
3231,
1006,
13045,
1012,
2828,
1007,
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... |
TryGhost/Ghost | core/server/data/meta/schema.js | trimSchema | function trimSchema(schema) {
var schemaObject = {};
_.each(schema, function (value, key) {
if (value !== null && typeof value !== 'undefined') {
schemaObject[key] = value;
}
});
return schemaObject;
} | javascript | function trimSchema(schema) {
var schemaObject = {};
_.each(schema, function (value, key) {
if (value !== null && typeof value !== 'undefined') {
schemaObject[key] = value;
}
});
return schemaObject;
} | [
"function",
"trimSchema",
"(",
"schema",
")",
"{",
"var",
"schemaObject",
"=",
"{",
"}",
";",
"_",
".",
"each",
"(",
"schema",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"if",
"(",
"value",
"!==",
"null",
"&&",
"typeof",
"value",
"!==",
"... | Creates the final schema object with values that are not null | [
"Creates",
"the",
"final",
"schema",
"object",
"with",
"values",
"that",
"are",
"not",
"null"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/data/meta/schema.js#L26-L36 | train | Trim schema from the schema object | [
30522,
3853,
12241,
22842,
2863,
1006,
8040,
28433,
1007,
1063,
13075,
8040,
28433,
16429,
20614,
1027,
1063,
1065,
1025,
1035,
1012,
2169,
1006,
8040,
28433,
1010,
3853,
1006,
3643,
1010,
3145,
1007,
1063,
2065,
1006,
3643,
999,
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... |
showdownjs/showdown | dist/showdown.js | writeAnchorTag | function writeAnchorTag (evt, options, globals, emptyCase) {
var wholeMatch = evt.getMatches().wholeMatch;
var text = evt.getMatches().text;
var id = evt.getMatches().id;
var url = evt.getMatches().url;
var title = evt.getMatches().title;
var target = '';
if (!title) {
title = '';
}
id = (id) ? id.toLowerCase() : '';
if (emptyCase) {
url = '';
} else if (!url) {
if (!id) {
// lower-case and turn embedded newlines into spaces
id = text.toLowerCase().replace(/ ?\n/g, ' ');
}
url = '#' + id;
if (!showdown.helper.isUndefined(globals.gUrls[id])) {
url = globals.gUrls[id];
if (!showdown.helper.isUndefined(globals.gTitles[id])) {
title = globals.gTitles[id];
}
} else {
return wholeMatch;
}
}
//url = showdown.helper.escapeCharacters(url, '*_:~', false); // replaced line to improve performance
url = url.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
if (title !== '' && title !== null) {
title = title.replace(/"/g, '"');
//title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
title = title.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
title = ' title="' + title + '"';
}
// optionLinksInNewWindow only applies
// to external links. Hash links (#) open in same page
if (options.openLinksInNewWindow && !/^#/.test(url)) {
// escaped _
target = ' target="¨E95Eblank"';
}
// Text can be a markdown element, so we run through the appropriate parsers
text = showdown.subParser('makehtml.codeSpans')(text, options, globals);
text = showdown.subParser('makehtml.emoji')(text, options, globals);
text = showdown.subParser('makehtml.underline')(text, options, globals);
text = showdown.subParser('makehtml.italicsAndBold')(text, options, globals);
text = showdown.subParser('makehtml.strikethrough')(text, options, globals);
text = showdown.subParser('makehtml.ellipsis')(text, options, globals);
text = showdown.subParser('makehtml.hashHTMLSpans')(text, options, globals);
//evt = createEvent(rgx, evtRootName + '.captureEnd', wholeMatch, text, id, url, title, options, globals);
var result = '<a href="' + url + '"' + title + target + '>' + text + '</a>';
//evt = createEvent(rgx, evtRootName + '.beforeHash', wholeMatch, text, id, url, title, options, globals);
result = showdown.subParser('makehtml.hashHTMLSpans')(result, options, globals);
return result;
} | javascript | function writeAnchorTag (evt, options, globals, emptyCase) {
var wholeMatch = evt.getMatches().wholeMatch;
var text = evt.getMatches().text;
var id = evt.getMatches().id;
var url = evt.getMatches().url;
var title = evt.getMatches().title;
var target = '';
if (!title) {
title = '';
}
id = (id) ? id.toLowerCase() : '';
if (emptyCase) {
url = '';
} else if (!url) {
if (!id) {
// lower-case and turn embedded newlines into spaces
id = text.toLowerCase().replace(/ ?\n/g, ' ');
}
url = '#' + id;
if (!showdown.helper.isUndefined(globals.gUrls[id])) {
url = globals.gUrls[id];
if (!showdown.helper.isUndefined(globals.gTitles[id])) {
title = globals.gTitles[id];
}
} else {
return wholeMatch;
}
}
//url = showdown.helper.escapeCharacters(url, '*_:~', false); // replaced line to improve performance
url = url.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
if (title !== '' && title !== null) {
title = title.replace(/"/g, '"');
//title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
title = title.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
title = ' title="' + title + '"';
}
// optionLinksInNewWindow only applies
// to external links. Hash links (#) open in same page
if (options.openLinksInNewWindow && !/^#/.test(url)) {
// escaped _
target = ' target="¨E95Eblank"';
}
// Text can be a markdown element, so we run through the appropriate parsers
text = showdown.subParser('makehtml.codeSpans')(text, options, globals);
text = showdown.subParser('makehtml.emoji')(text, options, globals);
text = showdown.subParser('makehtml.underline')(text, options, globals);
text = showdown.subParser('makehtml.italicsAndBold')(text, options, globals);
text = showdown.subParser('makehtml.strikethrough')(text, options, globals);
text = showdown.subParser('makehtml.ellipsis')(text, options, globals);
text = showdown.subParser('makehtml.hashHTMLSpans')(text, options, globals);
//evt = createEvent(rgx, evtRootName + '.captureEnd', wholeMatch, text, id, url, title, options, globals);
var result = '<a href="' + url + '"' + title + target + '>' + text + '</a>';
//evt = createEvent(rgx, evtRootName + '.beforeHash', wholeMatch, text, id, url, title, options, globals);
result = showdown.subParser('makehtml.hashHTMLSpans')(result, options, globals);
return result;
} | [
"function",
"writeAnchorTag",
"(",
"evt",
",",
"options",
",",
"globals",
",",
"emptyCase",
")",
"{",
"var",
"wholeMatch",
"=",
"evt",
".",
"getMatches",
"(",
")",
".",
"wholeMatch",
";",
"var",
"text",
"=",
"evt",
".",
"getMatches",
"(",
")",
".",
"te... | Helper Function: Normalize and write an anchor tag based on passed parameters
@param evt
@param options
@param globals
@param {boolean} emptyCase
@returns {string} | [
"Helper",
"Function",
":",
"Normalize",
"and",
"write",
"an",
"anchor",
"tag",
"based",
"on",
"passed",
"parameters"
] | 33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9 | https://github.com/showdownjs/showdown/blob/33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9/dist/showdown.js#L3320-L3387 | train | Write anchor tag | [
30522,
3853,
4339,
2319,
9905,
13320,
2290,
1006,
23408,
30524,
8376,
1006,
1007,
1012,
2878,
18900,
2818,
1025,
13075,
3793,
1027,
23408,
2102,
1012,
2131,
18900,
8376,
1006,
1007,
1012,
3793,
1025,
13075,
8909,
1027,
23408,
2102,
1012,
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... |
SAP/openui5 | src/sap.ui.core/src/ui5loader.js | unloadResources | function unloadResources(sName, bPreloadGroup, bUnloadAll, bDeleteExports) {
var aModules = [],
sURN, oModule;
if ( bPreloadGroup == null ) {
bPreloadGroup = true;
}
if ( bPreloadGroup ) {
// collect modules that belong to the given group
for ( sURN in mModules ) {
oModule = mModules[sURN];
if ( oModule && oModule.group === sName ) {
aModules.push(sURN);
}
}
} else {
// single module
if ( mModules[sName] ) {
aModules.push(sName);
}
}
aModules.forEach(function(sURN) {
var oModule = mModules[sURN];
if ( oModule && bDeleteExports && sURN.match(/\.js$/) ) {
// @evo-todo move to compat layer?
setGlobalProperty(urnToUI5(sURN), undefined);
}
if ( oModule && (bUnloadAll || oModule.state === PRELOADED) ) {
delete mModules[sURN];
}
});
} | javascript | function unloadResources(sName, bPreloadGroup, bUnloadAll, bDeleteExports) {
var aModules = [],
sURN, oModule;
if ( bPreloadGroup == null ) {
bPreloadGroup = true;
}
if ( bPreloadGroup ) {
// collect modules that belong to the given group
for ( sURN in mModules ) {
oModule = mModules[sURN];
if ( oModule && oModule.group === sName ) {
aModules.push(sURN);
}
}
} else {
// single module
if ( mModules[sName] ) {
aModules.push(sName);
}
}
aModules.forEach(function(sURN) {
var oModule = mModules[sURN];
if ( oModule && bDeleteExports && sURN.match(/\.js$/) ) {
// @evo-todo move to compat layer?
setGlobalProperty(urnToUI5(sURN), undefined);
}
if ( oModule && (bUnloadAll || oModule.state === PRELOADED) ) {
delete mModules[sURN];
}
});
} | [
"function",
"unloadResources",
"(",
"sName",
",",
"bPreloadGroup",
",",
"bUnloadAll",
",",
"bDeleteExports",
")",
"{",
"var",
"aModules",
"=",
"[",
"]",
",",
"sURN",
",",
"oModule",
";",
"if",
"(",
"bPreloadGroup",
"==",
"null",
")",
"{",
"bPreloadGroup",
... | Removes a set of resources from the resource cache.
@param {string} sName unified resource name of a resource or the name of a preload group to be removed
@param {boolean} [bPreloadGroup=true] whether the name specifies a preload group, defaults to true
@param {boolean} [bUnloadAll] Whether all matching resources should be unloaded, even if they have been executed already.
@param {boolean} [bDeleteExports] Whether exports (global variables) should be destroyed as well. Will be done for UI5 module names only.
@experimental Since 1.16.3 API might change completely, apps must not develop against it.
@private | [
"Removes",
"a",
"set",
"of",
"resources",
"from",
"the",
"resource",
"cache",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L2025-L2060 | train | Unload resources from the given module | [
30522,
3853,
4895,
11066,
6072,
8162,
9623,
1006,
1055,
18442,
1010,
17531,
16570,
10441,
2094,
17058,
1010,
21122,
11066,
8095,
1010,
1038,
9247,
12870,
10288,
25378,
1007,
1063,
13075,
2572,
7716,
16308,
1027,
1031,
1033,
1010,
7505,
2078,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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._aHierarchyPropertyNames) {
return this._aHierarchyPropertyNames;
}
this._aHierarchyPropertyNames = [];
for ( var sName in this._oRecursiveHierarchySet) {
this._aHierarchyPropertyNames.push(this._oRecursiveHierarchySet[sName].getNodeValueProperty().name);
}
return this._aHierarchyPropertyNames;
} | javascript | function() {
if (this._aHierarchyPropertyNames) {
return this._aHierarchyPropertyNames;
}
this._aHierarchyPropertyNames = [];
for ( var sName in this._oRecursiveHierarchySet) {
this._aHierarchyPropertyNames.push(this._oRecursiveHierarchySet[sName].getNodeValueProperty().name);
}
return this._aHierarchyPropertyNames;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_aHierarchyPropertyNames",
")",
"{",
"return",
"this",
".",
"_aHierarchyPropertyNames",
";",
"}",
"this",
".",
"_aHierarchyPropertyNames",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"sName",
"in",
"this",
"."... | Get the names of all properties with an associated hierarchy
@returns {string[]} List of all property names
@public
@function
@name sap.ui.model.analytics.odata4analytics.EntityType#getAllHierarchyPropertyNames | [
"Get",
"the",
"names",
"of",
"all",
"properties",
"with",
"an",
"associated",
"hierarchy"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L2812-L2824 | train | Returns an array of all the property names of the hierarchy | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
6289,
3771,
2906,
11714,
21572,
4842,
25680,
14074,
2015,
1007,
1063,
2709,
2023,
1012,
1035,
6289,
3771,
2906,
11714,
21572,
4842,
25680,
14074,
2015,
1025,
1065,
2023,
1012,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
openlayers/openlayers | config/jsdoc/api/plugins/inline-options.js | function(e) {
const doclets = e.doclets;
for (let i = 0, ii = doclets.length; i < ii; ++i) {
const doclet = doclets[i];
if (doclet.params) {
const params = doclet.params;
for (let j = 0, jj = params.length; j < jj; ++j) {
const param = params[j];
if (param.type && param.type.names) {
const type = param.type.names[0];
if (type in properties) {
param.type.names[0] = type;
params.push.apply(params, properties[type].map(p => {
const property = Object.assign({}, p);
property.name = `${param.name}.${property.name}`;
return property;
}));
}
}
}
}
}
} | javascript | function(e) {
const doclets = e.doclets;
for (let i = 0, ii = doclets.length; i < ii; ++i) {
const doclet = doclets[i];
if (doclet.params) {
const params = doclet.params;
for (let j = 0, jj = params.length; j < jj; ++j) {
const param = params[j];
if (param.type && param.type.names) {
const type = param.type.names[0];
if (type in properties) {
param.type.names[0] = type;
params.push.apply(params, properties[type].map(p => {
const property = Object.assign({}, p);
property.name = `${param.name}.${property.name}`;
return property;
}));
}
}
}
}
}
} | [
"function",
"(",
"e",
")",
"{",
"const",
"doclets",
"=",
"e",
".",
"doclets",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"ii",
"=",
"doclets",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"const",
"doclet",
"=",
"doclets",
"... | Adds `options.*` params for options that match the longname of one of the
collected typedefs.
@param {Object} e Event object. | [
"Adds",
"options",
".",
"*",
"params",
"for",
"options",
"that",
"match",
"the",
"longname",
"of",
"one",
"of",
"the",
"collected",
"typedefs",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/config/jsdoc/api/plugins/inline-options.js#L25-L47 | train | This function is used to generate the header for the header | [
30522,
3853,
1006,
1041,
1007,
1063,
9530,
3367,
9986,
13461,
1027,
1041,
1012,
9986,
13461,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1010,
2462,
1027,
9986,
13461,
1012,
3091,
1025,
1045,
1026,
2462,
1025,
1009,
1009,
1045,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
bokeh/bokeh | examples/custom/gears/gear_utils.js | involuteXbez | function involuteXbez(t)
{
// map t (0 <= t <= 1) onto x (where -1 <= x <= 1)
var x = t*2-1;
//map theta (where ts <= theta <= te) from x (-1 <=x <= 1)
var theta = x*(te-ts)/2 + (ts + te)/2;
return Rb*(Math.cos(theta)+theta*Math.sin(theta));
} | javascript | function involuteXbez(t)
{
// map t (0 <= t <= 1) onto x (where -1 <= x <= 1)
var x = t*2-1;
//map theta (where ts <= theta <= te) from x (-1 <=x <= 1)
var theta = x*(te-ts)/2 + (ts + te)/2;
return Rb*(Math.cos(theta)+theta*Math.sin(theta));
} | [
"function",
"involuteXbez",
"(",
"t",
")",
"{",
"// map t (0 <= t <= 1) onto x (where -1 <= x <= 1)",
"var",
"x",
"=",
"t",
"*",
"2",
"-",
"1",
";",
"//map theta (where ts <= theta <= te) from x (-1 <=x <= 1)",
"var",
"theta",
"=",
"x",
"*",
"(",
"te",
"-",
"ts",
... | Equation of involute using the Bezier parameter t as variable | [
"Equation",
"of",
"involute",
"using",
"the",
"Bezier",
"parameter",
"t",
"as",
"variable"
] | c3a9d4d5ab5662ea34813fd72de50e1bdaae714d | https://github.com/bokeh/bokeh/blob/c3a9d4d5ab5662ea34813fd72de50e1bdaae714d/examples/custom/gears/gear_utils.js#L128-L135 | train | involute xbez t | [
30522,
3853,
1999,
6767,
7630,
2618,
2595,
4783,
2480,
1006,
1056,
1007,
1063,
1013,
1013,
4949,
1056,
1006,
1014,
1026,
1027,
1056,
1026,
1027,
1015,
1007,
3031,
1060,
1006,
2073,
1011,
1015,
1026,
1027,
1060,
1026,
1027,
1015,
1007,
130... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/api/decodePage.js | decodePage | function decodePage(output, page, result) {
var originalContent = page.getContent();
// No returned value
// Existing content will be used
if (!result) {
return page;
}
deprecate.disable('page.sections');
// GitBook 3
// Use returned page.content if different from original content
if (result.content != originalContent) {
page = page.set('content', result.content);
}
// GitBook 2 compatibility
// Finally, use page.sections
else if (result.sections) {
page = page.set('content',
result.sections.map(function(section) {
return section.content;
}).join('\n')
);
}
deprecate.enable('page.sections');
return page;
} | javascript | function decodePage(output, page, result) {
var originalContent = page.getContent();
// No returned value
// Existing content will be used
if (!result) {
return page;
}
deprecate.disable('page.sections');
// GitBook 3
// Use returned page.content if different from original content
if (result.content != originalContent) {
page = page.set('content', result.content);
}
// GitBook 2 compatibility
// Finally, use page.sections
else if (result.sections) {
page = page.set('content',
result.sections.map(function(section) {
return section.content;
}).join('\n')
);
}
deprecate.enable('page.sections');
return page;
} | [
"function",
"decodePage",
"(",
"output",
",",
"page",
",",
"result",
")",
"{",
"var",
"originalContent",
"=",
"page",
".",
"getContent",
"(",
")",
";",
"// No returned value",
"// Existing content will be used",
"if",
"(",
"!",
"result",
")",
"{",
"return",
"p... | Decode changes from a JS API to a page object.
Only the content can be edited by plugin's hooks.
@param {Output} output
@param {Page} page: page instance to edit
@param {Object} result: result from API
@return {Page} | [
"Decode",
"changes",
"from",
"a",
"JS",
"API",
"to",
"a",
"page",
"object",
".",
"Only",
"the",
"content",
"can",
"be",
"edited",
"by",
"plugin",
"s",
"hooks",
"."
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/api/decodePage.js#L12-L42 | train | Decode a page | [
30522,
3853,
21933,
3207,
13704,
1006,
6434,
1010,
3931,
1010,
2765,
1007,
1063,
13075,
2434,
8663,
6528,
2102,
1027,
3931,
1012,
2131,
8663,
6528,
2102,
1006,
1007,
1025,
1013,
1013,
2053,
2513,
3643,
1013,
1013,
4493,
4180,
2097,
2022,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js | spliceContentIntoResult | function spliceContentIntoResult(vContent) {
// equivalent to aResult.apply(start, deleteCount, content1, content2...)
var args = [i, 1].concat(vContent);
Array.prototype.splice.apply(aResult, args);
} | javascript | function spliceContentIntoResult(vContent) {
// equivalent to aResult.apply(start, deleteCount, content1, content2...)
var args = [i, 1].concat(vContent);
Array.prototype.splice.apply(aResult, args);
} | [
"function",
"spliceContentIntoResult",
"(",
"vContent",
")",
"{",
"// equivalent to aResult.apply(start, deleteCount, content1, content2...)",
"var",
"args",
"=",
"[",
"i",
",",
"1",
"]",
".",
"concat",
"(",
"vContent",
")",
";",
"Array",
".",
"prototype",
".",
"spl... | replace the Promise with a variable number of contents in aResult | [
"replace",
"the",
"Promise",
"with",
"a",
"variable",
"number",
"of",
"contents",
"in",
"aResult"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L336-L340 | train | splice content into the result | [
30522,
3853,
11867,
13231,
8663,
6528,
7629,
19277,
23722,
2102,
1006,
18315,
28040,
3372,
1007,
1063,
1013,
1013,
5662,
2000,
23631,
11314,
1012,
6611,
1006,
2707,
1010,
3972,
12870,
3597,
16671,
1010,
4180,
2487,
1010,
4180,
2475,
1012,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/icon/js/iconService.js | loadFromIconSet | function loadFromIconSet(id) {
var setName = id.substring(0, id.lastIndexOf(':')) || '$default';
var iconSetConfig = config[setName];
return !iconSetConfig ? announceIdNotFound(id) : loadByURL(iconSetConfig.url).then(extractFromSet);
function extractFromSet(set) {
var iconName = id.slice(id.lastIndexOf(':') + 1);
var icon = set.querySelector('#' + iconName);
return icon ? new Icon(icon, iconSetConfig) : announceIdNotFound(id);
}
function announceIdNotFound(id) {
var msg = 'icon ' + id + ' not found';
$log.warn(msg);
return $q.reject(msg || id);
}
} | javascript | function loadFromIconSet(id) {
var setName = id.substring(0, id.lastIndexOf(':')) || '$default';
var iconSetConfig = config[setName];
return !iconSetConfig ? announceIdNotFound(id) : loadByURL(iconSetConfig.url).then(extractFromSet);
function extractFromSet(set) {
var iconName = id.slice(id.lastIndexOf(':') + 1);
var icon = set.querySelector('#' + iconName);
return icon ? new Icon(icon, iconSetConfig) : announceIdNotFound(id);
}
function announceIdNotFound(id) {
var msg = 'icon ' + id + ' not found';
$log.warn(msg);
return $q.reject(msg || id);
}
} | [
"function",
"loadFromIconSet",
"(",
"id",
")",
"{",
"var",
"setName",
"=",
"id",
".",
"substring",
"(",
"0",
",",
"id",
".",
"lastIndexOf",
"(",
"':'",
")",
")",
"||",
"'$default'",
";",
"var",
"iconSetConfig",
"=",
"config",
"[",
"setName",
"]",
";",
... | Loads the file as XML and uses querySelector( <id> ) to find the desired node...
@param {string} id icon id in icon set
@returns {angular.$q.Promise} | [
"Loads",
"the",
"file",
"as",
"XML",
"and",
"uses",
"querySelector",
"(",
"<id",
">",
")",
"to",
"find",
"the",
"desired",
"node",
"..."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L602-L620 | train | Load an icon from a iconSet | [
30522,
3853,
7170,
19699,
22026,
5644,
3388,
1006,
8909,
1007,
1063,
13075,
2275,
18442,
1027,
8909,
1012,
4942,
3367,
4892,
1006,
1014,
1010,
8909,
1012,
2197,
22254,
10288,
11253,
1006,
1005,
1024,
1005,
1007,
1007,
1064,
1064,
1005,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/StaticServer/node/StaticServerDomain.js | init | function init(domainManager) {
_domainManager = domainManager;
if (!domainManager.hasDomain("staticServer")) {
domainManager.registerDomain("staticServer", {major: 0, minor: 1});
}
_domainManager.registerCommand(
"staticServer",
"_setRequestFilterTimeout",
_cmdSetRequestFilterTimeout,
false,
"Unit tests only. Set timeout value for filtered requests.",
[{
name: "timeout",
type: "number",
description: "Duration to wait before passing a filtered request to the static file server."
}],
[]
);
_domainManager.registerCommand(
"staticServer",
"getServer",
_cmdGetServer,
true,
"Starts or returns an existing server for the given path.",
[
{
name: "path",
type: "string",
description: "Absolute filesystem path for root of server."
},
{
name: "port",
type: "number",
description: "Port number to use for HTTP server. Pass zero to assign a random port."
}
],
[{
name: "address",
type: "{address: string, family: string, port: number}",
description: "hostname (stored in 'address' parameter), port, and socket type (stored in 'family' parameter) for the server. Currently, 'family' will always be 'IPv4'."
}]
);
_domainManager.registerCommand(
"staticServer",
"closeServer",
_cmdCloseServer,
false,
"Closes the server for the given path.",
[{
name: "path",
type: "string",
description: "absolute filesystem path for root of server"
}],
[{
name: "result",
type: "boolean",
description: "indicates whether a server was found for the specific path then closed"
}]
);
_domainManager.registerCommand(
"staticServer",
"setRequestFilterPaths",
_cmdSetRequestFilterPaths,
false,
"Defines a set of paths from a server's root path to watch and fire 'requestFilter' events for.",
[
{
name: "root",
type: "string",
description: "absolute filesystem path for root of server"
},
{
name: "paths",
type: "Array",
description: "path to notify"
}
],
[]
);
_domainManager.registerCommand(
"staticServer",
"writeFilteredResponse",
_cmdWriteFilteredResponse,
false,
"Overrides the server response from static middleware with the provided response data. This should be called only in response to a filtered request.",
[
{
name: "root",
type: "string",
description: "absolute filesystem path for root of server"
},
{
name: "path",
type: "string",
description: "path to rewrite"
},
{
name: "resData",
type: "{body: string, headers: Array}",
description: "TODO"
}
],
[]
);
_domainManager.registerEvent(
"staticServer",
"requestFilter",
[{
name: "location",
type: "{hostname: string, pathname: string, port: number, root: string: id: number}",
description: "request path"
}]
);
} | javascript | function init(domainManager) {
_domainManager = domainManager;
if (!domainManager.hasDomain("staticServer")) {
domainManager.registerDomain("staticServer", {major: 0, minor: 1});
}
_domainManager.registerCommand(
"staticServer",
"_setRequestFilterTimeout",
_cmdSetRequestFilterTimeout,
false,
"Unit tests only. Set timeout value for filtered requests.",
[{
name: "timeout",
type: "number",
description: "Duration to wait before passing a filtered request to the static file server."
}],
[]
);
_domainManager.registerCommand(
"staticServer",
"getServer",
_cmdGetServer,
true,
"Starts or returns an existing server for the given path.",
[
{
name: "path",
type: "string",
description: "Absolute filesystem path for root of server."
},
{
name: "port",
type: "number",
description: "Port number to use for HTTP server. Pass zero to assign a random port."
}
],
[{
name: "address",
type: "{address: string, family: string, port: number}",
description: "hostname (stored in 'address' parameter), port, and socket type (stored in 'family' parameter) for the server. Currently, 'family' will always be 'IPv4'."
}]
);
_domainManager.registerCommand(
"staticServer",
"closeServer",
_cmdCloseServer,
false,
"Closes the server for the given path.",
[{
name: "path",
type: "string",
description: "absolute filesystem path for root of server"
}],
[{
name: "result",
type: "boolean",
description: "indicates whether a server was found for the specific path then closed"
}]
);
_domainManager.registerCommand(
"staticServer",
"setRequestFilterPaths",
_cmdSetRequestFilterPaths,
false,
"Defines a set of paths from a server's root path to watch and fire 'requestFilter' events for.",
[
{
name: "root",
type: "string",
description: "absolute filesystem path for root of server"
},
{
name: "paths",
type: "Array",
description: "path to notify"
}
],
[]
);
_domainManager.registerCommand(
"staticServer",
"writeFilteredResponse",
_cmdWriteFilteredResponse,
false,
"Overrides the server response from static middleware with the provided response data. This should be called only in response to a filtered request.",
[
{
name: "root",
type: "string",
description: "absolute filesystem path for root of server"
},
{
name: "path",
type: "string",
description: "path to rewrite"
},
{
name: "resData",
type: "{body: string, headers: Array}",
description: "TODO"
}
],
[]
);
_domainManager.registerEvent(
"staticServer",
"requestFilter",
[{
name: "location",
type: "{hostname: string, pathname: string, port: number, root: string: id: number}",
description: "request path"
}]
);
} | [
"function",
"init",
"(",
"domainManager",
")",
"{",
"_domainManager",
"=",
"domainManager",
";",
"if",
"(",
"!",
"domainManager",
".",
"hasDomain",
"(",
"\"staticServer\"",
")",
")",
"{",
"domainManager",
".",
"registerDomain",
"(",
"\"staticServer\"",
",",
"{",... | Initializes the StaticServer domain with its commands.
@param {DomainManager} domainManager The DomainManager for the server | [
"Initializes",
"the",
"StaticServer",
"domain",
"with",
"its",
"commands",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/StaticServer/node/StaticServerDomain.js#L361-L475 | train | Initializes the domain manager | [
30522,
3853,
1999,
4183,
1006,
5884,
24805,
4590,
1007,
1063,
1035,
5884,
24805,
4590,
1027,
5884,
24805,
4590,
1025,
2065,
1006,
999,
5884,
24805,
4590,
1012,
2038,
9527,
8113,
1006,
1000,
10763,
8043,
6299,
1000,
1007,
1007,
1063,
5884,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/MultiBrowserImpl/language/HTMLSimpleDOM.js | function () {
if (this.isElement()) {
var i,
subtreeHashes = "",
childHashes = "",
child;
for (i = 0; i < this.children.length; i++) {
child = this.children[i];
if (child.isElement()) {
childHashes += String(child.tagID);
subtreeHashes += String(child.tagID) + child.attributeSignature + child.subtreeSignature;
} else {
childHashes += child.textSignature;
subtreeHashes += child.textSignature;
}
}
this.childSignature = MurmurHash3.hashString(childHashes, childHashes.length, seed);
this.subtreeSignature = MurmurHash3.hashString(subtreeHashes, subtreeHashes.length, seed);
} else {
this.textSignature = MurmurHash3.hashString(this.content, this.content.length, seed);
}
} | javascript | function () {
if (this.isElement()) {
var i,
subtreeHashes = "",
childHashes = "",
child;
for (i = 0; i < this.children.length; i++) {
child = this.children[i];
if (child.isElement()) {
childHashes += String(child.tagID);
subtreeHashes += String(child.tagID) + child.attributeSignature + child.subtreeSignature;
} else {
childHashes += child.textSignature;
subtreeHashes += child.textSignature;
}
}
this.childSignature = MurmurHash3.hashString(childHashes, childHashes.length, seed);
this.subtreeSignature = MurmurHash3.hashString(subtreeHashes, subtreeHashes.length, seed);
} else {
this.textSignature = MurmurHash3.hashString(this.content, this.content.length, seed);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isElement",
"(",
")",
")",
"{",
"var",
"i",
",",
"subtreeHashes",
"=",
"\"\"",
",",
"childHashes",
"=",
"\"\"",
",",
"child",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"child... | Updates signatures used to optimize the number of comparisons done during
diffing. This is important to call if you change:
* children
* child node attributes
* text content of a text node
* child node text | [
"Updates",
"signatures",
"used",
"to",
"optimize",
"the",
"number",
"of",
"comparisons",
"done",
"during",
"diffing",
".",
"This",
"is",
"important",
"to",
"call",
"if",
"you",
"change",
":"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/language/HTMLSimpleDOM.js#L139-L160 | train | get signature of the tag | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
2003,
12260,
3672,
1006,
1007,
1007,
1063,
13075,
1045,
1010,
4942,
13334,
14949,
15689,
1027,
1000,
1000,
1010,
2775,
14949,
15689,
1027,
1000,
1000,
1010,
2775,
1025,
2005,
1006,
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... | |
fengyuanchen/cropper | dist/cropper.common.js | destroy | function destroy() {
var element = this.element;
if (!getData(element, NAMESPACE)) {
return this;
}
if (this.isImg && this.replaced) {
element.src = this.originalUrl;
}
this.uncreate();
removeData(element, NAMESPACE);
return this;
} | javascript | function destroy() {
var element = this.element;
if (!getData(element, NAMESPACE)) {
return this;
}
if (this.isImg && this.replaced) {
element.src = this.originalUrl;
}
this.uncreate();
removeData(element, NAMESPACE);
return this;
} | [
"function",
"destroy",
"(",
")",
"{",
"var",
"element",
"=",
"this",
".",
"element",
";",
"if",
"(",
"!",
"getData",
"(",
"element",
",",
"NAMESPACE",
")",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"this",
".",
"isImg",
"&&",
"this",
".",
... | Destroy the cropper and remove the instance from the image
@returns {Cropper} this | [
"Destroy",
"the",
"cropper",
"and",
"remove",
"the",
"instance",
"from",
"the",
"image"
] | 6677332a6a375b647f58808dfc24ea09f5804041 | https://github.com/fengyuanchen/cropper/blob/6677332a6a375b647f58808dfc24ea09f5804041/dist/cropper.common.js#L2559-L2575 | train | Destroys the image element | [
30522,
3853,
6033,
1006,
1007,
1063,
13075,
5783,
1027,
2023,
1012,
5783,
1025,
2065,
1006,
999,
2131,
2850,
2696,
1006,
5783,
1010,
3415,
15327,
1007,
1007,
1063,
2709,
2023,
1025,
1065,
2065,
1006,
2023,
1012,
2003,
5714,
2290,
1004,
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... |
ColorlibHQ/AdminLTE | bower_components/chart.js/Chart.js | function(data){
this.segments = [];
//Declare segment class as a chart instance specific class, so it can share props for this instance
this.SegmentArc = Chart.Arc.extend({
showStroke : this.options.segmentShowStroke,
strokeWidth : this.options.segmentStrokeWidth,
strokeColor : this.options.segmentStrokeColor,
ctx : this.chart.ctx,
innerRadius : 0,
x : this.chart.width/2,
y : this.chart.height/2
});
this.scale = new Chart.RadialScale({
display: this.options.showScale,
fontStyle: this.options.scaleFontStyle,
fontSize: this.options.scaleFontSize,
fontFamily: this.options.scaleFontFamily,
fontColor: this.options.scaleFontColor,
showLabels: this.options.scaleShowLabels,
showLabelBackdrop: this.options.scaleShowLabelBackdrop,
backdropColor: this.options.scaleBackdropColor,
backdropPaddingY : this.options.scaleBackdropPaddingY,
backdropPaddingX: this.options.scaleBackdropPaddingX,
lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0,
lineColor: this.options.scaleLineColor,
lineArc: true,
width: this.chart.width,
height: this.chart.height,
xCenter: this.chart.width/2,
yCenter: this.chart.height/2,
ctx : this.chart.ctx,
templateString: this.options.scaleLabel,
valuesCount: data.length
});
this.updateScaleRange(data);
this.scale.update();
helpers.each(data,function(segment,index){
this.addData(segment,index,true);
},this);
//Set up tooltip events on the chart
if (this.options.showTooltips){
helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];
helpers.each(this.segments,function(segment){
segment.restore(["fillColor"]);
});
helpers.each(activeSegments,function(activeSegment){
activeSegment.fillColor = activeSegment.highlightColor;
});
this.showTooltip(activeSegments);
});
}
this.render();
} | javascript | function(data){
this.segments = [];
//Declare segment class as a chart instance specific class, so it can share props for this instance
this.SegmentArc = Chart.Arc.extend({
showStroke : this.options.segmentShowStroke,
strokeWidth : this.options.segmentStrokeWidth,
strokeColor : this.options.segmentStrokeColor,
ctx : this.chart.ctx,
innerRadius : 0,
x : this.chart.width/2,
y : this.chart.height/2
});
this.scale = new Chart.RadialScale({
display: this.options.showScale,
fontStyle: this.options.scaleFontStyle,
fontSize: this.options.scaleFontSize,
fontFamily: this.options.scaleFontFamily,
fontColor: this.options.scaleFontColor,
showLabels: this.options.scaleShowLabels,
showLabelBackdrop: this.options.scaleShowLabelBackdrop,
backdropColor: this.options.scaleBackdropColor,
backdropPaddingY : this.options.scaleBackdropPaddingY,
backdropPaddingX: this.options.scaleBackdropPaddingX,
lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0,
lineColor: this.options.scaleLineColor,
lineArc: true,
width: this.chart.width,
height: this.chart.height,
xCenter: this.chart.width/2,
yCenter: this.chart.height/2,
ctx : this.chart.ctx,
templateString: this.options.scaleLabel,
valuesCount: data.length
});
this.updateScaleRange(data);
this.scale.update();
helpers.each(data,function(segment,index){
this.addData(segment,index,true);
},this);
//Set up tooltip events on the chart
if (this.options.showTooltips){
helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];
helpers.each(this.segments,function(segment){
segment.restore(["fillColor"]);
});
helpers.each(activeSegments,function(activeSegment){
activeSegment.fillColor = activeSegment.highlightColor;
});
this.showTooltip(activeSegments);
});
}
this.render();
} | [
"function",
"(",
"data",
")",
"{",
"this",
".",
"segments",
"=",
"[",
"]",
";",
"//Declare segment class as a chart instance specific class, so it can share props for this instance",
"this",
".",
"SegmentArc",
"=",
"Chart",
".",
"Arc",
".",
"extend",
"(",
"{",
"showSt... | Initialize is fired when the chart is initialized - Data is passed in as a parameter Config is automatically merged by the core of Chart.js, and is available at this.options | [
"Initialize",
"is",
"fired",
"when",
"the",
"chart",
"is",
"initialized",
"-",
"Data",
"is",
"passed",
"in",
"as",
"a",
"parameter",
"Config",
"is",
"automatically",
"merged",
"by",
"the",
"core",
"of",
"Chart",
".",
"js",
"and",
"is",
"available",
"at",
... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/chart.js/Chart.js#L2945-L3003 | train | Initialize the chart instance | [
30522,
3853,
1006,
2951,
1007,
1063,
2023,
1012,
9214,
1027,
1031,
1033,
1025,
1013,
1013,
13520,
6903,
2465,
2004,
1037,
3673,
6013,
3563,
2465,
1010,
2061,
2009,
2064,
3745,
24387,
2005,
2023,
6013,
2023,
1012,
6903,
2906,
2278,
1027,
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... | |
GoogleChrome/workbox | packages/workbox-webpack-plugin/src/lib/get-manifest-entries-from-compilation.js | filterAssets | function filterAssets(assetMetadata, whitelist, blacklist) {
const filteredMapping = {};
for (const [file, metadata] of Object.entries(assetMetadata)) {
const chunkName = metadata.chunkName;
// This file is whitelisted if:
// - Trivially, if there is no whitelist defined.
// - There is a whitelist and our file is associated with a chunk whose name
// is listed.
const isWhitelisted = whitelist.length === 0 ||
whitelist.includes(chunkName);
// This file is blacklisted if our file is associated with a chunk whose
// name is listed.
const isBlacklisted = blacklist.includes(chunkName);
// Only include this entry in the filtered mapping if we're whitelisted and
// not blacklisted.
if (isWhitelisted && !isBlacklisted) {
filteredMapping[file] = metadata;
}
}
return filteredMapping;
} | javascript | function filterAssets(assetMetadata, whitelist, blacklist) {
const filteredMapping = {};
for (const [file, metadata] of Object.entries(assetMetadata)) {
const chunkName = metadata.chunkName;
// This file is whitelisted if:
// - Trivially, if there is no whitelist defined.
// - There is a whitelist and our file is associated with a chunk whose name
// is listed.
const isWhitelisted = whitelist.length === 0 ||
whitelist.includes(chunkName);
// This file is blacklisted if our file is associated with a chunk whose
// name is listed.
const isBlacklisted = blacklist.includes(chunkName);
// Only include this entry in the filtered mapping if we're whitelisted and
// not blacklisted.
if (isWhitelisted && !isBlacklisted) {
filteredMapping[file] = metadata;
}
}
return filteredMapping;
} | [
"function",
"filterAssets",
"(",
"assetMetadata",
",",
"whitelist",
",",
"blacklist",
")",
"{",
"const",
"filteredMapping",
"=",
"{",
"}",
";",
"for",
"(",
"const",
"[",
"file",
",",
"metadata",
"]",
"of",
"Object",
".",
"entries",
"(",
"assetMetadata",
")... | Filter to narrow down the asset list to chunks that:
- have a name.
- if there's a whitelist, the chunk's name is in the whitelist.
- if there's a blacklist, the chunk's name is not in the blacklist.
TODO:
Filter files by size:
https://github.com/GoogleChrome/workbox/pull/808#discussion_r139606242
Filter files that match `staticFileGlobsIgnorePatterns` (or something)
but filter for [/\.map$/, /asset-manifest\.json$/] by default:
https://github.com/GoogleChrome/workbox/pull/808#discussion_r140565156
@param {Object<string, Object>} assetMetadata Metadata about the assets.
@param {Array<string>} [whitelist] Chunk names to include.
@param {Array<string>} [blacklist] Chunk names to exclude.
@return {Object<string, Object>} Filtered asset metadata.
@private | [
"Filter",
"to",
"narrow",
"down",
"the",
"asset",
"list",
"to",
"chunks",
"that",
":",
"-",
"have",
"a",
"name",
".",
"-",
"if",
"there",
"s",
"a",
"whitelist",
"the",
"chunk",
"s",
"name",
"is",
"in",
"the",
"whitelist",
".",
"-",
"if",
"there",
"... | 8379c51b6deaf52faed5879206fe84579cae41f0 | https://github.com/GoogleChrome/workbox/blob/8379c51b6deaf52faed5879206fe84579cae41f0/packages/workbox-webpack-plugin/src/lib/get-manifest-entries-from-compilation.js#L57-L81 | train | Filter the asset metadata object | [
30522,
3853,
11307,
27241,
3215,
1006,
11412,
11368,
8447,
2696,
1010,
2317,
9863,
1010,
2304,
9863,
1007,
1063,
9530,
3367,
21839,
2863,
14853,
1027,
1063,
1065,
1025,
2005,
1006,
9530,
3367,
1031,
5371,
1010,
27425,
1033,
1997,
4874,
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... |
sass/node-sass | lib/extensions.js | getCachePathCandidates | function getCachePathCandidates() {
return [
process.env.npm_config_sass_binary_cache,
process.env.npm_config_cache,
].filter(function(_) { return _; });
} | javascript | function getCachePathCandidates() {
return [
process.env.npm_config_sass_binary_cache,
process.env.npm_config_cache,
].filter(function(_) { return _; });
} | [
"function",
"getCachePathCandidates",
"(",
")",
"{",
"return",
"[",
"process",
".",
"env",
".",
"npm_config_sass_binary_cache",
",",
"process",
".",
"env",
".",
"npm_config_cache",
",",
"]",
".",
"filter",
"(",
"function",
"(",
"_",
")",
"{",
"return",
"_",
... | An array of paths suitable for use as a local disk cache of the binding.
@return {[]String} an array of paths
@api public | [
"An",
"array",
"of",
"paths",
"suitable",
"for",
"use",
"as",
"a",
"local",
"disk",
"cache",
"of",
"the",
"binding",
"."
] | 0c1a49eefa37544d16041c5fe5b2e3d9168004b7 | https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/extensions.js#L328-L333 | train | Get the paths to the cache file. | [
30522,
3853,
2131,
3540,
5403,
15069,
9336,
4305,
27122,
1006,
1007,
1063,
2709,
1031,
2832,
1012,
4372,
2615,
1012,
27937,
2213,
1035,
9530,
8873,
2290,
1035,
21871,
2015,
1035,
12441,
1035,
17053,
1010,
2832,
1012,
4372,
2615,
1012,
27937... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mochajs/mocha | lib/reporters/html.js | hideSuitesWithout | function hideSuitesWithout(classname) {
var suites = document.getElementsByClassName('suite');
for (var i = 0; i < suites.length; i++) {
var els = suites[i].getElementsByClassName(classname);
if (!els.length) {
suites[i].className += ' hidden';
}
}
} | javascript | function hideSuitesWithout(classname) {
var suites = document.getElementsByClassName('suite');
for (var i = 0; i < suites.length; i++) {
var els = suites[i].getElementsByClassName(classname);
if (!els.length) {
suites[i].className += ' hidden';
}
}
} | [
"function",
"hideSuitesWithout",
"(",
"classname",
")",
"{",
"var",
"suites",
"=",
"document",
".",
"getElementsByClassName",
"(",
"'suite'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"suites",
".",
"length",
";",
"i",
"++",
")",
"{",
... | Check for suites that do not have elements
with `classname`, and hide them.
@param {text} classname | [
"Check",
"for",
"suites",
"that",
"do",
"not",
"have",
"elements",
"with",
"classname",
"and",
"hide",
"them",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/html.js#L345-L353 | train | hide suites without classname | [
30522,
3853,
17382,
14663,
2229,
24415,
5833,
1006,
2465,
18442,
1007,
1063,
13075,
19796,
1027,
6254,
1012,
2131,
12260,
8163,
3762,
26266,
18442,
1006,
1005,
7621,
1005,
1007,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
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... |
PrismJS/prism | scripts/utopia.js | function(element) {
var left = 0, top = 0, el = element;
if (el.parentNode) {
do {
left += el.offsetLeft;
top += el.offsetTop;
} while ((el = el.offsetParent) && el.nodeType < 9);
el = element;
do {
left -= el.scrollLeft;
top -= el.scrollTop;
} while ((el = el.parentNode) && !/body/i.test(el.nodeName));
}
return {
top: top,
right: innerWidth - left - element.offsetWidth,
bottom: innerHeight - top - element.offsetHeight,
left: left,
};
} | javascript | function(element) {
var left = 0, top = 0, el = element;
if (el.parentNode) {
do {
left += el.offsetLeft;
top += el.offsetTop;
} while ((el = el.offsetParent) && el.nodeType < 9);
el = element;
do {
left -= el.scrollLeft;
top -= el.scrollTop;
} while ((el = el.parentNode) && !/body/i.test(el.nodeName));
}
return {
top: top,
right: innerWidth - left - element.offsetWidth,
bottom: innerHeight - top - element.offsetHeight,
left: left,
};
} | [
"function",
"(",
"element",
")",
"{",
"var",
"left",
"=",
"0",
",",
"top",
"=",
"0",
",",
"el",
"=",
"element",
";",
"if",
"(",
"el",
".",
"parentNode",
")",
"{",
"do",
"{",
"left",
"+=",
"el",
".",
"offsetLeft",
";",
"top",
"+=",
"el",
".",
... | Returns the absolute X, Y offsets for an element | [
"Returns",
"the",
"absolute",
"X",
"Y",
"offsets",
"for",
"an",
"element"
] | acceb3b56f0e8362a7ef274dbd85b17611df2ec4 | https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/scripts/utopia.js#L420-L443 | train | Returns the position of an element in the DOM. | [
30522,
3853,
1006,
5783,
1007,
1063,
13075,
2187,
1027,
1014,
1010,
2327,
1027,
1014,
1010,
3449,
1027,
5783,
1025,
2065,
1006,
3449,
1012,
6687,
3630,
3207,
1007,
1063,
2079,
1063,
2187,
1009,
1027,
3449,
30524,
1025,
2079,
1063,
2187,
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... | |
facebook/relay | packages/relay-compiler/codegen/deepMergeAssignments.js | collectAssignmentsInto | function collectAssignmentsInto(
assignments: Array<{path: Array<string | number>, value: mixed}>,
parentPath: Array<string | number>,
parentValue: Object,
): void {
// Iterate over the entries in the array or object.
forEach(parentValue, (value, key) => {
// The "path" is the sequence of keys to arrive at this assignment.
const path = parentPath.concat(key);
// For each entry, either add an assignment or recurse.
if (typeof value === 'object' && value !== null) {
collectAssignmentsInto(assignments, path, value);
} else {
assignments.push({path, value});
}
});
} | javascript | function collectAssignmentsInto(
assignments: Array<{path: Array<string | number>, value: mixed}>,
parentPath: Array<string | number>,
parentValue: Object,
): void {
// Iterate over the entries in the array or object.
forEach(parentValue, (value, key) => {
// The "path" is the sequence of keys to arrive at this assignment.
const path = parentPath.concat(key);
// For each entry, either add an assignment or recurse.
if (typeof value === 'object' && value !== null) {
collectAssignmentsInto(assignments, path, value);
} else {
assignments.push({path, value});
}
});
} | [
"function",
"collectAssignmentsInto",
"(",
"assignments",
":",
"Array",
"<",
"{",
"path",
":",
"Array",
"<",
"string",
"|",
"number",
">",
",",
"value",
":",
"mixed",
"}",
">",
",",
"parentPath",
":",
"Array",
"<",
"string",
"|",
"number",
">",
",",
"p... | Recursively collect assignments | [
"Recursively",
"collect",
"assignments"
] | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/codegen/deepMergeAssignments.js#L27-L43 | train | Recursively collect assignments into an array of objects. | [
30522,
3853,
8145,
12054,
24838,
11493,
3406,
1006,
14799,
1024,
9140,
1026,
1063,
4130,
1024,
9140,
1026,
5164,
1064,
2193,
1028,
1010,
3643,
1024,
3816,
1065,
1028,
1010,
6687,
15069,
1024,
9140,
1026,
5164,
1064,
2193,
1028,
1010,
6687,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
socketio/socket.io | lib/index.js | Server | function Server(srv, opts){
if (!(this instanceof Server)) return new Server(srv, opts);
if ('object' == typeof srv && srv instanceof Object && !srv.listen) {
opts = srv;
srv = null;
}
opts = opts || {};
this.nsps = {};
this.parentNsps = new Map();
this.path(opts.path || '/socket.io');
this.serveClient(false !== opts.serveClient);
this.parser = opts.parser || parser;
this.encoder = new this.parser.Encoder();
this.adapter(opts.adapter || Adapter);
this.origins(opts.origins || '*:*');
this.sockets = this.of('/');
if (srv) this.attach(srv, opts);
} | javascript | function Server(srv, opts){
if (!(this instanceof Server)) return new Server(srv, opts);
if ('object' == typeof srv && srv instanceof Object && !srv.listen) {
opts = srv;
srv = null;
}
opts = opts || {};
this.nsps = {};
this.parentNsps = new Map();
this.path(opts.path || '/socket.io');
this.serveClient(false !== opts.serveClient);
this.parser = opts.parser || parser;
this.encoder = new this.parser.Encoder();
this.adapter(opts.adapter || Adapter);
this.origins(opts.origins || '*:*');
this.sockets = this.of('/');
if (srv) this.attach(srv, opts);
} | [
"function",
"Server",
"(",
"srv",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Server",
")",
")",
"return",
"new",
"Server",
"(",
"srv",
",",
"opts",
")",
";",
"if",
"(",
"'object'",
"==",
"typeof",
"srv",
"&&",
"srv",
"instan... | Server constructor.
@param {http.Server|Number|Object} srv http server, port or options
@param {Object} [opts]
@api public | [
"Server",
"constructor",
"."
] | 9c1e73c752aec63f48b511330a506d037783d897 | https://github.com/socketio/socket.io/blob/9c1e73c752aec63f48b511330a506d037783d897/lib/index.js#L43-L60 | train | Server constructor. | [
30522,
3853,
8241,
1006,
5034,
2615,
1010,
23569,
2015,
1007,
1063,
2065,
1006,
999,
1006,
2023,
6013,
11253,
8241,
1007,
1007,
2709,
2047,
8241,
1006,
5034,
2615,
1010,
23569,
2015,
1007,
1025,
2065,
1006,
1005,
4874,
1005,
1027,
1027,
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 | wb_sheet_idx | function wb_sheet_idx(wb, sh) {
if(typeof sh == "number") {
if(sh >= 0 && wb.SheetNames.length > sh) return sh;
throw new Error("Cannot find sheet # " + sh);
} else if(typeof sh == "string") {
var idx = wb.SheetNames.indexOf(sh);
if(idx > -1) return idx;
throw new Error("Cannot find sheet name |" + sh + "|");
} else throw new Error("Cannot find sheet |" + sh + "|");
} | javascript | function wb_sheet_idx(wb, sh) {
if(typeof sh == "number") {
if(sh >= 0 && wb.SheetNames.length > sh) return sh;
throw new Error("Cannot find sheet # " + sh);
} else if(typeof sh == "string") {
var idx = wb.SheetNames.indexOf(sh);
if(idx > -1) return idx;
throw new Error("Cannot find sheet name |" + sh + "|");
} else throw new Error("Cannot find sheet |" + sh + "|");
} | [
"function",
"wb_sheet_idx",
"(",
"wb",
",",
"sh",
")",
"{",
"if",
"(",
"typeof",
"sh",
"==",
"\"number\"",
")",
"{",
"if",
"(",
"sh",
">=",
"0",
"&&",
"wb",
".",
"SheetNames",
".",
"length",
">",
"sh",
")",
"return",
"sh",
";",
"throw",
"new",
"E... | /* find sheet index for given name / validate index | [
"/",
"*",
"find",
"sheet",
"index",
"for",
"given",
"name",
"/",
"validate",
"index"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L20775-L20784 | train | Get index of sheet in workbook | [
30522,
3853,
25610,
1035,
7123,
1035,
8909,
2595,
1006,
25610,
1010,
14021,
1007,
1063,
2065,
1006,
2828,
11253,
14021,
1027,
1027,
1000,
2193,
1000,
1007,
1063,
2065,
1006,
14021,
1028,
1027,
1014,
1004,
1004,
25610,
1012,
7123,
18442,
201... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | find_mdw_colw | function find_mdw_colw(collw) {
var delta = Math.abs(collw - cycle_width(collw)), _MDW = MDW;
if(delta > 0.005) for(MDW=MIN_MDW; MDW<MAX_MDW; ++MDW) if(Math.abs(collw - cycle_width(collw)) <= delta) { delta = Math.abs(collw - cycle_width(collw)); _MDW = MDW; }
MDW = _MDW;
} | javascript | function find_mdw_colw(collw) {
var delta = Math.abs(collw - cycle_width(collw)), _MDW = MDW;
if(delta > 0.005) for(MDW=MIN_MDW; MDW<MAX_MDW; ++MDW) if(Math.abs(collw - cycle_width(collw)) <= delta) { delta = Math.abs(collw - cycle_width(collw)); _MDW = MDW; }
MDW = _MDW;
} | [
"function",
"find_mdw_colw",
"(",
"collw",
")",
"{",
"var",
"delta",
"=",
"Math",
".",
"abs",
"(",
"collw",
"-",
"cycle_width",
"(",
"collw",
")",
")",
",",
"_MDW",
"=",
"MDW",
";",
"if",
"(",
"delta",
">",
"0.005",
")",
"for",
"(",
"MDW",
"=",
"... | /* XLSX/XLSB/XLS specify width in units of MDW | [
"/",
"*",
"XLSX",
"/",
"XLSB",
"/",
"XLS",
"specify",
"width",
"in",
"units",
"of",
"MDW"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8542-L8546 | train | Find the MDW of a collide cycle | [
30522,
3853,
2424,
1035,
9108,
2860,
1035,
8902,
2860,
1006,
8902,
2140,
2860,
1007,
1063,
13075,
7160,
1027,
8785,
1012,
14689,
1006,
8902,
2140,
2860,
1011,
5402,
1035,
9381,
1006,
8902,
2140,
2860,
1007,
1007,
1010,
1035,
9108,
2860,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/lib/common/i18n.js | t | function t(path, bindings) {
let string, isTheme, msg;
currentLocale = I18n.locale();
if (bindings !== undefined) {
isTheme = bindings.isThemeString;
delete bindings.isThemeString;
}
string = I18n.findString(path, {isThemeString: isTheme});
// If the path returns an array (as in the case with anything that has multiple paragraphs such as emails), then
// loop through them and return an array of translated/formatted strings. Otherwise, just return the normal
// translated/formatted string.
if (Array.isArray(string)) {
msg = [];
string.forEach(function (s) {
let m = new MessageFormat(s, currentLocale);
try {
m.format(bindings);
} catch (err) {
logging.error(err.message);
// fallback
m = new MessageFormat(coreStrings.errors.errors.anErrorOccurred, currentLocale);
m = msg.format();
}
msg.push(m);
});
} else {
msg = new MessageFormat(string, currentLocale);
try {
msg = msg.format(bindings);
} catch (err) {
logging.error(err.message);
// fallback
msg = new MessageFormat(coreStrings.errors.errors.anErrorOccurred, currentLocale);
msg = msg.format();
}
}
return msg;
} | javascript | function t(path, bindings) {
let string, isTheme, msg;
currentLocale = I18n.locale();
if (bindings !== undefined) {
isTheme = bindings.isThemeString;
delete bindings.isThemeString;
}
string = I18n.findString(path, {isThemeString: isTheme});
// If the path returns an array (as in the case with anything that has multiple paragraphs such as emails), then
// loop through them and return an array of translated/formatted strings. Otherwise, just return the normal
// translated/formatted string.
if (Array.isArray(string)) {
msg = [];
string.forEach(function (s) {
let m = new MessageFormat(s, currentLocale);
try {
m.format(bindings);
} catch (err) {
logging.error(err.message);
// fallback
m = new MessageFormat(coreStrings.errors.errors.anErrorOccurred, currentLocale);
m = msg.format();
}
msg.push(m);
});
} else {
msg = new MessageFormat(string, currentLocale);
try {
msg = msg.format(bindings);
} catch (err) {
logging.error(err.message);
// fallback
msg = new MessageFormat(coreStrings.errors.errors.anErrorOccurred, currentLocale);
msg = msg.format();
}
}
return msg;
} | [
"function",
"t",
"(",
"path",
",",
"bindings",
")",
"{",
"let",
"string",
",",
"isTheme",
",",
"msg",
";",
"currentLocale",
"=",
"I18n",
".",
"locale",
"(",
")",
";",
"if",
"(",
"bindings",
"!==",
"undefined",
")",
"{",
"isTheme",
"=",
"bindings",
".... | Helper method to find and compile the given data context with a proper string resource.
@param {string} path Path with in the JSON language file to desired string (ie: "errors.init.jsNotBuilt")
@param {object} [bindings]
@returns {string} | [
"Helper",
"method",
"to",
"find",
"and",
"compile",
"the",
"given",
"data",
"context",
"with",
"a",
"proper",
"string",
"resource",
"."
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/lib/common/i18n.js#L61-L106 | train | Returns a string that can be used to translate a file. | [
30522,
3853,
1056,
1006,
4130,
1010,
8031,
2015,
1007,
1063,
2292,
5164,
1010,
21541,
29122,
2063,
1010,
5796,
2290,
1025,
2783,
4135,
9289,
2063,
1027,
1045,
15136,
2078,
1012,
2334,
2063,
1006,
1007,
1025,
2065,
1006,
8031,
2015,
999,
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... |
NetEase/pomelo | lib/server/server.js | function(server, crons) {
var handlers = server.cronHandlers;
for(var i = 0; i<crons.length; i++) {
var cronInfo = crons[i];
var time = cronInfo.time;
var action = cronInfo.action;
var jobId = cronInfo.id;
if(!time || !action || !jobId) {
logger.error('cron miss necessary parameters: %j', cronInfo);
continue;
}
if(action.indexOf('.') < 0) {
logger.error('cron action is error format: %j', cronInfo);
continue;
}
var cron = action.split('.')[0];
var job = action.split('.')[1];
var handler = handlers[cron];
if(!handler) {
logger.error('could not find cron: %j', cronInfo);
continue;
}
if(typeof handler[job] !== 'function') {
logger.error('could not find cron job: %j, %s', cronInfo, job);
continue;
}
var id = schedule.scheduleJob(time, handler[job].bind(handler));
server.jobs[jobId] = id;
}
} | javascript | function(server, crons) {
var handlers = server.cronHandlers;
for(var i = 0; i<crons.length; i++) {
var cronInfo = crons[i];
var time = cronInfo.time;
var action = cronInfo.action;
var jobId = cronInfo.id;
if(!time || !action || !jobId) {
logger.error('cron miss necessary parameters: %j', cronInfo);
continue;
}
if(action.indexOf('.') < 0) {
logger.error('cron action is error format: %j', cronInfo);
continue;
}
var cron = action.split('.')[0];
var job = action.split('.')[1];
var handler = handlers[cron];
if(!handler) {
logger.error('could not find cron: %j', cronInfo);
continue;
}
if(typeof handler[job] !== 'function') {
logger.error('could not find cron job: %j, %s', cronInfo, job);
continue;
}
var id = schedule.scheduleJob(time, handler[job].bind(handler));
server.jobs[jobId] = id;
}
} | [
"function",
"(",
"server",
",",
"crons",
")",
"{",
"var",
"handlers",
"=",
"server",
".",
"cronHandlers",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"crons",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"cronInfo",
"=",
"crons",
"["... | Schedule crons | [
"Schedule",
"crons"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/server/server.js#L394-L429 | train | Schedule crons | [
30522,
3853,
1006,
8241,
1010,
13675,
5644,
1007,
1063,
13075,
28213,
2015,
1027,
8241,
1012,
13675,
2239,
11774,
12910,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
13675,
5644,
1012,
3091,
1025,
1045,
1009,
1009,
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... | |
adobe/brackets | src/document/DocumentManager.js | getCurrentDocument | function getCurrentDocument() {
var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE);
if (file) {
return getOpenDocumentForPath(file.fullPath);
}
return null;
} | javascript | function getCurrentDocument() {
var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE);
if (file) {
return getOpenDocumentForPath(file.fullPath);
}
return null;
} | [
"function",
"getCurrentDocument",
"(",
")",
"{",
"var",
"file",
"=",
"MainViewManager",
".",
"getCurrentlyViewedFile",
"(",
"MainViewManager",
".",
"ACTIVE_PANE",
")",
";",
"if",
"(",
"file",
")",
"{",
"return",
"getOpenDocumentForPath",
"(",
"file",
".",
"fullP... | Returns the Document that is currently open in the editor UI. May be null.
@return {?Document} | [
"Returns",
"the",
"Document",
"that",
"is",
"currently",
"open",
"in",
"the",
"editor",
"UI",
".",
"May",
"be",
"null",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L140-L148 | train | Get the current document | [
30522,
3853,
2131,
10841,
14343,
3372,
3527,
24894,
4765,
1006,
1007,
1063,
13075,
5371,
1027,
2364,
8584,
24805,
4590,
1012,
2131,
10841,
14343,
20630,
8584,
2098,
8873,
2571,
1006,
2364,
8584,
24805,
4590,
1012,
3161,
1035,
6090,
2063,
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.unified/src/sap/ui/unified/CalendarRow.js | _determineVisibleIntervalHeaders | function _determineVisibleIntervalHeaders() {
var aVisibleIntervalHeaders = [];
if (this.getShowIntervalHeaders()) {
// only use appointments in visible time frame for rendering
var aAppointments = this.getIntervalHeaders();
var oAppointment;
var iIntervals = this.getIntervals();
var sIntervalType = this.getIntervalType();
var oStartDate = this._getStartDate();
var iStartTime = oStartDate.getTime();
var oEndDate = this._oUTCEndDate;
var iEndTime = oEndDate.getTime();
var i = 0;
var j = 0;
for (i = 0; i < aAppointments.length; i++) {
oAppointment = aAppointments[i];
var oAppointmentStartDate = CalendarUtils._createUniversalUTCDate(oAppointment.getStartDate(), undefined, true);
oAppointmentStartDate.setUTCSeconds(0); // ignore seconds
oAppointmentStartDate.setUTCMilliseconds(0); // ignore milliseconds
var oAppointmentEndDate = oAppointment.getEndDate()
? CalendarUtils._createUniversalUTCDate(oAppointment.getEndDate(), undefined, true)
: CalendarUtils._createUniversalUTCDate(new Date(864000000000000), undefined, true); //max date;
oAppointmentEndDate.setUTCSeconds(0); // ignore seconds
oAppointmentEndDate.setUTCMilliseconds(0); // ignore milliseconds
if (oAppointmentStartDate && oAppointmentStartDate.getTime() <= iEndTime &&
oAppointmentEndDate && oAppointmentEndDate.getTime() >= iStartTime) {
// appointment is visible in row - check intervals
var oIntervalStartDate = new UniversalDate(oStartDate.getTime());
var oIntervalEndDate = new UniversalDate(oStartDate.getTime());
oIntervalEndDate.setUTCMinutes(oIntervalEndDate.getUTCMinutes() - 1);
var iFirstInterval = -1;
var iLastInterval = -1;
for (j = 0; j < iIntervals; j++) {
switch (sIntervalType) {
case CalendarIntervalType.Hour:
oIntervalEndDate.setUTCHours(oIntervalEndDate.getUTCHours() + 1);
if (j > 0) {
oIntervalStartDate.setUTCHours(oIntervalStartDate.getUTCHours() + 1);
}
break;
case CalendarIntervalType.Day:
case CalendarIntervalType.Week:
case CalendarIntervalType.OneMonth:
oIntervalEndDate.setUTCDate(oIntervalEndDate.getUTCDate() + 1);
if (j > 0) {
oIntervalStartDate.setUTCDate(oIntervalStartDate.getUTCDate() + 1);
}
break;
case CalendarIntervalType.Month:
// as months have different length, go to 1st of next month to determine last of month
oIntervalEndDate.setUTCDate(1);
oIntervalEndDate.setUTCMonth(oIntervalEndDate.getUTCMonth() + 2);
oIntervalEndDate.setUTCDate(0);
if (j > 0) {
oIntervalStartDate.setUTCMonth(oIntervalStartDate.getUTCMonth() + 1);
}
break;
default:
throw new Error("Unknown IntervalType: " + sIntervalType + "; " + this);
}
if (oAppointmentStartDate && oAppointmentStartDate.getTime() <= oIntervalStartDate.getTime() &&
oAppointmentEndDate && oAppointmentEndDate.getTime() >= oIntervalEndDate.getTime()) {
// interval is completely in appointment
if (iFirstInterval < 0) {
iFirstInterval = j;
}
iLastInterval = j;
}
}
if (iFirstInterval >= 0) {
aVisibleIntervalHeaders.push({interval: iFirstInterval, appointment: oAppointment, last: iLastInterval});
}
}
}
}
this._aVisibleIntervalHeaders = aVisibleIntervalHeaders;
return this._aVisibleIntervalHeaders;
} | javascript | function _determineVisibleIntervalHeaders() {
var aVisibleIntervalHeaders = [];
if (this.getShowIntervalHeaders()) {
// only use appointments in visible time frame for rendering
var aAppointments = this.getIntervalHeaders();
var oAppointment;
var iIntervals = this.getIntervals();
var sIntervalType = this.getIntervalType();
var oStartDate = this._getStartDate();
var iStartTime = oStartDate.getTime();
var oEndDate = this._oUTCEndDate;
var iEndTime = oEndDate.getTime();
var i = 0;
var j = 0;
for (i = 0; i < aAppointments.length; i++) {
oAppointment = aAppointments[i];
var oAppointmentStartDate = CalendarUtils._createUniversalUTCDate(oAppointment.getStartDate(), undefined, true);
oAppointmentStartDate.setUTCSeconds(0); // ignore seconds
oAppointmentStartDate.setUTCMilliseconds(0); // ignore milliseconds
var oAppointmentEndDate = oAppointment.getEndDate()
? CalendarUtils._createUniversalUTCDate(oAppointment.getEndDate(), undefined, true)
: CalendarUtils._createUniversalUTCDate(new Date(864000000000000), undefined, true); //max date;
oAppointmentEndDate.setUTCSeconds(0); // ignore seconds
oAppointmentEndDate.setUTCMilliseconds(0); // ignore milliseconds
if (oAppointmentStartDate && oAppointmentStartDate.getTime() <= iEndTime &&
oAppointmentEndDate && oAppointmentEndDate.getTime() >= iStartTime) {
// appointment is visible in row - check intervals
var oIntervalStartDate = new UniversalDate(oStartDate.getTime());
var oIntervalEndDate = new UniversalDate(oStartDate.getTime());
oIntervalEndDate.setUTCMinutes(oIntervalEndDate.getUTCMinutes() - 1);
var iFirstInterval = -1;
var iLastInterval = -1;
for (j = 0; j < iIntervals; j++) {
switch (sIntervalType) {
case CalendarIntervalType.Hour:
oIntervalEndDate.setUTCHours(oIntervalEndDate.getUTCHours() + 1);
if (j > 0) {
oIntervalStartDate.setUTCHours(oIntervalStartDate.getUTCHours() + 1);
}
break;
case CalendarIntervalType.Day:
case CalendarIntervalType.Week:
case CalendarIntervalType.OneMonth:
oIntervalEndDate.setUTCDate(oIntervalEndDate.getUTCDate() + 1);
if (j > 0) {
oIntervalStartDate.setUTCDate(oIntervalStartDate.getUTCDate() + 1);
}
break;
case CalendarIntervalType.Month:
// as months have different length, go to 1st of next month to determine last of month
oIntervalEndDate.setUTCDate(1);
oIntervalEndDate.setUTCMonth(oIntervalEndDate.getUTCMonth() + 2);
oIntervalEndDate.setUTCDate(0);
if (j > 0) {
oIntervalStartDate.setUTCMonth(oIntervalStartDate.getUTCMonth() + 1);
}
break;
default:
throw new Error("Unknown IntervalType: " + sIntervalType + "; " + this);
}
if (oAppointmentStartDate && oAppointmentStartDate.getTime() <= oIntervalStartDate.getTime() &&
oAppointmentEndDate && oAppointmentEndDate.getTime() >= oIntervalEndDate.getTime()) {
// interval is completely in appointment
if (iFirstInterval < 0) {
iFirstInterval = j;
}
iLastInterval = j;
}
}
if (iFirstInterval >= 0) {
aVisibleIntervalHeaders.push({interval: iFirstInterval, appointment: oAppointment, last: iLastInterval});
}
}
}
}
this._aVisibleIntervalHeaders = aVisibleIntervalHeaders;
return this._aVisibleIntervalHeaders;
} | [
"function",
"_determineVisibleIntervalHeaders",
"(",
")",
"{",
"var",
"aVisibleIntervalHeaders",
"=",
"[",
"]",
";",
"if",
"(",
"this",
".",
"getShowIntervalHeaders",
"(",
")",
")",
"{",
"// only use appointments in visible time frame for rendering",
"var",
"aAppointments... | /*
returns an array of visible intervalHeaders
each entry is an object with the following properties
- interval: number of the interval
- appointment: the appointment object
- first: interval is the first one displaying the appointment | [
"/",
"*",
"returns",
"an",
"array",
"of",
"visible",
"intervalHeaders",
"each",
"entry",
"is",
"an",
"object",
"with",
"the",
"following",
"properties",
"-",
"interval",
":",
"number",
"of",
"the",
"interval",
"-",
"appointment",
":",
"the",
"appointment",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarRow.js#L1390-L1479 | train | Determines the headers that are visible in the interval frame. | [
30522,
3853,
1035,
5646,
11365,
7028,
18447,
2121,
10175,
4974,
2545,
1006,
1007,
1063,
13075,
20704,
17417,
3468,
18447,
2121,
10175,
4974,
2545,
1027,
1031,
1033,
1025,
2065,
1006,
2023,
1012,
4152,
14406,
18447,
2121,
10175,
4974,
2545,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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() {
var self = this;
self.viewer = $.dom("<div class='mui-imageviewer'><div class='mui-imageviewer-mask'></div><div class='mui-imageviewer-header'><i class='mui-icon mui-icon-closeempty mui-imageviewer-close'></i><span class='mui-imageviewer-state'></span></div><i class='mui-icon mui-icon-arrowleft mui-imageviewer-left'></i><i class='mui-icon mui-icon-arrowright mui-imageviewer-right'></i></div>");
self.viewer = self.viewer[0] || self.viewer;
//self.viewer.style.height = screen.height;
self.closeButton = self.viewer.querySelector('.mui-imageviewer-close');
self.state = self.viewer.querySelector('.mui-imageviewer-state');
self.leftButton = self.viewer.querySelector('.mui-imageviewer-left');
self.rightButton = self.viewer.querySelector('.mui-imageviewer-right');
self.mask = self.viewer.querySelector('.mui-imageviewer-mask');
document.body.appendChild(self.viewer);
} | javascript | function() {
var self = this;
self.viewer = $.dom("<div class='mui-imageviewer'><div class='mui-imageviewer-mask'></div><div class='mui-imageviewer-header'><i class='mui-icon mui-icon-closeempty mui-imageviewer-close'></i><span class='mui-imageviewer-state'></span></div><i class='mui-icon mui-icon-arrowleft mui-imageviewer-left'></i><i class='mui-icon mui-icon-arrowright mui-imageviewer-right'></i></div>");
self.viewer = self.viewer[0] || self.viewer;
//self.viewer.style.height = screen.height;
self.closeButton = self.viewer.querySelector('.mui-imageviewer-close');
self.state = self.viewer.querySelector('.mui-imageviewer-state');
self.leftButton = self.viewer.querySelector('.mui-imageviewer-left');
self.rightButton = self.viewer.querySelector('.mui-imageviewer-right');
self.mask = self.viewer.querySelector('.mui-imageviewer-mask');
document.body.appendChild(self.viewer);
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"viewer",
"=",
"$",
".",
"dom",
"(",
"\"<div class='mui-imageviewer'><div class='mui-imageviewer-mask'></div><div class='mui-imageviewer-header'><i class='mui-icon mui-icon-closeempty mui-imageviewer-close'></... | 创建图片预览组件的整体 UI | [
"创建图片预览组件的整体",
"UI"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.imageViewer.js#L52-L63 | train | Creates the image viewer element | [
30522,
3853,
1006,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2969,
1012,
13972,
1027,
1002,
1012,
14383,
1006,
1000,
1026,
4487,
2615,
2465,
30524,
1011,
3746,
8584,
2121,
1011,
7308,
1005,
1028,
1026,
1013,
4487,
2615,
1028,
1026,
4487,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/core/services/gesture/gesture.js | function (element, options) {
var self = this;
element[0].$mdGesture = element[0].$mdGesture || {};
element[0].$mdGesture[this.name] = options || {};
element.on('$destroy', onDestroy);
self.onSetup(element, options || {});
return onDestroy;
function onDestroy() {
delete element[0].$mdGesture[self.name];
element.off('$destroy', onDestroy);
self.onCleanup(element, options || {});
}
} | javascript | function (element, options) {
var self = this;
element[0].$mdGesture = element[0].$mdGesture || {};
element[0].$mdGesture[this.name] = options || {};
element.on('$destroy', onDestroy);
self.onSetup(element, options || {});
return onDestroy;
function onDestroy() {
delete element[0].$mdGesture[self.name];
element.off('$destroy', onDestroy);
self.onCleanup(element, options || {});
}
} | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"element",
"[",
"0",
"]",
".",
"$mdGesture",
"=",
"element",
"[",
"0",
"]",
".",
"$mdGesture",
"||",
"{",
"}",
";",
"element",
"[",
"0",
"]",
".",
"$mdGesture",
... | Called from $mdGesture.register when an element registers itself with a handler. Store the options the user gave on the DOMElement itself. These options will be retrieved with getNearestParent when the handler starts. | [
"Called",
"from",
"$mdGesture",
".",
"register",
"when",
"an",
"element",
"registers",
"itself",
"with",
"a",
"handler",
".",
"Store",
"the",
"options",
"the",
"user",
"gave",
"on",
"the",
"DOMElement",
"itself",
".",
"These",
"options",
"will",
"be",
"retri... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L459-L475 | train | Initialize the gesture | [
30522,
3853,
1006,
5783,
1010,
7047,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
5783,
1031,
1014,
1033,
1012,
1002,
9108,
8449,
11244,
1027,
5783,
1031,
1014,
1033,
1012,
1002,
9108,
8449,
11244,
1064,
1064,
1063,
1065,
1025,
5783,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
wangfupeng1988/wangEditor | src/js/menus/code/index.js | function (value) {
const editor = this.editor
const $selectionELem = editor.selection.getSelectionContainerElem()
if (!$selectionELem) {
return
}
$selectionELem.html(value)
editor.selection.restoreSelection()
} | javascript | function (value) {
const editor = this.editor
const $selectionELem = editor.selection.getSelectionContainerElem()
if (!$selectionELem) {
return
}
$selectionELem.html(value)
editor.selection.restoreSelection()
} | [
"function",
"(",
"value",
")",
"{",
"const",
"editor",
"=",
"this",
".",
"editor",
"const",
"$selectionELem",
"=",
"editor",
".",
"selection",
".",
"getSelectionContainerElem",
"(",
")",
"if",
"(",
"!",
"$selectionELem",
")",
"{",
"return",
"}",
"$selectionE... | 更新代码 | [
"更新代码"
] | b77696f5e81c8ec13d9d341252d6b9fa8a22db18 | https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/code/index.js#L121-L129 | train | Sets the current language | [
30522,
3853,
1006,
3643,
1007,
1063,
9530,
3367,
3559,
1027,
2023,
1012,
3559,
9530,
3367,
1002,
4989,
12260,
2213,
1027,
3559,
1012,
4989,
1012,
4152,
12260,
7542,
8663,
18249,
7869,
16930,
1006,
1007,
2065,
1006,
999,
1002,
4989,
12260,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_getTabTitleBox | function tabView_getTabTitleBox(aSpec) {
var spec = aSpec || {};
var tab = spec.tab;
if (!tab) {
throw new Error(arguments.callee.name + ": Tab not specified.");
}
return this.getElement({
type: "tab_titleBox",
parent: spec.tab
});
} | javascript | function tabView_getTabTitleBox(aSpec) {
var spec = aSpec || {};
var tab = spec.tab;
if (!tab) {
throw new Error(arguments.callee.name + ": Tab not specified.");
}
return this.getElement({
type: "tab_titleBox",
parent: spec.tab
});
} | [
"function",
"tabView_getTabTitleBox",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"var",
"tab",
"=",
"spec",
".",
"tab",
";",
"if",
"(",
"!",
"tab",
")",
"{",
"throw",
"new",
"Error",
"(",
"arguments",
".",
"callee",
"... | Retrieve the tab's title box
@param {object} aSpec
Information on which tab to operate on
Elements: tab - Tab
@returns Tab title box
@type {ElemBase} | [
"Retrieve",
"the",
"tab",
"s",
"title",
"box"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabview.js#L373-L385 | train | Returns the title box of a tab | [
30522,
3853,
21628,
8584,
1035,
2131,
2696,
19279,
4183,
2571,
8758,
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,
2162... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | examples/3d/js/map.js | function(sin, cos, range, origin) {
var stepX = this.step(sin, cos, origin.x, origin.y, false);
var stepY = this.step(cos, sin, origin.y, origin.x, true);
var inspectX = [sin, cos, stepX, 1, 0, origin.dist, stepX.y];
var inspectY = [sin, cos, stepY, 0, 1, origin.dist, stepY.x];
var next = this.inspect.apply(this, (stepX.len2 < stepY.len2) ? inspectX : inspectY);
if (next.dist > range) {
return [origin];
}
return [origin].concat(this.ray(sin, cos, range, next));
} | javascript | function(sin, cos, range, origin) {
var stepX = this.step(sin, cos, origin.x, origin.y, false);
var stepY = this.step(cos, sin, origin.y, origin.x, true);
var inspectX = [sin, cos, stepX, 1, 0, origin.dist, stepX.y];
var inspectY = [sin, cos, stepY, 0, 1, origin.dist, stepY.x];
var next = this.inspect.apply(this, (stepX.len2 < stepY.len2) ? inspectX : inspectY);
if (next.dist > range) {
return [origin];
}
return [origin].concat(this.ray(sin, cos, range, next));
} | [
"function",
"(",
"sin",
",",
"cos",
",",
"range",
",",
"origin",
")",
"{",
"var",
"stepX",
"=",
"this",
".",
"step",
"(",
"sin",
",",
"cos",
",",
"origin",
".",
"x",
",",
"origin",
".",
"y",
",",
"false",
")",
";",
"var",
"stepY",
"=",
"this",
... | Emit a ray to beginb uilding the scene.
@param {Number} sin Sine of the cast angle.
@param {Number} cos Cosine of the cast angle.
@param {Number} range Max length of the ray.
@param {Object} origin x, y, height and sitance | [
"Emit",
"a",
"ray",
"to",
"beginb",
"uilding",
"the",
"scene",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/3d/js/map.js#L67-L80 | train | Returns a new array of rays of the given radius | [
30522,
3853,
1006,
8254,
1010,
2522,
2015,
1010,
2846,
1010,
4761,
1007,
1063,
13075,
3357,
2595,
1027,
2023,
1012,
3357,
1006,
8254,
1010,
2522,
2015,
1010,
4761,
1012,
1060,
30524,
1015,
1010,
1014,
1010,
4761,
1012,
4487,
3367,
1010,
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... | |
vuejs/vuex | dist/vuex.esm.js | Store | function Store (options) {
var this$1 = this;
if ( options === void 0 ) options = {};
// Auto install if it is not done yet and `window` has `Vue`.
// To allow users to avoid auto-installation in some cases,
// this code should be placed here. See #731
if (!Vue && typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
if (process.env.NODE_ENV !== 'production') {
assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
assert(this instanceof Store, "store must be called with the new operator.");
}
var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
var strict = options.strict; if ( strict === void 0 ) strict = false;
// store internal state
this._committing = false;
this._actions = Object.create(null);
this._actionSubscribers = [];
this._mutations = Object.create(null);
this._wrappedGetters = Object.create(null);
this._modules = new ModuleCollection(options);
this._modulesNamespaceMap = Object.create(null);
this._subscribers = [];
this._watcherVM = new Vue();
// bind commit and dispatch to self
var store = this;
var ref = this;
var dispatch = ref.dispatch;
var commit = ref.commit;
this.dispatch = function boundDispatch (type, payload) {
return dispatch.call(store, type, payload)
};
this.commit = function boundCommit (type, payload, options) {
return commit.call(store, type, payload, options)
};
// strict mode
this.strict = strict;
var state = this._modules.root.state;
// init root module.
// this also recursively registers all sub-modules
// and collects all module getters inside this._wrappedGetters
installModule(this, state, [], this._modules.root);
// initialize the store vm, which is responsible for the reactivity
// (also registers _wrappedGetters as computed properties)
resetStoreVM(this, state);
// apply plugins
plugins.forEach(function (plugin) { return plugin(this$1); });
var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools;
if (useDevtools) {
devtoolPlugin(this);
}
} | javascript | function Store (options) {
var this$1 = this;
if ( options === void 0 ) options = {};
// Auto install if it is not done yet and `window` has `Vue`.
// To allow users to avoid auto-installation in some cases,
// this code should be placed here. See #731
if (!Vue && typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
if (process.env.NODE_ENV !== 'production') {
assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
assert(this instanceof Store, "store must be called with the new operator.");
}
var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
var strict = options.strict; if ( strict === void 0 ) strict = false;
// store internal state
this._committing = false;
this._actions = Object.create(null);
this._actionSubscribers = [];
this._mutations = Object.create(null);
this._wrappedGetters = Object.create(null);
this._modules = new ModuleCollection(options);
this._modulesNamespaceMap = Object.create(null);
this._subscribers = [];
this._watcherVM = new Vue();
// bind commit and dispatch to self
var store = this;
var ref = this;
var dispatch = ref.dispatch;
var commit = ref.commit;
this.dispatch = function boundDispatch (type, payload) {
return dispatch.call(store, type, payload)
};
this.commit = function boundCommit (type, payload, options) {
return commit.call(store, type, payload, options)
};
// strict mode
this.strict = strict;
var state = this._modules.root.state;
// init root module.
// this also recursively registers all sub-modules
// and collects all module getters inside this._wrappedGetters
installModule(this, state, [], this._modules.root);
// initialize the store vm, which is responsible for the reactivity
// (also registers _wrappedGetters as computed properties)
resetStoreVM(this, state);
// apply plugins
plugins.forEach(function (plugin) { return plugin(this$1); });
var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools;
if (useDevtools) {
devtoolPlugin(this);
}
} | [
"function",
"Store",
"(",
"options",
")",
"{",
"var",
"this$1",
"=",
"this",
";",
"if",
"(",
"options",
"===",
"void",
"0",
")",
"options",
"=",
"{",
"}",
";",
"// Auto install if it is not done yet and `window` has `Vue`.",
"// To allow users to avoid auto-installati... | bind on install | [
"bind",
"on",
"install"
] | d7c7f9844831f98c5c9aaca213746c4ccc5d6929 | https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/dist/vuex.esm.js#L285-L349 | train | A store that can be used to store mutations and getters. | [
30522,
3853,
3573,
1006,
7047,
1007,
1063,
13075,
2023,
1002,
1015,
1027,
2023,
1025,
2065,
1006,
7047,
1027,
1027,
1027,
11675,
1014,
1007,
7047,
1027,
1063,
1065,
1025,
1013,
1013,
8285,
16500,
2065,
2009,
2003,
2025,
2589,
2664,
1998,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/modifiers/config/getPluginConfig.js | getPluginConfig | function getPluginConfig(config, pluginName) {
var pluginsConfig = config.getValues().get('pluginsConfig');
if (pluginsConfig === undefined) {
return {};
}
var pluginConf = pluginsConfig.get(pluginName);
if (pluginConf === undefined) {
return {};
} else {
return pluginConf.toJS();
}
} | javascript | function getPluginConfig(config, pluginName) {
var pluginsConfig = config.getValues().get('pluginsConfig');
if (pluginsConfig === undefined) {
return {};
}
var pluginConf = pluginsConfig.get(pluginName);
if (pluginConf === undefined) {
return {};
} else {
return pluginConf.toJS();
}
} | [
"function",
"getPluginConfig",
"(",
"config",
",",
"pluginName",
")",
"{",
"var",
"pluginsConfig",
"=",
"config",
".",
"getValues",
"(",
")",
".",
"get",
"(",
"'pluginsConfig'",
")",
";",
"if",
"(",
"pluginsConfig",
"===",
"undefined",
")",
"{",
"return",
... | Return the configuration for a plugin
@param {Config} config
@param {String} pluginName
@return {Object} | [
"Return",
"the",
"configuration",
"for",
"a",
"plugin"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/modifiers/config/getPluginConfig.js#L7-L18 | train | Get the plugin config | [
30522,
3853,
2131,
24759,
15916,
2378,
8663,
8873,
2290,
1006,
9530,
8873,
2290,
1010,
13354,
23111,
14074,
1007,
1063,
13075,
30524,
9530,
8873,
2290,
1012,
2131,
10175,
15808,
1006,
1007,
1012,
2131,
1006,
1005,
13354,
7076,
8663,
8873,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moleculerjs/moleculer | src/serializers/proto/packets.proto.js | PacketGossipResponse | function PacketGossipResponse(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 PacketGossipResponse(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",
"PacketGossipResponse",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
... | Properties of a PacketGossipResponse.
@memberof packets
@interface IPacketGossipResponse
@property {string} ver PacketGossipResponse ver
@property {string} sender PacketGossipResponse sender
@property {string|null} [online] PacketGossipResponse online
@property {string|null} [offline] PacketGossipResponse offline
Constructs a new PacketGossipResponse.
@memberof packets
@classdesc Represents a PacketGossipResponse.
@implements IPacketGossipResponse
@constructor
@param {packets.IPacketGossipResponse=} [properties] Properties to set | [
"Properties",
"of",
"a",
"PacketGossipResponse",
"."
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/serializers/proto/packets.proto.js#L3432-L3437 | train | Properties of a PacketGossipResponse. | [
30522,
3853,
14771,
12333,
5332,
28994,
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,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/coord/single/singleCreator.js | create | function create(ecModel, api) {
var singles = [];
ecModel.eachComponent('singleAxis', function (axisModel, idx) {
var single = new Single(axisModel, ecModel, api);
single.name = 'single_' + idx;
single.resize(axisModel, api);
axisModel.coordinateSystem = single;
singles.push(single);
});
ecModel.eachSeries(function (seriesModel) {
if (seriesModel.get('coordinateSystem') === 'singleAxis') {
var singleAxisModel = ecModel.queryComponents({
mainType: 'singleAxis',
index: seriesModel.get('singleAxisIndex'),
id: seriesModel.get('singleAxisId')
})[0];
seriesModel.coordinateSystem = singleAxisModel && singleAxisModel.coordinateSystem;
}
});
return singles;
} | javascript | function create(ecModel, api) {
var singles = [];
ecModel.eachComponent('singleAxis', function (axisModel, idx) {
var single = new Single(axisModel, ecModel, api);
single.name = 'single_' + idx;
single.resize(axisModel, api);
axisModel.coordinateSystem = single;
singles.push(single);
});
ecModel.eachSeries(function (seriesModel) {
if (seriesModel.get('coordinateSystem') === 'singleAxis') {
var singleAxisModel = ecModel.queryComponents({
mainType: 'singleAxis',
index: seriesModel.get('singleAxisIndex'),
id: seriesModel.get('singleAxisId')
})[0];
seriesModel.coordinateSystem = singleAxisModel && singleAxisModel.coordinateSystem;
}
});
return singles;
} | [
"function",
"create",
"(",
"ecModel",
",",
"api",
")",
"{",
"var",
"singles",
"=",
"[",
"]",
";",
"ecModel",
".",
"eachComponent",
"(",
"'singleAxis'",
",",
"function",
"(",
"axisModel",
",",
"idx",
")",
"{",
"var",
"single",
"=",
"new",
"Single",
"(",... | Create single coordinate system and inject it into seriesModel.
@param {module:echarts/model/Global} ecModel
@param {module:echarts/ExtensionAPI} api
@return {Array.<module:echarts/coord/single/Single>} | [
"Create",
"single",
"coordinate",
"system",
"and",
"inject",
"it",
"into",
"seriesModel",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/single/singleCreator.js#L34-L59 | train | Create single series | [
30522,
3853,
3443,
1006,
14925,
5302,
9247,
1010,
17928,
1007,
1063,
13075,
3895,
1027,
1031,
1033,
1025,
14925,
5302,
9247,
1012,
2169,
9006,
29513,
3372,
1006,
1005,
2309,
8528,
2483,
1005,
1010,
3853,
1006,
8123,
5302,
9247,
1010,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/TopicDetail.controller.js | function () {
this.oPage = this.byId("topicDetailPage");
this.oPage.addStyleClass('docuPage');
if ( !window.prettyPrint ) {
//TODO: global jquery call found
jQuery.sap.require("sap.ui.documentation.sdk.thirdparty.google-code-prettify.prettify");
}
this.getRouter().getRoute("topicId").attachPatternMatched(this._onTopicMatched, this);
this._oConfig = this.getConfig();
this.jsonDefModel = new JSONModel();
this.getView().setModel(this.jsonDefModel);
} | javascript | function () {
this.oPage = this.byId("topicDetailPage");
this.oPage.addStyleClass('docuPage');
if ( !window.prettyPrint ) {
//TODO: global jquery call found
jQuery.sap.require("sap.ui.documentation.sdk.thirdparty.google-code-prettify.prettify");
}
this.getRouter().getRoute("topicId").attachPatternMatched(this._onTopicMatched, this);
this._oConfig = this.getConfig();
this.jsonDefModel = new JSONModel();
this.getView().setModel(this.jsonDefModel);
} | [
"function",
"(",
")",
"{",
"this",
".",
"oPage",
"=",
"this",
".",
"byId",
"(",
"\"topicDetailPage\"",
")",
";",
"this",
".",
"oPage",
".",
"addStyleClass",
"(",
"'docuPage'",
")",
";",
"if",
"(",
"!",
"window",
".",
"prettyPrint",
")",
"{",
"//TODO: g... | /* =========================================================== /* lifecycle methods /* =========================================================== | [
"/",
"*",
"===========================================================",
"/",
"*",
"lifecycle",
"methods",
"/",
"*",
"==========================================================="
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/TopicDetail.controller.js#L23-L37 | train | Creates the page that contains the topic detail page | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
6728,
4270,
1027,
2023,
1012,
2011,
3593,
1006,
1000,
8476,
3207,
14162,
13704,
1000,
1007,
1025,
2023,
1012,
6728,
4270,
1012,
9909,
27983,
26266,
1006,
1005,
9986,
6279,
4270,
1005,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | lib/jsdoc/ui5/template/publish.js | _processTypeString | function _processTypeString(type, builder) {
if ( type && Array.isArray(type.names) ) {
type = type.names.join('|');
}
if ( type ) {
try {
return typeParser.parse( type, builder ).str;
} catch (e) {
error("failed to parse type string '" + type + "': " + e);
return type;
}
}
} | javascript | function _processTypeString(type, builder) {
if ( type && Array.isArray(type.names) ) {
type = type.names.join('|');
}
if ( type ) {
try {
return typeParser.parse( type, builder ).str;
} catch (e) {
error("failed to parse type string '" + type + "': " + e);
return type;
}
}
} | [
"function",
"_processTypeString",
"(",
"type",
",",
"builder",
")",
"{",
"if",
"(",
"type",
"&&",
"Array",
".",
"isArray",
"(",
"type",
".",
"names",
")",
")",
"{",
"type",
"=",
"type",
".",
"names",
".",
"join",
"(",
"'|'",
")",
";",
"}",
"if",
... | /*
function testTypeParser(type) {
debug("Type: '" + type + "' gives AST");
try {
console.log(typeParser.parse(type));
} catch (e) {
error("**** throws: " + e);
}
}
testTypeParser("Array.<string>");
testTypeParser("Array<string>");
testTypeParser("Object.<string>");
testTypeParser("Object<string>");
testTypeParser("function(...string):Set<string>");
testTypeParser("{a:int,b,c:float,d,e}"); | [
"/",
"*",
"function",
"testTypeParser",
"(",
"type",
")",
"{",
"debug",
"(",
"Type",
":",
"+",
"type",
"+",
"gives",
"AST",
")",
";",
"try",
"{",
"console",
".",
"log",
"(",
"typeParser",
".",
"parse",
"(",
"type",
"))",
";",
"}",
"catch",
"(",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L2062-L2074 | train | Process a type string | [
30522,
3853,
1035,
2832,
13874,
3367,
4892,
1006,
2828,
1010,
12508,
1007,
1063,
2065,
1006,
2828,
1004,
1004,
9140,
1012,
18061,
11335,
2100,
1006,
2828,
1012,
3415,
1007,
1007,
1063,
2828,
1027,
2828,
1012,
3415,
1012,
3693,
1006,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/InAppNotifications/main.js | _getVersionInfoUrl | function _getVersionInfoUrl(localeParam) {
var locale = localeParam || brackets.getLocale();
if (locale.length > 2) {
locale = locale.substring(0, 2);
}
return brackets.config.notification_info_url.replace("<locale>", locale);
} | javascript | function _getVersionInfoUrl(localeParam) {
var locale = localeParam || brackets.getLocale();
if (locale.length > 2) {
locale = locale.substring(0, 2);
}
return brackets.config.notification_info_url.replace("<locale>", locale);
} | [
"function",
"_getVersionInfoUrl",
"(",
"localeParam",
")",
"{",
"var",
"locale",
"=",
"localeParam",
"||",
"brackets",
".",
"getLocale",
"(",
")",
";",
"if",
"(",
"locale",
".",
"length",
">",
"2",
")",
"{",
"locale",
"=",
"locale",
".",
"substring",
"("... | Constructs notification info URL for XHR
@param {string=} localeParam - optional locale, defaults to 'brackets.getLocale()' when omitted.
@returns {string} the new notification info url | [
"Constructs",
"notification",
"info",
"URL",
"for",
"XHR"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InAppNotifications/main.js#L55-L64 | train | Get the URL to the version information page | [
30522,
3853,
1035,
2131,
27774,
2378,
14876,
3126,
2140,
1006,
2334,
13699,
5400,
2213,
1007,
1063,
13075,
2334,
2063,
1027,
2334,
13699,
5400,
2213,
1064,
1064,
19719,
1012,
2131,
4135,
9289,
2063,
1006,
1007,
1025,
2065,
1006,
2334,
2063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/chart/sunburst/SunburstPiece.js | SunburstPiece | function SunburstPiece(node, seriesModel, ecModel) {
graphic.Group.call(this);
var sector = new graphic.Sector({
z2: DEFAULT_SECTOR_Z
});
sector.seriesIndex = seriesModel.seriesIndex;
var text = new graphic.Text({
z2: DEFAULT_TEXT_Z,
silent: node.getModel('label').get('silent')
});
this.add(sector);
this.add(text);
this.updateData(true, node, 'normal', seriesModel, ecModel);
// Hover to change label and labelLine
function onEmphasis() {
text.ignore = text.hoverIgnore;
}
function onNormal() {
text.ignore = text.normalIgnore;
}
this.on('emphasis', onEmphasis)
.on('normal', onNormal)
.on('mouseover', onEmphasis)
.on('mouseout', onNormal);
} | javascript | function SunburstPiece(node, seriesModel, ecModel) {
graphic.Group.call(this);
var sector = new graphic.Sector({
z2: DEFAULT_SECTOR_Z
});
sector.seriesIndex = seriesModel.seriesIndex;
var text = new graphic.Text({
z2: DEFAULT_TEXT_Z,
silent: node.getModel('label').get('silent')
});
this.add(sector);
this.add(text);
this.updateData(true, node, 'normal', seriesModel, ecModel);
// Hover to change label and labelLine
function onEmphasis() {
text.ignore = text.hoverIgnore;
}
function onNormal() {
text.ignore = text.normalIgnore;
}
this.on('emphasis', onEmphasis)
.on('normal', onNormal)
.on('mouseover', onEmphasis)
.on('mouseout', onNormal);
} | [
"function",
"SunburstPiece",
"(",
"node",
",",
"seriesModel",
",",
"ecModel",
")",
"{",
"graphic",
".",
"Group",
".",
"call",
"(",
"this",
")",
";",
"var",
"sector",
"=",
"new",
"graphic",
".",
"Sector",
"(",
"{",
"z2",
":",
"DEFAULT_SECTOR_Z",
"}",
")... | Sunburstce of Sunburst including Sector, Label, LabelLine
@constructor
@extends {module:zrender/graphic/Group} | [
"Sunburstce",
"of",
"Sunburst",
"including",
"Sector",
"Label",
"LabelLine"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/sunburst/SunburstPiece.js#L38-L67 | train | Sunburst piece | [
30522,
3853,
3103,
8569,
12096,
11198,
1006,
13045,
1010,
2186,
5302,
9247,
1010,
14925,
5302,
9247,
1007,
1063,
8425,
1012,
2177,
1012,
2655,
1006,
2023,
1007,
1025,
13075,
4753,
1027,
2047,
8425,
1012,
4753,
1006,
1063,
1062,
2475,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | genStaticKeys | function genStaticKeys (modules) {
return modules.reduce(function (keys, m) {
return keys.concat(m.staticKeys || [])
}, []).join(',')
} | javascript | function genStaticKeys (modules) {
return modules.reduce(function (keys, m) {
return keys.concat(m.staticKeys || [])
}, []).join(',')
} | [
"function",
"genStaticKeys",
"(",
"modules",
")",
"{",
"return",
"modules",
".",
"reduce",
"(",
"function",
"(",
"keys",
",",
"m",
")",
"{",
"return",
"keys",
".",
"concat",
"(",
"m",
".",
"staticKeys",
"||",
"[",
"]",
")",
"}",
",",
"[",
"]",
")",... | Generate a static keys string from compiler modules. | [
"Generate",
"a",
"static",
"keys",
"string",
"from",
"compiler",
"modules",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L187-L191 | train | Generate static keys for a list of modules | [
30522,
3853,
8991,
16677,
14839,
2015,
1006,
14184,
1007,
1063,
2709,
14184,
1012,
5547,
1006,
3853,
1006,
6309,
1010,
1049,
1007,
1063,
2709,
6309,
1012,
9530,
11266,
1006,
1049,
1012,
10763,
14839,
2015,
1064,
1064,
1031,
1033,
1007,
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... |
adobe/brackets | src/extensions/default/NavigationAndHistory/NavigationProvider.js | _handleExternalChange | function _handleExternalChange(evt, doc) {
if (doc) {
_removeBackwardFramesForFile(doc.file);
_removeForwardFramesForFile(doc.file);
_validateNavigationCmds();
}
} | javascript | function _handleExternalChange(evt, doc) {
if (doc) {
_removeBackwardFramesForFile(doc.file);
_removeForwardFramesForFile(doc.file);
_validateNavigationCmds();
}
} | [
"function",
"_handleExternalChange",
"(",
"evt",
",",
"doc",
")",
"{",
"if",
"(",
"doc",
")",
"{",
"_removeBackwardFramesForFile",
"(",
"doc",
".",
"file",
")",
";",
"_removeForwardFramesForFile",
"(",
"doc",
".",
"file",
")",
";",
"_validateNavigationCmds",
"... | Handles explicit content reset for a document caused by external changes
@private | [
"Handles",
"explicit",
"content",
"reset",
"for",
"a",
"document",
"caused",
"by",
"external",
"changes"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/NavigationProvider.js#L491-L497 | train | Handle external change | [
30522,
3853,
1035,
5047,
10288,
16451,
2389,
22305,
2063,
1006,
23408,
2102,
1010,
9986,
1007,
1063,
2065,
1006,
9986,
1007,
1063,
1035,
6366,
5963,
7652,
15643,
22747,
16347,
9463,
1006,
9986,
1012,
5371,
1007,
1025,
1035,
6366,
29278,
765... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExtractToVariable.js | handleExtractToVariable | function handleExtractToVariable() {
var editor = EditorManager.getActiveEditor();
if (editor.getSelections().length > 1) {
editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_VARIABLE_MULTICURSORS);
return;
}
initializeSession(editor);
var selection = editor.getSelection(),
doc = editor.document,
retObj = RefactoringUtils.normalizeText(editor.getSelectedText(), editor.indexFromPos(selection.start),
editor.indexFromPos(selection.end), true),
text = retObj.text,
start = retObj.start,
end = retObj.end,
ast,
scopes,
expns,
inlineMenu;
function callExtractToVariable(startPos, endPos, value) {
RefactoringUtils.getScopeData(session, editor.posFromIndex(startPos))
.done(function(expnscope) {
scopes = RefactoringUtils.getAllScopes(ast, expnscope, doc.getText());
extractToVariable(ast, startPos, endPos, value, scopes);
}).fail(function() {
editor.displayErrorMessageAtCursor(Strings.ERROR_TERN_FAILED);
});
}
RefactoringUtils.getScopeData(session, editor.posFromIndex(start)).done(function(scope) {
ast = RefactoringUtils.getAST(doc.getText());
scopes = RefactoringUtils.getAllScopes(ast, scope, doc.getText());
if (editor.hasSelection()) {
extractToVariable(ast, start, end, text, scopes);
} else {
expns = getExpressions(ast, start, end);
expns.forEach(function(expn, index) {
expn.value = doc.getText().substr(expn.start, expn.end - expn.start);
});
// Sort expressions by their length
expns.sort(function(a, b) {
return a.value.length - b.value.length;
});
if (!expns || !expns.length) {
session.editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_VARIABLE_NOT_VALID);
return;
}
// Filter expns based on length of first surrounding expression
var firstExpnLength = RefactoringUtils.numLines(expns[0].value);
expns = expns.filter(function(expn) {
return RefactoringUtils.numLines(expn.value) === firstExpnLength;
});
// Add name for the expression based on its value
expns.forEach(function(expn, index) {
// If expn name is multi-line, display only first line
if (RefactoringUtils.numLines(expn.value) > 1) {
expn.name = expn.value.substr(0, expn.value.indexOf("\n")) + "...";
} else {
expn.name = expn.value;
}
});
// If only one surround expression, extract
if (expns.length === 1) {
callExtractToVariable(expns[0].start, expns[0].end, expns[0].value);
return;
}
expns.forEach(function(expn, index) {
expn.id = index;
});
// UI for extract to variable
inlineMenu = new InlineMenu(session.editor, Strings.EXTRACTTO_VARIABLE_SELECT_EXPRESSION);
inlineMenu.onHover(function (expnId) {
// Remove the scroll Handlers If already Attached.
editor.off("scroll.inlinemenu");
// Add a scroll handler If Selection Range is not View.
// This is Added for a Bug, where Menu used not to open for the first Time
if(!editor.isLineVisible(editor.posFromIndex(expns[expnId].end).line)) {
editor.on("scroll.inlinemenu", function() {
// Remove the Handlers so that If scroll event is triggerd again by any other operation
// Menu should not be reopened.
// Menu Should be reopened only if Scroll event is triggered by onHover.
editor.off("scroll.inlinemenu");
inlineMenu.openRemovedMenu();
});
}
editor.setSelection(editor.posFromIndex(expns[expnId].start), editor.posFromIndex(expns[expnId].end));
});
inlineMenu.open(expns);
inlineMenu.onSelect(function (expnId) {
callExtractToVariable(expns[expnId].start, expns[expnId].end, expns[expnId].value);
inlineMenu.close();
});
inlineMenu.onClose(function () {
inlineMenu.close();
});
}
}).fail(function() {
editor.displayErrorMessageAtCursor(Strings.ERROR_TERN_FAILED);
});
} | javascript | function handleExtractToVariable() {
var editor = EditorManager.getActiveEditor();
if (editor.getSelections().length > 1) {
editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_VARIABLE_MULTICURSORS);
return;
}
initializeSession(editor);
var selection = editor.getSelection(),
doc = editor.document,
retObj = RefactoringUtils.normalizeText(editor.getSelectedText(), editor.indexFromPos(selection.start),
editor.indexFromPos(selection.end), true),
text = retObj.text,
start = retObj.start,
end = retObj.end,
ast,
scopes,
expns,
inlineMenu;
function callExtractToVariable(startPos, endPos, value) {
RefactoringUtils.getScopeData(session, editor.posFromIndex(startPos))
.done(function(expnscope) {
scopes = RefactoringUtils.getAllScopes(ast, expnscope, doc.getText());
extractToVariable(ast, startPos, endPos, value, scopes);
}).fail(function() {
editor.displayErrorMessageAtCursor(Strings.ERROR_TERN_FAILED);
});
}
RefactoringUtils.getScopeData(session, editor.posFromIndex(start)).done(function(scope) {
ast = RefactoringUtils.getAST(doc.getText());
scopes = RefactoringUtils.getAllScopes(ast, scope, doc.getText());
if (editor.hasSelection()) {
extractToVariable(ast, start, end, text, scopes);
} else {
expns = getExpressions(ast, start, end);
expns.forEach(function(expn, index) {
expn.value = doc.getText().substr(expn.start, expn.end - expn.start);
});
// Sort expressions by their length
expns.sort(function(a, b) {
return a.value.length - b.value.length;
});
if (!expns || !expns.length) {
session.editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_VARIABLE_NOT_VALID);
return;
}
// Filter expns based on length of first surrounding expression
var firstExpnLength = RefactoringUtils.numLines(expns[0].value);
expns = expns.filter(function(expn) {
return RefactoringUtils.numLines(expn.value) === firstExpnLength;
});
// Add name for the expression based on its value
expns.forEach(function(expn, index) {
// If expn name is multi-line, display only first line
if (RefactoringUtils.numLines(expn.value) > 1) {
expn.name = expn.value.substr(0, expn.value.indexOf("\n")) + "...";
} else {
expn.name = expn.value;
}
});
// If only one surround expression, extract
if (expns.length === 1) {
callExtractToVariable(expns[0].start, expns[0].end, expns[0].value);
return;
}
expns.forEach(function(expn, index) {
expn.id = index;
});
// UI for extract to variable
inlineMenu = new InlineMenu(session.editor, Strings.EXTRACTTO_VARIABLE_SELECT_EXPRESSION);
inlineMenu.onHover(function (expnId) {
// Remove the scroll Handlers If already Attached.
editor.off("scroll.inlinemenu");
// Add a scroll handler If Selection Range is not View.
// This is Added for a Bug, where Menu used not to open for the first Time
if(!editor.isLineVisible(editor.posFromIndex(expns[expnId].end).line)) {
editor.on("scroll.inlinemenu", function() {
// Remove the Handlers so that If scroll event is triggerd again by any other operation
// Menu should not be reopened.
// Menu Should be reopened only if Scroll event is triggered by onHover.
editor.off("scroll.inlinemenu");
inlineMenu.openRemovedMenu();
});
}
editor.setSelection(editor.posFromIndex(expns[expnId].start), editor.posFromIndex(expns[expnId].end));
});
inlineMenu.open(expns);
inlineMenu.onSelect(function (expnId) {
callExtractToVariable(expns[expnId].start, expns[expnId].end, expns[expnId].value);
inlineMenu.close();
});
inlineMenu.onClose(function () {
inlineMenu.close();
});
}
}).fail(function() {
editor.displayErrorMessageAtCursor(Strings.ERROR_TERN_FAILED);
});
} | [
"function",
"handleExtractToVariable",
"(",
")",
"{",
"var",
"editor",
"=",
"EditorManager",
".",
"getActiveEditor",
"(",
")",
";",
"if",
"(",
"editor",
".",
"getSelections",
"(",
")",
".",
"length",
">",
"1",
")",
"{",
"editor",
".",
"displayErrorMessageAtC... | Main function that handles extract to variable | [
"Main",
"function",
"that",
"handles",
"extract",
"to",
"variable"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/ExtractToVariable.js#L221-L336 | train | Handle extractToVariable - Extracts to variable | [
30522,
3853,
5047,
10288,
6494,
6593,
26525,
10980,
3468,
1006,
1007,
1063,
13075,
3559,
1027,
3559,
24805,
4590,
1012,
2131,
19620,
2098,
15660,
1006,
1007,
1025,
2065,
1006,
3559,
1012,
4152,
12260,
22014,
1006,
1007,
1012,
3091,
1028,
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... |
uber/deck.gl | modules/google-maps/src/utils.js | handleMouseEvent | function handleMouseEvent(deck, type, event) {
let callback;
switch (type) {
case 'click':
// Hack: because we do not listen to pointer down, perform picking now
deck._lastPointerDownInfo = deck.pickObject({
x: event.pixel.x,
y: event.pixel.y
});
callback = deck._onEvent;
break;
case 'mousemove':
callback = deck._onPointerMove;
break;
case 'mouseout':
callback = deck._onPointerLeave;
break;
default:
return;
}
callback({
type,
offsetCenter: event.pixel,
srcEvent: event
});
} | javascript | function handleMouseEvent(deck, type, event) {
let callback;
switch (type) {
case 'click':
// Hack: because we do not listen to pointer down, perform picking now
deck._lastPointerDownInfo = deck.pickObject({
x: event.pixel.x,
y: event.pixel.y
});
callback = deck._onEvent;
break;
case 'mousemove':
callback = deck._onPointerMove;
break;
case 'mouseout':
callback = deck._onPointerLeave;
break;
default:
return;
}
callback({
type,
offsetCenter: event.pixel,
srcEvent: event
});
} | [
"function",
"handleMouseEvent",
"(",
"deck",
",",
"type",
",",
"event",
")",
"{",
"let",
"callback",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"'click'",
":",
"// Hack: because we do not listen to pointer down, perform picking now",
"deck",
".",
"_lastPointerDownI... | Triggers picking on a mouse event | [
"Triggers",
"picking",
"on",
"a",
"mouse",
"event"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/google-maps/src/utils.js#L130-L159 | train | Handle mouse events | [
30522,
3853,
5047,
27711,
4402,
15338,
1006,
5877,
1010,
2828,
1010,
2724,
1007,
1063,
2292,
2655,
5963,
1025,
6942,
1006,
2828,
1007,
1063,
2553,
1005,
11562,
1005,
1024,
1013,
1013,
20578,
1024,
2138,
2057,
2079,
2025,
4952,
2000,
20884,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getsentry/sentry-javascript | packages/raven-js/plugins/react-native.js | reactNativePlugin | function reactNativePlugin(Raven, options) {
options = options || {};
// react-native doesn't have a document, so can't use default Image
// transport - use XMLHttpRequest instead
Raven.setTransport(reactNativePlugin._transport);
// Use data callback to strip device-specific paths from stack traces
Raven.setDataCallback(
wrappedCallback(function(data) {
return reactNativePlugin._normalizeData(data, options.pathStrip);
})
);
// Check for a previously persisted payload, and report it.
reactNativePlugin
._restorePayload()
.then(function(payload) {
options.onInitialize && options.onInitialize(payload);
if (!payload) return;
Raven._sendProcessedPayload(payload, function(error) {
if (error) return; // Try again next launch.
reactNativePlugin._clearPayload();
});
})
['catch'](function() {});
// Make sure that if multiple fatals occur, we only persist the first one.
//
// The first error is probably the most important/interesting error, and we
// want to crash ASAP, rather than potentially queueing up multiple errors.
var handlingFatal = false;
var defaultHandler =
(ErrorUtils.getGlobalHandler && ErrorUtils.getGlobalHandler()) ||
ErrorUtils._globalHandler;
Raven.setShouldSendCallback(function(data, originalCallback) {
if (!(FATAL_ERROR_KEY in data)) {
// not a fatal (will not crash runtime), continue as planned
return originalCallback ? originalCallback.call(this, data) : true;
}
var origError = data[FATAL_ERROR_KEY];
delete data[FATAL_ERROR_KEY];
reactNativePlugin
._persistPayload(data)
.then(function() {
defaultHandler(origError, true);
handlingFatal = false; // In case it isn't configured to crash.
return null;
})
['catch'](function() {});
return false; // Do not continue.
});
ErrorUtils.setGlobalHandler(function(error, isFatal) {
var captureOptions = {
timestamp: new Date() / 1000
};
var error = arguments[0];
// We want to handle fatals, but only in production mode.
var shouldHandleFatal = isFatal && !global.__DEV__;
if (shouldHandleFatal) {
if (handlingFatal) {
console.log('Encountered multiple fatals in a row. The latest:', error);
return;
}
handlingFatal = true;
// We need to preserve the original error so that it can be rethrown
// after it is persisted (see our shouldSendCallback above).
captureOptions[FATAL_ERROR_KEY] = error;
}
Raven.captureException(error, captureOptions);
// Handle non-fatals regularly.
if (!shouldHandleFatal) {
defaultHandler(error);
}
});
} | javascript | function reactNativePlugin(Raven, options) {
options = options || {};
// react-native doesn't have a document, so can't use default Image
// transport - use XMLHttpRequest instead
Raven.setTransport(reactNativePlugin._transport);
// Use data callback to strip device-specific paths from stack traces
Raven.setDataCallback(
wrappedCallback(function(data) {
return reactNativePlugin._normalizeData(data, options.pathStrip);
})
);
// Check for a previously persisted payload, and report it.
reactNativePlugin
._restorePayload()
.then(function(payload) {
options.onInitialize && options.onInitialize(payload);
if (!payload) return;
Raven._sendProcessedPayload(payload, function(error) {
if (error) return; // Try again next launch.
reactNativePlugin._clearPayload();
});
})
['catch'](function() {});
// Make sure that if multiple fatals occur, we only persist the first one.
//
// The first error is probably the most important/interesting error, and we
// want to crash ASAP, rather than potentially queueing up multiple errors.
var handlingFatal = false;
var defaultHandler =
(ErrorUtils.getGlobalHandler && ErrorUtils.getGlobalHandler()) ||
ErrorUtils._globalHandler;
Raven.setShouldSendCallback(function(data, originalCallback) {
if (!(FATAL_ERROR_KEY in data)) {
// not a fatal (will not crash runtime), continue as planned
return originalCallback ? originalCallback.call(this, data) : true;
}
var origError = data[FATAL_ERROR_KEY];
delete data[FATAL_ERROR_KEY];
reactNativePlugin
._persistPayload(data)
.then(function() {
defaultHandler(origError, true);
handlingFatal = false; // In case it isn't configured to crash.
return null;
})
['catch'](function() {});
return false; // Do not continue.
});
ErrorUtils.setGlobalHandler(function(error, isFatal) {
var captureOptions = {
timestamp: new Date() / 1000
};
var error = arguments[0];
// We want to handle fatals, but only in production mode.
var shouldHandleFatal = isFatal && !global.__DEV__;
if (shouldHandleFatal) {
if (handlingFatal) {
console.log('Encountered multiple fatals in a row. The latest:', error);
return;
}
handlingFatal = true;
// We need to preserve the original error so that it can be rethrown
// after it is persisted (see our shouldSendCallback above).
captureOptions[FATAL_ERROR_KEY] = error;
}
Raven.captureException(error, captureOptions);
// Handle non-fatals regularly.
if (!shouldHandleFatal) {
defaultHandler(error);
}
});
} | [
"function",
"reactNativePlugin",
"(",
"Raven",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"// react-native doesn't have a document, so can't use default Image",
"// transport - use XMLHttpRequest instead",
"Raven",
".",
"setTransport",
"(",
"r... | Initializes React Native plugin | [
"Initializes",
"React",
"Native",
"plugin"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/plugins/react-native.js#L57-L138 | train | This is the main function that is called by the react - native plugin. It is called by the react - native plugin to send the data to the server. | [
30522,
3853,
10509,
19833,
3512,
24759,
15916,
2378,
1006,
10000,
1010,
7047,
1007,
1063,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
1025,
1013,
1013,
10509,
1011,
3128,
2987,
1005,
1056,
2031,
1037,
6254,
1010,
2061,
2064,
1005,
1056,
2224,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
avajs/ava | lib/assert.js | assertExpectations | function assertExpectations({assertion, actual, expectations, message, prefix, stack}) {
if (!isError(actual)) {
throw new AssertionError({
assertion,
message,
stack,
values: [formatWithLabel(`${prefix} exception that is not an error:`, actual)]
});
}
const actualStack = actual.stack;
if (hasOwnProperty(expectations, 'is') && actual !== expectations.is) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected to be strictly equal to:', expectations.is)
]
});
}
if (expectations.instanceOf && !(actual instanceof expectations.instanceOf)) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected instance of:', expectations.instanceOf)
]
});
}
if (typeof expectations.name === 'string' && actual.name !== expectations.name) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected name to equal:', expectations.name)
]
});
}
if (typeof expectations.message === 'string' && actual.message !== expectations.message) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected message to equal:', expectations.message)
]
});
}
if (expectations.message instanceof RegExp && !expectations.message.test(actual.message)) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected message to match:', expectations.message)
]
});
}
if (typeof expectations.code !== 'undefined' && actual.code !== expectations.code) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected code to equal:', expectations.code)
]
});
}
} | javascript | function assertExpectations({assertion, actual, expectations, message, prefix, stack}) {
if (!isError(actual)) {
throw new AssertionError({
assertion,
message,
stack,
values: [formatWithLabel(`${prefix} exception that is not an error:`, actual)]
});
}
const actualStack = actual.stack;
if (hasOwnProperty(expectations, 'is') && actual !== expectations.is) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected to be strictly equal to:', expectations.is)
]
});
}
if (expectations.instanceOf && !(actual instanceof expectations.instanceOf)) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected instance of:', expectations.instanceOf)
]
});
}
if (typeof expectations.name === 'string' && actual.name !== expectations.name) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected name to equal:', expectations.name)
]
});
}
if (typeof expectations.message === 'string' && actual.message !== expectations.message) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected message to equal:', expectations.message)
]
});
}
if (expectations.message instanceof RegExp && !expectations.message.test(actual.message)) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected message to match:', expectations.message)
]
});
}
if (typeof expectations.code !== 'undefined' && actual.code !== expectations.code) {
throw new AssertionError({
assertion,
message,
stack,
actualStack,
values: [
formatWithLabel(`${prefix} unexpected exception:`, actual),
formatWithLabel('Expected code to equal:', expectations.code)
]
});
}
} | [
"function",
"assertExpectations",
"(",
"{",
"assertion",
",",
"actual",
",",
"expectations",
",",
"message",
",",
"prefix",
",",
"stack",
"}",
")",
"{",
"if",
"(",
"!",
"isError",
"(",
"actual",
")",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"{",
... | Note: this function *must* throw exceptions, since it can be used as part of a pending assertion for promises. | [
"Note",
":",
"this",
"function",
"*",
"must",
"*",
"throw",
"exceptions",
"since",
"it",
"can",
"be",
"used",
"as",
"part",
"of",
"a",
"pending",
"assertion",
"for",
"promises",
"."
] | 08e99e516e13af75d3ebe70f12194a89b610217c | https://github.com/avajs/ava/blob/08e99e516e13af75d3ebe70f12194a89b610217c/lib/assert.js#L146-L235 | train | Assert that an exception is not an error and that it is not equal to another exception. | [
30522,
3853,
20865,
10288,
5051,
25572,
9285,
1006,
1063,
23617,
1010,
5025,
1010,
10908,
1010,
4471,
1010,
17576,
1010,
9991,
1065,
1007,
1063,
2065,
1006,
999,
2003,
2121,
29165,
1006,
5025,
1007,
1007,
1063,
5466,
2047,
23617,
2121,
2916... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
typeorm/typeorm | extra/typeorm-class-transformer-shim.js | Column | function Column(typeOrOptions, options) {
return function (object, propertyName) {
if (typeOrOptions instanceof Function)
class_transformer_1.Type(typeOrOptions)(object, propertyName);
};
} | javascript | function Column(typeOrOptions, options) {
return function (object, propertyName) {
if (typeOrOptions instanceof Function)
class_transformer_1.Type(typeOrOptions)(object, propertyName);
};
} | [
"function",
"Column",
"(",
"typeOrOptions",
",",
"options",
")",
"{",
"return",
"function",
"(",
"object",
",",
"propertyName",
")",
"{",
"if",
"(",
"typeOrOptions",
"instanceof",
"Function",
")",
"class_transformer_1",
".",
"Type",
"(",
"typeOrOptions",
")",
... | columns /* export | [
"columns",
"/",
"*",
"export"
] | 360468b7913db8d988346fba1ee2d3f323498eef | https://github.com/typeorm/typeorm/blob/360468b7913db8d988346fba1ee2d3f323498eef/extra/typeorm-class-transformer-shim.js#L29-L34 | train | Creates a column transformer function. | [
30522,
3853,
5930,
1006,
2828,
14604,
16790,
2015,
1010,
7047,
1007,
1063,
2709,
3853,
1006,
4874,
1010,
3200,
18442,
1007,
1063,
2065,
1006,
2828,
14604,
16790,
2015,
6013,
11253,
3853,
1007,
2465,
1035,
10938,
2121,
1035,
1015,
1012,
2828... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(mAnnotationReferences) {
var bFound = false;
var oNode, i;
var xPath = AnnotationParser._oXPath;
var sAliasSelector = "//edmx:Reference/edmx:Include[@Namespace and @Alias]";
var oAliasNodes = xPath.selectNodes(sAliasSelector, AnnotationParser._parserData.xmlDocument);
for (i = 0; i < oAliasNodes.length; ++i) {
bFound = true;
oNode = xPath.nextNode(oAliasNodes, i);
AnnotationParser._parserData.aliases[oNode.getAttribute("Alias")] = oNode.getAttribute("Namespace");
}
var sReferenceSelector = "//edmx:Reference[@Uri]/edmx:IncludeAnnotations[@TermNamespace]";
var oReferenceNodes = xPath.selectNodes(sReferenceSelector, AnnotationParser._parserData.xmlDocument);
for (i = 0; i < oReferenceNodes.length; ++i) {
bFound = true;
oNode = xPath.nextNode(oReferenceNodes, i);
var sTermNamespace = oNode.getAttribute("TermNamespace");
var sTargetNamespace = oNode.getAttribute("TargetNamespace");
var sReferenceUri = oNode.parentNode.getAttribute("Uri");
if (sTargetNamespace) {
if (!mAnnotationReferences[sTargetNamespace]) {
mAnnotationReferences[sTargetNamespace] = {};
}
mAnnotationReferences[sTargetNamespace][sTermNamespace] = sReferenceUri;
} else {
mAnnotationReferences[sTermNamespace] = sReferenceUri;
}
}
return bFound;
} | javascript | function(mAnnotationReferences) {
var bFound = false;
var oNode, i;
var xPath = AnnotationParser._oXPath;
var sAliasSelector = "//edmx:Reference/edmx:Include[@Namespace and @Alias]";
var oAliasNodes = xPath.selectNodes(sAliasSelector, AnnotationParser._parserData.xmlDocument);
for (i = 0; i < oAliasNodes.length; ++i) {
bFound = true;
oNode = xPath.nextNode(oAliasNodes, i);
AnnotationParser._parserData.aliases[oNode.getAttribute("Alias")] = oNode.getAttribute("Namespace");
}
var sReferenceSelector = "//edmx:Reference[@Uri]/edmx:IncludeAnnotations[@TermNamespace]";
var oReferenceNodes = xPath.selectNodes(sReferenceSelector, AnnotationParser._parserData.xmlDocument);
for (i = 0; i < oReferenceNodes.length; ++i) {
bFound = true;
oNode = xPath.nextNode(oReferenceNodes, i);
var sTermNamespace = oNode.getAttribute("TermNamespace");
var sTargetNamespace = oNode.getAttribute("TargetNamespace");
var sReferenceUri = oNode.parentNode.getAttribute("Uri");
if (sTargetNamespace) {
if (!mAnnotationReferences[sTargetNamespace]) {
mAnnotationReferences[sTargetNamespace] = {};
}
mAnnotationReferences[sTargetNamespace][sTermNamespace] = sReferenceUri;
} else {
mAnnotationReferences[sTermNamespace] = sReferenceUri;
}
}
return bFound;
} | [
"function",
"(",
"mAnnotationReferences",
")",
"{",
"var",
"bFound",
"=",
"false",
";",
"var",
"oNode",
",",
"i",
";",
"var",
"xPath",
"=",
"AnnotationParser",
".",
"_oXPath",
";",
"var",
"sAliasSelector",
"=",
"\"//edmx:Reference/edmx:Include[@Namespace and @Alias]... | /*
Parses the alias definitions of the annotation document and fills the internal oAlias object.
@param {map} mAnnotationReferences - The annotation reference object (output)
@return {boolean} Whether references where found in the XML document
@static
@private | [
"/",
"*",
"Parses",
"the",
"alias",
"definitions",
"of",
"the",
"annotation",
"document",
"and",
"fills",
"the",
"internal",
"oAlias",
"object",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js#L587-L622 | train | Returns true if the reference is found in the annotation references | [
30522,
3853,
1006,
10856,
17287,
3508,
2890,
25523,
2015,
1007,
1063,
13075,
28939,
28819,
1027,
6270,
1025,
13075,
21058,
3207,
1010,
1045,
1025,
13075,
26726,
8988,
1027,
5754,
17287,
3508,
19362,
8043,
1012,
1035,
23060,
15069,
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... | |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js | function(oControl){
var bAdapted = false;
if (oControl.getParent() && oControl.getParent().getComputedPosition) {
var oPos = oControl.getParent().getComputedPosition();
if (oPos.top && oPos.bottom || oPos.height) {
jQuery(oControl.getDomRef()).css("height", "100%");
bAdapted = true;
}
if (oPos.left && oPos.right || oPos.width) {
jQuery(oControl.getDomRef()).css("width", "100%");
bAdapted = true;
}
if (bAdapted) {
AbsoluteLayoutRenderer.updatePositionStyles(oControl.getParent());
}
}
return bAdapted;
} | javascript | function(oControl){
var bAdapted = false;
if (oControl.getParent() && oControl.getParent().getComputedPosition) {
var oPos = oControl.getParent().getComputedPosition();
if (oPos.top && oPos.bottom || oPos.height) {
jQuery(oControl.getDomRef()).css("height", "100%");
bAdapted = true;
}
if (oPos.left && oPos.right || oPos.width) {
jQuery(oControl.getDomRef()).css("width", "100%");
bAdapted = true;
}
if (bAdapted) {
AbsoluteLayoutRenderer.updatePositionStyles(oControl.getParent());
}
}
return bAdapted;
} | [
"function",
"(",
"oControl",
")",
"{",
"var",
"bAdapted",
"=",
"false",
";",
"if",
"(",
"oControl",
".",
"getParent",
"(",
")",
"&&",
"oControl",
".",
"getParent",
"(",
")",
".",
"getComputedPosition",
")",
"{",
"var",
"oPos",
"=",
"oControl",
".",
"ge... | Adapt the sizes of controls if necessary.
@private | [
"Adapt",
"the",
"sizes",
"of",
"controls",
"if",
"necessary",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js#L564-L581 | train | Adaptes the position of the control based on the computed position | [
30522,
3853,
1006,
1051,
8663,
13181,
2140,
1007,
1063,
13075,
2919,
9331,
3064,
1027,
6270,
1025,
2065,
1006,
1051,
8663,
13181,
2140,
1012,
2131,
19362,
4765,
1006,
1007,
1004,
1004,
1051,
8663,
13181,
2140,
1012,
2131,
19362,
4765,
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... | |
nhn/tui.editor | src/js/extensions/chart/chart.js | detectDelimiter | function detectDelimiter(code) {
code = trimKeepingTabs(code);
// chunk first max 10 lines to detect
const chunk = code.split(REGEX_LINE_ENDING).slice(0, 10).join('\n');
// calc delta for each delimiters
// then pick a delimiter having the minimum value delta
return DSV_DELIMITERS.map(delimiter => ({
delimiter,
delta: calcDSVDelta(chunk, delimiter)
})).sort((a, b) => (
a.delta - b.delta
))[0].delimiter;
} | javascript | function detectDelimiter(code) {
code = trimKeepingTabs(code);
// chunk first max 10 lines to detect
const chunk = code.split(REGEX_LINE_ENDING).slice(0, 10).join('\n');
// calc delta for each delimiters
// then pick a delimiter having the minimum value delta
return DSV_DELIMITERS.map(delimiter => ({
delimiter,
delta: calcDSVDelta(chunk, delimiter)
})).sort((a, b) => (
a.delta - b.delta
))[0].delimiter;
} | [
"function",
"detectDelimiter",
"(",
"code",
")",
"{",
"code",
"=",
"trimKeepingTabs",
"(",
"code",
")",
";",
"// chunk first max 10 lines to detect",
"const",
"chunk",
"=",
"code",
".",
"split",
"(",
"REGEX_LINE_ENDING",
")",
".",
"slice",
"(",
"0",
",",
"10",... | detect delimiter the comma, tab, regex
@param {string} code - code to detect delimiter
@returns {string|RegExp} - detected delimiter
@ignore | [
"detect",
"delimiter",
"the",
"comma",
"tab",
"regex"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L118-L132 | train | detect a delimiter from a code | [
30522,
3853,
11487,
9247,
27605,
3334,
1006,
3642,
1007,
1063,
3642,
1027,
12241,
18321,
2696,
5910,
1006,
3642,
1007,
1025,
1013,
1013,
20000,
2034,
4098,
2184,
3210,
2000,
11487,
9530,
3367,
20000,
1027,
3642,
1012,
3975,
1006,
19723,
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... |
adobe/brackets | src/command/CommandManager.js | execute | function execute(id) {
var command = _commands[id];
if (command) {
try {
exports.trigger("beforeExecuteCommand", id);
} catch (err) {
console.error(err);
}
return command.execute.apply(command, Array.prototype.slice.call(arguments, 1));
} else {
return (new $.Deferred()).reject().promise();
}
} | javascript | function execute(id) {
var command = _commands[id];
if (command) {
try {
exports.trigger("beforeExecuteCommand", id);
} catch (err) {
console.error(err);
}
return command.execute.apply(command, Array.prototype.slice.call(arguments, 1));
} else {
return (new $.Deferred()).reject().promise();
}
} | [
"function",
"execute",
"(",
"id",
")",
"{",
"var",
"command",
"=",
"_commands",
"[",
"id",
"]",
";",
"if",
"(",
"command",
")",
"{",
"try",
"{",
"exports",
".",
"trigger",
"(",
"\"beforeExecuteCommand\"",
",",
"id",
")",
";",
"}",
"catch",
"(",
"err"... | Looks up and runs a global command. Additional arguments are passed to the command.
@param {string} id The ID of the command to run.
@return {$.Promise} a jQuery promise that will be resolved when the command completes. | [
"Looks",
"up",
"and",
"runs",
"a",
"global",
"command",
".",
"Additional",
"arguments",
"are",
"passed",
"to",
"the",
"command",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/CommandManager.js#L277-L291 | train | Execute a command | [
30522,
3853,
15389,
1006,
8909,
1007,
1063,
13075,
3094,
1027,
1035,
10954,
1031,
8909,
1033,
1025,
2065,
1006,
3094,
1007,
1063,
3046,
1063,
14338,
1012,
9495,
1006,
1000,
2077,
10288,
8586,
10421,
9006,
2386,
2094,
1000,
1010,
8909,
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... |
SheetJS/js-xlsx | xlsx.js | parse_DataSpaceMap | function parse_DataSpaceMap(blob) {
var o = [];
blob.l += 4; // must be 0x8
var cnt = blob.read_shift(4);
while(cnt-- > 0) o.push(parse_DataSpaceMapEntry(blob));
return o;
} | javascript | function parse_DataSpaceMap(blob) {
var o = [];
blob.l += 4; // must be 0x8
var cnt = blob.read_shift(4);
while(cnt-- > 0) o.push(parse_DataSpaceMapEntry(blob));
return o;
} | [
"function",
"parse_DataSpaceMap",
"(",
"blob",
")",
"{",
"var",
"o",
"=",
"[",
"]",
";",
"blob",
".",
"l",
"+=",
"4",
";",
"// must be 0x8",
"var",
"cnt",
"=",
"blob",
".",
"read_shift",
"(",
"4",
")",
";",
"while",
"(",
"cnt",
"--",
">",
"0",
")... | /* [MS-OFFCRYPTO] 2.1.6 DataSpaceMap | [
"/",
"*",
"[",
"MS",
"-",
"OFFCRYPTO",
"]",
"2",
".",
"1",
".",
"6",
"DataSpaceMap"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8156-L8162 | train | Parse a Data Space Map | [
30522,
3853,
11968,
3366,
1035,
2951,
23058,
2863,
2361,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
1051,
1027,
1031,
1033,
1025,
1038,
4135,
2497,
1012,
1048,
1009,
1027,
1018,
1025,
1013,
1013,
2442,
2022,
1014,
2595,
2620,
13075,
27166,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/consistent-docs-description.js | checkMetaDocsDescription | function checkMetaDocsDescription(context, exportsNode) {
if (exportsNode.type !== "ObjectExpression") {
// if the exported node is not the correct format, "internal-no-invalid-meta" will already report this.
return;
}
const metaProperty = getPropertyFromObject("meta", exportsNode);
const metaDocs = metaProperty && getPropertyFromObject("docs", metaProperty.value);
const metaDocsDescription = metaDocs && getPropertyFromObject("description", metaDocs.value);
if (!metaDocsDescription) {
// if there is no `meta.docs.description` property, "internal-no-invalid-meta" will already report this.
return;
}
const description = metaDocsDescription.value.value;
if (typeof description !== "string") {
context.report({
node: metaDocsDescription.value,
message: "`meta.docs.description` should be a string."
});
return;
}
if (description === "") {
context.report({
node: metaDocsDescription.value,
message: "`meta.docs.description` should not be empty."
});
return;
}
if (description.indexOf(" ") === 0) {
context.report({
node: metaDocsDescription.value,
message: "`meta.docs.description` should not start with whitespace."
});
return;
}
const firstWord = description.split(" ")[0];
if (ALLOWED_FIRST_WORDS.indexOf(firstWord) === -1) {
context.report({
node: metaDocsDescription.value,
message: "`meta.docs.description` should start with one of the following words: {{ allowedWords }}. Started with \"{{ firstWord }}\" instead.",
data: {
allowedWords: ALLOWED_FIRST_WORDS.join(", "),
firstWord
}
});
}
} | javascript | function checkMetaDocsDescription(context, exportsNode) {
if (exportsNode.type !== "ObjectExpression") {
// if the exported node is not the correct format, "internal-no-invalid-meta" will already report this.
return;
}
const metaProperty = getPropertyFromObject("meta", exportsNode);
const metaDocs = metaProperty && getPropertyFromObject("docs", metaProperty.value);
const metaDocsDescription = metaDocs && getPropertyFromObject("description", metaDocs.value);
if (!metaDocsDescription) {
// if there is no `meta.docs.description` property, "internal-no-invalid-meta" will already report this.
return;
}
const description = metaDocsDescription.value.value;
if (typeof description !== "string") {
context.report({
node: metaDocsDescription.value,
message: "`meta.docs.description` should be a string."
});
return;
}
if (description === "") {
context.report({
node: metaDocsDescription.value,
message: "`meta.docs.description` should not be empty."
});
return;
}
if (description.indexOf(" ") === 0) {
context.report({
node: metaDocsDescription.value,
message: "`meta.docs.description` should not start with whitespace."
});
return;
}
const firstWord = description.split(" ")[0];
if (ALLOWED_FIRST_WORDS.indexOf(firstWord) === -1) {
context.report({
node: metaDocsDescription.value,
message: "`meta.docs.description` should start with one of the following words: {{ allowedWords }}. Started with \"{{ firstWord }}\" instead.",
data: {
allowedWords: ALLOWED_FIRST_WORDS.join(", "),
firstWord
}
});
}
} | [
"function",
"checkMetaDocsDescription",
"(",
"context",
",",
"exportsNode",
")",
"{",
"if",
"(",
"exportsNode",
".",
"type",
"!==",
"\"ObjectExpression\"",
")",
"{",
"// if the exported node is not the correct format, \"internal-no-invalid-meta\" will already report this.",
"retu... | Verifies that the meta.docs.description property follows our internal conventions.
@param {RuleContext} context The ESLint rule context.
@param {ASTNode} exportsNode ObjectExpression node that the rule exports.
@returns {void} | [
"Verifies",
"that",
"the",
"meta",
".",
"docs",
".",
"description",
"property",
"follows",
"our",
"internal",
"conventions",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/tools/internal-rules/consistent-docs-description.js#L50-L105 | train | Check the meta. docs. description property of the exported node | [
30522,
3853,
4638,
11368,
9365,
6169,
6155,
23235,
3258,
1006,
6123,
1010,
14338,
3630,
3207,
1007,
1063,
2065,
1006,
14338,
3630,
3207,
1012,
2828,
999,
1027,
1027,
1000,
4874,
10288,
20110,
3258,
1000,
1007,
1063,
1013,
1013,
2065,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/utils/styleParser.js | styleStringify | function styleStringify (obj) {
var key;
var keyCount = 0;
var i = 0;
var str = '';
for (key in obj) { keyCount++; }
for (key in obj) {
str += (key + ': ' + obj[key]);
if (i < keyCount - 1) { str += '; '; }
i++;
}
return str;
} | javascript | function styleStringify (obj) {
var key;
var keyCount = 0;
var i = 0;
var str = '';
for (key in obj) { keyCount++; }
for (key in obj) {
str += (key + ': ' + obj[key]);
if (i < keyCount - 1) { str += '; '; }
i++;
}
return str;
} | [
"function",
"styleStringify",
"(",
"obj",
")",
"{",
"var",
"key",
";",
"var",
"keyCount",
"=",
"0",
";",
"var",
"i",
"=",
"0",
";",
"var",
"str",
"=",
"''",
";",
"for",
"(",
"key",
"in",
"obj",
")",
"{",
"keyCount",
"++",
";",
"}",
"for",
"(",
... | Convert an object into an attribute string | [
"Convert",
"an",
"object",
"into",
"an",
"attribute",
"string"
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/utils/styleParser.js#L135-L149 | train | styleStringify - returns a string | [
30522,
3853,
6782,
18886,
3070,
8757,
1006,
27885,
3501,
1007,
1063,
13075,
3145,
1025,
13075,
3145,
3597,
16671,
1027,
1014,
1025,
13075,
1045,
1027,
1014,
1025,
13075,
2358,
2099,
1027,
1005,
1005,
1025,
2005,
1006,
3145,
1999,
27885,
350... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/core/utils/preload-cssom.js | parseNonCrossOriginStylesheet | function parseNonCrossOriginStylesheet(sheet, options, priority) {
const q = axe.utils.queue();
/**
* `sheet.cssRules` throws an error on `cross-origin` stylesheets
*/
const cssRules = sheet.cssRules;
const rules = Array.from(cssRules);
if (!rules) {
return q;
}
/**
* reference -> https://developer.mozilla.org/en-US/docs/Web/API/CSSRule#Type_constants
*/
const cssImportRules = rules.filter(r => r.type === 3); // type === 3 -> CSSRule.IMPORT_RULE
/**
* when no `@import` rules in given sheet
* -> resolve the current `sheet` & exit
*/
if (!cssImportRules.length) {
q.defer(resolve =>
resolve({
isExternal: false,
priority,
root: options.rootNode,
shadowId: options.shadowId,
sheet
})
);
// exit
return q;
}
/**
* iterate `@import` rules and fetch styles
*/
cssImportRules.forEach((importRule, cssRuleIndex) =>
q.defer((resolve, reject) => {
const importUrl = importRule.href;
const newPriority = [...priority, cssRuleIndex];
const axiosOptions = {
method: 'get',
url: importUrl,
timeout: options.timeout
};
axe.imports
.axios(axiosOptions)
.then(({ data }) =>
resolve(
options.convertDataToStylesheet({
data,
isExternal: true,
priority: newPriority,
root: options.rootNode,
shadowId: options.shadowId
})
)
)
.catch(reject);
})
);
const nonImportCSSRules = rules.filter(r => r.type !== 3);
// no further rules to process in this sheet
if (!nonImportCSSRules.length) {
return q;
}
// convert all `nonImportCSSRules` style rules into `text` and defer into queue
q.defer(resolve =>
resolve(
options.convertDataToStylesheet({
data: nonImportCSSRules.map(rule => rule.cssText).join(),
isExternal: false,
priority,
root: options.rootNode,
shadowId: options.shadowId
})
)
);
return q;
} | javascript | function parseNonCrossOriginStylesheet(sheet, options, priority) {
const q = axe.utils.queue();
/**
* `sheet.cssRules` throws an error on `cross-origin` stylesheets
*/
const cssRules = sheet.cssRules;
const rules = Array.from(cssRules);
if (!rules) {
return q;
}
/**
* reference -> https://developer.mozilla.org/en-US/docs/Web/API/CSSRule#Type_constants
*/
const cssImportRules = rules.filter(r => r.type === 3); // type === 3 -> CSSRule.IMPORT_RULE
/**
* when no `@import` rules in given sheet
* -> resolve the current `sheet` & exit
*/
if (!cssImportRules.length) {
q.defer(resolve =>
resolve({
isExternal: false,
priority,
root: options.rootNode,
shadowId: options.shadowId,
sheet
})
);
// exit
return q;
}
/**
* iterate `@import` rules and fetch styles
*/
cssImportRules.forEach((importRule, cssRuleIndex) =>
q.defer((resolve, reject) => {
const importUrl = importRule.href;
const newPriority = [...priority, cssRuleIndex];
const axiosOptions = {
method: 'get',
url: importUrl,
timeout: options.timeout
};
axe.imports
.axios(axiosOptions)
.then(({ data }) =>
resolve(
options.convertDataToStylesheet({
data,
isExternal: true,
priority: newPriority,
root: options.rootNode,
shadowId: options.shadowId
})
)
)
.catch(reject);
})
);
const nonImportCSSRules = rules.filter(r => r.type !== 3);
// no further rules to process in this sheet
if (!nonImportCSSRules.length) {
return q;
}
// convert all `nonImportCSSRules` style rules into `text` and defer into queue
q.defer(resolve =>
resolve(
options.convertDataToStylesheet({
data: nonImportCSSRules.map(rule => rule.cssText).join(),
isExternal: false,
priority,
root: options.rootNode,
shadowId: options.shadowId
})
)
);
return q;
} | [
"function",
"parseNonCrossOriginStylesheet",
"(",
"sheet",
",",
"options",
",",
"priority",
")",
"{",
"const",
"q",
"=",
"axe",
".",
"utils",
".",
"queue",
"(",
")",
";",
"/**\n\t * `sheet.cssRules` throws an error on `cross-origin` stylesheets\n\t */",
"const",
"cssRul... | Parse non cross-origin stylesheets
@param {Object} sheet CSSStylesheet object
@param {Object} options `loadCssom` options
@param {Array<Number>} priority sheet priority | [
"Parse",
"non",
"cross",
"-",
"origin",
"stylesheets"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/preload-cssom.js#L213-L300 | train | Parse a stylesheet that is not cross - origin | [
30522,
3853,
11968,
5054,
2239,
16458,
10050,
16529,
27983,
4095,
15558,
1006,
7123,
1010,
7047,
1010,
9470,
1007,
1063,
9530,
3367,
1053,
1027,
12946,
1012,
21183,
12146,
1012,
24240,
1006,
1007,
1025,
1013,
1008,
1008,
1008,
1036,
7123,
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... |
eslint/eslint | lib/util/naming.js | getShorthandName | function getShorthandName(fullname, prefix) {
if (fullname[0] === "@") {
let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname);
if (matchResult) {
return matchResult[1];
}
matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname);
if (matchResult) {
return `${matchResult[1]}/${matchResult[2]}`;
}
} else if (fullname.startsWith(`${prefix}-`)) {
return fullname.slice(prefix.length + 1);
}
return fullname;
} | javascript | function getShorthandName(fullname, prefix) {
if (fullname[0] === "@") {
let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname);
if (matchResult) {
return matchResult[1];
}
matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname);
if (matchResult) {
return `${matchResult[1]}/${matchResult[2]}`;
}
} else if (fullname.startsWith(`${prefix}-`)) {
return fullname.slice(prefix.length + 1);
}
return fullname;
} | [
"function",
"getShorthandName",
"(",
"fullname",
",",
"prefix",
")",
"{",
"if",
"(",
"fullname",
"[",
"0",
"]",
"===",
"\"@\"",
")",
"{",
"let",
"matchResult",
"=",
"new",
"RegExp",
"(",
"`",
"${",
"prefix",
"}",
"`",
",",
"\"u\"",
")",
".",
"exec",
... | Removes the prefix from a fullname.
@param {string} fullname The term which may have the prefix.
@param {string} prefix The prefix to remove.
@returns {string} The term without prefix. | [
"Removes",
"the",
"prefix",
"from",
"a",
"fullname",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/naming.js#L69-L86 | train | Get the name of a resource | [
30522,
3853,
4152,
27794,
11774,
18442,
1006,
2440,
18442,
1010,
17576,
1007,
1063,
2065,
1006,
2440,
18442,
1031,
1014,
1033,
1027,
1027,
1027,
1000,
1030,
1000,
1007,
1063,
2292,
2674,
6072,
11314,
1027,
2047,
19723,
10288,
2361,
1006,
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.uxap/src/sap/uxap/component/Component.js | function () {
//step1: create model from configuration
this._oModel = null; //internal component model
this._oViewConfig = { //internal view configuration
viewData: {
component: this
}
};
//step2: load model from the component configuration
switch (this.oComponentData.mode) {
case ObjectPageConfigurationMode.JsonURL:
// jsonUrl bootstraps the ObjectPageLayout on a json config url jsonConfigurationURL
// case 1: load from an XML view + json for the object page layout configuration
this._oModel = new UIComponent(this.oComponentData.jsonConfigurationURL);
this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory";
this._oViewConfig.type = ViewType.XML;
break;
case ObjectPageConfigurationMode.JsonModel:
// JsonModel bootstraps the ObjectPageLayout from the external model objectPageLayoutMedatadata
this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory";
this._oViewConfig.type = ViewType.XML;
break;
default:
Log.error("UxAPComponent :: missing bootstrap information. Expecting one of the following: JsonURL, JsonModel and FacetsAnnotation");
}
//create the UIComponent
UIComponent.prototype.init.call(this);
} | javascript | function () {
//step1: create model from configuration
this._oModel = null; //internal component model
this._oViewConfig = { //internal view configuration
viewData: {
component: this
}
};
//step2: load model from the component configuration
switch (this.oComponentData.mode) {
case ObjectPageConfigurationMode.JsonURL:
// jsonUrl bootstraps the ObjectPageLayout on a json config url jsonConfigurationURL
// case 1: load from an XML view + json for the object page layout configuration
this._oModel = new UIComponent(this.oComponentData.jsonConfigurationURL);
this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory";
this._oViewConfig.type = ViewType.XML;
break;
case ObjectPageConfigurationMode.JsonModel:
// JsonModel bootstraps the ObjectPageLayout from the external model objectPageLayoutMedatadata
this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory";
this._oViewConfig.type = ViewType.XML;
break;
default:
Log.error("UxAPComponent :: missing bootstrap information. Expecting one of the following: JsonURL, JsonModel and FacetsAnnotation");
}
//create the UIComponent
UIComponent.prototype.init.call(this);
} | [
"function",
"(",
")",
"{",
"//step1: create model from configuration",
"this",
".",
"_oModel",
"=",
"null",
";",
"//internal component model",
"this",
".",
"_oViewConfig",
"=",
"{",
"//internal view configuration",
"viewData",
":",
"{",
"component",
":",
"this",
"}",
... | initialize the view containing the objectPageLayout | [
"initialize",
"the",
"view",
"containing",
"the",
"objectPageLayout"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.uxap/src/sap/uxap/component/Component.js#L28-L57 | train | Initializes the component model | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
3357,
2487,
1024,
3443,
2944,
2013,
9563,
2023,
1012,
1035,
18168,
10244,
2140,
1027,
19701,
1025,
1013,
1013,
4722,
6922,
2944,
2023,
1012,
1035,
1051,
8584,
8663,
8873,
2290,
1027,
1063,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
askmike/gekko | web/vue/public/vendor/humanize-duration.js | doHumanization | function doHumanization (ms, options) {
var i, len, piece
// Make sure we have a positive number.
// Has the nice sideffect of turning Number objects into primitives.
ms = Math.abs(ms)
var dictionary = options.languages[options.language] || languages[options.language]
if (!dictionary) {
throw new Error('No language ' + dictionary + '.')
}
var pieces = []
// Start at the top and keep removing units, bit by bit.
var unitName, unitMS, unitCount
for (i = 0, len = options.units.length; i < len; i++) {
unitName = options.units[i]
unitMS = options.unitMeasures[unitName]
// What's the number of full units we can fit?
if (i + 1 === len) {
unitCount = ms / unitMS
} else {
unitCount = Math.floor(ms / unitMS)
}
// Add the string.
pieces.push({
unitCount: unitCount,
unitName: unitName
})
// Remove what we just figured out.
ms -= unitCount * unitMS
}
var firstOccupiedUnitIndex = 0
for (i = 0; i < pieces.length; i++) {
if (pieces[i].unitCount) {
firstOccupiedUnitIndex = i
break
}
}
if (options.round) {
var ratioToLargerUnit, previousPiece
for (i = pieces.length - 1; i >= 0; i--) {
piece = pieces[i]
piece.unitCount = Math.round(piece.unitCount)
if (i === 0) { break }
previousPiece = pieces[i - 1]
ratioToLargerUnit = options.unitMeasures[previousPiece.unitName] / options.unitMeasures[piece.unitName]
if ((piece.unitCount % ratioToLargerUnit) === 0 || (options.largest && ((options.largest - 1) < (i - firstOccupiedUnitIndex)))) {
previousPiece.unitCount += piece.unitCount / ratioToLargerUnit
piece.unitCount = 0
}
}
}
var result = []
for (i = 0, pieces.length; i < len; i++) {
piece = pieces[i]
if (piece.unitCount) {
result.push(render(piece.unitCount, piece.unitName, dictionary, options))
}
if (result.length === options.largest) { break }
}
if (result.length) {
if (!options.conjunction || result.length === 1) {
return result.join(options.delimiter)
} else if (result.length === 2) {
return result.join(options.conjunction)
} else if (result.length > 2) {
return result.slice(0, -1).join(options.delimiter) + (options.serialComma ? ',' : '') + options.conjunction + result.slice(-1)
}
} else {
return render(0, options.units[options.units.length - 1], dictionary, options)
}
} | javascript | function doHumanization (ms, options) {
var i, len, piece
// Make sure we have a positive number.
// Has the nice sideffect of turning Number objects into primitives.
ms = Math.abs(ms)
var dictionary = options.languages[options.language] || languages[options.language]
if (!dictionary) {
throw new Error('No language ' + dictionary + '.')
}
var pieces = []
// Start at the top and keep removing units, bit by bit.
var unitName, unitMS, unitCount
for (i = 0, len = options.units.length; i < len; i++) {
unitName = options.units[i]
unitMS = options.unitMeasures[unitName]
// What's the number of full units we can fit?
if (i + 1 === len) {
unitCount = ms / unitMS
} else {
unitCount = Math.floor(ms / unitMS)
}
// Add the string.
pieces.push({
unitCount: unitCount,
unitName: unitName
})
// Remove what we just figured out.
ms -= unitCount * unitMS
}
var firstOccupiedUnitIndex = 0
for (i = 0; i < pieces.length; i++) {
if (pieces[i].unitCount) {
firstOccupiedUnitIndex = i
break
}
}
if (options.round) {
var ratioToLargerUnit, previousPiece
for (i = pieces.length - 1; i >= 0; i--) {
piece = pieces[i]
piece.unitCount = Math.round(piece.unitCount)
if (i === 0) { break }
previousPiece = pieces[i - 1]
ratioToLargerUnit = options.unitMeasures[previousPiece.unitName] / options.unitMeasures[piece.unitName]
if ((piece.unitCount % ratioToLargerUnit) === 0 || (options.largest && ((options.largest - 1) < (i - firstOccupiedUnitIndex)))) {
previousPiece.unitCount += piece.unitCount / ratioToLargerUnit
piece.unitCount = 0
}
}
}
var result = []
for (i = 0, pieces.length; i < len; i++) {
piece = pieces[i]
if (piece.unitCount) {
result.push(render(piece.unitCount, piece.unitName, dictionary, options))
}
if (result.length === options.largest) { break }
}
if (result.length) {
if (!options.conjunction || result.length === 1) {
return result.join(options.delimiter)
} else if (result.length === 2) {
return result.join(options.conjunction)
} else if (result.length > 2) {
return result.slice(0, -1).join(options.delimiter) + (options.serialComma ? ',' : '') + options.conjunction + result.slice(-1)
}
} else {
return render(0, options.units[options.units.length - 1], dictionary, options)
}
} | [
"function",
"doHumanization",
"(",
"ms",
",",
"options",
")",
"{",
"var",
"i",
",",
"len",
",",
"piece",
"// Make sure we have a positive number.",
"// Has the nice sideffect of turning Number objects into primitives.",
"ms",
"=",
"Math",
".",
"abs",
"(",
"ms",
")",
"... | doHumanization does the bulk of the work. | [
"doHumanization",
"does",
"the",
"bulk",
"of",
"the",
"work",
"."
] | 0ce9ddd577fa8a22812c02331a494086758dfadf | https://github.com/askmike/gekko/blob/0ce9ddd577fa8a22812c02331a494086758dfadf/web/vue/public/vendor/humanize-duration.js#L52-L136 | train | Humanization the given ms | [
30522,
3853,
2079,
28600,
7088,
9276,
1006,
5796,
1010,
7047,
1007,
1063,
13075,
1045,
1010,
18798,
1010,
3538,
1013,
1013,
2191,
2469,
2057,
2031,
1037,
3893,
2193,
1012,
1013,
1013,
2038,
1996,
3835,
2217,
16020,
6593,
1997,
3810,
2193,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/private-browsing.js | privateBrowsing_start | function privateBrowsing_start(useShortcut) {
var dialog = null;
if (this.enabled)
return;
if (this.showPrompt) {
dialog = new modalDialog.modalDialog(this._controller.window);
dialog.start(this._handler);
}
if (useShortcut) {
var cmdKey = utils.getEntity(this.getDtds(), "privateBrowsingCmd.commandkey");
this._controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true});
} else {
this._controller.click(this._pbMenuItem);
}
if (dialog) {
dialog.waitForDialog();
}
this.waitForTransistionComplete(true);
} | javascript | function privateBrowsing_start(useShortcut) {
var dialog = null;
if (this.enabled)
return;
if (this.showPrompt) {
dialog = new modalDialog.modalDialog(this._controller.window);
dialog.start(this._handler);
}
if (useShortcut) {
var cmdKey = utils.getEntity(this.getDtds(), "privateBrowsingCmd.commandkey");
this._controller.keypress(null, cmdKey, {accelKey: true, shiftKey: true});
} else {
this._controller.click(this._pbMenuItem);
}
if (dialog) {
dialog.waitForDialog();
}
this.waitForTransistionComplete(true);
} | [
"function",
"privateBrowsing_start",
"(",
"useShortcut",
")",
"{",
"var",
"dialog",
"=",
"null",
";",
"if",
"(",
"this",
".",
"enabled",
")",
"return",
";",
"if",
"(",
"this",
".",
"showPrompt",
")",
"{",
"dialog",
"=",
"new",
"modalDialog",
".",
"modalD... | Start the Private Browsing mode
@param {boolean} useShortcut
Use the keyboard shortcut if true otherwise the menu entry is used | [
"Start",
"the",
"Private",
"Browsing",
"mode"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/private-browsing.js#L176-L198 | train | privateBrowsing_start - Start private browsing | [
30522,
3853,
2797,
12618,
9333,
2075,
1035,
2707,
1006,
3594,
27794,
12690,
1007,
1063,
13075,
13764,
8649,
1027,
19701,
1025,
2065,
1006,
2023,
1012,
9124,
1007,
2709,
1025,
2065,
1006,
2023,
1012,
2265,
21572,
27718,
1007,
1063,
13764,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/components/scene/pool.js | function () {
var el;
if (this.availableEls.length === 0) {
if (this.data.dynamic === false) {
warn('Requested entity from empty pool: ' + this.attrName);
return;
} else {
warn('Requested entity from empty pool. This pool is dynamic and will resize ' +
'automatically. You might want to increase its initial size: ' + this.attrName);
}
this.createEntity();
}
el = this.availableEls.shift();
this.usedEls.push(el);
el.object3D.visible = true;
return el;
} | javascript | function () {
var el;
if (this.availableEls.length === 0) {
if (this.data.dynamic === false) {
warn('Requested entity from empty pool: ' + this.attrName);
return;
} else {
warn('Requested entity from empty pool. This pool is dynamic and will resize ' +
'automatically. You might want to increase its initial size: ' + this.attrName);
}
this.createEntity();
}
el = this.availableEls.shift();
this.usedEls.push(el);
el.object3D.visible = true;
return el;
} | [
"function",
"(",
")",
"{",
"var",
"el",
";",
"if",
"(",
"this",
".",
"availableEls",
".",
"length",
"===",
"0",
")",
"{",
"if",
"(",
"this",
".",
"data",
".",
"dynamic",
"===",
"false",
")",
"{",
"warn",
"(",
"'Requested entity from empty pool: '",
"+"... | Used to request one of the available entities of the pool. | [
"Used",
"to",
"request",
"one",
"of",
"the",
"available",
"entities",
"of",
"the",
"pool",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/scene/pool.js#L83-L99 | train | Returns the next available entity in the pool | [
30522,
3853,
1006,
1007,
1063,
13075,
3449,
1025,
2065,
1006,
2023,
1012,
2800,
9050,
1012,
3091,
1027,
1027,
1027,
1014,
1007,
1063,
2065,
1006,
2023,
1012,
2951,
1012,
8790,
1027,
1027,
1027,
6270,
1007,
1063,
11582,
1006,
1005,
7303,
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... | |
jgraph/mxgraph | javascript/mxClient.js | function(url, params, onload, onerror)
{
return new mxXmlRequest(url, params).send(onload, onerror);
} | javascript | function(url, params, onload, onerror)
{
return new mxXmlRequest(url, params).send(onload, onerror);
} | [
"function",
"(",
"url",
",",
"params",
",",
"onload",
",",
"onerror",
")",
"{",
"return",
"new",
"mxXmlRequest",
"(",
"url",
",",
"params",
")",
".",
"send",
"(",
"onload",
",",
"onerror",
")",
";",
"}"
] | Function: post
Posts the specified params to the given URL *asynchronously* and invokes
the given functions depending on the request status. Returns the
<mxXmlRequest> in use. Both functions take the <mxXmlRequest> as the
only parameter. Make sure to use encodeURIComponent for the parameter
values.
Example:
(code)
mxUtils.post(url, 'key=value', function(req)
{
mxUtils.alert('Ready: '+req.isReady()+' Status: '+req.getStatus());
// Process req.getDocumentElement() using DOM API if OK...
});
(end)
Parameters:
url - URL to get the data from.
params - Parameters for the post request.
onload - Optional function to execute for a successful response.
onerror - Optional function to execute on error. | [
"Function",
":",
"post"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3703-L3706 | train | This function is a wrapper around the mxXmlRequest class. It is not a wrapper around the mxXmlRequest class. | [
30522,
3853,
1006,
24471,
2140,
1010,
11498,
5244,
1010,
2006,
11066,
1010,
2028,
18933,
2099,
1007,
1063,
2709,
2047,
25630,
2595,
19968,
2890,
15500,
1006,
24471,
2140,
1010,
11498,
5244,
1007,
1012,
4604,
1006,
2006,
11066,
1010,
2028,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/search/FindInFiles.js | doReplace | function doReplace(results, replaceText, options) {
return FindUtils.performReplacements(results, replaceText, options).always(function () {
// For UI integration testing only
exports._replaceDone = true;
});
} | javascript | function doReplace(results, replaceText, options) {
return FindUtils.performReplacements(results, replaceText, options).always(function () {
// For UI integration testing only
exports._replaceDone = true;
});
} | [
"function",
"doReplace",
"(",
"results",
",",
"replaceText",
",",
"options",
")",
"{",
"return",
"FindUtils",
".",
"performReplacements",
"(",
"results",
",",
"replaceText",
",",
"options",
")",
".",
"always",
"(",
"function",
"(",
")",
"{",
"// For UI integra... | Given a set of search results, replaces them with the given replaceText, either on disk or in memory.
@param {Object.<fullPath: string, {matches: Array.<{start: {line:number,ch:number}, end: {line:number,ch:number}, startOffset: number, endOffset: number, line: string}>, collapsed: boolean}>} results
The list of results to replace, as returned from _doSearch..
@param {string} replaceText The text to replace each result with.
@param {?Object} options An options object:
forceFilesOpen: boolean - Whether to open all files in editors and do replacements there rather than doing the
replacements on disk. Note that even if this is false, files that are already open in editors will have replacements
done in memory.
isRegexp: boolean - Whether the original query was a regexp. If true, $-substitution is performed on the replaceText.
@return {$.Promise} A promise that's resolved when the replacement is finished or rejected with an array of errors
if there were one or more errors. Each individual item in the array will be a {item: string, error: string} object,
where item is the full path to the file that could not be updated, and error is either a FileSystem error or one
of the `FindInFiles.ERROR_*` constants. | [
"Given",
"a",
"set",
"of",
"search",
"results",
"replaces",
"them",
"with",
"the",
"given",
"replaceText",
"either",
"on",
"disk",
"or",
"in",
"memory",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindInFiles.js#L645-L650 | train | Perform replacements for the given text | [
30522,
3853,
2079,
2890,
24759,
10732,
1006,
3463,
1010,
5672,
18209,
1010,
7047,
1007,
1063,
2709,
2424,
21823,
4877,
1012,
4685,
2890,
24759,
10732,
8163,
1006,
3463,
1010,
5672,
18209,
1010,
7047,
1007,
1012,
2467,
1006,
3853,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/CodeInspection.js | register | function register(languageId, provider) {
if (!_providers[languageId]) {
_providers[languageId] = [];
} else {
// Check if provider with same name exists for the given language
// If yes, remove the provider before inserting the most recently loaded one
var indexOfProvider = _.findIndex(_providers[languageId], function(entry) { return entry.name === provider.name; });
if (indexOfProvider !== -1) {
_providers[languageId].splice(indexOfProvider, 1);
}
}
_providers[languageId].push(provider);
run(); // in case a file of this type is open currently
} | javascript | function register(languageId, provider) {
if (!_providers[languageId]) {
_providers[languageId] = [];
} else {
// Check if provider with same name exists for the given language
// If yes, remove the provider before inserting the most recently loaded one
var indexOfProvider = _.findIndex(_providers[languageId], function(entry) { return entry.name === provider.name; });
if (indexOfProvider !== -1) {
_providers[languageId].splice(indexOfProvider, 1);
}
}
_providers[languageId].push(provider);
run(); // in case a file of this type is open currently
} | [
"function",
"register",
"(",
"languageId",
",",
"provider",
")",
"{",
"if",
"(",
"!",
"_providers",
"[",
"languageId",
"]",
")",
"{",
"_providers",
"[",
"languageId",
"]",
"=",
"[",
"]",
";",
"}",
"else",
"{",
"// Check if provider with same name exists for th... | The provider is passed the text of the file and its fullPath. Providers should not assume
that the file is open (i.e. DocumentManager.getOpenDocumentForPath() may return null) or
that the file on disk matches the text given (file may have unsaved changes).
Registering any provider for the "javascript" language automatically unregisters the built-in
Brackets JSLint provider. This is a temporary convenience until UI exists for disabling
registered providers.
Providers implement scanFile() if results are available synchronously, or scanFileAsync() if results
may require an async wait (if both are implemented, scanFile() is ignored). scanFileAsync() returns
a {$.Promise} object resolved with the same type of value as scanFile() is expected to return.
Rejecting the promise is treated as an internal error in the provider.
@param {string} languageId
@param {{name:string, scanFileAsync:?function(string, string):!{$.Promise},
scanFile:?function(string, string):?{errors:!Array, aborted:boolean}}} provider
Each error is: { pos:{line,ch}, endPos:?{line,ch}, message:string, type:?Type }
If type is unspecified, Type.WARNING is assumed.
If no errors found, return either null or an object with a zero-length `errors` array. | [
"The",
"provider",
"is",
"passed",
"the",
"text",
"of",
"the",
"file",
"and",
"its",
"fullPath",
".",
"Providers",
"should",
"not",
"assume",
"that",
"the",
"file",
"is",
"open",
"(",
"i",
".",
"e",
".",
"DocumentManager",
".",
"getOpenDocumentForPath",
"(... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CodeInspection.js#L499-L514 | train | Register a new provider for a language | [
30522,
3853,
4236,
1006,
2653,
3593,
1010,
10802,
1007,
1063,
2065,
1006,
999,
1035,
11670,
1031,
2653,
3593,
1033,
1007,
1063,
1035,
11670,
1031,
2653,
3593,
1033,
1027,
1031,
1033,
1025,
1065,
2842,
1063,
1013,
1013,
4638,
2065,
10802,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | _hideDayPicker | function _hideDayPicker(bSkipFocus){
this._iMode = 0;
var oDatesRow = this.getAggregation("datesRow");
oDatesRow.$().css("display", "none");
this._hideOverlay();
if (!bSkipFocus) {
_renderTimesRow.call(this); // to focus date
// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0");
}
} | javascript | function _hideDayPicker(bSkipFocus){
this._iMode = 0;
var oDatesRow = this.getAggregation("datesRow");
oDatesRow.$().css("display", "none");
this._hideOverlay();
if (!bSkipFocus) {
_renderTimesRow.call(this); // to focus date
// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0");
}
} | [
"function",
"_hideDayPicker",
"(",
"bSkipFocus",
")",
"{",
"this",
".",
"_iMode",
"=",
"0",
";",
"var",
"oDatesRow",
"=",
"this",
".",
"getAggregation",
"(",
"\"datesRow\"",
")",
";",
"oDatesRow",
".",
"$",
"(",
")",
".",
"css",
"(",
"\"display\"",
",",
... | Hides an embedded day Picker.
This function assumes there is a "datesRow" aggregation.
So callers must take care.
@return {void}
@private | [
"Hides",
"an",
"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#L1428-L1445 | train | Hides the day picker | [
30522,
3853,
1035,
5342,
10259,
24330,
5484,
1006,
18667,
3211,
14376,
10085,
2271,
1007,
1063,
2023,
1012,
1035,
10047,
10244,
1027,
1014,
1025,
13075,
1051,
27122,
10524,
1027,
2023,
1012,
2131,
8490,
17603,
12540,
1006,
1000,
5246,
10524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FileFilters.js | getActiveFilter | function getActiveFilter() {
var filterSets = PreferencesManager.get("fileFilters") || [],
activeFilterIndex = PreferencesManager.getViewState("activeFileFilter"),
oldFilter = PreferencesManager.getViewState("search.exclusions") || [],
activeFilter = null;
if (activeFilterIndex === undefined && oldFilter.length) {
activeFilter = { name: "", patterns: oldFilter };
activeFilterIndex = _getFilterIndex(filterSets, activeFilter);
// Migrate the old filter into the new filter storage
if (activeFilterIndex === -1) {
activeFilterIndex = filterSets.length;
filterSets.push(activeFilter);
PreferencesManager.set("fileFilters", filterSets);
}
PreferencesManager.setViewState("activeFileFilter", activeFilterIndex);
} else if (activeFilterIndex > -1 && activeFilterIndex < filterSets.length) {
activeFilter = filterSets[activeFilterIndex];
}
return activeFilter;
} | javascript | function getActiveFilter() {
var filterSets = PreferencesManager.get("fileFilters") || [],
activeFilterIndex = PreferencesManager.getViewState("activeFileFilter"),
oldFilter = PreferencesManager.getViewState("search.exclusions") || [],
activeFilter = null;
if (activeFilterIndex === undefined && oldFilter.length) {
activeFilter = { name: "", patterns: oldFilter };
activeFilterIndex = _getFilterIndex(filterSets, activeFilter);
// Migrate the old filter into the new filter storage
if (activeFilterIndex === -1) {
activeFilterIndex = filterSets.length;
filterSets.push(activeFilter);
PreferencesManager.set("fileFilters", filterSets);
}
PreferencesManager.setViewState("activeFileFilter", activeFilterIndex);
} else if (activeFilterIndex > -1 && activeFilterIndex < filterSets.length) {
activeFilter = filterSets[activeFilterIndex];
}
return activeFilter;
} | [
"function",
"getActiveFilter",
"(",
")",
"{",
"var",
"filterSets",
"=",
"PreferencesManager",
".",
"get",
"(",
"\"fileFilters\"",
")",
"||",
"[",
"]",
",",
"activeFilterIndex",
"=",
"PreferencesManager",
".",
"getViewState",
"(",
"\"activeFileFilter\"",
")",
",",
... | A search filter is an array of one or more glob strings. The filter must be 'compiled' via compile()
before passing to filterPath()/filterFileList().
@return {?{name: string, patterns: Array.<string>}} | [
"A",
"search",
"filter",
"is",
"an",
"array",
"of",
"one",
"or",
"more",
"glob",
"strings",
".",
"The",
"filter",
"must",
"be",
"compiled",
"via",
"compile",
"()",
"before",
"passing",
"to",
"filterPath",
"()",
"/",
"filterFileList",
"()",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FileFilters.js#L130-L152 | train | Get the active filter | [
30522,
3853,
2131,
19620,
8873,
21928,
1006,
1007,
1063,
13075,
17736,
8454,
1027,
18394,
24805,
4590,
1012,
2131,
1006,
1000,
5371,
8873,
21928,
2015,
1000,
1007,
1064,
1064,
1031,
1033,
1010,
3161,
8873,
21928,
22254,
10288,
1027,
18394,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExpressionParser.js | PROPERTY_ACCESS | function PROPERTY_ACCESS(fnLeft, fnName, aParts, oReference) {
var oParent = fnLeft(aParts),
sIdentifier = fnName(aParts), // BEWARE: evaluate propertyNameValue AFTER baseValue!
vChild = oParent[sIdentifier];
if (oReference) {
oReference.base = oParent;
}
return vChild;
} | javascript | function PROPERTY_ACCESS(fnLeft, fnName, aParts, oReference) {
var oParent = fnLeft(aParts),
sIdentifier = fnName(aParts), // BEWARE: evaluate propertyNameValue AFTER baseValue!
vChild = oParent[sIdentifier];
if (oReference) {
oReference.base = oParent;
}
return vChild;
} | [
"function",
"PROPERTY_ACCESS",
"(",
"fnLeft",
",",
"fnName",
",",
"aParts",
",",
"oReference",
")",
"{",
"var",
"oParent",
"=",
"fnLeft",
"(",
"aParts",
")",
",",
"sIdentifier",
"=",
"fnName",
"(",
"aParts",
")",
",",
"// BEWARE: evaluate propertyNameValue AFTER... | Formatter function for a property access.
@param {function} fnLeft - formatter function for the left operand: the array or object to
access
@param {function} fnName - formatter function for the property name
@param {any[]} aParts - the array of binding values
@param {object} [oReference]
optional side channel to return the base value (left operand) of the reference
@return {any} - the array element or object property | [
"Formatter",
"function",
"for",
"a",
"property",
"access",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L429-L438 | train | This function is called by the property accessor function to determine the value of the property. | [
30522,
3853,
3200,
1035,
3229,
1006,
1042,
20554,
29218,
1010,
1042,
9516,
4168,
1010,
4237,
2015,
1010,
10848,
25523,
1007,
1063,
13075,
6728,
12069,
3372,
30524,
3372,
1031,
2217,
16778,
8873,
2121,
1033,
1025,
2065,
1006,
10848,
25523,
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/jquery.sap.history.js | preGenHash | function preGenHash(sIdf, oStateData){
var sEncodedIdf = window.encodeURIComponent(sIdf);
var sEncodedData = window.encodeURIComponent(window.JSON.stringify(oStateData));
return sEncodedIdf + sIdSeperator + sEncodedData;
} | javascript | function preGenHash(sIdf, oStateData){
var sEncodedIdf = window.encodeURIComponent(sIdf);
var sEncodedData = window.encodeURIComponent(window.JSON.stringify(oStateData));
return sEncodedIdf + sIdSeperator + sEncodedData;
} | [
"function",
"preGenHash",
"(",
"sIdf",
",",
"oStateData",
")",
"{",
"var",
"sEncodedIdf",
"=",
"window",
".",
"encodeURIComponent",
"(",
"sIdf",
")",
";",
"var",
"sEncodedData",
"=",
"window",
".",
"encodeURIComponent",
"(",
"window",
".",
"JSON",
".",
"stri... | This function encode the identifier and data into a string.
@private | [
"This",
"function",
"encode",
"the",
"identifier",
"and",
"data",
"into",
"a",
"string",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L494-L498 | train | Generates a hash for the given state data | [
30522,
3853,
3653,
6914,
14949,
2232,
1006,
15765,
2546,
1010,
9808,
16238,
6790,
1007,
1063,
13075,
12411,
16044,
4305,
20952,
1027,
3332,
1012,
4372,
16044,
9496,
9006,
29513,
3372,
1006,
15765,
2546,
1007,
1025,
13075,
12411,
16044,
25062,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/cli/getBook.js | getBook | function getBook(args, kwargs) {
var input = path.resolve(args[0] || process.cwd());
var logLevel = kwargs.log;
var fs = createNodeFS(input);
var book = Book.createForFS(fs);
return book.setLogLevel(logLevel);
} | javascript | function getBook(args, kwargs) {
var input = path.resolve(args[0] || process.cwd());
var logLevel = kwargs.log;
var fs = createNodeFS(input);
var book = Book.createForFS(fs);
return book.setLogLevel(logLevel);
} | [
"function",
"getBook",
"(",
"args",
",",
"kwargs",
")",
"{",
"var",
"input",
"=",
"path",
".",
"resolve",
"(",
"args",
"[",
"0",
"]",
"||",
"process",
".",
"cwd",
"(",
")",
")",
";",
"var",
"logLevel",
"=",
"kwargs",
".",
"log",
";",
"var",
"fs",... | Return a book instance to work on from
command line args/kwargs
@param {Array} args
@param {Object} kwargs
@return {Book} | [
"Return",
"a",
"book",
"instance",
"to",
"work",
"on",
"from",
"command",
"line",
"args",
"/",
"kwargs"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/cli/getBook.js#L13-L21 | train | Get a book | [
30522,
3853,
2131,
8654,
1006,
12098,
5620,
1010,
6448,
2906,
5620,
1007,
1063,
13075,
7953,
1027,
4130,
1012,
10663,
1006,
12098,
5620,
1031,
1014,
1033,
1064,
1064,
2832,
1012,
19296,
2094,
1006,
1007,
1007,
1025,
13075,
8833,
20414,
2884... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AnalyticalBinding.js | addOrUpdateHierarchy | function addOrUpdateHierarchy(oColumn) {
var iLevel = oColumn.level,
sName = oColumn.name;
aHierarchyProperties = aHierarchyProperties
|| oEntityType.getAllHierarchyPropertyNames();
aHierarchyProperties.forEach(function (sHierarchyName) {
var oHierarchy = that.oAnalyticalQueryResult
.findDimensionByPropertyName(sHierarchyName).getHierarchy(),
oHierarchyDetails = null,
// each hierarchy has a node ID property, see post processing in
// sap.ui.model.analytics.odata4analytics.EntityType.prototype._init
sNodeIDName = oHierarchy.getNodeIDProperty().name,
oProperty;
if (sNodeIDName === sName) {
oHierarchyDetails = getOrCreateHierarchyDetails(oHierarchy);
} else {
oProperty = oHierarchy.getNodeExternalKeyProperty();
if (oProperty && oProperty.name === sName) {
oHierarchyDetails = getOrCreateHierarchyDetails(oHierarchy);
oHierarchyDetails.nodeExternalKeyName = sName;
} else {
oProperty = oEntityType.getTextPropertyOfProperty(sNodeIDName);
if (oProperty && oProperty.name === sName) {
oHierarchyDetails = getOrCreateHierarchyDetails(oHierarchy);
oHierarchyDetails.nodeTextName = sName;
}
}
}
if (oHierarchyDetails && "level" in oColumn) {
// add level restriction and check that aColumns is properly defined
if (typeof iLevel === "number") {
if ("level" in oHierarchyDetails && oHierarchyDetails.level !== iLevel) {
throw new Error("Multiple different level filter for hierarchy '"
+ sNodeIDName + "' defined");
}
oHierarchyDetails.level = iLevel;
// the property which defines the level also defines the grouping
oHierarchyDetails.grouped = !!oColumn.grouped;
} else {
throw new Error("The level of '" + sNodeIDName
+ "' has to be an integer value");
}
}
});
} | javascript | function addOrUpdateHierarchy(oColumn) {
var iLevel = oColumn.level,
sName = oColumn.name;
aHierarchyProperties = aHierarchyProperties
|| oEntityType.getAllHierarchyPropertyNames();
aHierarchyProperties.forEach(function (sHierarchyName) {
var oHierarchy = that.oAnalyticalQueryResult
.findDimensionByPropertyName(sHierarchyName).getHierarchy(),
oHierarchyDetails = null,
// each hierarchy has a node ID property, see post processing in
// sap.ui.model.analytics.odata4analytics.EntityType.prototype._init
sNodeIDName = oHierarchy.getNodeIDProperty().name,
oProperty;
if (sNodeIDName === sName) {
oHierarchyDetails = getOrCreateHierarchyDetails(oHierarchy);
} else {
oProperty = oHierarchy.getNodeExternalKeyProperty();
if (oProperty && oProperty.name === sName) {
oHierarchyDetails = getOrCreateHierarchyDetails(oHierarchy);
oHierarchyDetails.nodeExternalKeyName = sName;
} else {
oProperty = oEntityType.getTextPropertyOfProperty(sNodeIDName);
if (oProperty && oProperty.name === sName) {
oHierarchyDetails = getOrCreateHierarchyDetails(oHierarchy);
oHierarchyDetails.nodeTextName = sName;
}
}
}
if (oHierarchyDetails && "level" in oColumn) {
// add level restriction and check that aColumns is properly defined
if (typeof iLevel === "number") {
if ("level" in oHierarchyDetails && oHierarchyDetails.level !== iLevel) {
throw new Error("Multiple different level filter for hierarchy '"
+ sNodeIDName + "' defined");
}
oHierarchyDetails.level = iLevel;
// the property which defines the level also defines the grouping
oHierarchyDetails.grouped = !!oColumn.grouped;
} else {
throw new Error("The level of '" + sNodeIDName
+ "' has to be an integer value");
}
}
});
} | [
"function",
"addOrUpdateHierarchy",
"(",
"oColumn",
")",
"{",
"var",
"iLevel",
"=",
"oColumn",
".",
"level",
",",
"sName",
"=",
"oColumn",
".",
"name",
";",
"aHierarchyProperties",
"=",
"aHierarchyProperties",
"||",
"oEntityType",
".",
"getAllHierarchyPropertyNames"... | /*
If the given analytical column is related to a hierarchy, add or update the corresponding
entry in <code>that.mHierarchyDetailsByName</code>.
@param {object} The analytical info for an analytical column | [
"/",
"*",
"If",
"the",
"given",
"analytical",
"column",
"is",
"related",
"to",
"a",
"hierarchy",
"add",
"or",
"update",
"the",
"corresponding",
"entry",
"in",
"<code",
">",
"that",
".",
"mHierarchyDetailsByName<",
"/",
"code",
">",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js#L1146-L1193 | train | Adds a column to the hierarchy | [
30522,
3853,
5587,
2953,
6279,
13701,
4048,
6906,
29389,
1006,
1051,
25778,
2819,
2078,
1007,
1063,
13075,
17869,
15985,
1027,
1051,
25778,
2819,
2078,
1012,
2504,
1010,
1055,
18442,
1027,
1051,
25778,
2819,
2078,
1012,
2171,
1025,
6289,
37... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/angular | aio/scripts/check-environment.js | checkEnvironment | function checkEnvironment(expected) {
exec('yarn --version', function(yarnErr, yarnStdout) {
var actualNodeVersion = process.version;
var actualYarnVersion = !yarnErr && semver.clean(yarnStdout);
var issues = [];
// Check Node version.
if (!semver.satisfies(actualNodeVersion, expected.nodeVersion)) {
issues.push(
'You are running an unsupported Node version. Expected: ' + expected.nodeVersion +
' Found: ' + actualNodeVersion + '. Use nvm to update your Node version.');
}
// Check yarn version.
if (yarnErr) {
issues.push(
'You don\'t have yarn globally installed. This is required if you want to work on this ' +
'project. Installation instructions: https://yarnpkg.com/lang/en/docs/install/');
} else if (!semver.satisfies(actualYarnVersion, expected.yarnVersion)) {
issues.push(
'You are running an unsupported yarn version. Expected: ' + expected.yarnVersion +
' Found: ' + actualYarnVersion + '. For instructions see:' +
' https://yarnpkg.com/lang/en/docs/install/');
}
reportIssues(issues);
});
} | javascript | function checkEnvironment(expected) {
exec('yarn --version', function(yarnErr, yarnStdout) {
var actualNodeVersion = process.version;
var actualYarnVersion = !yarnErr && semver.clean(yarnStdout);
var issues = [];
// Check Node version.
if (!semver.satisfies(actualNodeVersion, expected.nodeVersion)) {
issues.push(
'You are running an unsupported Node version. Expected: ' + expected.nodeVersion +
' Found: ' + actualNodeVersion + '. Use nvm to update your Node version.');
}
// Check yarn version.
if (yarnErr) {
issues.push(
'You don\'t have yarn globally installed. This is required if you want to work on this ' +
'project. Installation instructions: https://yarnpkg.com/lang/en/docs/install/');
} else if (!semver.satisfies(actualYarnVersion, expected.yarnVersion)) {
issues.push(
'You are running an unsupported yarn version. Expected: ' + expected.yarnVersion +
' Found: ' + actualYarnVersion + '. For instructions see:' +
' https://yarnpkg.com/lang/en/docs/install/');
}
reportIssues(issues);
});
} | [
"function",
"checkEnvironment",
"(",
"expected",
")",
"{",
"exec",
"(",
"'yarn --version'",
",",
"function",
"(",
"yarnErr",
",",
"yarnStdout",
")",
"{",
"var",
"actualNodeVersion",
"=",
"process",
".",
"version",
";",
"var",
"actualYarnVersion",
"=",
"!",
"ya... | Helpers | [
"Helpers"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/scripts/check-environment.js#L48-L75 | train | Check the environment | [
30522,
3853,
4638,
2368,
21663,
2239,
3672,
1006,
3517,
1007,
1063,
4654,
8586,
1006,
1005,
27158,
1011,
1011,
2544,
1005,
1010,
3853,
1006,
27158,
2121,
2099,
1010,
27158,
3367,
26797,
2102,
1007,
1063,
13075,
5025,
3630,
24844,
2545,
3258... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_DefaultRowHeight | function parse_DefaultRowHeight(blob, length, opts) {
var f = 0;
if(!(opts && opts.biff == 2)) {
f = blob.read_shift(2);
}
var miyRw = blob.read_shift(2);
if((opts && opts.biff == 2)) {
f = 1 - (miyRw >> 15); miyRw &= 0x7fff;
}
var fl = {Unsynced:f&1,DyZero:(f&2)>>1,ExAsc:(f&4)>>2,ExDsc:(f&8)>>3};
return [fl, miyRw];
} | javascript | function parse_DefaultRowHeight(blob, length, opts) {
var f = 0;
if(!(opts && opts.biff == 2)) {
f = blob.read_shift(2);
}
var miyRw = blob.read_shift(2);
if((opts && opts.biff == 2)) {
f = 1 - (miyRw >> 15); miyRw &= 0x7fff;
}
var fl = {Unsynced:f&1,DyZero:(f&2)>>1,ExAsc:(f&4)>>2,ExDsc:(f&8)>>3};
return [fl, miyRw];
} | [
"function",
"parse_DefaultRowHeight",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"f",
"=",
"0",
";",
"if",
"(",
"!",
"(",
"opts",
"&&",
"opts",
".",
"biff",
"==",
"2",
")",
")",
"{",
"f",
"=",
"blob",
".",
"read_shift",
"(",
"2",
... | /* [MS-XLS] 2.4.87 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"87"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5886-L5897 | train | Parse a default row height | [
30522,
3853,
11968,
3366,
1035,
12398,
10524,
26036,
13900,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
1042,
1027,
1014,
1025,
2065,
1006,
999,
1006,
23569,
2015,
1004,
1004,
23569,
2015,
1012,
12170,
4246,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vuex | dist/vuex.esm.js | Module | function Module (rawModule, runtime) {
this.runtime = runtime;
// Store some children item
this._children = Object.create(null);
// Store the origin module object which passed by programmer
this._rawModule = rawModule;
var rawState = rawModule.state;
// Store the origin module's state
this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
} | javascript | function Module (rawModule, runtime) {
this.runtime = runtime;
// Store some children item
this._children = Object.create(null);
// Store the origin module object which passed by programmer
this._rawModule = rawModule;
var rawState = rawModule.state;
// Store the origin module's state
this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
} | [
"function",
"Module",
"(",
"rawModule",
",",
"runtime",
")",
"{",
"this",
".",
"runtime",
"=",
"runtime",
";",
"// Store some children item",
"this",
".",
"_children",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"// Store the origin module object which pa... | Base data struct for store's module, package with some attribute and method | [
"Base",
"data",
"struct",
"for",
"store",
"s",
"module",
"package",
"with",
"some",
"attribute",
"and",
"method"
] | d7c7f9844831f98c5c9aaca213746c4ccc5d6929 | https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/dist/vuex.esm.js#L91-L101 | train | The module object | [
30522,
3853,
11336,
1006,
6315,
5302,
8566,
2571,
1010,
2448,
7292,
1007,
1063,
2023,
1012,
2448,
7292,
1027,
2448,
7292,
1025,
1013,
1013,
3573,
2070,
2336,
8875,
2023,
1012,
1035,
2336,
1027,
4874,
1012,
3443,
1006,
19701,
1007,
1025,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | common/src/web/jquery-1.3.2.js | function(elem, types, handler) {
// don't do events on text and comment nodes
if ( elem.nodeType == 3 || elem.nodeType == 8 )
return;
var events = jQuery.data(elem, "events"), ret, index;
if ( events ) {
// Unbind all events for the element
if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
for ( var type in events )
this.remove( elem, type + (types || "") );
else {
// types is actually an event object here
if ( types.type ) {
handler = types.handler;
types = types.type;
}
// Handle multiple events seperated by a space
// jQuery(...).unbind("mouseover mouseout", fn);
jQuery.each(types.split(/\s+/), function(index, type){
// Namespaced event handlers
var namespaces = type.split(".");
type = namespaces.shift();
var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
if ( events[type] ) {
// remove the given handler for the given type
if ( handler )
delete events[type][handler.guid];
// remove all handlers for the given type
else
for ( var handle in events[type] )
// Handle the removal of namespaced events
if ( namespace.test(events[type][handle].type) )
delete events[type][handle];
if ( jQuery.event.specialAll[type] )
jQuery.event.specialAll[type].teardown.call(elem, namespaces);
// remove generic event handler if no more handlers exist
for ( ret in events[type] ) break;
if ( !ret ) {
if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
if (elem.removeEventListener)
elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
else if (elem.detachEvent)
elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
}
ret = null;
delete events[type];
}
}
});
}
// Remove the expando if it's no longer used
for ( ret in events ) break;
if ( !ret ) {
var handle = jQuery.data( elem, "handle" );
if ( handle ) handle.elem = null;
jQuery.removeData( elem, "events" );
jQuery.removeData( elem, "handle" );
}
}
} | javascript | function(elem, types, handler) {
// don't do events on text and comment nodes
if ( elem.nodeType == 3 || elem.nodeType == 8 )
return;
var events = jQuery.data(elem, "events"), ret, index;
if ( events ) {
// Unbind all events for the element
if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
for ( var type in events )
this.remove( elem, type + (types || "") );
else {
// types is actually an event object here
if ( types.type ) {
handler = types.handler;
types = types.type;
}
// Handle multiple events seperated by a space
// jQuery(...).unbind("mouseover mouseout", fn);
jQuery.each(types.split(/\s+/), function(index, type){
// Namespaced event handlers
var namespaces = type.split(".");
type = namespaces.shift();
var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
if ( events[type] ) {
// remove the given handler for the given type
if ( handler )
delete events[type][handler.guid];
// remove all handlers for the given type
else
for ( var handle in events[type] )
// Handle the removal of namespaced events
if ( namespace.test(events[type][handle].type) )
delete events[type][handle];
if ( jQuery.event.specialAll[type] )
jQuery.event.specialAll[type].teardown.call(elem, namespaces);
// remove generic event handler if no more handlers exist
for ( ret in events[type] ) break;
if ( !ret ) {
if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
if (elem.removeEventListener)
elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
else if (elem.detachEvent)
elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
}
ret = null;
delete events[type];
}
}
});
}
// Remove the expando if it's no longer used
for ( ret in events ) break;
if ( !ret ) {
var handle = jQuery.data( elem, "handle" );
if ( handle ) handle.elem = null;
jQuery.removeData( elem, "events" );
jQuery.removeData( elem, "handle" );
}
}
} | [
"function",
"(",
"elem",
",",
"types",
",",
"handler",
")",
"{",
"// don't do events on text and comment nodes",
"if",
"(",
"elem",
".",
"nodeType",
"==",
"3",
"||",
"elem",
".",
"nodeType",
"==",
"8",
")",
"return",
";",
"var",
"events",
"=",
"jQuery",
".... | Detach an event or set of events from an element | [
"Detach",
"an",
"event",
"or",
"set",
"of",
"events",
"from",
"an",
"element"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L2521-L2588 | train | Remove event handlers for an element | [
30522,
3853,
1006,
3449,
6633,
1010,
4127,
1010,
28213,
1007,
1063,
1013,
1013,
2123,
1005,
1056,
2079,
2824,
2006,
3793,
1998,
7615,
14164,
2065,
1006,
3449,
6633,
1012,
13045,
13874,
1027,
1027,
1017,
1064,
1064,
3449,
6633,
1012,
13045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/max-len.js | getAllStrings | function getAllStrings() {
return sourceCode.ast.tokens.filter(token => (token.type === "String" ||
(token.type === "JSXText" && sourceCode.getNodeByRangeIndex(token.range[0] - 1).type === "JSXAttribute")));
} | javascript | function getAllStrings() {
return sourceCode.ast.tokens.filter(token => (token.type === "String" ||
(token.type === "JSXText" && sourceCode.getNodeByRangeIndex(token.range[0] - 1).type === "JSXAttribute")));
} | [
"function",
"getAllStrings",
"(",
")",
"{",
"return",
"sourceCode",
".",
"ast",
".",
"tokens",
".",
"filter",
"(",
"token",
"=>",
"(",
"token",
".",
"type",
"===",
"\"String\"",
"||",
"(",
"token",
".",
"type",
"===",
"\"JSXText\"",
"&&",
"sourceCode",
"... | Retrieves an array containing all strings (" or ') in the source code.
@returns {ASTNode[]} An array of string nodes. | [
"Retrieves",
"an",
"array",
"containing",
"all",
"strings",
"(",
"or",
")",
"in",
"the",
"source",
"code",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/max-len.js#L220-L223 | train | Get all strings in the source | [
30522,
3853,
2131,
8095,
3367,
4892,
2015,
1006,
1007,
1063,
2709,
3120,
16044,
1012,
2004,
2102,
1012,
19204,
2015,
1012,
11307,
1006,
19204,
1027,
1028,
1006,
19204,
1012,
2828,
1027,
1027,
1027,
1000,
5164,
1000,
1064,
1064,
1006,
19204,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/code-prettify | tasks/aliases.js | syncMod | function syncMod(src, dest, mode) {
if (mode !== false) {
fs.chmodSync(dest, (mode === true) ? fs.lstatSync(src).mode : mode);
}
} | javascript | function syncMod(src, dest, mode) {
if (mode !== false) {
fs.chmodSync(dest, (mode === true) ? fs.lstatSync(src).mode : mode);
}
} | [
"function",
"syncMod",
"(",
"src",
",",
"dest",
",",
"mode",
")",
"{",
"if",
"(",
"mode",
"!==",
"false",
")",
"{",
"fs",
".",
"chmodSync",
"(",
"dest",
",",
"(",
"mode",
"===",
"true",
")",
"?",
"fs",
".",
"lstatSync",
"(",
"src",
")",
".",
"m... | Copy file mode from source to destination.
@param {string} src
@param {string} dest
@param {boolean|number} mode | [
"Copy",
"file",
"mode",
"from",
"source",
"to",
"destination",
"."
] | e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc | https://github.com/google/code-prettify/blob/e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc/tasks/aliases.js#L36-L40 | train | Syncs the file mode to the destination | [
30522,
3853,
26351,
5302,
2094,
1006,
5034,
2278,
1010,
4078,
2102,
1010,
5549,
1007,
1063,
2065,
30524,
1007,
1012,
5549,
1024,
5549,
1007,
1025,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/prefer-template.js | fixNonStringBinaryExpression | function fixNonStringBinaryExpression(fixer, node) {
const topBinaryExpr = getTopConcatBinaryExpression(node.parent);
if (hasOctalEscapeSequence(topBinaryExpr)) {
return null;
}
return fixer.replaceText(topBinaryExpr, getTemplateLiteral(topBinaryExpr, null, null));
} | javascript | function fixNonStringBinaryExpression(fixer, node) {
const topBinaryExpr = getTopConcatBinaryExpression(node.parent);
if (hasOctalEscapeSequence(topBinaryExpr)) {
return null;
}
return fixer.replaceText(topBinaryExpr, getTemplateLiteral(topBinaryExpr, null, null));
} | [
"function",
"fixNonStringBinaryExpression",
"(",
"fixer",
",",
"node",
")",
"{",
"const",
"topBinaryExpr",
"=",
"getTopConcatBinaryExpression",
"(",
"node",
".",
"parent",
")",
";",
"if",
"(",
"hasOctalEscapeSequence",
"(",
"topBinaryExpr",
")",
")",
"{",
"return"... | Returns a fixer object that converts a non-string binary expression to a template literal
@param {SourceCodeFixer} fixer The fixer object
@param {ASTNode} node A node that should be converted to a template literal
@returns {Object} A fix for this binary expression | [
"Returns",
"a",
"fixer",
"object",
"that",
"converts",
"a",
"non",
"-",
"string",
"binary",
"expression",
"to",
"a",
"template",
"literal"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-template.js#L242-L250 | train | Fix non string binary expression | [
30522,
3853,
8081,
8540,
3367,
4892,
21114,
2854,
10288,
20110,
3258,
1006,
8081,
2121,
1010,
13045,
1007,
1063,
9530,
3367,
2327,
21114,
2854,
10288,
18098,
1027,
2131,
14399,
8663,
11266,
21114,
2854,
10288,
20110,
3258,
1006,
13045,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/FileTreeView.js | function (nextProps, nextState) {
return nextProps.forceRender ||
this.props.entry !== nextProps.entry ||
this.props.extensions !== nextProps.extensions;
} | javascript | function (nextProps, nextState) {
return nextProps.forceRender ||
this.props.entry !== nextProps.entry ||
this.props.extensions !== nextProps.extensions;
} | [
"function",
"(",
"nextProps",
",",
"nextState",
")",
"{",
"return",
"nextProps",
".",
"forceRender",
"||",
"this",
".",
"props",
".",
"entry",
"!==",
"nextProps",
".",
"entry",
"||",
"this",
".",
"props",
".",
"extensions",
"!==",
"nextProps",
".",
"extens... | Thanks to immutable objects, we can just do a start object identity check to know
whether or not we need to re-render. | [
"Thanks",
"to",
"immutable",
"objects",
"we",
"can",
"just",
"do",
"a",
"start",
"object",
"identity",
"check",
"to",
"know",
"whether",
"or",
"not",
"we",
"need",
"to",
"re",
"-",
"render",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeView.js#L492-L496 | train | check if the component is a duplicate of the component | [
30522,
3853,
1006,
2279,
21572,
4523,
1010,
2279,
9153,
2618,
1007,
1063,
2709,
2279,
21572,
4523,
1012,
2486,
7389,
4063,
1064,
1064,
2023,
1012,
24387,
1012,
4443,
999,
1027,
1027,
2279,
21572,
4523,
1012,
4443,
1064,
1064,
2023,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(sCalendarType) {
var mChanges;
if (this.calendarType !== sCalendarType) {
mChanges = this._collect();
this.calendarType = mChanges.calendarType = sCalendarType;
this._endCollect();
}
return this;
} | javascript | function(sCalendarType) {
var mChanges;
if (this.calendarType !== sCalendarType) {
mChanges = this._collect();
this.calendarType = mChanges.calendarType = sCalendarType;
this._endCollect();
}
return this;
} | [
"function",
"(",
"sCalendarType",
")",
"{",
"var",
"mChanges",
";",
"if",
"(",
"this",
".",
"calendarType",
"!==",
"sCalendarType",
")",
"{",
"mChanges",
"=",
"this",
".",
"_collect",
"(",
")",
";",
"this",
".",
"calendarType",
"=",
"mChanges",
".",
"cal... | Sets the new calendar type to be used from now on in locale dependent functionality (for example,
formatting, translation texts, etc.).
@param {sap.ui.core.CalendarType|null} sCalendarType the new calendar type. Set it with null to clear the calendar type
and the calendar type is calculated based on the format settings and current locale.
@return {sap.ui.core.Configuration} <code>this</code> to allow method chaining
@public
@since 1.28.6 | [
"Sets",
"the",
"new",
"calendar",
"type",
"to",
"be",
"used",
"from",
"now",
"on",
"in",
"locale",
"dependent",
"functionality",
"(",
"for",
"example",
"formatting",
"translation",
"texts",
"etc",
".",
")",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L872-L881 | train | Sets the calendar type of the object. | [
30522,
3853,
1006,
4094,
8943,
5339,
18863,
1007,
1063,
13075,
11338,
18003,
2229,
1025,
2065,
1006,
2023,
1012,
8094,
13874,
999,
1027,
1027,
4094,
8943,
5339,
18863,
1007,
1063,
11338,
18003,
2229,
1027,
2023,
1012,
1035,
8145,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/require-atomic-updates.js | getScope | function getScope(identifier) {
for (let currentNode = identifier; currentNode; currentNode = currentNode.parent) {
const scope = sourceCode.scopeManager.acquire(currentNode, true);
if (scope) {
return scope;
}
}
return null;
} | javascript | function getScope(identifier) {
for (let currentNode = identifier; currentNode; currentNode = currentNode.parent) {
const scope = sourceCode.scopeManager.acquire(currentNode, true);
if (scope) {
return scope;
}
}
return null;
} | [
"function",
"getScope",
"(",
"identifier",
")",
"{",
"for",
"(",
"let",
"currentNode",
"=",
"identifier",
";",
"currentNode",
";",
"currentNode",
"=",
"currentNode",
".",
"parent",
")",
"{",
"const",
"scope",
"=",
"sourceCode",
".",
"scopeManager",
".",
"acq... | Gets the variable scope around this variable reference
@param {ASTNode} identifier An `Identifier` AST node
@returns {Scope|null} An escope Scope | [
"Gets",
"the",
"variable",
"scope",
"around",
"this",
"variable",
"reference"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/require-atomic-updates.js#L48-L57 | train | Get the scope of the given identifier | [
30522,
3853,
4152,
16186,
1006,
8909,
4765,
18095,
1007,
1063,
2005,
1006,
2292,
2783,
3630,
3207,
1027,
8909,
4765,
18095,
1025,
2783,
3630,
3207,
1025,
2783,
3630,
3207,
1027,
2783,
3630,
3207,
1012,
6687,
1007,
1063,
9530,
3367,
9531,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NavigationAndHistory/main.js | _moveNext | function _moveNext() {
var $context, $next;
$context = $currentContext || $("#mrof-container #mrof-list > li.highlight");
if ($context.length > 0) {
$next = $context.next();
if ($next.length === 0) {
$next = $("#mrof-container #mrof-list > li").first();
}
if ($next.length > 0) {
$currentContext = $next;
$next.find("a.mroitem").trigger("focus");
}
} else {
//WTF! (Worse than failure). We should not get here.
$("#mrof-container #mrof-list > li > a.mroitem:visited").last().trigger("focus");
}
} | javascript | function _moveNext() {
var $context, $next;
$context = $currentContext || $("#mrof-container #mrof-list > li.highlight");
if ($context.length > 0) {
$next = $context.next();
if ($next.length === 0) {
$next = $("#mrof-container #mrof-list > li").first();
}
if ($next.length > 0) {
$currentContext = $next;
$next.find("a.mroitem").trigger("focus");
}
} else {
//WTF! (Worse than failure). We should not get here.
$("#mrof-container #mrof-list > li > a.mroitem:visited").last().trigger("focus");
}
} | [
"function",
"_moveNext",
"(",
")",
"{",
"var",
"$context",
",",
"$next",
";",
"$context",
"=",
"$currentContext",
"||",
"$",
"(",
"\"#mrof-container #mrof-list > li.highlight\"",
")",
";",
"if",
"(",
"$context",
".",
"length",
">",
"0",
")",
"{",
"$next",
"=... | Opens the next item in MROF list if pop over is visible else displays the pop over
@private | [
"Opens",
"the",
"next",
"item",
"in",
"MROF",
"list",
"if",
"pop",
"over",
"is",
"visible",
"else",
"displays",
"the",
"pop",
"over"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L479-L496 | train | Move the next item in the list | [
30522,
3853,
1035,
2693,
2638,
18413,
1006,
1007,
1063,
13075,
1002,
6123,
1010,
1002,
2279,
1025,
1002,
6123,
1027,
1002,
2783,
8663,
18209,
1064,
1064,
1002,
1006,
1000,
1001,
2720,
11253,
1011,
11661,
1001,
2720,
11253,
1011,
2862,
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... |
adobe/brackets | src/utils/ExtensionUtils.js | loadMetadata | function loadMetadata(folder) {
var packageJSONFile = FileSystem.getFileForPath(folder + "/package.json"),
disabledFile = FileSystem.getFileForPath(folder + "/.disabled"),
baseName = FileUtils.getBaseName(folder),
result = new $.Deferred(),
jsonPromise = new $.Deferred(),
disabledPromise = new $.Deferred(),
json,
disabled;
FileUtils.readAsText(packageJSONFile)
.then(function (text) {
try {
json = JSON.parse(text);
jsonPromise.resolve();
} catch (e) {
jsonPromise.reject();
}
})
.fail(jsonPromise.reject);
disabledFile.exists(function (err, exists) {
if (err) {
disabled = false;
} else {
disabled = exists;
}
var defaultDisabled = PreferencesManager.get("extensions.default.disabled");
if (Array.isArray(defaultDisabled) && defaultDisabled.indexOf(folder) !== -1) {
console.warn("Default extension has been disabled on startup: " + baseName);
disabled = true;
}
disabledPromise.resolve();
});
Async.waitForAll([jsonPromise, disabledPromise])
.always(function () {
if (!json) {
// if we don't have any metadata for the extension
// we should still create an empty one, so we can attach
// disabled property on it in case it's disabled
json = {
name: baseName
};
}
json.disabled = disabled;
result.resolve(json);
});
return result.promise();
} | javascript | function loadMetadata(folder) {
var packageJSONFile = FileSystem.getFileForPath(folder + "/package.json"),
disabledFile = FileSystem.getFileForPath(folder + "/.disabled"),
baseName = FileUtils.getBaseName(folder),
result = new $.Deferred(),
jsonPromise = new $.Deferred(),
disabledPromise = new $.Deferred(),
json,
disabled;
FileUtils.readAsText(packageJSONFile)
.then(function (text) {
try {
json = JSON.parse(text);
jsonPromise.resolve();
} catch (e) {
jsonPromise.reject();
}
})
.fail(jsonPromise.reject);
disabledFile.exists(function (err, exists) {
if (err) {
disabled = false;
} else {
disabled = exists;
}
var defaultDisabled = PreferencesManager.get("extensions.default.disabled");
if (Array.isArray(defaultDisabled) && defaultDisabled.indexOf(folder) !== -1) {
console.warn("Default extension has been disabled on startup: " + baseName);
disabled = true;
}
disabledPromise.resolve();
});
Async.waitForAll([jsonPromise, disabledPromise])
.always(function () {
if (!json) {
// if we don't have any metadata for the extension
// we should still create an empty one, so we can attach
// disabled property on it in case it's disabled
json = {
name: baseName
};
}
json.disabled = disabled;
result.resolve(json);
});
return result.promise();
} | [
"function",
"loadMetadata",
"(",
"folder",
")",
"{",
"var",
"packageJSONFile",
"=",
"FileSystem",
".",
"getFileForPath",
"(",
"folder",
"+",
"\"/package.json\"",
")",
",",
"disabledFile",
"=",
"FileSystem",
".",
"getFileForPath",
"(",
"folder",
"+",
"\"/.disabled\... | Loads the package.json file in the given extension folder as well as any additional
metadata.
If there's a .disabled file in the extension directory, then the content of package.json
will be augmented with disabled property set to true. It will override whatever value of
disabled might be set.
@param {string} folder The extension folder.
@return {$.Promise} A promise object that is resolved with the parsed contents of the package.json file,
or rejected if there is no package.json with the boolean indicating whether .disabled file exists. | [
"Loads",
"the",
"package",
".",
"json",
"file",
"in",
"the",
"given",
"extension",
"folder",
"as",
"well",
"as",
"any",
"additional",
"metadata",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ExtensionUtils.js#L241-L289 | train | Load metadata for a specific extension | [
30522,
3853,
7170,
11368,
8447,
2696,
1006,
19622,
1007,
1063,
13075,
7427,
22578,
2239,
8873,
2571,
1027,
6764,
27268,
6633,
1012,
2131,
8873,
2571,
29278,
15069,
1006,
19622,
1009,
1000,
1013,
7427,
1012,
1046,
3385,
1000,
1007,
1010,
977... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-self-assign.js | report | function report(node) {
context.report({
node,
message: "'{{name}}' is assigned to itself.",
data: {
name: sourceCode.getText(node).replace(SPACES, "")
}
});
} | javascript | function report(node) {
context.report({
node,
message: "'{{name}}' is assigned to itself.",
data: {
name: sourceCode.getText(node).replace(SPACES, "")
}
});
} | [
"function",
"report",
"(",
"node",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
",",
"message",
":",
"\"'{{name}}' is assigned to itself.\"",
",",
"data",
":",
"{",
"name",
":",
"sourceCode",
".",
"getText",
"(",
"node",
")",
".",
"replace",
"(",
... | Reports a given node as self assignments.
@param {ASTNode} node - A node to report. This is an Identifier node.
@returns {void} | [
"Reports",
"a",
"given",
"node",
"as",
"self",
"assignments",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-self-assign.js#L201-L209 | train | Report a node as an error. | [
30522,
3853,
3189,
1006,
13045,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
30524,
1012,
5672,
1006,
7258,
1010,
1000,
1000,
1007,
1065,
1065,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/MainViewManager.js | _saveViewState | function _saveViewState() {
function _computeSplitPercentage() {
var available,
used;
if (getPaneCount() === 1) {
// just short-circuit here and
// return 100% to avoid any rounding issues
return 1;
} else {
if (_orientation === VERTICAL) {
available = _$el.innerWidth();
used = _panes[FIRST_PANE].$el.width();
} else {
available = _$el.innerHeight();
used = _panes[FIRST_PANE].$el.height();
}
return used / available;
}
}
var projectRoot = ProjectManager.getProjectRoot(),
context = { location : { scope: "user",
layer: "project",
layerID: projectRoot.fullPath } },
state = {
orientation: _orientation,
activePaneId: getActivePaneId(),
splitPercentage: _computeSplitPercentage(),
panes: {
}
};
if (!projectRoot) {
return;
}
_.forEach(_panes, function (pane) {
state.panes[pane.id] = pane.saveState();
});
PreferencesManager.setViewState(PREFS_NAME, state, context);
} | javascript | function _saveViewState() {
function _computeSplitPercentage() {
var available,
used;
if (getPaneCount() === 1) {
// just short-circuit here and
// return 100% to avoid any rounding issues
return 1;
} else {
if (_orientation === VERTICAL) {
available = _$el.innerWidth();
used = _panes[FIRST_PANE].$el.width();
} else {
available = _$el.innerHeight();
used = _panes[FIRST_PANE].$el.height();
}
return used / available;
}
}
var projectRoot = ProjectManager.getProjectRoot(),
context = { location : { scope: "user",
layer: "project",
layerID: projectRoot.fullPath } },
state = {
orientation: _orientation,
activePaneId: getActivePaneId(),
splitPercentage: _computeSplitPercentage(),
panes: {
}
};
if (!projectRoot) {
return;
}
_.forEach(_panes, function (pane) {
state.panes[pane.id] = pane.saveState();
});
PreferencesManager.setViewState(PREFS_NAME, state, context);
} | [
"function",
"_saveViewState",
"(",
")",
"{",
"function",
"_computeSplitPercentage",
"(",
")",
"{",
"var",
"available",
",",
"used",
";",
"if",
"(",
"getPaneCount",
"(",
")",
"===",
"1",
")",
"{",
"// just short-circuit here and",
"// return 100% to avoid any roundi... | Saves the workingset state
@private | [
"Saves",
"the",
"workingset",
"state"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1567-L1612 | train | Save the state of the view | [
30522,
3853,
1035,
3828,
8584,
9153,
2618,
1006,
1007,
1063,
3853,
1035,
24134,
13102,
15909,
4842,
13013,
4270,
1006,
1007,
1063,
13075,
2800,
1010,
2109,
1025,
2065,
1006,
2131,
9739,
8586,
21723,
1006,
1007,
1027,
1027,
1027,
1015,
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... |
ecomfe/zrender | src/Painter.js | function (zlevel) {
var layers = this._layers;
var zlevelList = this._zlevelList;
var layer = layers[zlevel];
if (!layer) {
return;
}
layer.dom.parentNode.removeChild(layer.dom);
delete layers[zlevel];
zlevelList.splice(util.indexOf(zlevelList, zlevel), 1);
} | javascript | function (zlevel) {
var layers = this._layers;
var zlevelList = this._zlevelList;
var layer = layers[zlevel];
if (!layer) {
return;
}
layer.dom.parentNode.removeChild(layer.dom);
delete layers[zlevel];
zlevelList.splice(util.indexOf(zlevelList, zlevel), 1);
} | [
"function",
"(",
"zlevel",
")",
"{",
"var",
"layers",
"=",
"this",
".",
"_layers",
";",
"var",
"zlevelList",
"=",
"this",
".",
"_zlevelList",
";",
"var",
"layer",
"=",
"layers",
"[",
"zlevel",
"]",
";",
"if",
"(",
"!",
"layer",
")",
"{",
"return",
... | 删除指定层
@param {number} zlevel 层所在的zlevel | [
"删除指定层"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/Painter.js#L818-L829 | train | Remove a log file layer | [
30522,
3853,
1006,
1062,
20414,
2884,
1007,
1063,
13075,
9014,
1027,
2023,
1012,
1035,
9014,
1025,
13075,
1062,
20414,
13348,
3367,
1027,
2023,
1012,
1035,
1062,
20414,
13348,
3367,
1025,
13075,
6741,
1027,
9014,
1031,
1062,
20414,
2884,
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.table/src/sap/ui/table/TableScrollExtension.js | function(oEvent) {
// For interaction detection.
Interaction.notifyScrollEvent && Interaction.notifyScrollEvent(oEvent);
if (internal(this).bIsScrolledVerticallyByKeyboard) {
// When scrolling with the keyboard the first visible row is already correct and does not need adjustment.
log("Vertical scroll event handler: Aborted - Scrolled by keyboard", this);
return;
}
// Do not scroll in action mode, if scrolling was not initiated by a keyboard action!
// Might cause loss of user input and other undesired behavior.
this._getKeyboardExtension().setActionMode(false);
var nNewScrollTop = oEvent.target.scrollTop; // Can be a float if zoomed in Chrome.
var nOldScrollTop = oEvent.target._scrollTop; // This will be set in VerticalScrollingHelper#updateScrollPosition.
var bScrollWithScrollbar = nNewScrollTop !== nOldScrollTop;
if (bScrollWithScrollbar) {
log("Vertical scroll event handler: Scroll position changed by scrolling with the scrollbar:"
+ " From " + internal(this).nVerticalScrollPosition + " to " + nNewScrollTop, this);
delete oEvent.target._scrollTop;
VerticalScrollingHelper.updateScrollPosition(this, nNewScrollTop, ScrollTrigger.SCROLLBAR);
} else {
log("Vertical scroll event handler: Scroll position changed by scrolling with VerticalScrollingHelper#updateScrollPosition", this);
}
internal(this).bIsScrolledVerticallyByWheel = false;
} | javascript | function(oEvent) {
// For interaction detection.
Interaction.notifyScrollEvent && Interaction.notifyScrollEvent(oEvent);
if (internal(this).bIsScrolledVerticallyByKeyboard) {
// When scrolling with the keyboard the first visible row is already correct and does not need adjustment.
log("Vertical scroll event handler: Aborted - Scrolled by keyboard", this);
return;
}
// Do not scroll in action mode, if scrolling was not initiated by a keyboard action!
// Might cause loss of user input and other undesired behavior.
this._getKeyboardExtension().setActionMode(false);
var nNewScrollTop = oEvent.target.scrollTop; // Can be a float if zoomed in Chrome.
var nOldScrollTop = oEvent.target._scrollTop; // This will be set in VerticalScrollingHelper#updateScrollPosition.
var bScrollWithScrollbar = nNewScrollTop !== nOldScrollTop;
if (bScrollWithScrollbar) {
log("Vertical scroll event handler: Scroll position changed by scrolling with the scrollbar:"
+ " From " + internal(this).nVerticalScrollPosition + " to " + nNewScrollTop, this);
delete oEvent.target._scrollTop;
VerticalScrollingHelper.updateScrollPosition(this, nNewScrollTop, ScrollTrigger.SCROLLBAR);
} else {
log("Vertical scroll event handler: Scroll position changed by scrolling with VerticalScrollingHelper#updateScrollPosition", this);
}
internal(this).bIsScrolledVerticallyByWheel = false;
} | [
"function",
"(",
"oEvent",
")",
"{",
"// For interaction detection.",
"Interaction",
".",
"notifyScrollEvent",
"&&",
"Interaction",
".",
"notifyScrollEvent",
"(",
"oEvent",
")",
";",
"if",
"(",
"internal",
"(",
"this",
")",
".",
"bIsScrolledVerticallyByKeyboard",
")... | Will be called if scrolled vertically. Updates the visualized data by applying the first visible row from the vertical scrollbar.
@param {jQuery.Event} oEvent The event object. | [
"Will",
"be",
"called",
"if",
"scrolled",
"vertically",
".",
"Updates",
"the",
"visualized",
"data",
"by",
"applying",
"the",
"first",
"visible",
"row",
"from",
"the",
"vertical",
"scrollbar",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L430-L458 | train | Handles vertical scroll events. | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
1013,
1013,
2005,
8290,
10788,
1012,
8290,
1012,
2025,
8757,
11020,
28402,
18697,
3372,
1004,
1004,
8290,
1012,
2025,
8757,
11020,
28402,
18697,
3372,
1006,
1051,
18697,
3372,
1007,
1025,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.