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 sequencelengths 23 4.2k | docstring stringlengths 2 23.7k | docstring_tokens sequencelengths 1 810 | sha stringclasses 192 values | url stringlengths 90 200 | partition stringclasses 1 value | summary stringlengths 6 313 | input_ids sequencelengths 502 502 | token_type_ids sequencelengths 502 502 | attention_mask sequencelengths 502 502 | labels sequencelengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
badges/shields | services/php-version.js | numberedVersionData | function numberedVersionData(version) {
// A version has a numbered part and a modifier part
// (eg, 1.0.0-patch, 2.0.x-dev).
const parts = version.split('-')
const numbered = parts[0]
// Aliases that get caught here.
if (numbered === 'dev') {
return {
numbers: parts[1],
modifier: 5,
modifierCount: 1,
}
}
let modifierLevel = 3
let modifierLevelCount = 0
if (parts.length > 1) {
const modifier = parts[parts.length - 1]
const firstLetter = modifier.charCodeAt(0)
let modifierLevelCountString
// Modifiers: alpha < beta < RC < normal < patch < dev
if (firstLetter === 97) {
// a
modifierLevel = 0
if (/^alpha/.test(modifier)) {
modifierLevelCountString = +modifier.slice(5)
} else {
modifierLevelCountString = +modifier.slice(1)
}
} else if (firstLetter === 98) {
// b
modifierLevel = 1
if (/^beta/.test(modifier)) {
modifierLevelCountString = +modifier.slice(4)
} else {
modifierLevelCountString = +modifier.slice(1)
}
} else if (firstLetter === 82) {
// R
modifierLevel = 2
modifierLevelCountString = +modifier.slice(2)
} else if (firstLetter === 112) {
// p
modifierLevel = 4
if (/^patch/.test(modifier)) {
modifierLevelCountString = +modifier.slice(5)
} else {
modifierLevelCountString = +modifier.slice(1)
}
} else if (firstLetter === 100) {
// d
modifierLevel = 5
if (/^dev/.test(modifier)) {
modifierLevelCountString = +modifier.slice(3)
} else {
modifierLevelCountString = +modifier.slice(1)
}
}
// If we got the empty string, it defaults to a modifier count of 1.
if (!modifierLevelCountString) {
modifierLevelCount = 1
} else {
modifierLevelCount = +modifierLevelCountString
}
}
// Try to convert to a list of numbers.
function toNum(s) {
let n = +s
if (Number.isNaN(n)) {
n = 0xffffffff
}
return n
}
const numberList = numbered.split('.').map(toNum)
return {
numbers: numberList,
modifier: modifierLevel,
modifierCount: modifierLevelCount,
}
} | javascript | function numberedVersionData(version) {
// A version has a numbered part and a modifier part
// (eg, 1.0.0-patch, 2.0.x-dev).
const parts = version.split('-')
const numbered = parts[0]
// Aliases that get caught here.
if (numbered === 'dev') {
return {
numbers: parts[1],
modifier: 5,
modifierCount: 1,
}
}
let modifierLevel = 3
let modifierLevelCount = 0
if (parts.length > 1) {
const modifier = parts[parts.length - 1]
const firstLetter = modifier.charCodeAt(0)
let modifierLevelCountString
// Modifiers: alpha < beta < RC < normal < patch < dev
if (firstLetter === 97) {
// a
modifierLevel = 0
if (/^alpha/.test(modifier)) {
modifierLevelCountString = +modifier.slice(5)
} else {
modifierLevelCountString = +modifier.slice(1)
}
} else if (firstLetter === 98) {
// b
modifierLevel = 1
if (/^beta/.test(modifier)) {
modifierLevelCountString = +modifier.slice(4)
} else {
modifierLevelCountString = +modifier.slice(1)
}
} else if (firstLetter === 82) {
// R
modifierLevel = 2
modifierLevelCountString = +modifier.slice(2)
} else if (firstLetter === 112) {
// p
modifierLevel = 4
if (/^patch/.test(modifier)) {
modifierLevelCountString = +modifier.slice(5)
} else {
modifierLevelCountString = +modifier.slice(1)
}
} else if (firstLetter === 100) {
// d
modifierLevel = 5
if (/^dev/.test(modifier)) {
modifierLevelCountString = +modifier.slice(3)
} else {
modifierLevelCountString = +modifier.slice(1)
}
}
// If we got the empty string, it defaults to a modifier count of 1.
if (!modifierLevelCountString) {
modifierLevelCount = 1
} else {
modifierLevelCount = +modifierLevelCountString
}
}
// Try to convert to a list of numbers.
function toNum(s) {
let n = +s
if (Number.isNaN(n)) {
n = 0xffffffff
}
return n
}
const numberList = numbered.split('.').map(toNum)
return {
numbers: numberList,
modifier: modifierLevel,
modifierCount: modifierLevelCount,
}
} | [
"function",
"numberedVersionData",
"(",
"version",
")",
"{",
"// A version has a numbered part and a modifier part",
"// (eg, 1.0.0-patch, 2.0.x-dev).",
"const",
"parts",
"=",
"version",
".",
"split",
"(",
"'-'",
")",
"const",
"numbered",
"=",
"parts",
"[",
"0",
"]",
... | Take a version without the starting v. eg, '1.0.x-beta' Return { numbers: [1,0,something big], modifier: 2, modifierCount: 1 } | [
"Take",
"a",
"version",
"without",
"the",
"starting",
"v",
".",
"eg",
"1",
".",
"0",
".",
"x",
"-",
"beta",
"Return",
"{",
"numbers",
":",
"[",
"1",
"0",
"something",
"big",
"]",
"modifier",
":",
"2",
"modifierCount",
":",
"1",
"}"
] | 283601423f3d1a19aae83bf62032d40683948636 | https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/services/php-version.js#L29-L114 | train | Returns the data for a numbered version. | [
30522,
3853,
8597,
27774,
2850,
2696,
1006,
2544,
1007,
1063,
1013,
1013,
1037,
2544,
2038,
1037,
8597,
2112,
1998,
1037,
16913,
18095,
2112,
1013,
1013,
1006,
1041,
2290,
1010,
1015,
1012,
1014,
1012,
1014,
1011,
8983,
1010,
1016,
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/switch-colon-spacing.js | commentsExistBetween | function commentsExistBetween(left, right) {
return sourceCode.getFirstTokenBetween(
left,
right,
{
includeComments: true,
filter: astUtils.isCommentToken
}
) !== null;
} | javascript | function commentsExistBetween(left, right) {
return sourceCode.getFirstTokenBetween(
left,
right,
{
includeComments: true,
filter: astUtils.isCommentToken
}
) !== null;
} | [
"function",
"commentsExistBetween",
"(",
"left",
",",
"right",
")",
"{",
"return",
"sourceCode",
".",
"getFirstTokenBetween",
"(",
"left",
",",
"right",
",",
"{",
"includeComments",
":",
"true",
",",
"filter",
":",
"astUtils",
".",
"isCommentToken",
"}",
")",
... | Check whether comments exist between the given 2 tokens.
@param {Token} left The left token to check.
@param {Token} right The right token to check.
@returns {boolean} `true` if comments exist between the given 2 tokens. | [
"Check",
"whether",
"comments",
"exist",
"between",
"the",
"given",
"2",
"tokens",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/switch-colon-spacing.js#L87-L96 | train | Check if comments exist between two tokens | [
30522,
3853,
7928,
10288,
2923,
20915,
28394,
2078,
1006,
2187,
1010,
2157,
1007,
1063,
2709,
3120,
16044,
1012,
2131,
8873,
12096,
18715,
2368,
20915,
28394,
2078,
1006,
2187,
1010,
2157,
1010,
1063,
2421,
9006,
8163,
1024,
2995,
1010,
113... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Agents/GotoAgent.js | _makeHTMLTarget | function _makeHTMLTarget(targets, node) {
if (node.location) {
var url = DOMAgent.url;
var location = node.location;
if (node.canHaveChildren()) {
location += node.length;
}
url += ":" + location;
var name = "<" + node.name + ">";
var file = _fileFromURL(url);
targets.push({"type": "html", "url": url, "name": name, "file": file});
}
} | javascript | function _makeHTMLTarget(targets, node) {
if (node.location) {
var url = DOMAgent.url;
var location = node.location;
if (node.canHaveChildren()) {
location += node.length;
}
url += ":" + location;
var name = "<" + node.name + ">";
var file = _fileFromURL(url);
targets.push({"type": "html", "url": url, "name": name, "file": file});
}
} | [
"function",
"_makeHTMLTarget",
"(",
"targets",
",",
"node",
")",
"{",
"if",
"(",
"node",
".",
"location",
")",
"{",
"var",
"url",
"=",
"DOMAgent",
".",
"url",
";",
"var",
"location",
"=",
"node",
".",
"location",
";",
"if",
"(",
"node",
".",
"canHave... | Make the given node a target for goto
@param [] targets array
@param {DOMNode} node | [
"Make",
"the",
"given",
"node",
"a",
"target",
"for",
"goto"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/GotoAgent.js#L67-L79 | train | Aliquivo HTML target | [
30522,
3853,
1035,
2191,
11039,
19968,
7559,
18150,
1006,
7889,
1010,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
3295,
1007,
1063,
13075,
24471,
2140,
1027,
14383,
4270,
3372,
1012,
24471,
2140,
1025,
13075,
3295,
1027,
13045,
1012,
3295,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laurent22/joplin | ReactNativeClient/lib/file-api.js | basicDelta | async function basicDelta(path, getDirStatFn, options) {
const outputLimit = 50;
const itemIds = await options.allItemIdsHandler();
if (!Array.isArray(itemIds)) throw new Error('Delta API not supported - local IDs must be provided');
const context = basicDeltaContextFromOptions_(options);
let newContext = {
timestamp: context.timestamp,
filesAtTimestamp: context.filesAtTimestamp.slice(),
statsCache: context.statsCache,
statIdsCache: context.statIdsCache,
deletedItemsProcessed: context.deletedItemsProcessed,
};
// Stats are cached until all items have been processed (until hasMore is false)
if (newContext.statsCache === null) {
newContext.statsCache = await getDirStatFn(path);
newContext.statsCache.sort(function(a, b) {
return a.updated_time - b.updated_time;
});
newContext.statIdsCache = newContext.statsCache
.filter(item => BaseItem.isSystemPath(item.path))
.map(item => BaseItem.pathToId(item.path));
newContext.statIdsCache.sort(); // Items must be sorted to use binary search below
}
let output = [];
// Find out which files have been changed since the last time. Note that we keep
// both the timestamp of the most recent change, *and* the items that exactly match
// this timestamp. This to handle cases where an item is modified while this delta
// function is running. For example:
// t0: Item 1 is changed
// t0: Sync items - run delta function
// t0: While delta() is running, modify Item 2
// Since item 2 was modified within the same millisecond, it would be skipped in the
// next sync if we relied exclusively on a timestamp.
for (let i = 0; i < newContext.statsCache.length; i++) {
const stat = newContext.statsCache[i];
if (stat.isDir) continue;
if (stat.updated_time < context.timestamp) continue;
// Special case for items that exactly match the timestamp
if (stat.updated_time === context.timestamp) {
if (context.filesAtTimestamp.indexOf(stat.path) >= 0) continue;
}
if (stat.updated_time > newContext.timestamp) {
newContext.timestamp = stat.updated_time;
newContext.filesAtTimestamp = [];
}
newContext.filesAtTimestamp.push(stat.path);
output.push(stat);
if (output.length >= outputLimit) break;
}
if (!newContext.deletedItemsProcessed) {
// Find out which items have been deleted on the sync target by comparing the items
// we have to the items on the target.
// Note that when deleted items are processed it might result in the output having
// more items than outputLimit. This is acceptable since delete operations are cheap.
let deletedItems = [];
for (let i = 0; i < itemIds.length; i++) {
const itemId = itemIds[i];
if (ArrayUtils.binarySearch(newContext.statIdsCache, itemId) < 0) {
deletedItems.push({
path: BaseItem.systemPath(itemId),
isDeleted: true,
});
}
}
output = output.concat(deletedItems);
}
newContext.deletedItemsProcessed = true;
const hasMore = output.length >= outputLimit;
if (!hasMore) {
// Clear temporary info from context. It's especially important to remove deletedItemsProcessed
// so that they are processed again on the next sync.
newContext.statsCache = null;
newContext.statIdsCache = null;
delete newContext.deletedItemsProcessed;
}
return {
hasMore: hasMore,
context: newContext,
items: output,
};
} | javascript | async function basicDelta(path, getDirStatFn, options) {
const outputLimit = 50;
const itemIds = await options.allItemIdsHandler();
if (!Array.isArray(itemIds)) throw new Error('Delta API not supported - local IDs must be provided');
const context = basicDeltaContextFromOptions_(options);
let newContext = {
timestamp: context.timestamp,
filesAtTimestamp: context.filesAtTimestamp.slice(),
statsCache: context.statsCache,
statIdsCache: context.statIdsCache,
deletedItemsProcessed: context.deletedItemsProcessed,
};
// Stats are cached until all items have been processed (until hasMore is false)
if (newContext.statsCache === null) {
newContext.statsCache = await getDirStatFn(path);
newContext.statsCache.sort(function(a, b) {
return a.updated_time - b.updated_time;
});
newContext.statIdsCache = newContext.statsCache
.filter(item => BaseItem.isSystemPath(item.path))
.map(item => BaseItem.pathToId(item.path));
newContext.statIdsCache.sort(); // Items must be sorted to use binary search below
}
let output = [];
// Find out which files have been changed since the last time. Note that we keep
// both the timestamp of the most recent change, *and* the items that exactly match
// this timestamp. This to handle cases where an item is modified while this delta
// function is running. For example:
// t0: Item 1 is changed
// t0: Sync items - run delta function
// t0: While delta() is running, modify Item 2
// Since item 2 was modified within the same millisecond, it would be skipped in the
// next sync if we relied exclusively on a timestamp.
for (let i = 0; i < newContext.statsCache.length; i++) {
const stat = newContext.statsCache[i];
if (stat.isDir) continue;
if (stat.updated_time < context.timestamp) continue;
// Special case for items that exactly match the timestamp
if (stat.updated_time === context.timestamp) {
if (context.filesAtTimestamp.indexOf(stat.path) >= 0) continue;
}
if (stat.updated_time > newContext.timestamp) {
newContext.timestamp = stat.updated_time;
newContext.filesAtTimestamp = [];
}
newContext.filesAtTimestamp.push(stat.path);
output.push(stat);
if (output.length >= outputLimit) break;
}
if (!newContext.deletedItemsProcessed) {
// Find out which items have been deleted on the sync target by comparing the items
// we have to the items on the target.
// Note that when deleted items are processed it might result in the output having
// more items than outputLimit. This is acceptable since delete operations are cheap.
let deletedItems = [];
for (let i = 0; i < itemIds.length; i++) {
const itemId = itemIds[i];
if (ArrayUtils.binarySearch(newContext.statIdsCache, itemId) < 0) {
deletedItems.push({
path: BaseItem.systemPath(itemId),
isDeleted: true,
});
}
}
output = output.concat(deletedItems);
}
newContext.deletedItemsProcessed = true;
const hasMore = output.length >= outputLimit;
if (!hasMore) {
// Clear temporary info from context. It's especially important to remove deletedItemsProcessed
// so that they are processed again on the next sync.
newContext.statsCache = null;
newContext.statIdsCache = null;
delete newContext.deletedItemsProcessed;
}
return {
hasMore: hasMore,
context: newContext,
items: output,
};
} | [
"async",
"function",
"basicDelta",
"(",
"path",
",",
"getDirStatFn",
",",
"options",
")",
"{",
"const",
"outputLimit",
"=",
"50",
";",
"const",
"itemIds",
"=",
"await",
"options",
".",
"allItemIdsHandler",
"(",
")",
";",
"if",
"(",
"!",
"Array",
".",
"is... | This is the basic delta algorithm, which can be used in case the cloud service does not have a built-in delta API. OneDrive and Dropbox have one for example, but Nextcloud and obviously the file system do not. | [
"This",
"is",
"the",
"basic",
"delta",
"algorithm",
"which",
"can",
"be",
"used",
"in",
"case",
"the",
"cloud",
"service",
"does",
"not",
"have",
"a",
"built",
"-",
"in",
"delta",
"API",
".",
"OneDrive",
"and",
"Dropbox",
"have",
"one",
"for",
"example",... | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/ReactNativeClient/lib/file-api.js#L218-L316 | train | This function is the main entry point of the delta function. It is the main entry point of the delta function. | [
30522,
2004,
6038,
2278,
3853,
3937,
9247,
2696,
1006,
4130,
1010,
2131,
4305,
12096,
4017,
2546,
2078,
1010,
7047,
1007,
1063,
9530,
3367,
6434,
17960,
4183,
1027,
2753,
1025,
9530,
3367,
8875,
9821,
1027,
26751,
7047,
1012,
2035,
4221,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesBase.js | function (data) {
if (!data) {
return;
}
return _.union.apply(null, _.map(_.values(data), _.keys));
} | javascript | function (data) {
if (!data) {
return;
}
return _.union.apply(null, _.map(_.values(data), _.keys));
} | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"return",
";",
"}",
"return",
"_",
".",
"union",
".",
"apply",
"(",
"null",
",",
"_",
".",
"map",
"(",
"_",
".",
"values",
"(",
"data",
")",
",",
"_",
".",
"keys",
")",
")... | Retrieves the keys provided by this layer object.
@param {Object} data the preference data from the Scope | [
"Retrieves",
"the",
"keys",
"provided",
"by",
"this",
"layer",
"object",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L684-L690 | train | get a list of all the tables | [
30522,
3853,
1006,
2951,
1007,
1063,
2065,
1006,
999,
2951,
1007,
1063,
2709,
1025,
1065,
2709,
1035,
1012,
2586,
1012,
6611,
1006,
19701,
1010,
1035,
1012,
4949,
1006,
1035,
1012,
5300,
1006,
2951,
1007,
1010,
1035,
1012,
6309,
1007,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js | function (oControl) {
var sControlType = oControl.namespaceURI;
sControlType = sControlType ? sControlType + "." : ""; // add a dot if there is already a prefix
sControlType += oControl.localName;
return sControlType;
} | javascript | function (oControl) {
var sControlType = oControl.namespaceURI;
sControlType = sControlType ? sControlType + "." : ""; // add a dot if there is already a prefix
sControlType += oControl.localName;
return sControlType;
} | [
"function",
"(",
"oControl",
")",
"{",
"var",
"sControlType",
"=",
"oControl",
".",
"namespaceURI",
";",
"sControlType",
"=",
"sControlType",
"?",
"sControlType",
"+",
"\".\"",
":",
"\"\"",
";",
"// add a dot if there is already a prefix",
"sControlType",
"+=",
"oCo... | Gets the ControlType of an XML control.
@param {Element} oControl - Control in XML
@returns {string} Control type as a string, e.g. 'sap.m.Button' | [
"Gets",
"the",
"ControlType",
"of",
"an",
"XML",
"control",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L306-L312 | train | Returns the control type | [
30522,
3853,
1006,
1051,
8663,
13181,
2140,
1007,
1063,
13075,
8040,
12162,
13153,
13874,
1027,
1051,
8663,
13181,
2140,
1012,
3415,
15327,
9496,
1025,
8040,
12162,
13153,
13874,
1027,
8040,
12162,
13153,
13874,
1029,
8040,
12162,
13153,
1387... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/JSUtils/node/TernNodeDomain.js | handleGetFile | function handleGetFile(file, text) {
var next = fileCallBacks[file];
if (next) {
try {
next(null, text);
} catch (e) {
_reportError(e, file);
}
}
delete fileCallBacks[file];
} | javascript | function handleGetFile(file, text) {
var next = fileCallBacks[file];
if (next) {
try {
next(null, text);
} catch (e) {
_reportError(e, file);
}
}
delete fileCallBacks[file];
} | [
"function",
"handleGetFile",
"(",
"file",
",",
"text",
")",
"{",
"var",
"next",
"=",
"fileCallBacks",
"[",
"file",
"]",
";",
"if",
"(",
"next",
")",
"{",
"try",
"{",
"next",
"(",
"null",
",",
"text",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
... | Handle a response from the main thread providing the contents of a file
@param {string} file - the name of the file
@param {string} text - the contents of the file | [
"Handle",
"a",
"response",
"from",
"the",
"main",
"thread",
"providing",
"the",
"contents",
"of",
"a",
"file"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/node/TernNodeDomain.js#L90-L100 | train | Handle the get file callback | [
30522,
3853,
5047,
18150,
8873,
2571,
1006,
5371,
1010,
3793,
1007,
1063,
13075,
2279,
1027,
5371,
9289,
20850,
8684,
2015,
1031,
5371,
1033,
1025,
2065,
1006,
2279,
1007,
1063,
3046,
1063,
2279,
1006,
19701,
1010,
3793,
1007,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/Session.js | isOnFunctionIdentifier | function isOnFunctionIdentifier() {
// Check if we might be on function identifier of the function call.
var type = token.type,
nextToken,
localLexical,
localCursor = {line: cursor.line, ch: token.end};
if (type === "variable-2" || type === "variable" || type === "property") {
nextToken = self.getNextToken(localCursor, true);
if (nextToken && nextToken.string === "(") {
localLexical = getLexicalState(nextToken);
return localLexical;
}
}
return null;
} | javascript | function isOnFunctionIdentifier() {
// Check if we might be on function identifier of the function call.
var type = token.type,
nextToken,
localLexical,
localCursor = {line: cursor.line, ch: token.end};
if (type === "variable-2" || type === "variable" || type === "property") {
nextToken = self.getNextToken(localCursor, true);
if (nextToken && nextToken.string === "(") {
localLexical = getLexicalState(nextToken);
return localLexical;
}
}
return null;
} | [
"function",
"isOnFunctionIdentifier",
"(",
")",
"{",
"// Check if we might be on function identifier of the function call.",
"var",
"type",
"=",
"token",
".",
"type",
",",
"nextToken",
",",
"localLexical",
",",
"localCursor",
"=",
"{",
"line",
":",
"cursor",
".",
"lin... | Test if the cursor is on a function identifier
@return {Object} - lexical state if on a function identifier, null otherwise. | [
"Test",
"if",
"the",
"cursor",
"is",
"on",
"a",
"function",
"identifier"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/Session.js#L364-L381 | train | Check if the current token is on function identifier | [
30522,
3853,
11163,
2078,
11263,
27989,
5178,
16778,
8873,
2121,
1006,
1007,
1063,
1013,
1013,
4638,
2065,
2057,
2453,
2022,
2006,
3853,
8909,
4765,
18095,
1997,
1996,
3853,
2655,
1012,
13075,
2828,
1027,
19204,
1012,
2828,
1010,
2279,
1871... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tap.js | TAP13Producer | function TAP13Producer() {
/**
* Writes the TAP version to reporter output stream.
* @override
*/
this.writeVersion = function() {
println('TAP version 13');
};
/**
* Writes that test failed to reporter output stream, with error formatting.
* @override
*/
this.writeFail = function(n, test, err) {
TAPProducer.prototype.writeFail.call(this, n, test, err);
var emitYamlBlock = err.message != null || err.stack != null;
if (emitYamlBlock) {
println(indent(1) + '---');
if (err.message) {
println(indent(2) + 'message: |-');
println(err.message.replace(/^/gm, indent(3)));
}
if (err.stack) {
println(indent(2) + 'stack: |-');
println(err.stack.replace(/^/gm, indent(3)));
}
println(indent(1) + '...');
}
};
function indent(level) {
return Array(level + 1).join(' ');
}
} | javascript | function TAP13Producer() {
/**
* Writes the TAP version to reporter output stream.
* @override
*/
this.writeVersion = function() {
println('TAP version 13');
};
/**
* Writes that test failed to reporter output stream, with error formatting.
* @override
*/
this.writeFail = function(n, test, err) {
TAPProducer.prototype.writeFail.call(this, n, test, err);
var emitYamlBlock = err.message != null || err.stack != null;
if (emitYamlBlock) {
println(indent(1) + '---');
if (err.message) {
println(indent(2) + 'message: |-');
println(err.message.replace(/^/gm, indent(3)));
}
if (err.stack) {
println(indent(2) + 'stack: |-');
println(err.stack.replace(/^/gm, indent(3)));
}
println(indent(1) + '...');
}
};
function indent(level) {
return Array(level + 1).join(' ');
}
} | [
"function",
"TAP13Producer",
"(",
")",
"{",
"/**\n * Writes the TAP version to reporter output stream.\n * @override\n */",
"this",
".",
"writeVersion",
"=",
"function",
"(",
")",
"{",
"println",
"(",
"'TAP version 13'",
")",
";",
"}",
";",
"/**\n * Writes that test... | @summary
Constructs a new TAP13Producer.
@description
Produces output conforming to the TAP13 specification.
@private
@constructor
@extends TAPProducer
@see {@link https://testanything.org/tap-version-13-specification.html|Specification} | [
"@summary",
"Constructs",
"a",
"new",
"TAP13Producer",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/tap.js#L254-L287 | train | TAP13Producer - TAP13 reporter | [
30522,
3853,
11112,
17134,
21572,
8566,
17119,
1006,
1007,
1063,
1013,
1008,
1008,
1008,
7009,
1996,
11112,
2544,
2000,
6398,
6434,
5460,
1012,
1008,
1030,
2058,
15637,
1008,
1013,
2023,
1012,
4339,
27774,
1027,
3853,
1006,
1007,
1063,
6140... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/WorkspaceManager.js | triggerUpdateLayout | function triggerUpdateLayout(refreshHint) {
// Find how much space is left for the editor
var editorAreaHeight = calcAvailableHeight();
$editorHolder.height(editorAreaHeight); // affects size of "not-editor" placeholder as well
// Resize editor to fill the space
exports.trigger(EVENT_WORKSPACE_UPDATE_LAYOUT, editorAreaHeight, refreshHint);
} | javascript | function triggerUpdateLayout(refreshHint) {
// Find how much space is left for the editor
var editorAreaHeight = calcAvailableHeight();
$editorHolder.height(editorAreaHeight); // affects size of "not-editor" placeholder as well
// Resize editor to fill the space
exports.trigger(EVENT_WORKSPACE_UPDATE_LAYOUT, editorAreaHeight, refreshHint);
} | [
"function",
"triggerUpdateLayout",
"(",
"refreshHint",
")",
"{",
"// Find how much space is left for the editor",
"var",
"editorAreaHeight",
"=",
"calcAvailableHeight",
"(",
")",
";",
"$editorHolder",
".",
"height",
"(",
"editorAreaHeight",
")",
";",
"// affects size of \"n... | Calculates a new size for editor-holder and resizes it accordingly, then and dispatches the "workspaceUpdateLayout"
event. (The editors within are resized by EditorManager, in response to that event).
@param {boolean=} refreshHint true to force a complete refresh | [
"Calculates",
"a",
"new",
"size",
"for",
"editor",
"-",
"holder",
"and",
"resizes",
"it",
"accordingly",
"then",
"and",
"dispatches",
"the",
"workspaceUpdateLayout",
"event",
".",
"(",
"The",
"editors",
"within",
"are",
"resized",
"by",
"EditorManager",
"in",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/WorkspaceManager.js#L111-L119 | train | Trigger the layout update event | [
30522,
3853,
9495,
6279,
13701,
8485,
5833,
1006,
25416,
21898,
10606,
2102,
1007,
1063,
1013,
1013,
2424,
2129,
2172,
2686,
2003,
2187,
2005,
1996,
3559,
13075,
3559,
12069,
4430,
7416,
13900,
1027,
10250,
3540,
3567,
11733,
3468,
26036,
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... |
wuchangming/spy-debugger | buildin_modules/weinre/web/client/inspector.js | flushQueue | function flushQueue()
{
var queued = WebInspector.log.queued;
if (!queued)
return;
for (var i = 0; i < queued.length; ++i)
logMessage(queued[i]);
delete WebInspector.log.queued;
} | javascript | function flushQueue()
{
var queued = WebInspector.log.queued;
if (!queued)
return;
for (var i = 0; i < queued.length; ++i)
logMessage(queued[i]);
delete WebInspector.log.queued;
} | [
"function",
"flushQueue",
"(",
")",
"{",
"var",
"queued",
"=",
"WebInspector",
".",
"log",
".",
"queued",
";",
"if",
"(",
"!",
"queued",
")",
"return",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"queued",
".",
"length",
";",
"++",
"i",... | flush the queue of pending messages | [
"flush",
"the",
"queue",
"of",
"pending",
"messages"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/inspector.js#L1213-L1223 | train | Flush the queue of queued messages | [
30522,
3853,
13862,
4226,
5657,
1006,
1007,
1063,
13075,
24240,
2094,
1027,
4773,
7076,
5051,
16761,
1012,
8833,
1012,
24240,
2094,
1025,
2065,
1006,
999,
24240,
2094,
1007,
2709,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airbnb/enzyme | packages/enzyme/src/ShallowWrapper.js | makeShallowOptions | function makeShallowOptions(nodes, root, passedOptions, wrapper) {
const options = makeOptions(passedOptions);
const adapter = getAdapter(passedOptions);
privateSet(options, PROVIDER_VALUES, passedOptions[PROVIDER_VALUES]);
if (root || !isCustomComponent(options.wrappingComponent, adapter)) {
return options;
}
if (typeof adapter.wrapWithWrappingComponent !== 'function') {
throw new TypeError('your adapter does not support `wrappingComponent`. Try upgrading it!');
}
const { node: wrappedNode, RootFinder } = adapter.wrapWithWrappingComponent(nodes, options);
// eslint-disable-next-line no-use-before-define
const wrappingComponent = new WrappingComponentWrapper(wrappedNode, wrapper, RootFinder);
const {
legacyContext: wrappingComponentLegacyContext,
providerValues: wrappingComponentProviderValues,
} = getContextFromWrappingComponent(wrappingComponent, adapter);
privateSet(wrapper, WRAPPING_COMPONENT, wrappingComponent);
return {
...options,
context: {
...options.context,
...wrappingComponentLegacyContext,
},
[PROVIDER_VALUES]: wrappingComponentProviderValues,
};
} | javascript | function makeShallowOptions(nodes, root, passedOptions, wrapper) {
const options = makeOptions(passedOptions);
const adapter = getAdapter(passedOptions);
privateSet(options, PROVIDER_VALUES, passedOptions[PROVIDER_VALUES]);
if (root || !isCustomComponent(options.wrappingComponent, adapter)) {
return options;
}
if (typeof adapter.wrapWithWrappingComponent !== 'function') {
throw new TypeError('your adapter does not support `wrappingComponent`. Try upgrading it!');
}
const { node: wrappedNode, RootFinder } = adapter.wrapWithWrappingComponent(nodes, options);
// eslint-disable-next-line no-use-before-define
const wrappingComponent = new WrappingComponentWrapper(wrappedNode, wrapper, RootFinder);
const {
legacyContext: wrappingComponentLegacyContext,
providerValues: wrappingComponentProviderValues,
} = getContextFromWrappingComponent(wrappingComponent, adapter);
privateSet(wrapper, WRAPPING_COMPONENT, wrappingComponent);
return {
...options,
context: {
...options.context,
...wrappingComponentLegacyContext,
},
[PROVIDER_VALUES]: wrappingComponentProviderValues,
};
} | [
"function",
"makeShallowOptions",
"(",
"nodes",
",",
"root",
",",
"passedOptions",
",",
"wrapper",
")",
"{",
"const",
"options",
"=",
"makeOptions",
"(",
"passedOptions",
")",
";",
"const",
"adapter",
"=",
"getAdapter",
"(",
"passedOptions",
")",
";",
"private... | Makes options specifically for `ShallowWrapper`. Most of the logic here is around rendering
a `wrappingComponent` (if one was provided) and adding the child context of that component
to `options.context`.
@param {ReactElement} nodes the nodes passed to `ShallowWrapper`
@param {ShallowWrapper} root this `ShallowWrapper`'s parent. If this is passed, options are
not transformed.
@param {*} passedOptions the options passed to `ShallowWrapper`.
@param {*} wrapper the `ShallowWrapper` itself
@returns {Object} the decorated and transformed options | [
"Makes",
"options",
"specifically",
"for",
"ShallowWrapper",
".",
"Most",
"of",
"the",
"logic",
"here",
"is",
"around",
"rendering",
"a",
"wrappingComponent",
"(",
"if",
"one",
"was",
"provided",
")",
"and",
"adding",
"the",
"child",
"context",
"of",
"that",
... | cd430eae95eba151f17e970ee77c18f09476de0e | https://github.com/airbnb/enzyme/blob/cd430eae95eba151f17e970ee77c18f09476de0e/packages/enzyme/src/ShallowWrapper.js#L343-L369 | train | Creates a shallow copy of passed options | [
30522,
3853,
3084,
9892,
5004,
7361,
9285,
1006,
14164,
1010,
7117,
1010,
2979,
7361,
9285,
1010,
10236,
4842,
1007,
1063,
9530,
3367,
7047,
1027,
2191,
7361,
9285,
1006,
2979,
7361,
9285,
1007,
1025,
9530,
3367,
15581,
2121,
1027,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_theme_xml | function parse_theme_xml(data, opts) {
/* 20.1.6.9 theme CT_OfficeStyleSheet */
if(!data || data.length === 0) return parse_theme_xml(write_theme());
var t;
var themes = {};
/* themeElements CT_BaseStyles */
if(!(t=data.match(themeltregex))) throw new Error('themeElements not found in theme');
parse_themeElements(t[0], themes, opts);
return themes;
} | javascript | function parse_theme_xml(data, opts) {
/* 20.1.6.9 theme CT_OfficeStyleSheet */
if(!data || data.length === 0) return parse_theme_xml(write_theme());
var t;
var themes = {};
/* themeElements CT_BaseStyles */
if(!(t=data.match(themeltregex))) throw new Error('themeElements not found in theme');
parse_themeElements(t[0], themes, opts);
return themes;
} | [
"function",
"parse_theme_xml",
"(",
"data",
",",
"opts",
")",
"{",
"/* 20.1.6.9 theme CT_OfficeStyleSheet */",
"if",
"(",
"!",
"data",
"||",
"data",
".",
"length",
"===",
"0",
")",
"return",
"parse_theme_xml",
"(",
"write_theme",
"(",
")",
")",
";",
"var",
"... | /* 14.2.7 Theme Part | [
"/",
"*",
"14",
".",
"2",
".",
"7",
"Theme",
"Part"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L9496-L9508 | train | Parse theme XML | [
30522,
3853,
11968,
3366,
1035,
4323,
1035,
20950,
1006,
2951,
1010,
23569,
2015,
1007,
1063,
1013,
1008,
2322,
1012,
1015,
1012,
1020,
1012,
1023,
4323,
14931,
1035,
4822,
27983,
4095,
15558,
1008,
1013,
2065,
1006,
999,
2951,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sass/node-sass | lib/index.js | getStats | function getStats(options) {
var stats = {};
stats.entry = options.file || 'data';
stats.start = Date.now();
return stats;
} | javascript | function getStats(options) {
var stats = {};
stats.entry = options.file || 'data';
stats.start = Date.now();
return stats;
} | [
"function",
"getStats",
"(",
"options",
")",
"{",
"var",
"stats",
"=",
"{",
"}",
";",
"stats",
".",
"entry",
"=",
"options",
".",
"file",
"||",
"'data'",
";",
"stats",
".",
"start",
"=",
"Date",
".",
"now",
"(",
")",
";",
"return",
"stats",
";",
... | Get stats
@param {Object} options
@api private | [
"Get",
"stats"
] | 0c1a49eefa37544d16041c5fe5b2e3d9168004b7 | https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/index.js#L68-L75 | train | Get stats for a file | [
30522,
3853,
4152,
29336,
2015,
1006,
7047,
1007,
1063,
13075,
26319,
1027,
1063,
1065,
1025,
26319,
1012,
4443,
1027,
7047,
1012,
5371,
1064,
1064,
1005,
2951,
1005,
1025,
26319,
1012,
2707,
1027,
3058,
1012,
2085,
1006,
1007,
1025,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/less.js | function () {
var str, j = i, e, index = i;
if (input.charAt(j) === '~') { j++; e = true; } // Escaped strings
if (input.charAt(j) !== '"' && input.charAt(j) !== "'") { return; }
if (e) { $char('~'); }
str = $re(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
if (str) {
return new(tree.Quoted)(str[0], str[1] || str[2], e, index, env.currentFileInfo);
}
} | javascript | function () {
var str, j = i, e, index = i;
if (input.charAt(j) === '~') { j++; e = true; } // Escaped strings
if (input.charAt(j) !== '"' && input.charAt(j) !== "'") { return; }
if (e) { $char('~'); }
str = $re(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
if (str) {
return new(tree.Quoted)(str[0], str[1] || str[2], e, index, env.currentFileInfo);
}
} | [
"function",
"(",
")",
"{",
"var",
"str",
",",
"j",
"=",
"i",
",",
"e",
",",
"index",
"=",
"i",
";",
"if",
"(",
"input",
".",
"charAt",
"(",
"j",
")",
"===",
"'~'",
")",
"{",
"j",
"++",
";",
"e",
"=",
"true",
";",
"}",
"// Escaped strings",
... | A string, which supports escaping " and ' "milky way" 'he\'s the one!' | [
"A",
"string",
"which",
"supports",
"escaping",
"and",
"milky",
"way",
"he",
"\\",
"s",
"the",
"one!"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L812-L824 | train | Parse a quoted string | [
30522,
3853,
1006,
1007,
1063,
13075,
2358,
2099,
1010,
1046,
1027,
1045,
1010,
1041,
1010,
5950,
1027,
1045,
1025,
2065,
1006,
7953,
1012,
25869,
4017,
1006,
1046,
1007,
1027,
1027,
1027,
1005,
1066,
1005,
1007,
1063,
1046,
1009,
1009,
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... | |
summernote/summernote | src/js/base/core/dom.js | makePredByNodeName | function makePredByNodeName(nodeName) {
nodeName = nodeName.toUpperCase();
return function(node) {
return node && node.nodeName.toUpperCase() === nodeName;
};
} | javascript | function makePredByNodeName(nodeName) {
nodeName = nodeName.toUpperCase();
return function(node) {
return node && node.nodeName.toUpperCase() === nodeName;
};
} | [
"function",
"makePredByNodeName",
"(",
"nodeName",
")",
"{",
"nodeName",
"=",
"nodeName",
".",
"toUpperCase",
"(",
")",
";",
"return",
"function",
"(",
"node",
")",
"{",
"return",
"node",
"&&",
"node",
".",
"nodeName",
".",
"toUpperCase",
"(",
")",
"===",
... | @method makePredByNodeName
returns predicate which judge whether nodeName is same
@param {String} nodeName
@return {Function} | [
"@method",
"makePredByNodeName"
] | 8dcafb8107453006b905ef697a529c42e76beb3f | https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L41-L46 | train | Returns a function that returns true if the node is a pred | [
30522,
3853,
2191,
28139,
18939,
6038,
10244,
18442,
1006,
13045,
18442,
1007,
1063,
13045,
18442,
1027,
13045,
18442,
1012,
2000,
29547,
18992,
3366,
1006,
1007,
1025,
2709,
3853,
1006,
13045,
1007,
1063,
2709,
13045,
1004,
1004,
13045,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function() {
var oReferencedProperties = {};
for ( var i = -1, oUI5Filter; (oUI5Filter = this._aConditionUI5Filter[++i]) !== undefined;) {
if (oReferencedProperties[oUI5Filter.sPath] == undefined) {
oReferencedProperties[oUI5Filter.sPath] = [];
}
oReferencedProperties[oUI5Filter.sPath].push(oUI5Filter);
}
for ( var j = -1, aUI5Filter; (aUI5Filter = this._aUI5FilterArray[++j]) !== undefined;) {
this.getPropertiesReferencedByUI5FilterArray(aUI5Filter, oReferencedProperties);
}
return oReferencedProperties;
} | javascript | function() {
var oReferencedProperties = {};
for ( var i = -1, oUI5Filter; (oUI5Filter = this._aConditionUI5Filter[++i]) !== undefined;) {
if (oReferencedProperties[oUI5Filter.sPath] == undefined) {
oReferencedProperties[oUI5Filter.sPath] = [];
}
oReferencedProperties[oUI5Filter.sPath].push(oUI5Filter);
}
for ( var j = -1, aUI5Filter; (aUI5Filter = this._aUI5FilterArray[++j]) !== undefined;) {
this.getPropertiesReferencedByUI5FilterArray(aUI5Filter, oReferencedProperties);
}
return oReferencedProperties;
} | [
"function",
"(",
")",
"{",
"var",
"oReferencedProperties",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"-",
"1",
",",
"oUI5Filter",
";",
"(",
"oUI5Filter",
"=",
"this",
".",
"_aConditionUI5Filter",
"[",
"++",
"i",
"]",
")",
"!==",
"undefined",
"... | Get the properties referenced by the filter expression.
@returns {object} Object containing (JavaScript) properties for all (OData entity type)
properties referenced in the filter expression. The value for each of these properties is an array holding all used UI5 filters referencing them.
@private | [
"Get",
"the",
"properties",
"referenced",
"by",
"the",
"filter",
"expression",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L3310-L3324 | train | Returns the properties referenced by the filter | [
30522,
3853,
1006,
1007,
1063,
13075,
10848,
25523,
18927,
18981,
8743,
3111,
1027,
1063,
1065,
1025,
2005,
1006,
13075,
1045,
1027,
1011,
1015,
1010,
15068,
2072,
2629,
8873,
21928,
1025,
1006,
15068,
2072,
2629,
8873,
21928,
1027,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensions/default/AutoUpdate/main.js | initState | function initState() {
var result = $.Deferred();
updateJsonHandler.parse()
.done(function() {
result.resolve();
})
.fail(function (code) {
var logMsg;
switch (code) {
case StateHandlerMessages.FILE_NOT_FOUND:
logMsg = "AutoUpdate : updateHelper.json cannot be parsed, does not exist";
break;
case StateHandlerMessages.FILE_NOT_READ:
logMsg = "AutoUpdate : updateHelper.json could not be read";
break;
case StateHandlerMessages.FILE_PARSE_EXCEPTION:
logMsg = "AutoUpdate : updateHelper.json could not be parsed, exception encountered";
break;
case StateHandlerMessages.FILE_READ_FAIL:
logMsg = "AutoUpdate : updateHelper.json could not be parsed";
break;
}
console.log(logMsg);
result.reject();
});
return result.promise();
} | javascript | function initState() {
var result = $.Deferred();
updateJsonHandler.parse()
.done(function() {
result.resolve();
})
.fail(function (code) {
var logMsg;
switch (code) {
case StateHandlerMessages.FILE_NOT_FOUND:
logMsg = "AutoUpdate : updateHelper.json cannot be parsed, does not exist";
break;
case StateHandlerMessages.FILE_NOT_READ:
logMsg = "AutoUpdate : updateHelper.json could not be read";
break;
case StateHandlerMessages.FILE_PARSE_EXCEPTION:
logMsg = "AutoUpdate : updateHelper.json could not be parsed, exception encountered";
break;
case StateHandlerMessages.FILE_READ_FAIL:
logMsg = "AutoUpdate : updateHelper.json could not be parsed";
break;
}
console.log(logMsg);
result.reject();
});
return result.promise();
} | [
"function",
"initState",
"(",
")",
"{",
"var",
"result",
"=",
"$",
".",
"Deferred",
"(",
")",
";",
"updateJsonHandler",
".",
"parse",
"(",
")",
".",
"done",
"(",
"function",
"(",
")",
"{",
"result",
".",
"resolve",
"(",
")",
";",
"}",
")",
".",
"... | Initializes the state of parsed content from updateHelper.json
returns Promise Object Which is resolved when parsing is success
and rejected if parsing is failed. | [
"Initializes",
"the",
"state",
"of",
"parsed",
"content",
"from",
"updateHelper",
".",
"json",
"returns",
"Promise",
"Object",
"Which",
"is",
"resolved",
"when",
"parsing",
"is",
"success",
"and",
"rejected",
"if",
"parsing",
"is",
"failed",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L287-L313 | train | Initialize AutoUpdate state | [
30522,
3853,
1999,
12762,
12259,
1006,
1007,
1063,
13075,
2765,
1027,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
10651,
22578,
2239,
11774,
3917,
1012,
11968,
3366,
1006,
1007,
1012,
2589,
1006,
3853,
1006,
1007,
1063,
2765,
1012,
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/TableAccExtension.js | function(oExtension) {
if (oExtension._cleanupInfo) {
oExtension._cleanupInfo.cell.attr(oExtension._cleanupInfo.attr);
oExtension._cleanupInfo = null;
}
} | javascript | function(oExtension) {
if (oExtension._cleanupInfo) {
oExtension._cleanupInfo.cell.attr(oExtension._cleanupInfo.attr);
oExtension._cleanupInfo = null;
}
} | [
"function",
"(",
"oExtension",
")",
"{",
"if",
"(",
"oExtension",
".",
"_cleanupInfo",
")",
"{",
"oExtension",
".",
"_cleanupInfo",
".",
"cell",
".",
"attr",
"(",
"oExtension",
".",
"_cleanupInfo",
".",
"attr",
")",
";",
"oExtension",
".",
"_cleanupInfo",
... | /*
Removes the acc modifications of the cell which had the focus before. | [
"/",
"*",
"Removes",
"the",
"acc",
"modifications",
"of",
"the",
"cell",
"which",
"had",
"the",
"focus",
"before",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L280-L285 | train | Removes the attribute from the cell if any. | [
30522,
3853,
1006,
1051,
10288,
29048,
1007,
1063,
2065,
1006,
1051,
10288,
29048,
1012,
1035,
27686,
2378,
14876,
1007,
1063,
1051,
10288,
29048,
1012,
1035,
27686,
2378,
14876,
1012,
3526,
1012,
2012,
16344,
1006,
1051,
10288,
29048,
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... | |
openlayers/openlayers | examples/geolocation-orientation.js | getCenterWithHeading | function getCenterWithHeading(position, rotation, resolution) {
const size = map.getSize();
const height = size[1];
return [
position[0] - Math.sin(rotation) * height * resolution * 1 / 4,
position[1] + Math.cos(rotation) * height * resolution * 1 / 4
];
} | javascript | function getCenterWithHeading(position, rotation, resolution) {
const size = map.getSize();
const height = size[1];
return [
position[0] - Math.sin(rotation) * height * resolution * 1 / 4,
position[1] + Math.cos(rotation) * height * resolution * 1 / 4
];
} | [
"function",
"getCenterWithHeading",
"(",
"position",
",",
"rotation",
",",
"resolution",
")",
"{",
"const",
"size",
"=",
"map",
".",
"getSize",
"(",
")",
";",
"const",
"height",
"=",
"size",
"[",
"1",
"]",
";",
"return",
"[",
"position",
"[",
"0",
"]",... | recenters the view by putting the given coordinates at 3/4 from the top or the screen | [
"recenters",
"the",
"view",
"by",
"putting",
"the",
"given",
"coordinates",
"at",
"3",
"/",
"4",
"from",
"the",
"top",
"or",
"the",
"screen"
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/geolocation-orientation.js#L128-L136 | train | Get center of the block with heading | [
30522,
3853,
2131,
13013,
2121,
24415,
4974,
2075,
1006,
2597,
1010,
9963,
1010,
5813,
1007,
1063,
9530,
3367,
2946,
1027,
4949,
1012,
4152,
4697,
1006,
1007,
1025,
9530,
3367,
4578,
1027,
2946,
1031,
1015,
1033,
1025,
2709,
1031,
2597,
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/project/FileViewController.js | openAndSelectDocument | function openAndSelectDocument(fullPath, fileSelectionFocus, paneId) {
var result,
curDocChangedDueToMe = _curDocChangedDueToMe;
function _getDerivedPaneContext() {
function _secondPaneContext() {
return (window.event.ctrlKey || window.event.metaKey) && window.event.altKey ? MainViewManager.SECOND_PANE : null;
}
function _firstPaneContext() {
return (window.event.ctrlKey || window.event.metaKey) ? MainViewManager.FIRST_PANE : null;
}
return window.event && (_secondPaneContext() || _firstPaneContext());
}
if (fileSelectionFocus !== PROJECT_MANAGER && fileSelectionFocus !== WORKING_SET_VIEW) {
console.error("Bad parameter passed to FileViewController.openAndSelectDocument");
return;
}
// Opening files are asynchronous and we want to know when this function caused a file
// to open so that _fileSelectionFocus is set appropriatly. _curDocChangedDueToMe is set here
// and checked in the currentFileChange handler
_curDocChangedDueToMe = true;
_fileSelectionFocus = fileSelectionFocus;
paneId = (paneId || _getDerivedPaneContext() || MainViewManager.ACTIVE_PANE);
// If fullPath corresonds to the current doc being viewed then opening the file won't
// trigger a currentFileChange event, so we need to trigger a documentSelectionFocusChange
// in this case to signify the selection focus has changed even though the current document has not.
var currentPath = MainViewManager.getCurrentlyViewedPath(paneId);
if (currentPath === fullPath) {
_activatePane(paneId);
result = (new $.Deferred()).resolve().promise();
} else {
result = CommandManager.execute(Commands.FILE_OPEN, {fullPath: fullPath,
paneId: paneId});
}
// clear after notification is done
result.always(function () {
_curDocChangedDueToMe = curDocChangedDueToMe;
});
return result;
} | javascript | function openAndSelectDocument(fullPath, fileSelectionFocus, paneId) {
var result,
curDocChangedDueToMe = _curDocChangedDueToMe;
function _getDerivedPaneContext() {
function _secondPaneContext() {
return (window.event.ctrlKey || window.event.metaKey) && window.event.altKey ? MainViewManager.SECOND_PANE : null;
}
function _firstPaneContext() {
return (window.event.ctrlKey || window.event.metaKey) ? MainViewManager.FIRST_PANE : null;
}
return window.event && (_secondPaneContext() || _firstPaneContext());
}
if (fileSelectionFocus !== PROJECT_MANAGER && fileSelectionFocus !== WORKING_SET_VIEW) {
console.error("Bad parameter passed to FileViewController.openAndSelectDocument");
return;
}
// Opening files are asynchronous and we want to know when this function caused a file
// to open so that _fileSelectionFocus is set appropriatly. _curDocChangedDueToMe is set here
// and checked in the currentFileChange handler
_curDocChangedDueToMe = true;
_fileSelectionFocus = fileSelectionFocus;
paneId = (paneId || _getDerivedPaneContext() || MainViewManager.ACTIVE_PANE);
// If fullPath corresonds to the current doc being viewed then opening the file won't
// trigger a currentFileChange event, so we need to trigger a documentSelectionFocusChange
// in this case to signify the selection focus has changed even though the current document has not.
var currentPath = MainViewManager.getCurrentlyViewedPath(paneId);
if (currentPath === fullPath) {
_activatePane(paneId);
result = (new $.Deferred()).resolve().promise();
} else {
result = CommandManager.execute(Commands.FILE_OPEN, {fullPath: fullPath,
paneId: paneId});
}
// clear after notification is done
result.always(function () {
_curDocChangedDueToMe = curDocChangedDueToMe;
});
return result;
} | [
"function",
"openAndSelectDocument",
"(",
"fullPath",
",",
"fileSelectionFocus",
",",
"paneId",
")",
"{",
"var",
"result",
",",
"curDocChangedDueToMe",
"=",
"_curDocChangedDueToMe",
";",
"function",
"_getDerivedPaneContext",
"(",
")",
"{",
"function",
"_secondPaneContex... | Opens a document if it's not open and selects the file in the UI corresponding to
fileSelectionFocus
@param {!fullPath} fullPath - full path of the document to open
@param {string} fileSelectionFocus - (WORKING_SET_VIEW || PROJECT_MANAGER)
@param {string} paneId - pane in which to open the document
@return {$.Promise} | [
"Opens",
"a",
"document",
"if",
"it",
"s",
"not",
"open",
"and",
"selects",
"the",
"file",
"in",
"the",
"UI",
"corresponding",
"to",
"fileSelectionFocus"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileViewController.js#L145-L195 | train | Open a file and select a document in the specified pane | [
30522,
3853,
2330,
29560,
12260,
6593,
3527,
24894,
4765,
1006,
2440,
15069,
1010,
6764,
12260,
7542,
14876,
7874,
1010,
6090,
7416,
2094,
1007,
1063,
13075,
2765,
1010,
12731,
20683,
9468,
18003,
22367,
23361,
8462,
1027,
1035,
12731,
20683,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 5