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
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 = "&lt;" + node.name + "&gt;"; 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 = "&lt;" + node.name + "&gt;"; 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...
adobe/brackets
src/LiveDevelopment/Agents/DOMAgent.js
_onLoadEventFired
function _onLoadEventFired(event, res) { // res = {timestamp} Inspector.DOM.getDocument(function onGetDocument(res) { exports.trigger("getDocument", res); // res = {root} _idToNode = {}; _pendingRequests = 0; exports.root = new DOMNode(exports, res.root); }); }
javascript
function _onLoadEventFired(event, res) { // res = {timestamp} Inspector.DOM.getDocument(function onGetDocument(res) { exports.trigger("getDocument", res); // res = {root} _idToNode = {}; _pendingRequests = 0; exports.root = new DOMNode(exports, res.root); }); }
[ "function", "_onLoadEventFired", "(", "event", ",", "res", ")", "{", "// res = {timestamp}", "Inspector", ".", "DOM", ".", "getDocument", "(", "function", "onGetDocument", "(", "res", ")", "{", "exports", ".", "trigger", "(", "\"getDocument\"", ",", "res", ")"...
WebInspector Event: Page.loadEventFired
[ "WebInspector", "Event", ":", "Page", ".", "loadEventFired" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMAgent.js#L184-L193
train
Load event fired
[ 30522, 3853, 1035, 2006, 11066, 18697, 3372, 10273, 2094, 1006, 2724, 1010, 24501, 1007, 1063, 1013, 1013, 24501, 1027, 1063, 2335, 15464, 2361, 1065, 7742, 1012, 14383, 1012, 2131, 3527, 24894, 4765, 1006, 3853, 2006, 18150, 3527, 24894, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-return-await.js
isInTailCallPosition
function isInTailCallPosition(node) { if (node.parent.type === "ArrowFunctionExpression") { return true; } if (node.parent.type === "ReturnStatement") { return !hasErrorHandler(node.parent); } if (node.parent.type === "ConditionalExpression" && (node === node.parent.consequent || node === node.parent.alternate)) { return isInTailCallPosition(node.parent); } if (node.parent.type === "LogicalExpression" && node === node.parent.right) { return isInTailCallPosition(node.parent); } if (node.parent.type === "SequenceExpression" && node === node.parent.expressions[node.parent.expressions.length - 1]) { return isInTailCallPosition(node.parent); } return false; }
javascript
function isInTailCallPosition(node) { if (node.parent.type === "ArrowFunctionExpression") { return true; } if (node.parent.type === "ReturnStatement") { return !hasErrorHandler(node.parent); } if (node.parent.type === "ConditionalExpression" && (node === node.parent.consequent || node === node.parent.alternate)) { return isInTailCallPosition(node.parent); } if (node.parent.type === "LogicalExpression" && node === node.parent.right) { return isInTailCallPosition(node.parent); } if (node.parent.type === "SequenceExpression" && node === node.parent.expressions[node.parent.expressions.length - 1]) { return isInTailCallPosition(node.parent); } return false; }
[ "function", "isInTailCallPosition", "(", "node", ")", "{", "if", "(", "node", ".", "parent", ".", "type", "===", "\"ArrowFunctionExpression\"", ")", "{", "return", "true", ";", "}", "if", "(", "node", ".", "parent", ".", "type", "===", "\"ReturnStatement\"",...
Checks if a node is placed in tail call position. Once `return` arguments (or arrow function expressions) can be a complex expression, an `await` expression could or could not be unnecessary by the definition of this rule. So we're looking for `await` expressions that are in tail position. @param {ASTNode} node A node representing the `await` expression to check @returns {boolean} The checking result
[ "Checks", "if", "a", "node", "is", "placed", "in", "tail", "call", "position", ".", "Once", "return", "arguments", "(", "or", "arrow", "function", "expressions", ")", "can", "be", "a", "complex", "expression", "an", "await", "expression", "could", "or", "c...
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-return-await.js#L74-L91
train
Check if a node is in the tail of the call
[ 30522, 3853, 2003, 18447, 12502, 9289, 14277, 19234, 1006, 13045, 1007, 1063, 2065, 1006, 13045, 1012, 6687, 1012, 2828, 1027, 1027, 1027, 1000, 8612, 11263, 27989, 10288, 20110, 3258, 1000, 1007, 1063, 2709, 2995, 1025, 1065, 2065, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mjmlio/mjml
packages/mjml-validator/src/dependencies.js
mergeArrays
function mergeArrays(objValue, srcValue) { if (isArray(objValue) && isArray(srcValue)) { return objValue.concat(srcValue) } }
javascript
function mergeArrays(objValue, srcValue) { if (isArray(objValue) && isArray(srcValue)) { return objValue.concat(srcValue) } }
[ "function", "mergeArrays", "(", "objValue", ",", "srcValue", ")", "{", "if", "(", "isArray", "(", "objValue", ")", "&&", "isArray", "(", "srcValue", ")", ")", "{", "return", "objValue", ".", "concat", "(", "srcValue", ")", "}", "}" ]
eslint-disable-next-line consistent-return
[ "eslint", "-", "disable", "-", "next", "-", "line", "consistent", "-", "return" ]
50e0505ef0377c13e7989a699b4c3c264faf4c0f
https://github.com/mjmlio/mjml/blob/50e0505ef0377c13e7989a699b4c3c264faf4c0f/packages/mjml-validator/src/dependencies.js#L4-L8
train
Merge two arrays
[ 30522, 3853, 13590, 2906, 9447, 2015, 1006, 27885, 3501, 10175, 5657, 1010, 5034, 2278, 10175, 5657, 1007, 1063, 2065, 1006, 18061, 11335, 2100, 1006, 27885, 3501, 10175, 5657, 1007, 1004, 1004, 18061, 11335, 2100, 1006, 5034, 2278, 10175, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dequelabs/axe-core
lib/core/utils/get-selector.js
generateSelector
function generateSelector(elm, options, doc) { /*eslint no-loop-func:0*/ if (!axe._selectorData) { throw new Error('Expect axe._selectorData to be set up'); } const { toRoot = false } = options; let selector; let similar; /** * Try to find a unique selector by filtering out all the clashing * nodes by adding ancestor selectors iteratively. * This loop is much faster than recursing and using querySelectorAll */ do { let features = getElmId(elm); if (!features) { features = getThreeLeastCommonFeatures(elm, axe._selectorData); features += getNthChildString(elm, features); } if (selector) { selector = features + ' > ' + selector; } else { selector = features; } if (!similar) { similar = Array.from(doc.querySelectorAll(selector)); } else { similar = similar.filter(item => { return axe.utils.matchesSelector(item, selector); }); } elm = elm.parentElement; } while ((similar.length > 1 || toRoot) && elm && elm.nodeType !== 11); if (similar.length === 1) { return selector; } else if (selector.indexOf(' > ') !== -1) { // For the odd case that document doesn't have a unique selector return ':root' + selector.substring(selector.indexOf(' > ')); } return ':root'; }
javascript
function generateSelector(elm, options, doc) { /*eslint no-loop-func:0*/ if (!axe._selectorData) { throw new Error('Expect axe._selectorData to be set up'); } const { toRoot = false } = options; let selector; let similar; /** * Try to find a unique selector by filtering out all the clashing * nodes by adding ancestor selectors iteratively. * This loop is much faster than recursing and using querySelectorAll */ do { let features = getElmId(elm); if (!features) { features = getThreeLeastCommonFeatures(elm, axe._selectorData); features += getNthChildString(elm, features); } if (selector) { selector = features + ' > ' + selector; } else { selector = features; } if (!similar) { similar = Array.from(doc.querySelectorAll(selector)); } else { similar = similar.filter(item => { return axe.utils.matchesSelector(item, selector); }); } elm = elm.parentElement; } while ((similar.length > 1 || toRoot) && elm && elm.nodeType !== 11); if (similar.length === 1) { return selector; } else if (selector.indexOf(' > ') !== -1) { // For the odd case that document doesn't have a unique selector return ':root' + selector.substring(selector.indexOf(' > ')); } return ':root'; }
[ "function", "generateSelector", "(", "elm", ",", "options", ",", "doc", ")", "{", "/*eslint no-loop-func:0*/", "if", "(", "!", "axe", ".", "_selectorData", ")", "{", "throw", "new", "Error", "(", "'Expect axe._selectorData to be set up'", ")", ";", "}", "const",...
generates a single selector for an element @param {Element} elm The element for which to generate a selector @param {Object} options Options for how to generate the selector @param {RootNode} doc The root node of the document or document fragment @returns {String} The selector
[ "generates", "a", "single", "selector", "for", "an", "element" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/get-selector.js#L336-L378
train
Generates a unique selector for the given element
[ 30522, 3853, 19421, 12260, 16761, 1006, 17709, 1010, 7047, 1010, 9986, 1007, 1063, 1013, 1008, 9686, 4115, 2102, 2053, 1011, 7077, 1011, 4569, 2278, 1024, 1014, 1008, 1013, 2065, 1006, 999, 12946, 1012, 1035, 27000, 2850, 2696, 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...
getsentry/sentry-javascript
packages/raven-js/src/raven.js
function(current) { var last = this._lastData; if ( !last || current.message !== last.message || // defined for captureMessage current.transaction !== last.transaction // defined for captureException/onerror ) return false; // Stacktrace interface (i.e. from captureMessage) if (current.stacktrace || last.stacktrace) { return isSameStacktrace(current.stacktrace, last.stacktrace); } else if (current.exception || last.exception) { // Exception interface (i.e. from captureException/onerror) return isSameException(current.exception, last.exception); } else if (current.fingerprint || last.fingerprint) { return Boolean(current.fingerprint && last.fingerprint) && JSON.stringify(current.fingerprint) === JSON.stringify(last.fingerprint) } return true; }
javascript
function(current) { var last = this._lastData; if ( !last || current.message !== last.message || // defined for captureMessage current.transaction !== last.transaction // defined for captureException/onerror ) return false; // Stacktrace interface (i.e. from captureMessage) if (current.stacktrace || last.stacktrace) { return isSameStacktrace(current.stacktrace, last.stacktrace); } else if (current.exception || last.exception) { // Exception interface (i.e. from captureException/onerror) return isSameException(current.exception, last.exception); } else if (current.fingerprint || last.fingerprint) { return Boolean(current.fingerprint && last.fingerprint) && JSON.stringify(current.fingerprint) === JSON.stringify(last.fingerprint) } return true; }
[ "function", "(", "current", ")", "{", "var", "last", "=", "this", ".", "_lastData", ";", "if", "(", "!", "last", "||", "current", ".", "message", "!==", "last", ".", "message", "||", "// defined for captureMessage", "current", ".", "transaction", "!==", "l...
Returns true if the in-process data payload matches the signature of the previously-sent data NOTE: This has to be done at this level because TraceKit can generate data from window.onerror WITHOUT an exception object (IE8, IE9, other old browsers). This can take the form of an "exception" data object with a single frame (derived from the onerror args).
[ "Returns", "true", "if", "the", "in", "-", "process", "data", "payload", "matches", "the", "signature", "of", "the", "previously", "-", "sent", "data" ]
a872223343fecf7364473b78bede937f1eb57bd0
https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/src/raven.js#L1908-L1930
train
Returns true if current is the same as last data
[ 30522, 3853, 1006, 2783, 1007, 1063, 13075, 2197, 1027, 2023, 1012, 1035, 2197, 2850, 2696, 1025, 2065, 1006, 999, 2197, 1064, 1064, 2783, 1012, 4471, 999, 1027, 1027, 2197, 1012, 4471, 1064, 1064, 1013, 1013, 4225, 2005, 5425, 7834, 3736...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(oSourceInfo, oTargetInfo, iLevel) { iLevel = iLevel ? iLevel : 0; ACCInfoHelper._normalize(oSourceInfo); if (iLevel == 0) { ACCInfoHelper._normalize(oTargetInfo); oTargetInfo._descriptions = []; } oTargetInfo._descriptions.push(ACCInfoHelper._getFullDescription(oSourceInfo)); oSourceInfo.children.forEach(function(oChild) { if (!oChild.getAccessibilityInfo || (oChild.getVisible && !oChild.getVisible())) { return; } var oChildInfo = oChild.getAccessibilityInfo(); if (oChildInfo) { ACCInfoHelper._flatten(oChildInfo, oTargetInfo, iLevel + 1); } }); if (iLevel == 0) { oTargetInfo.description = oTargetInfo._descriptions.join(" ").trim(); oTargetInfo._descriptions = undefined; } }
javascript
function(oSourceInfo, oTargetInfo, iLevel) { iLevel = iLevel ? iLevel : 0; ACCInfoHelper._normalize(oSourceInfo); if (iLevel == 0) { ACCInfoHelper._normalize(oTargetInfo); oTargetInfo._descriptions = []; } oTargetInfo._descriptions.push(ACCInfoHelper._getFullDescription(oSourceInfo)); oSourceInfo.children.forEach(function(oChild) { if (!oChild.getAccessibilityInfo || (oChild.getVisible && !oChild.getVisible())) { return; } var oChildInfo = oChild.getAccessibilityInfo(); if (oChildInfo) { ACCInfoHelper._flatten(oChildInfo, oTargetInfo, iLevel + 1); } }); if (iLevel == 0) { oTargetInfo.description = oTargetInfo._descriptions.join(" ").trim(); oTargetInfo._descriptions = undefined; } }
[ "function", "(", "oSourceInfo", ",", "oTargetInfo", ",", "iLevel", ")", "{", "iLevel", "=", "iLevel", "?", "iLevel", ":", "0", ";", "ACCInfoHelper", ".", "_normalize", "(", "oSourceInfo", ")", ";", "if", "(", "iLevel", "==", "0", ")", "{", "ACCInfoHelper...
/* Merges the focusable flag and the descriptions of the source and its children into the given target.
[ "/", "*", "Merges", "the", "focusable", "flag", "and", "the", "descriptions", "of", "the", "source", "and", "its", "children", "into", "the", "given", "target", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L74-L100
train
flattens the source and target information
[ 30522, 3853, 1006, 9808, 8162, 3401, 2378, 14876, 1010, 27178, 2906, 18150, 2378, 14876, 1010, 17869, 15985, 1007, 1063, 17869, 15985, 1027, 17869, 15985, 1029, 17869, 15985, 1024, 1014, 1025, 16222, 2378, 14876, 16001, 4842, 1012, 1035, 3671...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function (moreattrs) { for (var k in moreattrs) { if (moreattrs.hasOwnProperty(k)) { this.node.setAttribute(k, moreattrs[k]); } } return this; }
javascript
function (moreattrs) { for (var k in moreattrs) { if (moreattrs.hasOwnProperty(k)) { this.node.setAttribute(k, moreattrs[k]); } } return this; }
[ "function", "(", "moreattrs", ")", "{", "for", "(", "var", "k", "in", "moreattrs", ")", "{", "if", "(", "moreattrs", ".", "hasOwnProperty", "(", "k", ")", ")", "{", "this", ".", "node", ".", "setAttribute", "(", "k", ",", "moreattrs", "[", "k", "]"...
Function: attrs Add or modify attributes of the current element. The attributes should be passed in object notation. This function does not move the current element pointer. Parameters: (Object) moreattrs - The attributes to add/modify in object notation. Returns: The Strophe.Builder object.
[ "Function", ":", "attrs", "Add", "or", "modify", "attributes", "of", "the", "current", "element", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L1660-L1668
train
Returns a new node with the specified attributes.
[ 30522, 3853, 1006, 2062, 19321, 2869, 1007, 1063, 2005, 1006, 13075, 1047, 1999, 2062, 19321, 2869, 1007, 1063, 2065, 1006, 2062, 19321, 2869, 1012, 2038, 12384, 21572, 4842, 3723, 1006, 1047, 1007, 1007, 1063, 2023, 1012, 13045, 1012, 2275...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/table/mergedTableRemoveCol.js
_updateColspan
function _updateColspan(tableData, startColIndex, endColIndex) { tableData.forEach(rowData => { util.range(startColIndex, endColIndex + 1).forEach(colIndex => { const cellData = rowData [colIndex]; if (util.isExisty(cellData.colMergeWith)) { const merger = rowData [cellData.colMergeWith]; if (merger.colspan) { merger.colspan -= 1; } } else if (cellData.colspan > 1) { const lastMergedCellIndex = colIndex + cellData.colspan - 1; cellData.colspan -= (endColIndex - colIndex + 1); if (lastMergedCellIndex > endColIndex) { rowData [endColIndex + 1] = util.extend({}, cellData); } } }); }); }
javascript
function _updateColspan(tableData, startColIndex, endColIndex) { tableData.forEach(rowData => { util.range(startColIndex, endColIndex + 1).forEach(colIndex => { const cellData = rowData [colIndex]; if (util.isExisty(cellData.colMergeWith)) { const merger = rowData [cellData.colMergeWith]; if (merger.colspan) { merger.colspan -= 1; } } else if (cellData.colspan > 1) { const lastMergedCellIndex = colIndex + cellData.colspan - 1; cellData.colspan -= (endColIndex - colIndex + 1); if (lastMergedCellIndex > endColIndex) { rowData [endColIndex + 1] = util.extend({}, cellData); } } }); }); }
[ "function", "_updateColspan", "(", "tableData", ",", "startColIndex", ",", "endColIndex", ")", "{", "tableData", ".", "forEach", "(", "rowData", "=>", "{", "util", ".", "range", "(", "startColIndex", ",", "endColIndex", "+", "1", ")", ".", "forEach", "(", ...
Update colspan to col merger. @param {Array.<Array.<object>>} tableData - table data @param {number} startColIndex - start col index @param {number} endColIndex - end col index @private
[ "Update", "colspan", "to", "col", "merger", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableRemoveCol.js#L64-L86
train
Update the colspan of the table data
[ 30522, 3853, 1035, 30524, 1006, 5216, 2850, 2696, 1027, 1028, 1063, 21183, 4014, 1012, 2846, 1006, 2707, 25778, 22254, 10288, 1010, 2203, 25778, 22254, 10288, 1009, 1015, 1007, 1012, 18921, 6776, 1006, 6972, 3207, 2595, 1027, 1028, 1063, 95...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oTable, sColumnId, iLevel) { var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId); if (!oColumnMapItem) { return undefined; } var aChildren = []; var iEnd; if (iLevel === undefined) { iEnd = oColumnMapItem.levelInfo.length; } else { iEnd = iLevel + 1; } for (var i = iLevel || 0; i < iEnd; i++) { var oLevelInfo = oColumnMapItem.levelInfo[i]; for (var j = 0; j < oLevelInfo.spannedColumns.length; j++) { aChildren.push({column: oLevelInfo.spannedColumns[j], level: i}); } } return aChildren; }
javascript
function(oTable, sColumnId, iLevel) { var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId); if (!oColumnMapItem) { return undefined; } var aChildren = []; var iEnd; if (iLevel === undefined) { iEnd = oColumnMapItem.levelInfo.length; } else { iEnd = iLevel + 1; } for (var i = iLevel || 0; i < iEnd; i++) { var oLevelInfo = oColumnMapItem.levelInfo[i]; for (var j = 0; j < oLevelInfo.spannedColumns.length; j++) { aChildren.push({column: oLevelInfo.spannedColumns[j], level: i}); } } return aChildren; }
[ "function", "(", "oTable", ",", "sColumnId", ",", "iLevel", ")", "{", "var", "oColumnMapItem", "=", "TableColumnUtils", ".", "getColumnMapItem", "(", "oTable", ",", "sColumnId", ")", ";", "if", "(", "!", "oColumnMapItem", ")", "{", "return", "undefined", ";"...
Returns an array of the column information about all columns which are spanned by the column identified by sColumnId. If there is no "parent", it returns undefined. @param {sap.ui.table.Table} oTable Instance of the table. @param {string} sColumnId ID of the column for which the Span-parent shall be found. @param {int} [iLevel] level where the parent is looked up. @returns {Array.<{column: sap.ui.table.Column, level: int}>|undefined} Array of column information. @private
[ "Returns", "an", "array", "of", "the", "column", "information", "about", "all", "columns", "which", "are", "spanned", "by", "the", "column", "identified", "by", "sColumnId", ".", "If", "there", "is", "no", "parent", "it", "returns", "undefined", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L210-L232
train
Returns an array of the children of the column
[ 30522, 3853, 1006, 27178, 3085, 1010, 8040, 4747, 2819, 3490, 2094, 1010, 17869, 15985, 1007, 1063, 13075, 1051, 25778, 2819, 2078, 2863, 23270, 6633, 1027, 2795, 25778, 2819, 24072, 12146, 1012, 2131, 25778, 2819, 2078, 2863, 23270, 6633, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/components/tracked-controls-webvr.js
function (id, buttonState) { var evtName; var previousButtonState = this.buttonStates[id]; // Not changed. if (buttonState.touched === previousButtonState.touched) { return false; } evtName = buttonState.touched ? EVENTS.TOUCHSTART : EVENTS.TOUCHEND; this.el.emit(evtName, this.buttonEventDetails[id], false, EMPTY_DAYDREAM_TOUCHES); previousButtonState.touched = buttonState.touched; return true; }
javascript
function (id, buttonState) { var evtName; var previousButtonState = this.buttonStates[id]; // Not changed. if (buttonState.touched === previousButtonState.touched) { return false; } evtName = buttonState.touched ? EVENTS.TOUCHSTART : EVENTS.TOUCHEND; this.el.emit(evtName, this.buttonEventDetails[id], false, EMPTY_DAYDREAM_TOUCHES); previousButtonState.touched = buttonState.touched; return true; }
[ "function", "(", "id", ",", "buttonState", ")", "{", "var", "evtName", ";", "var", "previousButtonState", "=", "this", ".", "buttonStates", "[", "id", "]", ";", "// Not changed.", "if", "(", "buttonState", ".", "touched", "===", "previousButtonState", ".", "...
Determine whether a button touch has occured and emit events as appropriate. @param {string} id - ID of the button to check. @param {object} buttonState - State of the button to check. @returns {boolean} Whether button touch state changed.
[ "Determine", "whether", "a", "button", "touch", "has", "occured", "and", "emit", "events", "as", "appropriate", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/tracked-controls-webvr.js#L306-L317
train
Trigger a touch event on a button
[ 30522, 3853, 1006, 8909, 1010, 11287, 12259, 1007, 1063, 13075, 23408, 2102, 18442, 1025, 13075, 3025, 8569, 15474, 9153, 2618, 1027, 2023, 1012, 11287, 12259, 2015, 1031, 8909, 1033, 1025, 1013, 1013, 2025, 2904, 1012, 2065, 1006, 11287, 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...
grpc/grpc
examples/node/dynamic_codegen/route_guide/route_guide_client.js
runRouteChat
function runRouteChat(callback) { var call = client.routeChat(); call.on('data', function(note) { console.log('Got message "' + note.message + '" at ' + note.location.latitude + ', ' + note.location.longitude); }); call.on('end', callback); var notes = [{ location: { latitude: 0, longitude: 0 }, message: 'First message' }, { location: { latitude: 0, longitude: 1 }, message: 'Second message' }, { location: { latitude: 1, longitude: 0 }, message: 'Third message' }, { location: { latitude: 0, longitude: 0 }, message: 'Fourth message' }]; for (var i = 0; i < notes.length; i++) { var note = notes[i]; console.log('Sending message "' + note.message + '" at ' + note.location.latitude + ', ' + note.location.longitude); call.write(note); } call.end(); }
javascript
function runRouteChat(callback) { var call = client.routeChat(); call.on('data', function(note) { console.log('Got message "' + note.message + '" at ' + note.location.latitude + ', ' + note.location.longitude); }); call.on('end', callback); var notes = [{ location: { latitude: 0, longitude: 0 }, message: 'First message' }, { location: { latitude: 0, longitude: 1 }, message: 'Second message' }, { location: { latitude: 1, longitude: 0 }, message: 'Third message' }, { location: { latitude: 0, longitude: 0 }, message: 'Fourth message' }]; for (var i = 0; i < notes.length; i++) { var note = notes[i]; console.log('Sending message "' + note.message + '" at ' + note.location.latitude + ', ' + note.location.longitude); call.write(note); } call.end(); }
[ "function", "runRouteChat", "(", "callback", ")", "{", "var", "call", "=", "client", ".", "routeChat", "(", ")", ";", "call", ".", "on", "(", "'data'", ",", "function", "(", "note", ")", "{", "console", ".", "log", "(", "'Got message \"'", "+", "note",...
Run the routeChat demo. Send some chat messages, and print any chat messages that are sent from the server. @param {function} callback Called when the demo is complete
[ "Run", "the", "routeChat", "demo", ".", "Send", "some", "chat", "messages", "and", "print", "any", "chat", "messages", "that", "are", "sent", "from", "the", "server", "." ]
cc75d93818410e2b0edd0fa3009a6def9ac403ca
https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/dynamic_codegen/route_guide/route_guide_client.js#L172-L213
train
Run the route chat
[ 30522, 3853, 2448, 22494, 15007, 4017, 1006, 2655, 5963, 1007, 1063, 13075, 2655, 1027, 7396, 1012, 2799, 7507, 2102, 1006, 1007, 1025, 2655, 1012, 2006, 1006, 1005, 2951, 1005, 1010, 3853, 1006, 3602, 1007, 1063, 10122, 1012, 8833, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.f/src/sap/f/GridContainer.js
isGridSupportedByBrowser
function isGridSupportedByBrowser() { return !Device.browser.msie && !(Device.browser.edge && Device.browser.version < EDGE_VERSION_WITH_GRID_SUPPORT); }
javascript
function isGridSupportedByBrowser() { return !Device.browser.msie && !(Device.browser.edge && Device.browser.version < EDGE_VERSION_WITH_GRID_SUPPORT); }
[ "function", "isGridSupportedByBrowser", "(", ")", "{", "return", "!", "Device", ".", "browser", ".", "msie", "&&", "!", "(", "Device", ".", "browser", ".", "edge", "&&", "Device", ".", "browser", ".", "version", "<", "EDGE_VERSION_WITH_GRID_SUPPORT", ")", ";...
Indicates whether the grid is supported by the browser. @private @returns {boolean} If native grid is supported by the browser
[ "Indicates", "whether", "the", "grid", "is", "supported", "by", "the", "browser", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/GridContainer.js#L35-L37
train
Check if the browser supports grid
[ 30522, 3853, 2003, 16523, 9821, 6279, 6442, 2098, 3762, 12618, 9333, 2121, 1006, 1007, 1063, 2709, 999, 5080, 1012, 16602, 1012, 5796, 2666, 1004, 1004, 999, 1006, 5080, 1012, 16602, 1012, 3341, 1004, 1004, 5080, 1012, 16602, 1012, 2544, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/uml.js
umlExtension
function umlExtension(editor, options = {}) { const { rendererURL = DEFAULT_RENDERER_URL } = options; /** * render html from uml * @param {string} umlCode - plant uml code text * @returns {string} - rendered html */ function plantUMLReplacer(umlCode) { let renderedHTML; try { if (!plantumlEncoder) { throw new Error('plantuml-encoder dependency required'); } renderedHTML = `<img src="${rendererURL}${plantumlEncoder.encode(umlCode)}" />`; } catch (err) { renderedHTML = `Error occurred on encoding uml: ${err.message}`; } return renderedHTML; } const {codeBlockLanguages} = editor.options; UML_LANGUAGES.forEach(umlLanguage => { if (codeBlockLanguages.indexOf(umlLanguage) < 0) { codeBlockLanguages.push(umlLanguage); } codeBlockManager.setReplacer(umlLanguage, plantUMLReplacer); }); }
javascript
function umlExtension(editor, options = {}) { const { rendererURL = DEFAULT_RENDERER_URL } = options; /** * render html from uml * @param {string} umlCode - plant uml code text * @returns {string} - rendered html */ function plantUMLReplacer(umlCode) { let renderedHTML; try { if (!plantumlEncoder) { throw new Error('plantuml-encoder dependency required'); } renderedHTML = `<img src="${rendererURL}${plantumlEncoder.encode(umlCode)}" />`; } catch (err) { renderedHTML = `Error occurred on encoding uml: ${err.message}`; } return renderedHTML; } const {codeBlockLanguages} = editor.options; UML_LANGUAGES.forEach(umlLanguage => { if (codeBlockLanguages.indexOf(umlLanguage) < 0) { codeBlockLanguages.push(umlLanguage); } codeBlockManager.setReplacer(umlLanguage, plantUMLReplacer); }); }
[ "function", "umlExtension", "(", "editor", ",", "options", "=", "{", "}", ")", "{", "const", "{", "rendererURL", "=", "DEFAULT_RENDERER_URL", "}", "=", "options", ";", "/**\n * render html from uml\n * @param {string} umlCode - plant uml code text\n * @returns {string} ...
plant uml plugin @param {Editor} editor - editor @param {object} [options={}] - plugin options @param {string} options.rendererURL - plant uml renderer url @ignore
[ "plant", "uml", "plugin" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/uml.js#L20-L52
train
This function is called by the plantUMLEditor to render the HTML from a uml code
[ 30522, 3853, 8529, 2571, 18413, 6132, 3258, 1006, 3559, 1010, 7047, 1027, 1063, 1065, 1007, 1063, 9530, 3367, 1063, 17552, 2121, 3126, 2140, 1027, 12398, 1035, 17552, 2121, 1035, 24471, 2140, 1065, 1027, 7047, 1025, 1013, 1008, 1008, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/UpdateNotification.js
_getUpdateInformation
function _getUpdateInformation(force, dontCache, _versionInfoUrl) { // Last time the versionInfoURL was fetched var lastInfoURLFetchTime = PreferencesManager.getViewState("lastInfoURLFetchTime"); var result = new $.Deferred(); var fetchData = false; var data; // If force is true, always fetch if (force) { fetchData = true; } // If we don't have data saved in prefs, fetch data = PreferencesManager.getViewState("updateInfo"); if (!data) { fetchData = true; } // If more than 24 hours have passed since our last fetch, fetch again if ((new Date()).getTime() > lastInfoURLFetchTime + ONE_DAY) { fetchData = true; } if (fetchData) { var lookupPromise = new $.Deferred(), localVersionInfoUrl; // If the current locale isn't "en" or "en-US", check whether we actually have a // locale-specific update notification, and fall back to "en" if not. // Note: we check for both "en" and "en-US" to watch for the general case or // country-specific English locale. The former appears default on Mac, while // the latter appears default on Windows. var locale = brackets.getLocale().toLowerCase(); if (locale !== "en" && locale !== "en-us") { localVersionInfoUrl = _versionInfoUrl || _getVersionInfoUrl(); $.ajax({ url: localVersionInfoUrl, cache: false, type: "HEAD" }).fail(function (jqXHR, status, error) { // get rid of any country information from locale and try again var tmpUrl = _getVersionInfoUrl(brackets.getLocale(), true); if (tmpUrl !== localVersionInfoUrl) { $.ajax({ url: tmpUrl, cache: false, type: "HEAD" }).fail(function (jqXHR, status, error) { localVersionInfoUrl = _getVersionInfoUrl("en"); }).done(function (jqXHR, status, error) { localVersionInfoUrl = tmpUrl; }).always(function (jqXHR, status, error) { lookupPromise.resolve(); }); } else { localVersionInfoUrl = _getVersionInfoUrl("en"); lookupPromise.resolve(); } }).done(function (jqXHR, status, error) { lookupPromise.resolve(); }); } else { localVersionInfoUrl = _versionInfoUrl || _getVersionInfoUrl("en"); lookupPromise.resolve(); } lookupPromise.done(function () { $.ajax({ url: localVersionInfoUrl, dataType: "json", cache: false }).done(function (updateInfo, textStatus, jqXHR) { if (!dontCache) { lastInfoURLFetchTime = (new Date()).getTime(); PreferencesManager.setViewState("lastInfoURLFetchTime", lastInfoURLFetchTime); PreferencesManager.setViewState("updateInfo", updateInfo); } result.resolve(updateInfo); }).fail(function (jqXHR, status, error) { // When loading data for unit tests, the error handler is // called but the responseText is valid. Try to use it here, // but *don't* save the results in prefs. if (!jqXHR.responseText) { // Text is NULL or empty string, reject(). result.reject(); return; } try { data = JSON.parse(jqXHR.responseText); result.resolve(data); } catch (e) { result.reject(); } }); }); } else { result.resolve(data); } return result.promise(); }
javascript
function _getUpdateInformation(force, dontCache, _versionInfoUrl) { // Last time the versionInfoURL was fetched var lastInfoURLFetchTime = PreferencesManager.getViewState("lastInfoURLFetchTime"); var result = new $.Deferred(); var fetchData = false; var data; // If force is true, always fetch if (force) { fetchData = true; } // If we don't have data saved in prefs, fetch data = PreferencesManager.getViewState("updateInfo"); if (!data) { fetchData = true; } // If more than 24 hours have passed since our last fetch, fetch again if ((new Date()).getTime() > lastInfoURLFetchTime + ONE_DAY) { fetchData = true; } if (fetchData) { var lookupPromise = new $.Deferred(), localVersionInfoUrl; // If the current locale isn't "en" or "en-US", check whether we actually have a // locale-specific update notification, and fall back to "en" if not. // Note: we check for both "en" and "en-US" to watch for the general case or // country-specific English locale. The former appears default on Mac, while // the latter appears default on Windows. var locale = brackets.getLocale().toLowerCase(); if (locale !== "en" && locale !== "en-us") { localVersionInfoUrl = _versionInfoUrl || _getVersionInfoUrl(); $.ajax({ url: localVersionInfoUrl, cache: false, type: "HEAD" }).fail(function (jqXHR, status, error) { // get rid of any country information from locale and try again var tmpUrl = _getVersionInfoUrl(brackets.getLocale(), true); if (tmpUrl !== localVersionInfoUrl) { $.ajax({ url: tmpUrl, cache: false, type: "HEAD" }).fail(function (jqXHR, status, error) { localVersionInfoUrl = _getVersionInfoUrl("en"); }).done(function (jqXHR, status, error) { localVersionInfoUrl = tmpUrl; }).always(function (jqXHR, status, error) { lookupPromise.resolve(); }); } else { localVersionInfoUrl = _getVersionInfoUrl("en"); lookupPromise.resolve(); } }).done(function (jqXHR, status, error) { lookupPromise.resolve(); }); } else { localVersionInfoUrl = _versionInfoUrl || _getVersionInfoUrl("en"); lookupPromise.resolve(); } lookupPromise.done(function () { $.ajax({ url: localVersionInfoUrl, dataType: "json", cache: false }).done(function (updateInfo, textStatus, jqXHR) { if (!dontCache) { lastInfoURLFetchTime = (new Date()).getTime(); PreferencesManager.setViewState("lastInfoURLFetchTime", lastInfoURLFetchTime); PreferencesManager.setViewState("updateInfo", updateInfo); } result.resolve(updateInfo); }).fail(function (jqXHR, status, error) { // When loading data for unit tests, the error handler is // called but the responseText is valid. Try to use it here, // but *don't* save the results in prefs. if (!jqXHR.responseText) { // Text is NULL or empty string, reject(). result.reject(); return; } try { data = JSON.parse(jqXHR.responseText); result.resolve(data); } catch (e) { result.reject(); } }); }); } else { result.resolve(data); } return result.promise(); }
[ "function", "_getUpdateInformation", "(", "force", ",", "dontCache", ",", "_versionInfoUrl", ")", "{", "// Last time the versionInfoURL was fetched", "var", "lastInfoURLFetchTime", "=", "PreferencesManager", ".", "getViewState", "(", "\"lastInfoURLFetchTime\"", ")", ";", "v...
Get a data structure that has information for all builds of Brackets. If force is true, the information is always fetched from _versionInfoURL. If force is false, we try to use cached information. If more than 24 hours have passed since the last fetch, or if cached data can't be found, the data is fetched again. If new data is fetched and dontCache is false, the data is saved in preferences for quick fetching later. _versionInfoUrl is used for unit testing.
[ "Get", "a", "data", "structure", "that", "has", "information", "for", "all", "builds", "of", "Brackets", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/UpdateNotification.js#L159-L262
train
Get the update information from the cache
[ 30522, 3853, 1035, 2131, 6279, 13701, 2378, 14192, 3370, 1006, 2486, 1010, 2123, 13535, 15395, 1010, 1035, 2544, 2378, 14876, 3126, 2140, 1007, 1063, 1013, 1013, 2197, 2051, 1996, 2544, 2378, 14876, 3126, 2140, 2001, 18584, 2098, 13075, 219...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/rules/CoreHelper.support.js
function (node, oScope) { /** * Here we white list all controls that can contain DOM elements with style different than the framework style */ var skipParents = ["sap.ui.core.HTML"], parentNode = jQuery(node).control()[0]; if (!parentNode) { return false; } var parentName = parentNode.getMetadata().getName(), isParentOutOfSkipList = skipParents.indexOf(parentName) === -1, isParentInScope = oScope.getElements().indexOf(parentNode) > -1; return isParentOutOfSkipList && isParentInScope; }
javascript
function (node, oScope) { /** * Here we white list all controls that can contain DOM elements with style different than the framework style */ var skipParents = ["sap.ui.core.HTML"], parentNode = jQuery(node).control()[0]; if (!parentNode) { return false; } var parentName = parentNode.getMetadata().getName(), isParentOutOfSkipList = skipParents.indexOf(parentName) === -1, isParentInScope = oScope.getElements().indexOf(parentNode) > -1; return isParentOutOfSkipList && isParentInScope; }
[ "function", "(", "node", ",", "oScope", ")", "{", "/**\n\t\t\t\t * Here we white list all controls that can contain DOM elements with style different than the framework style\n\t\t\t\t */", "var", "skipParents", "=", "[", "\"sap.ui.core.HTML\"", "]", ",", "parentNode", "=", "jQuery...
* Checks of passed node has parent control of type UI5. @param node HTML element that will be checked. @param oScope Scope in witch checking will be executed. @returns {boolean} If node has parent of type UI5 control it will return true, otherwise false.
[ "*", "Checks", "of", "passed", "node", "has", "parent", "control", "of", "type", "UI5", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/rules/CoreHelper.support.js#L18-L35
train
Checks if the DOM node is a control that can be used as a parent of the parent of the parent
[ 30522, 3853, 1006, 13045, 1010, 9808, 16186, 1007, 1063, 1013, 1008, 1008, 1008, 2182, 2057, 2317, 2862, 2035, 7711, 2008, 2064, 5383, 14383, 3787, 2007, 2806, 2367, 2084, 1996, 7705, 2806, 1008, 1013, 13075, 13558, 19362, 11187, 1027, 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
example/server/index.js
saveFiles
function saveFiles(req) { return new Promise((resolve, reject) => { const imgLinks = [] const form = new formidable.IncomingForm() form.parse(req, function (err, fields, files) { if (err) { reject('formidable, form.parse err', err.stack) } // 存储图片的文件夹 const storePath = path.resolve(__dirname, '..', 'upload-files') if (!fs.existsSync(storePath)) { fs.mkdirSync(storePath) } // 遍历所有上传来的图片 util.objForEach(files, (name, file) => { // 图片临时位置 const tempFilePath = file.path // 图片名称和路径 const fileName = file.name const fullFileName = path.join(storePath, fileName) // 将临时文件保存为正式文件 fs.renameSync(tempFilePath, fullFileName) // 存储链接 imgLinks.push('/upload-files/' + fileName) }) // 重新设置静态文件缓存 setStaticCache() // 返回结果 resolve({ errno: 0, data: imgLinks }) }) }) }
javascript
function saveFiles(req) { return new Promise((resolve, reject) => { const imgLinks = [] const form = new formidable.IncomingForm() form.parse(req, function (err, fields, files) { if (err) { reject('formidable, form.parse err', err.stack) } // 存储图片的文件夹 const storePath = path.resolve(__dirname, '..', 'upload-files') if (!fs.existsSync(storePath)) { fs.mkdirSync(storePath) } // 遍历所有上传来的图片 util.objForEach(files, (name, file) => { // 图片临时位置 const tempFilePath = file.path // 图片名称和路径 const fileName = file.name const fullFileName = path.join(storePath, fileName) // 将临时文件保存为正式文件 fs.renameSync(tempFilePath, fullFileName) // 存储链接 imgLinks.push('/upload-files/' + fileName) }) // 重新设置静态文件缓存 setStaticCache() // 返回结果 resolve({ errno: 0, data: imgLinks }) }) }) }
[ "function", "saveFiles", "(", "req", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "imgLinks", "=", "[", "]", "const", "form", "=", "new", "formidable", ".", "IncomingForm", "(", ")", "form", ".", ...
保存上传的文件
[ "保存上传的文件" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/example/server/index.js#L31-L68
train
saveFiles - Save files to disk
[ 30522, 3853, 3828, 8873, 4244, 1006, 2128, 4160, 1007, 1063, 2709, 2047, 4872, 1006, 1006, 10663, 1010, 15454, 1007, 1027, 1028, 1063, 9530, 3367, 10047, 25394, 8950, 2015, 1027, 1031, 1033, 9530, 3367, 2433, 1027, 2047, 18085, 1012, 14932,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
catapult-project/catapult
tracing/third_party/oboe/src/lists.js
without
function without(list, test, removedFn) { return withoutInner(list, removedFn || noop); function withoutInner(subList, removedFn) { return subList ? ( test(head(subList)) ? (removedFn(head(subList)), tail(subList)) : cons(head(subList), withoutInner(tail(subList), removedFn)) ) : emptyList ; } }
javascript
function without(list, test, removedFn) { return withoutInner(list, removedFn || noop); function withoutInner(subList, removedFn) { return subList ? ( test(head(subList)) ? (removedFn(head(subList)), tail(subList)) : cons(head(subList), withoutInner(tail(subList), removedFn)) ) : emptyList ; } }
[ "function", "without", "(", "list", ",", "test", ",", "removedFn", ")", "{", "return", "withoutInner", "(", "list", ",", "removedFn", "||", "noop", ")", ";", "function", "withoutInner", "(", "subList", ",", "removedFn", ")", "{", "return", "subList", "?", ...
Return a list like the one given but with the first instance equal to item removed
[ "Return", "a", "list", "like", "the", "one", "given", "but", "with", "the", "first", "instance", "equal", "to", "item", "removed" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L128-L141
train
Removes elements from list that pass test
[ 30522, 3853, 2302, 1006, 2862, 1010, 3231, 1010, 3718, 2546, 2078, 1007, 1063, 2709, 2302, 23111, 2121, 1006, 2862, 1010, 3718, 2546, 2078, 1064, 1064, 2053, 7361, 1007, 1025, 3853, 2302, 23111, 2121, 1006, 4942, 9863, 1010, 3718, 2546, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js
function (oRawValue) { if (oRawValue) { if (oRawValue.hasOwnProperty("AnnotationPath")) { return oRawValue.AnnotationPath; } if (oRawValue.hasOwnProperty("Path")) { return oRawValue.Path; } if (oRawValue.hasOwnProperty("PropertyPath")) { return oRawValue.PropertyPath; } if (oRawValue.hasOwnProperty("NavigationPropertyPath")) { return oRawValue.NavigationPropertyPath; } } // Note: we cannot return undefined above! return undefined; // some unsupported case }
javascript
function (oRawValue) { if (oRawValue) { if (oRawValue.hasOwnProperty("AnnotationPath")) { return oRawValue.AnnotationPath; } if (oRawValue.hasOwnProperty("Path")) { return oRawValue.Path; } if (oRawValue.hasOwnProperty("PropertyPath")) { return oRawValue.PropertyPath; } if (oRawValue.hasOwnProperty("NavigationPropertyPath")) { return oRawValue.NavigationPropertyPath; } } // Note: we cannot return undefined above! return undefined; // some unsupported case }
[ "function", "(", "oRawValue", ")", "{", "if", "(", "oRawValue", ")", "{", "if", "(", "oRawValue", ".", "hasOwnProperty", "(", "\"AnnotationPath\"", ")", ")", "{", "return", "oRawValue", ".", "AnnotationPath", ";", "}", "if", "(", "oRawValue", ".", "hasOwnP...
Returns the dynamic "14.5.12 Expression edm:Path" (or variant thereof) contained within the given raw value. @param {object} oRawValue the raw value from the meta model, e.g. <code>{AnnotationPath : "ToSupplier/@com.sap.vocabularies.Communication.v1.Address"}</code> or <code> {AnnotationPath : "@com.sap.vocabularies.UI.v1.FieldGroup#Dimensions"}</code> @returns {string} the path or <code>undefined</code> in case the raw value is not supported
[ "Returns", "the", "dynamic", "14", ".", "5", ".", "12", "Expression", "edm", ":", "Path", "(", "or", "variant", "thereof", ")", "contained", "within", "the", "given", "raw", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js#L233-L250
train
Returns the path property path and navigation property path of the given annotation.
[ 30522, 3853, 1006, 2030, 10376, 10175, 5657, 1007, 1063, 2065, 1006, 2030, 10376, 10175, 5657, 1007, 1063, 2065, 1006, 2030, 10376, 10175, 5657, 1012, 2038, 12384, 21572, 4842, 3723, 1006, 1000, 5754, 17287, 3508, 15069, 1000, 1007, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
openlayers/openlayers
src/ol/interaction/Snap.js
sortByDistance
function sortByDistance(a, b) { const deltaA = squaredDistanceToSegment(this.pixelCoordinate_, a.segment); const deltaB = squaredDistanceToSegment(this.pixelCoordinate_, b.segment); return deltaA - deltaB; }
javascript
function sortByDistance(a, b) { const deltaA = squaredDistanceToSegment(this.pixelCoordinate_, a.segment); const deltaB = squaredDistanceToSegment(this.pixelCoordinate_, b.segment); return deltaA - deltaB; }
[ "function", "sortByDistance", "(", "a", ",", "b", ")", "{", "const", "deltaA", "=", "squaredDistanceToSegment", "(", "this", ".", "pixelCoordinate_", ",", "a", ".", "segment", ")", ";", "const", "deltaB", "=", "squaredDistanceToSegment", "(", "this", ".", "p...
Sort segments by distance, helper function @param {SegmentData} a The first segment data. @param {SegmentData} b The second segment data. @return {number} The difference in distance. @this {Snap}
[ "Sort", "segments", "by", "distance", "helper", "function" ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/interaction/Snap.js#L623-L627
train
Sort by distance from one segment to another
[ 30522, 3853, 4066, 3762, 10521, 26897, 1006, 1037, 1010, 1038, 1007, 1063, 9530, 3367, 7160, 2050, 1027, 19942, 10521, 26897, 22282, 21693, 4765, 1006, 2023, 1012, 22138, 3597, 8551, 14776, 1035, 1010, 1037, 1012, 6903, 1007, 1025, 9530, 33...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.integration/src/sap/ui/integration/host/HostConfigurationCompiler.js
loadResource
function loadResource(sUrl, sType) { return new Promise(function (resolve, reject) { jQuery.ajax({ url: sUrl, async: true, dataType: sType, success: function (oJson) { resolve(oJson); }, error: function () { reject(); } }); }); }
javascript
function loadResource(sUrl, sType) { return new Promise(function (resolve, reject) { jQuery.ajax({ url: sUrl, async: true, dataType: sType, success: function (oJson) { resolve(oJson); }, error: function () { reject(); } }); }); }
[ "function", "loadResource", "(", "sUrl", ",", "sType", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "jQuery", ".", "ajax", "(", "{", "url", ":", "sUrl", ",", "async", ":", "true", ",", "dataType", ":...
Loads a resource of a given type async and returns a promise @param {string} sUrl the URL to load @param {string} sType the expected type of response "json" or "text" @retunrs {Promise} @private
[ "Loads", "a", "resource", "of", "a", "given", "type", "async", "and", "returns", "a", "promise" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.integration/src/sap/ui/integration/host/HostConfigurationCompiler.js#L29-L43
train
Load a resource
[ 30522, 3853, 7170, 6072, 8162, 3401, 1006, 7505, 2140, 1010, 2358, 18863, 1007, 1063, 2709, 2047, 4872, 1006, 3853, 1006, 10663, 1010, 15454, 1007, 1063, 1046, 4226, 2854, 1012, 18176, 1006, 1063, 24471, 2140, 1024, 7505, 2140, 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...
jgraph/mxgraph
javascript/examples/grapheditor/www/js/EditorUi.js
ChangePageSetup
function ChangePageSetup(ui, color, image, format) { this.ui = ui; this.color = color; this.previousColor = color; this.image = image; this.previousImage = image; this.format = format; this.previousFormat = format; // Needed since null are valid values for color and image this.ignoreColor = false; this.ignoreImage = false; }
javascript
function ChangePageSetup(ui, color, image, format) { this.ui = ui; this.color = color; this.previousColor = color; this.image = image; this.previousImage = image; this.format = format; this.previousFormat = format; // Needed since null are valid values for color and image this.ignoreColor = false; this.ignoreImage = false; }
[ "function", "ChangePageSetup", "(", "ui", ",", "color", ",", "image", ",", "format", ")", "{", "this", ".", "ui", "=", "ui", ";", "this", ".", "color", "=", "color", ";", "this", ".", "previousColor", "=", "color", ";", "this", ".", "image", "=", "...
Change types
[ "Change", "types" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/examples/grapheditor/www/js/EditorUi.js#L2624-L2637
train
ChangePageSetup - Sets up the page
[ 30522, 3853, 2689, 13704, 13462, 6279, 1006, 21318, 1010, 3609, 1010, 3746, 1010, 4289, 1007, 1063, 2023, 1012, 21318, 1027, 21318, 1025, 2023, 1012, 3609, 1027, 3609, 1025, 2023, 1012, 3025, 18717, 1027, 3609, 1025, 2023, 1012, 3746, 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...
moleculerjs/moleculer
dev/dev.config.js
myMiddleware
function myMiddleware() { return handler => async ctx => { ctx.broker.logger.warn(">> MW1-before (from config)"); const res = await handler(ctx); ctx.broker.logger.warn("<< MW1-after (from config)"); return res; }; }
javascript
function myMiddleware() { return handler => async ctx => { ctx.broker.logger.warn(">> MW1-before (from config)"); const res = await handler(ctx); ctx.broker.logger.warn("<< MW1-after (from config)"); return res; }; }
[ "function", "myMiddleware", "(", ")", "{", "return", "handler", "=>", "async", "ctx", "=>", "{", "ctx", ".", "broker", ".", "logger", ".", "warn", "(", "\">> MW1-before (from config)\"", ")", ";", "const", "res", "=", "await", "handler", "(", "ctx", ")", ...
/* To test run: node bin/moleculer-runner.js --config dev/dev.config.js --repl Call the service and you will see middleware messages in console mol $ call test.hello
[ "/", "*", "To", "test", "run", ":" ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/dev/dev.config.js#L14-L21
train
This is the middleware that is used to run a middleware in a middleware context.
[ 30522, 3853, 2026, 4328, 20338, 8059, 1006, 1007, 1063, 2709, 28213, 1027, 1028, 2004, 6038, 2278, 14931, 2595, 1027, 1028, 1063, 14931, 2595, 1012, 20138, 1012, 8833, 4590, 1012, 11582, 1006, 1000, 1028, 1028, 12464, 2487, 1011, 2077, 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...
ColorlibHQ/AdminLTE
bower_components/Flot/examples/axes-time-zones/date.js
function (number, digits) { if (typeof number !== "number") { throw "not a number: " + number; } var s = number.toString(); if (number.length > digits) { return number.substr(number.length - digits, number.length); } while (s.length < digits) { s = '0' + s; } return s; }
javascript
function (number, digits) { if (typeof number !== "number") { throw "not a number: " + number; } var s = number.toString(); if (number.length > digits) { return number.substr(number.length - digits, number.length); } while (s.length < digits) { s = '0' + s; } return s; }
[ "function", "(", "number", ",", "digits", ")", "{", "if", "(", "typeof", "number", "!==", "\"number\"", ")", "{", "throw", "\"not a number: \"", "+", "number", ";", "}", "var", "s", "=", "number", ".", "toString", "(", ")", ";", "if", "(", "number", ...
Format a number to the length = digits. For ex: `_fixWidth(2, 2) = '02'` `_fixWidth(1998, 2) = '98'` This is used to pad numbers in converting date to string in ISO standard.
[ "Format", "a", "number", "to", "the", "length", "=", "digits", ".", "For", "ex", ":", "_fixWidth", "(", "2", "2", ")", "=", "02", "_fixWidth", "(", "1998", "2", ")", "=", "98", "This", "is", "used", "to", "pad", "numbers", "in", "converting", "date...
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/Flot/examples/axes-time-zones/date.js#L92-L102
train
Returns a number with the given number of digits
[ 30522, 3853, 1006, 2193, 1010, 16648, 1007, 1063, 2065, 1006, 2828, 11253, 2193, 999, 1027, 1027, 1000, 2193, 1000, 1007, 1063, 5466, 1000, 2025, 1037, 2193, 1024, 1000, 1009, 2193, 1025, 1065, 13075, 1055, 1027, 2193, 1012, 2000, 3367, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(oXhr, oEntry) { var fnRespond = function() { if (oXhr.readyState !== 0) { var sResponseText = oEntry.response.content.text; // Transform headers to the required format for XMLHttpRequests. var oHeaders = {}; oEntry.response.headers.forEach(function(mHeader) { oHeaders[mHeader.name] = mHeader.value; }); // Support for injected callbacks if (typeof sResponseText === "function") { sResponseText = sResponseText(); } oXhr.respond( oEntry.response.status, oHeaders, sResponseText ); } }; // If the request is async, a possible delay will be applied. if (oXhr.async) { // Create new browser task with the setTimeout function to make sure that responses of async requests are not delievered too fast. setTimeout(function() { fnRespond(); }, this.calculateDelay(this.mDelaySettings, oEntry.time)); } else { fnRespond(); } }
javascript
function(oXhr, oEntry) { var fnRespond = function() { if (oXhr.readyState !== 0) { var sResponseText = oEntry.response.content.text; // Transform headers to the required format for XMLHttpRequests. var oHeaders = {}; oEntry.response.headers.forEach(function(mHeader) { oHeaders[mHeader.name] = mHeader.value; }); // Support for injected callbacks if (typeof sResponseText === "function") { sResponseText = sResponseText(); } oXhr.respond( oEntry.response.status, oHeaders, sResponseText ); } }; // If the request is async, a possible delay will be applied. if (oXhr.async) { // Create new browser task with the setTimeout function to make sure that responses of async requests are not delievered too fast. setTimeout(function() { fnRespond(); }, this.calculateDelay(this.mDelaySettings, oEntry.time)); } else { fnRespond(); } }
[ "function", "(", "oXhr", ",", "oEntry", ")", "{", "var", "fnRespond", "=", "function", "(", ")", "{", "if", "(", "oXhr", ".", "readyState", "!==", "0", ")", "{", "var", "sResponseText", "=", "oEntry", ".", "response", ".", "content", ".", "text", ";"...
Responds to a given FakeXMLHttpRequest object with an entry from a har file. If a delay is provided, the time is calculated and the response of async requests will be delayed. Sync requests can not be deleayed. @param {Object} oXhr FakeXMLHttpRequest to respond. @param {Object} oEntry Entry from the har file.
[ "Responds", "to", "a", "given", "FakeXMLHttpRequest", "object", "with", "an", "entry", "from", "a", "har", "file", ".", "If", "a", "delay", "is", "provided", "the", "time", "is", "calculated", "and", "the", "response", "of", "async", "requests", "will", "b...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L364-L396
train
This function is called by the XMLHttpRequests module when the response is ready.
[ 30522, 3853, 1006, 23060, 8093, 1010, 1051, 4765, 2854, 1007, 1063, 13075, 1042, 16118, 2229, 26029, 2094, 1027, 3853, 1006, 1007, 1063, 2065, 1006, 23060, 8093, 1012, 3201, 9153, 2618, 999, 1027, 1027, 1014, 1007, 1063, 13075, 5034, 2229, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/polar/polarCreator.js
resizePolar
function resizePolar(polar, polarModel, api) { var center = polarModel.get('center'); var width = api.getWidth(); var height = api.getHeight(); polar.cx = parsePercent(center[0], width); polar.cy = parsePercent(center[1], height); var radiusAxis = polar.getRadiusAxis(); var size = Math.min(width, height) / 2; var radius = parsePercent(polarModel.get('radius'), size); radiusAxis.inverse ? radiusAxis.setExtent(radius, 0) : radiusAxis.setExtent(0, radius); }
javascript
function resizePolar(polar, polarModel, api) { var center = polarModel.get('center'); var width = api.getWidth(); var height = api.getHeight(); polar.cx = parsePercent(center[0], width); polar.cy = parsePercent(center[1], height); var radiusAxis = polar.getRadiusAxis(); var size = Math.min(width, height) / 2; var radius = parsePercent(polarModel.get('radius'), size); radiusAxis.inverse ? radiusAxis.setExtent(radius, 0) : radiusAxis.setExtent(0, radius); }
[ "function", "resizePolar", "(", "polar", ",", "polarModel", ",", "api", ")", "{", "var", "center", "=", "polarModel", ".", "get", "(", "'center'", ")", ";", "var", "width", "=", "api", ".", "getWidth", "(", ")", ";", "var", "height", "=", "api", ".",...
Resize method bound to the polar @param {module:echarts/coord/polar/PolarModel} polarModel @param {module:echarts/ExtensionAPI} api
[ "Resize", "method", "bound", "to", "the", "polar" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/polar/polarCreator.js#L40-L54
train
Resize polar to fit the specified size
[ 30522, 3853, 24501, 4697, 18155, 2906, 1006, 11508, 1010, 11508, 5302, 9247, 1010, 17928, 1007, 1063, 13075, 2415, 1027, 11508, 5302, 9247, 1012, 2131, 1006, 1005, 2415, 1005, 1007, 1025, 13075, 9381, 1027, 17928, 1012, 2131, 9148, 11927, 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...
eslint/eslint
lib/rules/no-else-return.js
checkIfWithElse
function checkIfWithElse(node) { const parent = node.parent; /* * Fixing this would require splitting one statement into two, so no error should * be reported if this node is in a position where only one statement is allowed. */ if (!astUtils.STATEMENT_LIST_PARENTS.has(parent.type)) { return; } const alternate = node.alternate; if (alternate && alwaysReturns(node.consequent)) { displayReport(alternate); } }
javascript
function checkIfWithElse(node) { const parent = node.parent; /* * Fixing this would require splitting one statement into two, so no error should * be reported if this node is in a position where only one statement is allowed. */ if (!astUtils.STATEMENT_LIST_PARENTS.has(parent.type)) { return; } const alternate = node.alternate; if (alternate && alwaysReturns(node.consequent)) { displayReport(alternate); } }
[ "function", "checkIfWithElse", "(", "node", ")", "{", "const", "parent", "=", "node", ".", "parent", ";", "/*\n * Fixing this would require splitting one statement into two, so no error should\n * be reported if this node is in a position where only one statement is...
Check the if statement @returns {void} @param {Node} node The node for the if statement to check @private
[ "Check", "the", "if", "statement" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-else-return.js#L253-L270
train
Check if node is a statement with an else statement
[ 30522, 3853, 4638, 10128, 24415, 9050, 2063, 1006, 13045, 1007, 1063, 9530, 3367, 6687, 1027, 13045, 1012, 6687, 1025, 1013, 1008, 1008, 15887, 2023, 2052, 5478, 14541, 2028, 4861, 2046, 2048, 1010, 2061, 2053, 7561, 2323, 1008, 2022, 2988,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(mSettings) { function applyAll(ctx, m) { var sName, sMethod; for ( sName in m ) { sMethod = "set" + sName.slice(0,1).toUpperCase() + sName.slice(1); if ( sName === 'formatSettings' && ctx.oFormatSettings ) { applyAll(ctx.oFormatSettings, m[sName]); } else if ( typeof ctx[sMethod] === 'function' ) { ctx[sMethod](m[sName]); } else { Log.warning("Configuration.applySettings: unknown setting '" + sName + "' ignored"); } } } assert(typeof mSettings === 'object', "mSettings must be an object"); this._collect(); // block events applyAll(this, mSettings); this._endCollect(); // might fire localizationChanged return this; }
javascript
function(mSettings) { function applyAll(ctx, m) { var sName, sMethod; for ( sName in m ) { sMethod = "set" + sName.slice(0,1).toUpperCase() + sName.slice(1); if ( sName === 'formatSettings' && ctx.oFormatSettings ) { applyAll(ctx.oFormatSettings, m[sName]); } else if ( typeof ctx[sMethod] === 'function' ) { ctx[sMethod](m[sName]); } else { Log.warning("Configuration.applySettings: unknown setting '" + sName + "' ignored"); } } } assert(typeof mSettings === 'object', "mSettings must be an object"); this._collect(); // block events applyAll(this, mSettings); this._endCollect(); // might fire localizationChanged return this; }
[ "function", "(", "mSettings", ")", "{", "function", "applyAll", "(", "ctx", ",", "m", ")", "{", "var", "sName", ",", "sMethod", ";", "for", "(", "sName", "in", "m", ")", "{", "sMethod", "=", "\"set\"", "+", "sName", ".", "slice", "(", "0", ",", "...
Applies multiple changes to the configuration at once. If the changed settings contain localization related settings like <code>language</code> or <ode>calendarType</code>, then only a single <code>localizationChanged</code> event will be fired. As the framework has to inform all existing components, elements, models etc. about localization changes, using <code>applySettings</code> can significantly reduce the overhead for multiple changes, esp. when they occur after the UI has been created already. The <code>mSettings</code> can contain any property <code><i>xyz</i></code> for which a setter method <code>set<i>XYZ</i></code> exists in the API of this class. Similarly, values for the {@link sap.ui.core.Configuration.FormatSettings format settings} API can be provided in a nested object with name <code>formatSettings</code>. @example <caption>Apply <code>language</code>, <code>calendarType</code> and several legacy format settings in one call</caption> sap.ui.getCore().getConfiguration().applySettings({ language: 'de', calendarType: sap.ui.core.CalendarType.Gregorian, formatSettings: { legacyDateFormat: '1', legacyTimeFormat: '1', legacyNumberFormat: '1' } }); @param {object} mSettings Configuration options to apply @returns {sap.ui.core.Configuration} Returns <code>this</code> to allow method chaining @public @since 1.38.6
[ "Applies", "multiple", "changes", "to", "the", "configuration", "at", "once", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1475-L1498
train
Apply all the settings to the current context
[ 30522, 3853, 1006, 5796, 18319, 3070, 2015, 1007, 1063, 3853, 6611, 8095, 1006, 14931, 2595, 1010, 1049, 1007, 1063, 13075, 1055, 18442, 1010, 15488, 11031, 7716, 1025, 2005, 1006, 1055, 18442, 1999, 1049, 1007, 1063, 15488, 11031, 7716, 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...
angular/angular
tools/rebase-pr.js
_main
async function _main(repository, prNumber) { console.log(`Determining target branch for PR ${prNumber} on ${repository}.`); const targetBranch = await determineTargetBranch(repository, prNumber); console.log(`Target branch is ${targetBranch}.`); await exec(`git fetch origin ${targetBranch}`); console.log(`Rebasing current branch on ${targetBranch}.`); await exec(`git rebase origin/${targetBranch}`); console.log('Rebase successful.'); }
javascript
async function _main(repository, prNumber) { console.log(`Determining target branch for PR ${prNumber} on ${repository}.`); const targetBranch = await determineTargetBranch(repository, prNumber); console.log(`Target branch is ${targetBranch}.`); await exec(`git fetch origin ${targetBranch}`); console.log(`Rebasing current branch on ${targetBranch}.`); await exec(`git rebase origin/${targetBranch}`); console.log('Rebase successful.'); }
[ "async", "function", "_main", "(", "repository", ",", "prNumber", ")", "{", "console", ".", "log", "(", "`", "${", "prNumber", "}", "${", "repository", "}", "`", ")", ";", "const", "targetBranch", "=", "await", "determineTargetBranch", "(", "repository", "...
Helpers
[ "Helpers" ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/rebase-pr.js#L61-L69
train
Main function.
[ 30522, 2004, 6038, 2278, 3853, 1035, 2364, 1006, 22409, 1010, 10975, 19172, 5677, 1007, 1063, 10122, 1012, 8833, 1006, 1036, 12515, 4539, 3589, 2005, 10975, 1002, 1063, 10975, 19172, 5677, 1065, 2006, 1002, 1063, 22409, 1065, 1012, 1036, 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...
mochajs/mocha
lib/runner.js
Runner
function Runner(suite, delay) { var self = this; this._globals = []; this._abort = false; this._delay = delay; this.suite = suite; this.started = false; this.total = suite.total(); this.failures = 0; this.on(constants.EVENT_TEST_END, function(test) { self.checkGlobals(test); }); this.on(constants.EVENT_HOOK_END, function(hook) { self.checkGlobals(hook); }); this._defaultGrep = /.*/; this.grep(this._defaultGrep); this.globals(this.globalProps().concat(extraGlobals())); }
javascript
function Runner(suite, delay) { var self = this; this._globals = []; this._abort = false; this._delay = delay; this.suite = suite; this.started = false; this.total = suite.total(); this.failures = 0; this.on(constants.EVENT_TEST_END, function(test) { self.checkGlobals(test); }); this.on(constants.EVENT_HOOK_END, function(hook) { self.checkGlobals(hook); }); this._defaultGrep = /.*/; this.grep(this._defaultGrep); this.globals(this.globalProps().concat(extraGlobals())); }
[ "function", "Runner", "(", "suite", ",", "delay", ")", "{", "var", "self", "=", "this", ";", "this", ".", "_globals", "=", "[", "]", ";", "this", ".", "_abort", "=", "false", ";", "this", ".", "_delay", "=", "delay", ";", "this", ".", "suite", "=...
Initialize a `Runner` at the Root {@link Suite}, which represents a hierarchy of {@link Suite|Suites} and {@link Test|Tests}. @extends external:EventEmitter @public @class @param {Suite} suite Root suite @param {boolean} [delay] Whether or not to delay execution of root suite until ready.
[ "Initialize", "a", "Runner", "at", "the", "Root", "{", "@link", "Suite", "}", "which", "represents", "a", "hierarchy", "of", "{", "@link", "Suite|Suites", "}", "and", "{", "@link", "Test|Tests", "}", "." ]
9b00fedb610241e33f7592c40164e42a38a793cf
https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/runner.js#L127-L145
train
A Runner is a suite of tests that run in a single test or hook.
[ 30522, 3853, 5479, 1006, 7621, 1010, 8536, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 2023, 1012, 1035, 3795, 2015, 1027, 1031, 1033, 1025, 2023, 1012, 1035, 11113, 11589, 1027, 6270, 1025, 2023, 1012, 1035, 8536, 1027, 8536, 1025, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/Agents/DOMAgent.js
_onChildNodeCountUpdated
function _onChildNodeCountUpdated(event, res) { // res = {nodeId, childNodeCount} if (res.nodeId > 0) { Inspector.DOM.requestChildNodes(res.nodeId); } }
javascript
function _onChildNodeCountUpdated(event, res) { // res = {nodeId, childNodeCount} if (res.nodeId > 0) { Inspector.DOM.requestChildNodes(res.nodeId); } }
[ "function", "_onChildNodeCountUpdated", "(", "event", ",", "res", ")", "{", "// res = {nodeId, childNodeCount}", "if", "(", "res", ".", "nodeId", ">", "0", ")", "{", "Inspector", ".", "DOM", ".", "requestChildNodes", "(", "res", ".", "nodeId", ")", ";", "}",...
WebInspector Event: DOM.childNodeCountUpdated
[ "WebInspector", "Event", ":", "DOM", ".", "childNodeCountUpdated" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMAgent.js#L219-L224
train
Called when the childNodeCount of the node has been updated
[ 30522, 3853, 1035, 2006, 19339, 3630, 3207, 3597, 16671, 6279, 13701, 2094, 1006, 2724, 1010, 24501, 1007, 1063, 1013, 1013, 24501, 1027, 1063, 13045, 3593, 1010, 2775, 3630, 3207, 3597, 16671, 1065, 2065, 1006, 24501, 1012, 13045, 3593, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/base/util/Properties.js
parse
function parse(sText, oProp) { var aLines = sText.split(rLines), // split file into lines sLine,rMatcher,sKey,sValue,i,m,iLastIndex,iConcatOps; function append(s) { if ( sValue ) { sValue = sValue + s; iConcatOps++; } else { sValue = s; iConcatOps = 0; } } oProp.mProperties = {}; for (i = 0; i < aLines.length; i++) { sLine = aLines[i]; // ignore empty lines if (sLine === "" || sLine.charAt(0) === "#" || sLine.charAt(0) === "!" ) { continue; } // start with the full regexp incl. key/value separator rMatcher = rEscapesOrSeparator; rMatcher.lastIndex = iLastIndex = 0; sKey = null; sValue = ""; while ( (m = rMatcher.exec(sLine)) !== null ) { // handle any raw, unmatched input if ( iLastIndex < m.index ) { append(sLine.slice(iLastIndex, m.index)); } iLastIndex = rMatcher.lastIndex; if ( m[1] ) { // unicode escape if ( m[1].length !== 6 ) { throw new Error("Incomplete Unicode Escape '" + m[1] + "'"); } append(String.fromCharCode(parseInt(m[1].slice(2), 16))); } else if ( m[2] ) { // special or simple escape append(mEscapes[m[2]] || m[2].slice(1)); } else if ( m[3] ) { // continuation line marker sLine = aLines[++i]; rMatcher.lastIndex = iLastIndex = 0; } else if ( m[4] ) { // only occurs in full regexp // key/value separator detected // -> remember key and switch to simplified regexp sKey = sValue; sValue = ""; rMatcher = rEscapes; rMatcher.lastIndex = iLastIndex; } } if ( iLastIndex < sLine.length ) { append(sLine.slice(iLastIndex)); } if ( sKey == null ) { sKey = sValue; sValue = ""; } oProp.mProperties[sKey] = flatstr(sValue, sValue ? iConcatOps : 0); // Note: empty sValue implies iConcatOps == 0 } }
javascript
function parse(sText, oProp) { var aLines = sText.split(rLines), // split file into lines sLine,rMatcher,sKey,sValue,i,m,iLastIndex,iConcatOps; function append(s) { if ( sValue ) { sValue = sValue + s; iConcatOps++; } else { sValue = s; iConcatOps = 0; } } oProp.mProperties = {}; for (i = 0; i < aLines.length; i++) { sLine = aLines[i]; // ignore empty lines if (sLine === "" || sLine.charAt(0) === "#" || sLine.charAt(0) === "!" ) { continue; } // start with the full regexp incl. key/value separator rMatcher = rEscapesOrSeparator; rMatcher.lastIndex = iLastIndex = 0; sKey = null; sValue = ""; while ( (m = rMatcher.exec(sLine)) !== null ) { // handle any raw, unmatched input if ( iLastIndex < m.index ) { append(sLine.slice(iLastIndex, m.index)); } iLastIndex = rMatcher.lastIndex; if ( m[1] ) { // unicode escape if ( m[1].length !== 6 ) { throw new Error("Incomplete Unicode Escape '" + m[1] + "'"); } append(String.fromCharCode(parseInt(m[1].slice(2), 16))); } else if ( m[2] ) { // special or simple escape append(mEscapes[m[2]] || m[2].slice(1)); } else if ( m[3] ) { // continuation line marker sLine = aLines[++i]; rMatcher.lastIndex = iLastIndex = 0; } else if ( m[4] ) { // only occurs in full regexp // key/value separator detected // -> remember key and switch to simplified regexp sKey = sValue; sValue = ""; rMatcher = rEscapes; rMatcher.lastIndex = iLastIndex; } } if ( iLastIndex < sLine.length ) { append(sLine.slice(iLastIndex)); } if ( sKey == null ) { sKey = sValue; sValue = ""; } oProp.mProperties[sKey] = flatstr(sValue, sValue ? iConcatOps : 0); // Note: empty sValue implies iConcatOps == 0 } }
[ "function", "parse", "(", "sText", ",", "oProp", ")", "{", "var", "aLines", "=", "sText", ".", "split", "(", "rLines", ")", ",", "// split file into lines", "sLine", ",", "rMatcher", ",", "sKey", ",", "sValue", ",", "i", ",", "m", ",", "iLastIndex", ",...
/* Parses the given text sText and sets the properties in the properties object oProp accordingly. @param {string} sText the text to parse @param oProp the properties object to fill @private
[ "/", "*", "Parses", "the", "given", "text", "sText", "and", "sets", "the", "properties", "in", "the", "properties", "object", "oProp", "accordingly", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/util/Properties.js#L139-L209
train
Parses a text file into a property object
[ 30522, 3853, 11968, 3366, 1006, 26261, 18413, 1010, 6728, 18981, 1007, 1063, 13075, 4862, 5267, 1027, 26261, 18413, 1012, 3975, 1006, 1054, 12735, 1007, 1010, 1013, 1013, 3975, 5371, 2046, 3210, 22889, 3170, 1010, 28549, 4017, 7474, 1010, 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...
elastic/elasticsearch-js
api/api/nodes.stats.js
buildNodesStats
function buildNodesStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html) request * * @param {list} metric - Limit the information returned to the specified metrics * @param {list} index_metric - Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. * @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes * @param {list} completion_fields - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) * @param {list} fielddata_fields - A comma-separated list of fields for `fielddata` index metric (supports wildcards) * @param {list} fields - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) * @param {boolean} groups - A comma-separated list of search groups for `search` index metric * @param {enum} level - Return indices stats aggregated at index, node or shard level * @param {list} types - A comma-separated list of document types for the `indexing` index metric * @param {time} timeout - Explicit operation timeout * @param {boolean} include_segment_file_sizes - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) */ const acceptedQuerystring = [ 'completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'types', 'timeout', 'include_segment_file_sizes', 'pretty', 'human', 'error_trace', 'source', 'filter_path' ] const snakeCase = { completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', errorTrace: 'error_trace', filterPath: 'filter_path' } return function nodesStats (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options options = {} } if (typeof params === 'function' || params == null) { callback = params params = {} options = {} } // check required parameters if (params.body != null) { const err = new ConfigurationError('This API does not require a body') return handleError(err, callback) } // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) return handleError(err, callback) } var warnings = [] var { method, body, metric, indexMetric, index_metric, nodeId, node_id, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } var path = '' if ((node_id || nodeId) != null && (metric) != null && (index_metric || indexMetric) != null) { path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index_metric || indexMetric) } else if ((node_id || nodeId) != null && (metric) != null) { path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats' + '/' + encodeURIComponent(metric) } else if ((metric) != null && (index_metric || indexMetric) != null) { path = '/' + '_nodes' + '/' + 'stats' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index_metric || indexMetric) } else if ((node_id || nodeId) != null) { path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats' } else if ((metric) != null) { path = '/' + '_nodes' + '/' + 'stats' + '/' + encodeURIComponent(metric) } else { path = '/' + '_nodes' + '/' + 'stats' } // build request object const request = { method, path, body: null, querystring } options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) } }
javascript
function buildNodesStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html) request * * @param {list} metric - Limit the information returned to the specified metrics * @param {list} index_metric - Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. * @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes * @param {list} completion_fields - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) * @param {list} fielddata_fields - A comma-separated list of fields for `fielddata` index metric (supports wildcards) * @param {list} fields - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) * @param {boolean} groups - A comma-separated list of search groups for `search` index metric * @param {enum} level - Return indices stats aggregated at index, node or shard level * @param {list} types - A comma-separated list of document types for the `indexing` index metric * @param {time} timeout - Explicit operation timeout * @param {boolean} include_segment_file_sizes - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) */ const acceptedQuerystring = [ 'completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'types', 'timeout', 'include_segment_file_sizes', 'pretty', 'human', 'error_trace', 'source', 'filter_path' ] const snakeCase = { completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', errorTrace: 'error_trace', filterPath: 'filter_path' } return function nodesStats (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options options = {} } if (typeof params === 'function' || params == null) { callback = params params = {} options = {} } // check required parameters if (params.body != null) { const err = new ConfigurationError('This API does not require a body') return handleError(err, callback) } // validate headers object if (options.headers != null && typeof options.headers !== 'object') { const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`) return handleError(err, callback) } var warnings = [] var { method, body, metric, indexMetric, index_metric, nodeId, node_id, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' } var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } var path = '' if ((node_id || nodeId) != null && (metric) != null && (index_metric || indexMetric) != null) { path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index_metric || indexMetric) } else if ((node_id || nodeId) != null && (metric) != null) { path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats' + '/' + encodeURIComponent(metric) } else if ((metric) != null && (index_metric || indexMetric) != null) { path = '/' + '_nodes' + '/' + 'stats' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index_metric || indexMetric) } else if ((node_id || nodeId) != null) { path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'stats' } else if ((metric) != null) { path = '/' + '_nodes' + '/' + 'stats' + '/' + encodeURIComponent(metric) } else { path = '/' + '_nodes' + '/' + 'stats' } // build request object const request = { method, path, body: null, querystring } options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) } }
[ "function", "buildNodesStats", "(", "opts", ")", "{", "// eslint-disable-next-line no-unused-vars", "const", "{", "makeRequest", ",", "ConfigurationError", ",", "handleError", ",", "snakeCaseKeys", "}", "=", "opts", "/**\n * Perform a [nodes.stats](http://www.elastic.co/guide...
/* eslint camelcase: 0 /* eslint no-unused-vars: 0
[ "/", "*", "eslint", "camelcase", ":", "0", "/", "*", "eslint", "no", "-", "unused", "-", "vars", ":", "0" ]
4fc4699a4d4474d7887bc7757e0269218a859294
https://github.com/elastic/elasticsearch-js/blob/4fc4699a4d4474d7887bc7757e0269218a859294/api/api/nodes.stats.js#L25-L132
train
Build the nodes stats
[ 30522, 3853, 3857, 3630, 6155, 9153, 3215, 1006, 23569, 2015, 1007, 1063, 1013, 1013, 9686, 4115, 2102, 1011, 4487, 19150, 1011, 2279, 1011, 2240, 2053, 1011, 15171, 1011, 13075, 2015, 9530, 3367, 1063, 9338, 2063, 15500, 1010, 9563, 2121, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
electron/electron
lib/browser/guest-window-manager.js
function (embedder, options) { if (options.webPreferences == null) { options.webPreferences = {} } if (embedder.browserWindowOptions != null) { let parentOptions = embedder.browserWindowOptions // if parent's visibility is available, that overrides 'show' flag (#12125) const win = BrowserWindow.fromWebContents(embedder.webContents) if (win != null) { parentOptions = { ...embedder.browserWindowOptions, show: win.isVisible() } } // Inherit the original options if it is a BrowserWindow. mergeOptions(options, parentOptions) } else { // Or only inherit webPreferences if it is a webview. mergeOptions(options.webPreferences, embedder.getLastWebPreferences()) } // Inherit certain option values from parent window const webPreferences = embedder.getLastWebPreferences() for (const [name, value] of inheritedWebPreferences) { if (webPreferences[name] === value) { options.webPreferences[name] = value } } // Sets correct openerId here to give correct options to 'new-window' event handler options.webPreferences.openerId = embedder.id return options }
javascript
function (embedder, options) { if (options.webPreferences == null) { options.webPreferences = {} } if (embedder.browserWindowOptions != null) { let parentOptions = embedder.browserWindowOptions // if parent's visibility is available, that overrides 'show' flag (#12125) const win = BrowserWindow.fromWebContents(embedder.webContents) if (win != null) { parentOptions = { ...embedder.browserWindowOptions, show: win.isVisible() } } // Inherit the original options if it is a BrowserWindow. mergeOptions(options, parentOptions) } else { // Or only inherit webPreferences if it is a webview. mergeOptions(options.webPreferences, embedder.getLastWebPreferences()) } // Inherit certain option values from parent window const webPreferences = embedder.getLastWebPreferences() for (const [name, value] of inheritedWebPreferences) { if (webPreferences[name] === value) { options.webPreferences[name] = value } } // Sets correct openerId here to give correct options to 'new-window' event handler options.webPreferences.openerId = embedder.id return options }
[ "function", "(", "embedder", ",", "options", ")", "{", "if", "(", "options", ".", "webPreferences", "==", "null", ")", "{", "options", ".", "webPreferences", "=", "{", "}", "}", "if", "(", "embedder", ".", "browserWindowOptions", "!=", "null", ")", "{", ...
Merge |options| with the |embedder|'s window's options.
[ "Merge", "|options|", "with", "the", "|embedder|", "s", "window", "s", "options", "." ]
6e29611788277729647acf465f10db1ea6f15788
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-window-manager.js#L48-L80
train
Inherit options from the parent window
[ 30522, 3853, 1006, 7861, 8270, 4063, 1010, 7047, 1007, 1063, 2065, 1006, 7047, 1012, 4773, 28139, 25523, 2015, 1027, 1027, 19701, 1007, 1063, 7047, 1012, 4773, 28139, 25523, 2015, 1027, 1063, 1065, 1065, 2065, 1006, 7861, 8270, 4063, 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...
dequelabs/axe-core
lib/core/utils/get-selector.js
getNthChildString
function getNthChildString(elm, selector) { const siblings = (elm.parentNode && Array.from(elm.parentNode.children || '')) || []; const hasMatchingSiblings = siblings.find( sibling => sibling !== elm && axe.utils.matchesSelector(sibling, selector) ); if (hasMatchingSiblings) { const nthChild = 1 + siblings.indexOf(elm); return ':nth-child(' + nthChild + ')'; } else { return ''; } }
javascript
function getNthChildString(elm, selector) { const siblings = (elm.parentNode && Array.from(elm.parentNode.children || '')) || []; const hasMatchingSiblings = siblings.find( sibling => sibling !== elm && axe.utils.matchesSelector(sibling, selector) ); if (hasMatchingSiblings) { const nthChild = 1 + siblings.indexOf(elm); return ':nth-child(' + nthChild + ')'; } else { return ''; } }
[ "function", "getNthChildString", "(", "elm", ",", "selector", ")", "{", "const", "siblings", "=", "(", "elm", ".", "parentNode", "&&", "Array", ".", "from", "(", "elm", ".", "parentNode", ".", "children", "||", "''", ")", ")", "||", "[", "]", ";", "c...
Given an element and a selector that finds that element (but possibly other sibling elements) return the :nth-child(n) pseudo selector that uniquely finds the node within its siblings @param {Element} elm The Element @param {String} selector The selector @return {String} The nth-child selector
[ "Given", "an", "element", "and", "a", "selector", "that", "finds", "that", "element", "(", "but", "possibly", "other", "sibling", "elements", ")", "return", "the", ":", "nth", "-", "child", "(", "n", ")", "pseudo", "selector", "that", "uniquely", "finds", ...
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/get-selector.js#L184-L196
train
Returns the nth child of the element that matches the selector
[ 30522, 3853, 2131, 3372, 16257, 19466, 5104, 18886, 3070, 1006, 17709, 1010, 27000, 1007, 1063, 9530, 3367, 9504, 1027, 1006, 17709, 1012, 6687, 3630, 3207, 1004, 1004, 9140, 1012, 2013, 1006, 17709, 1012, 6687, 3630, 3207, 1012, 2336, 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...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/toolbars.js
locationBar_focus
function locationBar_focus(event) { switch (event.type) { case "click": this._controller.click(this.urlbar); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "openCmd.commandkey"); this._controller.keypress(null, cmdKey, {accelKey: true}); break; default: throw new Error(arguments.callee.name + ": Unkown event type - " + event.type); } // Wait until the location bar has been focused this._controller.waitForEval("subject.getAttribute('focused') == 'true'", TIMEOUT, 100, this.urlbar.getNode()); }
javascript
function locationBar_focus(event) { switch (event.type) { case "click": this._controller.click(this.urlbar); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "openCmd.commandkey"); this._controller.keypress(null, cmdKey, {accelKey: true}); break; default: throw new Error(arguments.callee.name + ": Unkown event type - " + event.type); } // Wait until the location bar has been focused this._controller.waitForEval("subject.getAttribute('focused') == 'true'", TIMEOUT, 100, this.urlbar.getNode()); }
[ "function", "locationBar_focus", "(", "event", ")", "{", "switch", "(", "event", ".", "type", ")", "{", "case", "\"click\"", ":", "this", ".", "_controller", ".", "click", "(", "this", ".", "urlbar", ")", ";", "break", ";", "case", "\"shortcut\"", ":", ...
Focus the location bar @param {object} event Focus the location bar with the given event (click or shortcut)
[ "Focus", "the", "location", "bar" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L332-L348
train
Focus the location bar
[ 30522, 3853, 3295, 8237, 1035, 3579, 1006, 2724, 1007, 1063, 6942, 1006, 2724, 1012, 2828, 1007, 1063, 2553, 1000, 11562, 1000, 1024, 2023, 1012, 1035, 11486, 1012, 11562, 1006, 2023, 1012, 24471, 20850, 2906, 1007, 1025, 3338, 1025, 2553, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
didi/cube-ui
example/modules/image.js
detectVerticalSquash
function detectVerticalSquash(img) { // 拍照在IOS7或以下的机型会出现照片被压扁的bug var data; var ih = img.naturalHeight; var canvas = document.createElement('canvas'); canvas.width = 1; canvas.height = ih; var ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0); try { data = ctx.getImageData(0, 0, 1, ih).data; } catch (err) { console.log('Cannot check verticalSquash: CORS?'); return 1; } var sy = 0; var ey = ih; var py = ih; while (py > sy) { var alpha = data[(py - 1) * 4 + 3]; if (alpha === 0) { ey = py; } else { sy = py; } py = (ey + sy) >> 1; // py = parseInt((ey + sy) / 2) } var ratio = (py / ih); return (ratio === 0) ? 1 : ratio; }
javascript
function detectVerticalSquash(img) { // 拍照在IOS7或以下的机型会出现照片被压扁的bug var data; var ih = img.naturalHeight; var canvas = document.createElement('canvas'); canvas.width = 1; canvas.height = ih; var ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0); try { data = ctx.getImageData(0, 0, 1, ih).data; } catch (err) { console.log('Cannot check verticalSquash: CORS?'); return 1; } var sy = 0; var ey = ih; var py = ih; while (py > sy) { var alpha = data[(py - 1) * 4 + 3]; if (alpha === 0) { ey = py; } else { sy = py; } py = (ey + sy) >> 1; // py = parseInt((ey + sy) / 2) } var ratio = (py / ih); return (ratio === 0) ? 1 : ratio; }
[ "function", "detectVerticalSquash", "(", "img", ")", "{", "// 拍照在IOS7或以下的机型会出现照片被压扁的bug", "var", "data", ";", "var", "ih", "=", "img", ".", "naturalHeight", ";", "var", "canvas", "=", "document", ".", "createElement", "(", "'canvas'", ")", ";", "canvas", ".", ...
/* Tencent is pleased to support the open source community by making WeUI.js available. Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://opensource.org/licenses/MIT Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 检查图片是否有被压扁,如果有,返回比率 ref to http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios
[ "/", "*", "Tencent", "is", "pleased", "to", "support", "the", "open", "source", "community", "by", "making", "WeUI", ".", "js", "available", "." ]
29096d1fe600c699237db8039255f74126730157
https://github.com/didi/cube-ui/blob/29096d1fe600c699237db8039255f74126730157/example/modules/image.js#L24-L53
train
detect vertical squash
[ 30522, 3853, 11487, 16874, 7476, 2015, 16211, 4095, 1006, 10047, 2290, 1007, 1063, 1013, 1013, 100, 100, 100, 16380, 2581, 100, 100, 1743, 1916, 100, 100, 1763, 1774, 100, 100, 100, 100, 100, 100, 1916, 11829, 13075, 2951, 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...
airyland/vux
src/components/orientation/orientation.js
merge
function merge (s) { var r = {} var k if (s) { for (k in s) { if (s.hasOwnProperty(k)) { r[k] = s[k] } } } return r }
javascript
function merge (s) { var r = {} var k if (s) { for (k in s) { if (s.hasOwnProperty(k)) { r[k] = s[k] } } } return r }
[ "function", "merge", "(", "s", ")", "{", "var", "r", "=", "{", "}", "var", "k", "if", "(", "s", ")", "{", "for", "(", "k", "in", "s", ")", "{", "if", "(", "s", ".", "hasOwnProperty", "(", "k", ")", ")", "{", "r", "[", "k", "]", "=", "s"...
混入对象属性 @method merge @param {Object} s 提供对象 @return {Object} r 接收对象 @private
[ "混入对象属性" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/orientation/orientation.js#L25-L38
train
Merge the specified object with the current object
[ 30522, 3853, 13590, 1006, 1055, 1007, 1063, 13075, 1054, 1027, 1063, 1065, 13075, 1047, 2065, 1006, 1055, 1007, 1063, 2005, 1006, 1047, 1999, 1055, 1007, 1063, 2065, 1006, 1055, 1012, 2038, 12384, 21572, 4842, 3723, 1006, 1047, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js
function(oEvent) { var oTouch; if (bHandleEvent) { oTouch = oEvent.touches[0]; // Check if the finger is moved. When the finger was moved, no "click" event is fired. if (Math.abs(oTouch.clientX - iStartX) > 10 || Math.abs(oTouch.clientY - iStartY) > 10) { bIsMoved = true; } if (bIsMoved) { // Fire "mousemove" event only when the finger was moved. This is to prevent unwanted movements. fireMouseEvent("mousemove", oEvent); } } }
javascript
function(oEvent) { var oTouch; if (bHandleEvent) { oTouch = oEvent.touches[0]; // Check if the finger is moved. When the finger was moved, no "click" event is fired. if (Math.abs(oTouch.clientX - iStartX) > 10 || Math.abs(oTouch.clientY - iStartY) > 10) { bIsMoved = true; } if (bIsMoved) { // Fire "mousemove" event only when the finger was moved. This is to prevent unwanted movements. fireMouseEvent("mousemove", oEvent); } } }
[ "function", "(", "oEvent", ")", "{", "var", "oTouch", ";", "if", "(", "bHandleEvent", ")", "{", "oTouch", "=", "oEvent", ".", "touches", "[", "0", "]", ";", "// Check if the finger is moved. When the finger was moved, no \"click\" event is fired.", "if", "(", "Math"...
Touch move event handler. Fires mouse move event. @param {jQuery.Event} oEvent the event object @private
[ "Touch", "move", "event", "handler", ".", "Fires", "mouse", "move", "event", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js#L116-L133
train
Handles the mouse move event
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 13075, 27178, 7140, 2818, 1025, 2065, 1006, 1038, 11774, 10559, 15338, 1007, 1063, 27178, 30524, 7140, 2818, 1012, 7396, 2595, 1011, 21541, 8445, 2595, 1007, 1028, 2184, 1064, 1064, 8785, 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...
GeekyAnts/vue-native-core
dist/vue.runtime.common.js
getHookArgumentsLength
function getHookArgumentsLength (fn) { if (isUndef(fn)) { return false } var invokerFns = fn.fns; if (isDef(invokerFns)) { // invoker return getHookArgumentsLength( Array.isArray(invokerFns) ? invokerFns[0] : invokerFns ) } else { return (fn._length || fn.length) > 1 } }
javascript
function getHookArgumentsLength (fn) { if (isUndef(fn)) { return false } var invokerFns = fn.fns; if (isDef(invokerFns)) { // invoker return getHookArgumentsLength( Array.isArray(invokerFns) ? invokerFns[0] : invokerFns ) } else { return (fn._length || fn.length) > 1 } }
[ "function", "getHookArgumentsLength", "(", "fn", ")", "{", "if", "(", "isUndef", "(", "fn", ")", ")", "{", "return", "false", "}", "var", "invokerFns", "=", "fn", ".", "fns", ";", "if", "(", "isDef", "(", "invokerFns", ")", ")", "{", "// invoker", "r...
Normalize a transition hook's argument length. The hook may be: - a merged hook (invoker) with the original in .fns - a wrapped component method (check ._length) - a plain function (.length)
[ "Normalize", "a", "transition", "hook", "s", "argument", "length", ".", "The", "hook", "may", "be", ":", "-", "a", "merged", "hook", "(", "invoker", ")", "with", "the", "original", "in", ".", "fns", "-", "a", "wrapped", "component", "method", "(", "che...
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L6003-L6018
train
Returns the number of arguments in a hook
[ 30522, 3853, 2131, 6806, 12352, 10623, 27417, 3215, 7770, 13512, 2232, 1006, 1042, 2078, 1007, 1063, 2065, 1006, 2003, 8630, 12879, 1006, 1042, 2078, 1007, 1007, 1063, 2709, 6270, 1065, 13075, 1999, 6767, 5484, 2546, 3619, 1027, 1042, 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...
goldfire/howler.js
dist/howler.js
function() { var self = this; self._drain(); // Find the first inactive node to recycle. for (var i=0; i<self._sounds.length; i++) { if (self._sounds[i]._ended) { return self._sounds[i].reset(); } } // If no inactive node was found, create a new one. return new Sound(self); }
javascript
function() { var self = this; self._drain(); // Find the first inactive node to recycle. for (var i=0; i<self._sounds.length; i++) { if (self._sounds[i]._ended) { return self._sounds[i].reset(); } } // If no inactive node was found, create a new one. return new Sound(self); }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "self", ".", "_drain", "(", ")", ";", "// Find the first inactive node to recycle.", "for", "(", "var", "i", "=", "0", ";", "i", "<", "self", ".", "_sounds", ".", "length", ";", "i", "++", "...
Return an inactive sound from the pool or create a new one. @return {Sound} Sound playback object.
[ "Return", "an", "inactive", "sound", "from", "the", "pool", "or", "create", "a", "new", "one", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L2009-L2023
train
Returns the last node to recycle.
[ 30522, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 2969, 1012, 1035, 12475, 1006, 1007, 1025, 1013, 1013, 2424, 1996, 2034, 16389, 13045, 2000, 28667, 2100, 14321, 1012, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 2969...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
goldfire/howler.js
examples/sprite/sprite.js
function() { var self = this; var keys = Object.keys(self._spriteMap); keys.forEach(function(key) { window[key].addEventListener('click', function() { self.play(key); }, false); }); }
javascript
function() { var self = this; var keys = Object.keys(self._spriteMap); keys.forEach(function(key) { window[key].addEventListener('click', function() { self.play(key); }, false); }); }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "var", "keys", "=", "Object", ".", "keys", "(", "self", ".", "_spriteMap", ")", ";", "keys", ".", "forEach", "(", "function", "(", "key", ")", "{", "window", "[", "key", "]", ".", "addEv...
Setup the listeners for each sprite click area.
[ "Setup", "the", "listeners", "for", "each", "sprite", "click", "area", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/sprite/sprite.js#L52-L61
train
Add event listeners to the sprites
[ 30522, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 6309, 1027, 4874, 1012, 6309, 1006, 2969, 1012, 1035, 11867, 17625, 2863, 2361, 1007, 1025, 6309, 1012, 18921, 6776, 1006, 3853, 1006, 3145, 1007, 1063, 3332, 1031, 3145, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.m/src/sap/m/ios7.js
function() { var bIsIOS7Safari = sap.ui.Device.os.ios && sap.ui.Device.os.version >= 7 && sap.ui.Device.os.version < 8 && sap.ui.Device.browser.name === "sf"; //call the base to properly init the event registry sap.ui.base.EventProvider.apply(this); if (!bIsIOS7Safari) { return; } this._bIntervallAttached = false; this._bInputIsOpen = false; this._bNavigationBarEventFired = false; var bIsLandscape = window.orientation === 90 || window.orientation === -90; if (bIsLandscape) { this._attachNavigationBarPolling(); } sap.ui.Device.orientation.attachHandler(this._onOrientationChange, this); this._onFocusin = jQuery.proxy(this._onFocusin, this); document.addEventListener("focusin", this._onFocusin , true); this._onFocusout = jQuery.proxy(this._onFocusout, this); //attach this event in the capturing phase, so noone can stop propagation document.addEventListener("focusout", this._onFocusout, true); }
javascript
function() { var bIsIOS7Safari = sap.ui.Device.os.ios && sap.ui.Device.os.version >= 7 && sap.ui.Device.os.version < 8 && sap.ui.Device.browser.name === "sf"; //call the base to properly init the event registry sap.ui.base.EventProvider.apply(this); if (!bIsIOS7Safari) { return; } this._bIntervallAttached = false; this._bInputIsOpen = false; this._bNavigationBarEventFired = false; var bIsLandscape = window.orientation === 90 || window.orientation === -90; if (bIsLandscape) { this._attachNavigationBarPolling(); } sap.ui.Device.orientation.attachHandler(this._onOrientationChange, this); this._onFocusin = jQuery.proxy(this._onFocusin, this); document.addEventListener("focusin", this._onFocusin , true); this._onFocusout = jQuery.proxy(this._onFocusout, this); //attach this event in the capturing phase, so noone can stop propagation document.addEventListener("focusout", this._onFocusout, true); }
[ "function", "(", ")", "{", "var", "bIsIOS7Safari", "=", "sap", ".", "ui", ".", "Device", ".", "os", ".", "ios", "&&", "sap", ".", "ui", ".", "Device", ".", "os", ".", "version", ">=", "7", "&&", "sap", ".", "ui", ".", "Device", ".", "os", ".", ...
IOS 7 behaves strange if the keyboard is open and you do an orientation change: There will be a black space below the page and it will scroll away from the top in this case. That's why we scroll to the top on orientation change. We also need to catch blur since if you do orientation change with keyboard open, close the Keyboard, Open it on another input, the black box will appear again. Since closing the keyboard will fire blur, we attach on this one. @private
[ "IOS", "7", "behaves", "strange", "if", "the", "keyboard", "is", "open", "and", "you", "do", "an", "orientation", "change", ":", "There", "will", "be", "a", "black", "space", "below", "the", "page", "and", "it", "will", "scroll", "away", "from", "the", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ios7.js#L21-L48
train
Initializes the event registry
[ 30522, 3853, 1006, 1007, 1063, 13075, 20377, 10735, 2581, 3736, 14971, 2072, 1027, 20066, 1012, 21318, 1012, 5080, 1012, 9808, 1012, 16380, 1004, 1004, 20066, 1012, 21318, 1012, 5080, 1012, 9808, 1012, 2544, 1028, 1027, 1021, 1004, 1004, 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...
SeleniumHQ/selenium
third_party/closure/goog/bootstrap/nodejs.js
nodeGlobalRequire
function nodeGlobalRequire(file) { vm.runInThisContext.call(global, fs.readFileSync(file), file); }
javascript
function nodeGlobalRequire(file) { vm.runInThisContext.call(global, fs.readFileSync(file), file); }
[ "function", "nodeGlobalRequire", "(", "file", ")", "{", "vm", ".", "runInThisContext", ".", "call", "(", "global", ",", "fs", ".", "readFileSync", "(", "file", ")", ",", "file", ")", ";", "}" ]
Declared here so it can be used to require base.js
[ "Declared", "here", "so", "it", "can", "be", "used", "to", "require", "base", ".", "js" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/bootstrap/nodejs.js#L86-L88
train
Require a node module
[ 30522, 3853, 13045, 23296, 16429, 2389, 2890, 15549, 2890, 1006, 5371, 1007, 1063, 1058, 2213, 1012, 2448, 18447, 24158, 8663, 18209, 1012, 2655, 1006, 3795, 1010, 1042, 2015, 1012, 3191, 8873, 4244, 6038, 2278, 1006, 5371, 1007, 1010, 5371...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
summernote/summernote
src/js/base/core/range.js
textRangeToPoint
function textRangeToPoint(textRange, isStart) { let container = textRange.parentElement(); let offset; const tester = document.body.createTextRange(); let prevContainer; const childNodes = lists.from(container.childNodes); for (offset = 0; offset < childNodes.length; offset++) { if (dom.isText(childNodes[offset])) { continue; } tester.moveToElementText(childNodes[offset]); if (tester.compareEndPoints('StartToStart', textRange) >= 0) { break; } prevContainer = childNodes[offset]; } if (offset !== 0 && dom.isText(childNodes[offset - 1])) { const textRangeStart = document.body.createTextRange(); let curTextNode = null; textRangeStart.moveToElementText(prevContainer || container); textRangeStart.collapse(!prevContainer); curTextNode = prevContainer ? prevContainer.nextSibling : container.firstChild; const pointTester = textRange.duplicate(); pointTester.setEndPoint('StartToStart', textRangeStart); let textCount = pointTester.text.replace(/[\r\n]/g, '').length; while (textCount > curTextNode.nodeValue.length && curTextNode.nextSibling) { textCount -= curTextNode.nodeValue.length; curTextNode = curTextNode.nextSibling; } // [workaround] enforce IE to re-reference curTextNode, hack const dummy = curTextNode.nodeValue; // eslint-disable-line if (isStart && curTextNode.nextSibling && dom.isText(curTextNode.nextSibling) && textCount === curTextNode.nodeValue.length) { textCount -= curTextNode.nodeValue.length; curTextNode = curTextNode.nextSibling; } container = curTextNode; offset = textCount; } return { cont: container, offset: offset, }; }
javascript
function textRangeToPoint(textRange, isStart) { let container = textRange.parentElement(); let offset; const tester = document.body.createTextRange(); let prevContainer; const childNodes = lists.from(container.childNodes); for (offset = 0; offset < childNodes.length; offset++) { if (dom.isText(childNodes[offset])) { continue; } tester.moveToElementText(childNodes[offset]); if (tester.compareEndPoints('StartToStart', textRange) >= 0) { break; } prevContainer = childNodes[offset]; } if (offset !== 0 && dom.isText(childNodes[offset - 1])) { const textRangeStart = document.body.createTextRange(); let curTextNode = null; textRangeStart.moveToElementText(prevContainer || container); textRangeStart.collapse(!prevContainer); curTextNode = prevContainer ? prevContainer.nextSibling : container.firstChild; const pointTester = textRange.duplicate(); pointTester.setEndPoint('StartToStart', textRangeStart); let textCount = pointTester.text.replace(/[\r\n]/g, '').length; while (textCount > curTextNode.nodeValue.length && curTextNode.nextSibling) { textCount -= curTextNode.nodeValue.length; curTextNode = curTextNode.nextSibling; } // [workaround] enforce IE to re-reference curTextNode, hack const dummy = curTextNode.nodeValue; // eslint-disable-line if (isStart && curTextNode.nextSibling && dom.isText(curTextNode.nextSibling) && textCount === curTextNode.nodeValue.length) { textCount -= curTextNode.nodeValue.length; curTextNode = curTextNode.nextSibling; } container = curTextNode; offset = textCount; } return { cont: container, offset: offset, }; }
[ "function", "textRangeToPoint", "(", "textRange", ",", "isStart", ")", "{", "let", "container", "=", "textRange", ".", "parentElement", "(", ")", ";", "let", "offset", ";", "const", "tester", "=", "document", ".", "body", ".", "createTextRange", "(", ")", ...
return boundaryPoint from TextRange, inspired by Andy Na's HuskyRange.js @param {TextRange} textRange @param {Boolean} isStart @return {BoundaryPoint} @see http://msdn.microsoft.com/en-us/library/ie/ms535872(v=vs.85).aspx
[ "return", "boundaryPoint", "from", "TextRange", "inspired", "by", "Andy", "Na", "s", "HuskyRange", ".", "js" ]
8dcafb8107453006b905ef697a529c42e76beb3f
https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/range.js#L16-L67
train
Get the element that contains the given text range
[ 30522, 3853, 3793, 24388, 18903, 8400, 1006, 3793, 24388, 2063, 1010, 26354, 7559, 2102, 1007, 1063, 2292, 11661, 1027, 3793, 24388, 2063, 1012, 6687, 12260, 3672, 1006, 1007, 1025, 2292, 16396, 1025, 9530, 3367, 3231, 2121, 1027, 6254, 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...
apache/incubator-echarts
src/chart/treemap/treemapLayout.js
prunning
function prunning(node, clipRect, viewAbovePath, viewRoot, depth) { var nodeLayout = node.getLayout(); var nodeInViewAbovePath = viewAbovePath[depth]; var isAboveViewRoot = nodeInViewAbovePath && nodeInViewAbovePath === node; if ( (nodeInViewAbovePath && !isAboveViewRoot) || (depth === viewAbovePath.length && node !== viewRoot) ) { return; } node.setLayout({ // isInView means: viewRoot sub tree + viewAbovePath isInView: true, // invisible only means: outside view clip so that the node can not // see but still layout for animation preparation but not render. invisible: !isAboveViewRoot && !clipRect.intersect(nodeLayout), isAboveViewRoot: isAboveViewRoot }, true); // Transform to child coordinate. var childClipRect = new BoundingRect( clipRect.x - nodeLayout.x, clipRect.y - nodeLayout.y, clipRect.width, clipRect.height ); each(node.viewChildren || [], function (child) { prunning(child, childClipRect, viewAbovePath, viewRoot, depth + 1); }); }
javascript
function prunning(node, clipRect, viewAbovePath, viewRoot, depth) { var nodeLayout = node.getLayout(); var nodeInViewAbovePath = viewAbovePath[depth]; var isAboveViewRoot = nodeInViewAbovePath && nodeInViewAbovePath === node; if ( (nodeInViewAbovePath && !isAboveViewRoot) || (depth === viewAbovePath.length && node !== viewRoot) ) { return; } node.setLayout({ // isInView means: viewRoot sub tree + viewAbovePath isInView: true, // invisible only means: outside view clip so that the node can not // see but still layout for animation preparation but not render. invisible: !isAboveViewRoot && !clipRect.intersect(nodeLayout), isAboveViewRoot: isAboveViewRoot }, true); // Transform to child coordinate. var childClipRect = new BoundingRect( clipRect.x - nodeLayout.x, clipRect.y - nodeLayout.y, clipRect.width, clipRect.height ); each(node.viewChildren || [], function (child) { prunning(child, childClipRect, viewAbovePath, viewRoot, depth + 1); }); }
[ "function", "prunning", "(", "node", ",", "clipRect", ",", "viewAbovePath", ",", "viewRoot", ",", "depth", ")", "{", "var", "nodeLayout", "=", "node", ".", "getLayout", "(", ")", ";", "var", "nodeInViewAbovePath", "=", "viewAbovePath", "[", "depth", "]", "...
Mark nodes visible for prunning when visual coding and rendering. Prunning depends on layout and root position, so we have to do it after layout.
[ "Mark", "nodes", "visible", "for", "prunning", "when", "visual", "coding", "and", "rendering", ".", "Prunning", "depends", "on", "layout", "and", "root", "position", "so", "we", "have", "to", "do", "it", "after", "layout", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/treemapLayout.js#L563-L595
train
prunning is called for each node in the view
[ 30522, 3853, 10975, 4609, 5582, 1006, 13045, 1010, 12528, 2890, 6593, 1010, 3193, 7875, 21818, 15069, 1010, 3193, 3217, 4140, 1010, 5995, 1007, 1063, 13075, 13045, 8485, 5833, 1027, 13045, 1012, 2131, 8485, 5833, 1006, 1007, 1025, 13075, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/sankey/sankeyLayout.js
moveSinksRight
function moveSinksRight(nodes, maxDepth) { zrUtil.each(nodes, function (node) { if (!isNodeDepth(node) && !node.outEdges.length) { node.setLayout({depth: maxDepth}, true); } }); }
javascript
function moveSinksRight(nodes, maxDepth) { zrUtil.each(nodes, function (node) { if (!isNodeDepth(node) && !node.outEdges.length) { node.setLayout({depth: maxDepth}, true); } }); }
[ "function", "moveSinksRight", "(", "nodes", ",", "maxDepth", ")", "{", "zrUtil", ".", "each", "(", "nodes", ",", "function", "(", "node", ")", "{", "if", "(", "!", "isNodeDepth", "(", "node", ")", "&&", "!", "node", ".", "outEdges", ".", "length", ")...
All the node without outEgdes are assigned maximum x-position and be aligned in the last column. @param {module:echarts/data/Graph~Node} nodes. node of sankey view. @param {number} maxDepth. use to assign to node without outEdges as x-position.
[ "All", "the", "node", "without", "outEgdes", "are", "assigned", "maximum", "x", "-", "position", "and", "be", "aligned", "in", "the", "last", "column", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/sankey/sankeyLayout.js#L225-L231
train
Move sinks right
[ 30522, 3853, 5829, 19839, 21338, 18743, 1006, 14164, 1010, 4098, 3207, 13876, 2232, 1007, 1063, 1062, 22134, 4014, 1012, 2169, 1006, 14164, 1010, 3853, 1006, 13045, 1007, 1063, 2065, 1006, 999, 3475, 10244, 3207, 13876, 2232, 1006, 13045, 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...
SheetJS/js-xlsx
bits/19_fsutils.js
read_binary
function read_binary(path/*:string*/) { if(typeof _fs !== 'undefined') return _fs.readFileSync(path); // $FlowIgnore if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript // $FlowIgnore var infile = File(path); infile.open("r"); infile.encoding = "binary"; var data = infile.read(); infile.close(); return data; } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } throw new Error("Cannot access file " + path); }
javascript
function read_binary(path/*:string*/) { if(typeof _fs !== 'undefined') return _fs.readFileSync(path); // $FlowIgnore if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript // $FlowIgnore var infile = File(path); infile.open("r"); infile.encoding = "binary"; var data = infile.read(); infile.close(); return data; } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } throw new Error("Cannot access file " + path); }
[ "function", "read_binary", "(", "path", "/*:string*/", ")", "{", "if", "(", "typeof", "_fs", "!==", "'undefined'", ")", "return", "_fs", ".", "readFileSync", "(", "path", ")", ";", "// $FlowIgnore", "if", "(", "typeof", "$", "!==", "'undefined'", "&&", "ty...
/* read binary data from file
[ "/", "*", "read", "binary", "data", "from", "file" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/19_fsutils.js#L51-L61
train
read binary file
[ 30522, 3853, 3191, 1035, 12441, 1006, 4130, 1013, 1008, 1024, 5164, 1008, 1013, 1007, 1063, 2065, 1006, 2828, 11253, 1035, 1042, 2015, 999, 1027, 1027, 1005, 6151, 28344, 1005, 1007, 2709, 1035, 1042, 2015, 1012, 3191, 8873, 4244, 6038, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
release.js
replaceBaseHref
function replaceBaseHref (folder) { // handle index.html const filePath = path.join(__dirname, '/code.material.angularjs.org/', folder, '/index.html'); const file = fs.readFileSync(filePath); const contents = file.toString().replace(/base href="\//g, 'base href="/' + folder + '/'); fs.writeFileSync(filePath, contents); }
javascript
function replaceBaseHref (folder) { // handle index.html const filePath = path.join(__dirname, '/code.material.angularjs.org/', folder, '/index.html'); const file = fs.readFileSync(filePath); const contents = file.toString().replace(/base href="\//g, 'base href="/' + folder + '/'); fs.writeFileSync(filePath, contents); }
[ "function", "replaceBaseHref", "(", "folder", ")", "{", "// handle index.html", "const", "filePath", "=", "path", ".", "join", "(", "__dirname", ",", "'/code.material.angularjs.org/'", ",", "folder", ",", "'/index.html'", ")", ";", "const", "file", "=", "fs", "....
replaces base href in index.html for new version as well as latest
[ "replaces", "base", "href", "in", "index", ".", "html", "for", "new", "version", "as", "well", "as", "latest" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L345-L351
train
replace base href in index. html
[ 30522, 3853, 5672, 15058, 28362, 2546, 1006, 19622, 1007, 1063, 1013, 1013, 5047, 5950, 1012, 16129, 9530, 3367, 5371, 15069, 1027, 4130, 1012, 3693, 1006, 1035, 1035, 16101, 18442, 1010, 1005, 1013, 3642, 1012, 3430, 1012, 16108, 22578, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/widgets/bootstrap-twipsy-mod.js
function ( element, options ) { this.$element = $(element) this.options = options this.enabled = true /***** [changed for Brackets] *****/ this.autoHideTimeout = null; /***** [/changed for Brackets] *****/ this.fixTitle() }
javascript
function ( element, options ) { this.$element = $(element) this.options = options this.enabled = true /***** [changed for Brackets] *****/ this.autoHideTimeout = null; /***** [/changed for Brackets] *****/ this.fixTitle() }
[ "function", "(", "element", ",", "options", ")", "{", "this", ".", "$element", "=", "$", "(", "element", ")", "this", ".", "options", "=", "options", "this", ".", "enabled", "=", "true", "/***** [changed for Brackets] *****/", "this", ".", "autoHideTimeout", ...
/* TWIPSY PUBLIC CLASS DEFINITION ==============================
[ "/", "*", "TWIPSY", "PUBLIC", "CLASS", "DEFINITION", "==============================" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/widgets/bootstrap-twipsy-mod.js#L86-L94
train
Constructor for the node
[ 30522, 3853, 1006, 5783, 1010, 7047, 1007, 1063, 2023, 1012, 1002, 5783, 1027, 1002, 1006, 5783, 1007, 2023, 1012, 7047, 1027, 7047, 2023, 1012, 9124, 1027, 2995, 1013, 1008, 1008, 1008, 1008, 1008, 1031, 2904, 2005, 19719, 1033, 1008, 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...
feathericons/feather
bin/process-svg.js
setAttrs
function setAttrs(svg) { const $ = cheerio.load(svg); Object.keys(DEFAULT_ATTRS).forEach(key => $('svg').attr(key, DEFAULT_ATTRS[key]), ); return $('body').html(); }
javascript
function setAttrs(svg) { const $ = cheerio.load(svg); Object.keys(DEFAULT_ATTRS).forEach(key => $('svg').attr(key, DEFAULT_ATTRS[key]), ); return $('body').html(); }
[ "function", "setAttrs", "(", "svg", ")", "{", "const", "$", "=", "cheerio", ".", "load", "(", "svg", ")", ";", "Object", ".", "keys", "(", "DEFAULT_ATTRS", ")", ".", "forEach", "(", "key", "=>", "$", "(", "'svg'", ")", ".", "attr", "(", "key", ",...
Set default attibutes on SVG. @param {string} svg - An SVG string. @returns {string}
[ "Set", "default", "attibutes", "on", "SVG", "." ]
8f658193d25e943b196a2367319b5d9e85ee9f9f
https://github.com/feathericons/feather/blob/8f658193d25e943b196a2367319b5d9e85ee9f9f/bin/process-svg.js#L48-L56
train
Set the SVG attributes
[ 30522, 3853, 2275, 19321, 2869, 1006, 17917, 2290, 1007, 1063, 9530, 3367, 1002, 1027, 15138, 3695, 1012, 7170, 1006, 17917, 2290, 1007, 1025, 4874, 1012, 6309, 1006, 12398, 1035, 2012, 16344, 2015, 1007, 1012, 18921, 6776, 1006, 3145, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js
function(left, top, animate) { var self = this; var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft; var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop; self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate); }
javascript
function(left, top, animate) { var self = this; var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft; var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop; self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate); }
[ "function", "(", "left", ",", "top", ",", "animate", ")", "{", "var", "self", "=", "this", ";", "var", "startLeft", "=", "self", ".", "__isAnimating", "?", "self", ".", "__scheduledLeft", ":", "self", ".", "__scrollLeft", ";", "var", "startTop", "=", "...
Scroll by the given offset @param {Number ? 0} left Scroll x-axis by given offset @param {Number ? 0} top Scroll x-axis by given offset @param {Boolean ? false} animate Whether to animate the given change
[ "Scroll", "by", "the", "given", "offset" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js#L872-L881
train
Scrolls to the specified position
[ 30522, 3853, 1006, 2187, 1010, 2327, 1010, 2019, 21499, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 2707, 2571, 6199, 1027, 2969, 1012, 1035, 1035, 18061, 3490, 18900, 2075, 1029, 2969, 1012, 1035, 1035, 5115, 2571, 6199, 1024, 2969, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/text.js
PromiseCache
function PromiseCache () { var cache = this.cache = {}; this.get = function (key, promiseGenerator) { if (key in cache) { return cache[key]; } cache[key] = promiseGenerator(); return cache[key]; }; }
javascript
function PromiseCache () { var cache = this.cache = {}; this.get = function (key, promiseGenerator) { if (key in cache) { return cache[key]; } cache[key] = promiseGenerator(); return cache[key]; }; }
[ "function", "PromiseCache", "(", ")", "{", "var", "cache", "=", "this", ".", "cache", "=", "{", "}", ";", "this", ".", "get", "=", "function", "(", "key", ",", "promiseGenerator", ")", "{", "if", "(", "key", "in", "cache", ")", "{", "return", "cach...
Get or create a promise given a key and promise generator. @todo Move to a utility and use in other parts of A-Frame.
[ "Get", "or", "create", "a", "promise", "given", "a", "key", "and", "promise", "generator", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/text.js#L473-L483
train
A cache for the promise generator
[ 30522, 3853, 4872, 3540, 5403, 1006, 1007, 1063, 13075, 17053, 1027, 2023, 1012, 17053, 1027, 1063, 1065, 1025, 2023, 1012, 2131, 1027, 3853, 1006, 3145, 1010, 4872, 6914, 6906, 4263, 1007, 1063, 2065, 1006, 3145, 1999, 17053, 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...
babel/babel
packages/babel-plugin-transform-typescript/src/enum.js
enumFill
function enumFill(path, t, id) { const x = translateEnumValues(path, t); const assignments = x.map(([memberName, memberValue]) => buildEnumMember(t.isStringLiteral(memberValue), { ENUM: t.cloneNode(id), NAME: memberName, VALUE: memberValue, }), ); return buildEnumWrapper({ ID: t.cloneNode(id), ASSIGNMENTS: assignments, }); }
javascript
function enumFill(path, t, id) { const x = translateEnumValues(path, t); const assignments = x.map(([memberName, memberValue]) => buildEnumMember(t.isStringLiteral(memberValue), { ENUM: t.cloneNode(id), NAME: memberName, VALUE: memberValue, }), ); return buildEnumWrapper({ ID: t.cloneNode(id), ASSIGNMENTS: assignments, }); }
[ "function", "enumFill", "(", "path", ",", "t", ",", "id", ")", "{", "const", "x", "=", "translateEnumValues", "(", "path", ",", "t", ")", ";", "const", "assignments", "=", "x", ".", "map", "(", "(", "[", "memberName", ",", "memberValue", "]", ")", ...
Generates the statement that fills in the variable declared by the enum. `(function (E) { ... assignments ... })(E || (E = {}));`
[ "Generates", "the", "statement", "that", "fills", "in", "the", "variable", "declared", "by", "the", "enum", ".", "(", "function", "(", "E", ")", "{", "...", "assignments", "...", "}", ")", "(", "E", "||", "(", "E", "=", "{}", "))", ";" ]
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-plugin-transform-typescript/src/enum.js#L75-L89
train
Fill an enum with the given path
[ 30522, 3853, 4372, 2819, 8873, 3363, 1006, 4130, 1010, 1056, 1010, 8909, 1007, 1063, 9530, 3367, 1060, 1027, 17637, 2368, 2819, 10175, 15808, 1006, 4130, 1010, 1056, 1007, 1025, 9530, 3367, 14799, 1027, 1060, 1012, 4949, 1006, 1006, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function (sLanguage, sSAPLogonLanguage) { var oLocale = convertToLocaleOrNull(sLanguage), bOldRTL = this.getRTL(), mChanges; check(oLocale, "Configuration.setLanguage: sLanguage must be a valid BCP47 language tag"); check(sSAPLogonLanguage == null || (typeof sSAPLogonLanguage === 'string' && /[A-Z0-9]{2,2}/i.test(sSAPLogonLanguage)), "Configuration.setLanguage: sSAPLogonLanguage must be null or be a string of length 2, consisting of digits and latin characters only", /* warn= */ true); if ( oLocale.toString() != this.getLanguageTag() || sSAPLogonLanguage !== this.sapLogonLanguage ) { this.language = oLocale; this.sapLogonLanguage = sSAPLogonLanguage || undefined; this.sapparams['sap-language'] = this.getSAPLogonLanguage(); mChanges = this._collect(); mChanges.language = this.getLanguageTag(); this.derivedRTL = Locale._impliesRTL(oLocale); if ( bOldRTL != this.getRTL() ) { mChanges.rtl = this.getRTL(); } this._endCollect(); } return this; }
javascript
function (sLanguage, sSAPLogonLanguage) { var oLocale = convertToLocaleOrNull(sLanguage), bOldRTL = this.getRTL(), mChanges; check(oLocale, "Configuration.setLanguage: sLanguage must be a valid BCP47 language tag"); check(sSAPLogonLanguage == null || (typeof sSAPLogonLanguage === 'string' && /[A-Z0-9]{2,2}/i.test(sSAPLogonLanguage)), "Configuration.setLanguage: sSAPLogonLanguage must be null or be a string of length 2, consisting of digits and latin characters only", /* warn= */ true); if ( oLocale.toString() != this.getLanguageTag() || sSAPLogonLanguage !== this.sapLogonLanguage ) { this.language = oLocale; this.sapLogonLanguage = sSAPLogonLanguage || undefined; this.sapparams['sap-language'] = this.getSAPLogonLanguage(); mChanges = this._collect(); mChanges.language = this.getLanguageTag(); this.derivedRTL = Locale._impliesRTL(oLocale); if ( bOldRTL != this.getRTL() ) { mChanges.rtl = this.getRTL(); } this._endCollect(); } return this; }
[ "function", "(", "sLanguage", ",", "sSAPLogonLanguage", ")", "{", "var", "oLocale", "=", "convertToLocaleOrNull", "(", "sLanguage", ")", ",", "bOldRTL", "=", "this", ".", "getRTL", "(", ")", ",", "mChanges", ";", "check", "(", "oLocale", ",", "\"Configuratio...
Sets a new language to be used from now on for language/region dependent functionality (e.g. formatting, data types, translated texts, ...). When the language can't be interpreted as a BCP47 language (using the relaxed syntax described in {@link #getLanguage}, an error will be thrown. When the language has changed, the Core will fire its {@link sap.ui.core.Core#event:localizationChanged localizationChanged} event. <h3>Restrictions</h3> The framework <strong>does not</strong> guarantee that already created, language dependent objects will be updated by this call. It therefore remains best practice for applications to switch the language early, e.g. before any language dependent objects are created. Applications that need to support more dynamic changes of the language should listen to the <code>localizationChanged</code> event and adapt all language dependent objects that they use (e.g. by rebuilding their UI). Currently, the framework notifies the following objects about a change of the localization settings before it fires the <code>localizationChanged</code> event: <ul> <li>date and number data types that are used in property bindings or composite bindings in existing Elements, Controls, UIAreas or Components</li> <li>ResourceModels currently assigned to the Core, a UIArea, Component, Element or Control</li> <li>Elements or Controls that implement the <code>onlocalizationChanged</code> hook (note the lowercase 'l' in onlocalizationChanged)</li> </ul> It furthermore derives the RTL mode from the new language, if no explicit RTL mode has been set. If the RTL mode changes, the following additional actions will be taken: <ul> <li>the URLs of already loaded library theme files will be changed</li> <li>the <code>dir</code> attribute of the page will be changed to reflect the new mode.</li> <li>all UIAreas will be invalidated (which results in a rendering of the whole UI5 UI)</li> </ul> This method does not accept SAP language codes for <code>sLanguage</code>. Instead, a second parameter <code>sSAPLogonLanguage</code> can be provided with an SAP language code corresponding to the given language. A given value will be returned by the {@link #getSAPLogonLanguage} method. It is up to the caller to provide a consistent pair of BCP47 language and SAP language code. The SAP language code is only checked to be of length 2 and must consist of letters or digits only. <b>Note</b>: When using this method please take note of and respect the above mentioned restrictions. @param {string} sLanguage the new language as a BCP47 compliant language tag; case doesn't matter and underscores can be used instead of dashes to separate components (compatibility with Java Locale IDs) @param {string} [sSAPLogonLanguage] SAP language code that corresponds to the <code>sLanguage</code>; if a value is specified, future calls to <code>getSAPLogonLanguage</code> will return that value; if no value is specified, the framework will use the ISO639 language part of <code>sLanguage</code> as SAP Logon language. @throws {Error} When <code>sLanguage</code> can't be interpreted as a BCP47 language or when <code>sSAPLanguage</code> is given and can't be interpreted as SAP language code. @return {sap.ui.core.Configuration} <code>this</code> to allow method chaining @see http://scn.sap.com/docs/DOC-14377 @public
[ "Sets", "a", "new", "language", "to", "be", "used", "from", "now", "on", "for", "language", "/", "region", "dependent", "functionality", "(", "e", ".", "g", ".", "formatting", "data", "types", "translated", "texts", "...", ")", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L708-L730
train
Sets the language tag of the configuration object.
[ 30522, 3853, 1006, 21435, 6692, 3351, 1010, 7020, 9331, 21197, 2239, 25023, 6692, 3351, 1007, 1063, 13075, 19330, 24755, 2571, 1027, 10463, 3406, 4135, 9289, 8780, 6826, 18083, 1006, 21435, 6692, 3351, 1007, 1010, 7782, 5339, 2140, 1027, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/project/ProjectManager.js
getLanguageFilter
function getLanguageFilter(languageId) { return function languageFilter(file) { var id = LanguageManager.getLanguageForPath(file.fullPath).getId(); if (typeof languageId === "string") { return (id === languageId); } else { return (languageId.indexOf(id) !== -1); } }; }
javascript
function getLanguageFilter(languageId) { return function languageFilter(file) { var id = LanguageManager.getLanguageForPath(file.fullPath).getId(); if (typeof languageId === "string") { return (id === languageId); } else { return (languageId.indexOf(id) !== -1); } }; }
[ "function", "getLanguageFilter", "(", "languageId", ")", "{", "return", "function", "languageFilter", "(", "file", ")", "{", "var", "id", "=", "LanguageManager", ".", "getLanguageForPath", "(", "file", ".", "fullPath", ")", ".", "getId", "(", ")", ";", "if",...
Returns a filter for use with getAllFiles() that filters files based on LanguageManager language id @param {!(string|Array.<string>)} languageId a single string of a language id or an array of language ids @return {!function(File):boolean}
[ "Returns", "a", "filter", "for", "use", "with", "getAllFiles", "()", "that", "filters", "files", "based", "on", "LanguageManager", "language", "id" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectManager.js#L1152-L1161
train
getLanguageFilter - returns a function that returns true if the file matches the given language
[ 30522, 3853, 2131, 25023, 6692, 3351, 8873, 21928, 1006, 2653, 3593, 1007, 1063, 2709, 3853, 2653, 8873, 21928, 1006, 5371, 1007, 1063, 13075, 8909, 1027, 2653, 24805, 4590, 1012, 2131, 25023, 6692, 3351, 29278, 15069, 1006, 5371, 1012, 244...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dequelabs/axe-core
lib/core/utils/get-selector.js
getElmId
function getElmId(elm) { if (!elm.getAttribute('id')) { return; } let doc = (elm.getRootNode && elm.getRootNode()) || document; const id = '#' + escapeSelector(elm.getAttribute('id') || ''); if ( // Don't include youtube's uid values, they change on reload !id.match(/player_uid_/) && // Don't include IDs that occur more then once on the page doc.querySelectorAll(id).length === 1 ) { return id; } }
javascript
function getElmId(elm) { if (!elm.getAttribute('id')) { return; } let doc = (elm.getRootNode && elm.getRootNode()) || document; const id = '#' + escapeSelector(elm.getAttribute('id') || ''); if ( // Don't include youtube's uid values, they change on reload !id.match(/player_uid_/) && // Don't include IDs that occur more then once on the page doc.querySelectorAll(id).length === 1 ) { return id; } }
[ "function", "getElmId", "(", "elm", ")", "{", "if", "(", "!", "elm", ".", "getAttribute", "(", "'id'", ")", ")", "{", "return", ";", "}", "let", "doc", "=", "(", "elm", ".", "getRootNode", "&&", "elm", ".", "getRootNode", "(", ")", ")", "||", "do...
Get ID selector
[ "Get", "ID", "selector" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/get-selector.js#L201-L215
train
Get the id of an element
[ 30522, 3853, 2131, 2884, 4328, 2094, 1006, 17709, 1007, 1063, 2065, 1006, 999, 17709, 1012, 2131, 19321, 3089, 8569, 2618, 1006, 1005, 8909, 1005, 1007, 1007, 1063, 2709, 1025, 1065, 2292, 9986, 1027, 1006, 17709, 1012, 2131, 3217, 4140, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/prefer-const.js
getIdentifierIfShouldBeConst
function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) { if (variable.eslintUsed && variable.scope.type === "global") { return null; } // Finds the unique WriteReference. let writer = null; let isReadBeforeInit = false; const references = variable.references; for (let i = 0; i < references.length; ++i) { const reference = references[i]; if (reference.isWrite()) { const isReassigned = ( writer !== null && writer.identifier !== reference.identifier ); if (isReassigned) { return null; } const destructuringHost = getDestructuringHost(reference); if (destructuringHost !== null && destructuringHost.left !== void 0) { const leftNode = destructuringHost.left; let hasOuterVariables = false, hasNonIdentifiers = false; if (leftNode.type === "ObjectPattern") { const properties = leftNode.properties; hasOuterVariables = properties .filter(prop => prop.value) .map(prop => prop.value.name) .some(name => isOuterVariableInDestructing(name, variable.scope)); hasNonIdentifiers = hasMemberExpressionAssignment(leftNode); } else if (leftNode.type === "ArrayPattern") { const elements = leftNode.elements; hasOuterVariables = elements .map(element => element && element.name) .some(name => isOuterVariableInDestructing(name, variable.scope)); hasNonIdentifiers = hasMemberExpressionAssignment(leftNode); } if (hasOuterVariables || hasNonIdentifiers) { return null; } } writer = reference; } else if (reference.isRead() && writer === null) { if (ignoreReadBeforeAssign) { return null; } isReadBeforeInit = true; } } /* * If the assignment is from a different scope, ignore it. * If the assignment cannot change to a declaration, ignore it. */ const shouldBeConst = ( writer !== null && writer.from === variable.scope && canBecomeVariableDeclaration(writer.identifier) ); if (!shouldBeConst) { return null; } if (isReadBeforeInit) { return variable.defs[0].name; } return writer.identifier; }
javascript
function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) { if (variable.eslintUsed && variable.scope.type === "global") { return null; } // Finds the unique WriteReference. let writer = null; let isReadBeforeInit = false; const references = variable.references; for (let i = 0; i < references.length; ++i) { const reference = references[i]; if (reference.isWrite()) { const isReassigned = ( writer !== null && writer.identifier !== reference.identifier ); if (isReassigned) { return null; } const destructuringHost = getDestructuringHost(reference); if (destructuringHost !== null && destructuringHost.left !== void 0) { const leftNode = destructuringHost.left; let hasOuterVariables = false, hasNonIdentifiers = false; if (leftNode.type === "ObjectPattern") { const properties = leftNode.properties; hasOuterVariables = properties .filter(prop => prop.value) .map(prop => prop.value.name) .some(name => isOuterVariableInDestructing(name, variable.scope)); hasNonIdentifiers = hasMemberExpressionAssignment(leftNode); } else if (leftNode.type === "ArrayPattern") { const elements = leftNode.elements; hasOuterVariables = elements .map(element => element && element.name) .some(name => isOuterVariableInDestructing(name, variable.scope)); hasNonIdentifiers = hasMemberExpressionAssignment(leftNode); } if (hasOuterVariables || hasNonIdentifiers) { return null; } } writer = reference; } else if (reference.isRead() && writer === null) { if (ignoreReadBeforeAssign) { return null; } isReadBeforeInit = true; } } /* * If the assignment is from a different scope, ignore it. * If the assignment cannot change to a declaration, ignore it. */ const shouldBeConst = ( writer !== null && writer.from === variable.scope && canBecomeVariableDeclaration(writer.identifier) ); if (!shouldBeConst) { return null; } if (isReadBeforeInit) { return variable.defs[0].name; } return writer.identifier; }
[ "function", "getIdentifierIfShouldBeConst", "(", "variable", ",", "ignoreReadBeforeAssign", ")", "{", "if", "(", "variable", ".", "eslintUsed", "&&", "variable", ".", "scope", ".", "type", "===", "\"global\"", ")", "{", "return", "null", ";", "}", "// Finds the ...
Gets an identifier node of a given variable. If the initialization exists or one or more reading references exist before the first assignment, the identifier node is the node of the declaration. Otherwise, the identifier node is the node of the first assignment. If the variable should not change to const, this function returns null. - If the variable is reassigned. - If the variable is never initialized nor assigned. - If the variable is initialized in a different scope from the declaration. - If the unique assignment of the variable cannot change to a declaration. e.g. `if (a) b = 1` / `return (b = 1)` - If the variable is declared in the global scope and `eslintUsed` is `true`. `/*exported foo` directive comment makes such variables. This rule does not warn such variables because this rule cannot distinguish whether the exported variables are reassigned or not. @param {eslint-scope.Variable} variable - A variable to get. @param {boolean} ignoreReadBeforeAssign - The value of `ignoreReadBeforeAssign` option. @returns {ASTNode|null} An Identifier node if the variable should change to const. Otherwise, null.
[ "Gets", "an", "identifier", "node", "of", "a", "given", "variable", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-const.js#L173-L258
train
Returns the identifier if the variable is a constant
[ 30522, 3853, 2131, 5178, 16778, 8873, 11124, 10343, 6806, 21285, 4783, 8663, 3367, 1006, 8023, 1010, 8568, 16416, 18939, 12879, 5686, 12054, 23773, 1007, 1063, 2065, 1006, 8023, 1012, 9686, 4115, 5809, 2098, 1004, 1004, 8023, 1012, 9531, 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...
goldfire/howler.js
dist/howler.js
function(event, fn, id) { var self = this; var events = self['_on' + event]; var i = 0; // Allow passing just an event and ID. if (typeof fn === 'number') { id = fn; fn = null; } if (fn || id) { // Loop through event store and remove the passed function. for (i=0; i<events.length; i++) { var isId = (id === events[i].id); if (fn === events[i].fn && isId || !fn && isId) { events.splice(i, 1); break; } } } else if (event) { // Clear out all events of this type. self['_on' + event] = []; } else { // Clear out all events of every type. var keys = Object.keys(self); for (i=0; i<keys.length; i++) { if ((keys[i].indexOf('_on') === 0) && Array.isArray(self[keys[i]])) { self[keys[i]] = []; } } } return self; }
javascript
function(event, fn, id) { var self = this; var events = self['_on' + event]; var i = 0; // Allow passing just an event and ID. if (typeof fn === 'number') { id = fn; fn = null; } if (fn || id) { // Loop through event store and remove the passed function. for (i=0; i<events.length; i++) { var isId = (id === events[i].id); if (fn === events[i].fn && isId || !fn && isId) { events.splice(i, 1); break; } } } else if (event) { // Clear out all events of this type. self['_on' + event] = []; } else { // Clear out all events of every type. var keys = Object.keys(self); for (i=0; i<keys.length; i++) { if ((keys[i].indexOf('_on') === 0) && Array.isArray(self[keys[i]])) { self[keys[i]] = []; } } } return self; }
[ "function", "(", "event", ",", "fn", ",", "id", ")", "{", "var", "self", "=", "this", ";", "var", "events", "=", "self", "[", "'_on'", "+", "event", "]", ";", "var", "i", "=", "0", ";", "// Allow passing just an event and ID.", "if", "(", "typeof", "...
Remove a custom event. Call without parameters to remove all events. @param {String} event Event name. @param {Function} fn Listener to remove. Leave empty to remove all. @param {Number} id (optional) Only remove events for this sound. @return {Howl}
[ "Remove", "a", "custom", "event", ".", "Call", "without", "parameters", "to", "remove", "all", "events", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L1789-L1823
train
Remove an event handler
[ 30522, 3853, 1006, 2724, 1010, 1042, 2078, 1010, 8909, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 2824, 1027, 2969, 1031, 1005, 1035, 2006, 1005, 1009, 2724, 1033, 1025, 13075, 1045, 1027, 1014, 1025, 1013, 30524, 2078, 1025, 1042, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/lines-around-directive.js
checkDirectives
function checkDirectives(node) { const directives = astUtils.getDirectivePrologue(node); if (!directives.length) { return; } const firstDirective = directives[0]; const leadingComments = sourceCode.getCommentsBefore(firstDirective); /* * Only check before the first directive if it is preceded by a comment or if it is at the top of * the file and expectLineBefore is set to "never". This is to not force a newline at the top of * the file if there are no comments as well as for compatibility with padded-blocks. */ if (leadingComments.length) { if (expectLineBefore === "always" && !hasNewlineBefore(firstDirective)) { reportError(firstDirective, "before", true); } if (expectLineBefore === "never" && hasNewlineBefore(firstDirective)) { reportError(firstDirective, "before", false); } } else if ( node.type === "Program" && expectLineBefore === "never" && !leadingComments.length && hasNewlineBefore(firstDirective) ) { reportError(firstDirective, "before", false); } const lastDirective = directives[directives.length - 1]; const statements = node.type === "Program" ? node.body : node.body.body; /* * Do not check after the last directive if the body only * contains a directive prologue and isn't followed by a comment to ensure * this rule behaves well with padded-blocks. */ if (lastDirective === statements[statements.length - 1] && !lastDirective.trailingComments) { return; } if (expectLineAfter === "always" && !hasNewlineAfter(lastDirective)) { reportError(lastDirective, "after", true); } if (expectLineAfter === "never" && hasNewlineAfter(lastDirective)) { reportError(lastDirective, "after", false); } }
javascript
function checkDirectives(node) { const directives = astUtils.getDirectivePrologue(node); if (!directives.length) { return; } const firstDirective = directives[0]; const leadingComments = sourceCode.getCommentsBefore(firstDirective); /* * Only check before the first directive if it is preceded by a comment or if it is at the top of * the file and expectLineBefore is set to "never". This is to not force a newline at the top of * the file if there are no comments as well as for compatibility with padded-blocks. */ if (leadingComments.length) { if (expectLineBefore === "always" && !hasNewlineBefore(firstDirective)) { reportError(firstDirective, "before", true); } if (expectLineBefore === "never" && hasNewlineBefore(firstDirective)) { reportError(firstDirective, "before", false); } } else if ( node.type === "Program" && expectLineBefore === "never" && !leadingComments.length && hasNewlineBefore(firstDirective) ) { reportError(firstDirective, "before", false); } const lastDirective = directives[directives.length - 1]; const statements = node.type === "Program" ? node.body : node.body.body; /* * Do not check after the last directive if the body only * contains a directive prologue and isn't followed by a comment to ensure * this rule behaves well with padded-blocks. */ if (lastDirective === statements[statements.length - 1] && !lastDirective.trailingComments) { return; } if (expectLineAfter === "always" && !hasNewlineAfter(lastDirective)) { reportError(lastDirective, "after", true); } if (expectLineAfter === "never" && hasNewlineAfter(lastDirective)) { reportError(lastDirective, "after", false); } }
[ "function", "checkDirectives", "(", "node", ")", "{", "const", "directives", "=", "astUtils", ".", "getDirectivePrologue", "(", "node", ")", ";", "if", "(", "!", "directives", ".", "length", ")", "{", "return", ";", "}", "const", "firstDirective", "=", "di...
Check lines around directives in node @param {ASTNode} node - node to check @returns {void}
[ "Check", "lines", "around", "directives", "in", "node" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/lines-around-directive.js#L137-L188
train
Check directives of a node
[ 30522, 3853, 4638, 4305, 2890, 15277, 2015, 1006, 13045, 1007, 1063, 9530, 3367, 16449, 2015, 1027, 2004, 8525, 3775, 4877, 1012, 2131, 4305, 2890, 15277, 21572, 24277, 1006, 13045, 1007, 1025, 2065, 1006, 999, 16449, 2015, 1012, 3091, 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...
NervJS/taro
packages/taro-transformer-wx/src/plugins/remove-dead-code.js
isControlTransfer
function isControlTransfer(stmt, path, control = "break") { const { [control]: type } = { break: "BreakStatement", continue: "ContinueStatement" }; if (!type) { throw new Error("Can only handle break and continue statements"); } const checker = `is${type}`; if (stmt[checker]()) { return _isControlTransfer(stmt, path); } let isTransferred = false; let result = { [control]: false, bail: false }; stmt.traverse({ [type](cPath) { // if we already detected a break/continue statement, if (isTransferred) return; result = _isControlTransfer(cPath, path); if (result.bail || result[control]) { isTransferred = true; } } }); return result; function _isControlTransfer(cPath, path) { const label = cPath.get("label"); if (label.node !== null) { // labels are fn scoped and not accessible by inner functions // path is the switch statement if (!isSameFunctionScope(path, cPath)) { // we don't have to worry about this break statement return { break: false, bail: false }; } // here we handle the break labels // if they are outside switch, we bail out // if they are within the case, we keep them let labelPath; if (path.scope.getLabel) { labelPath = getLabel(label.node.name, path); } else { labelPath = path.scope.getBinding(label.node.name).path; } const _isAncestor = isAncestor(labelPath, path); return { bail: _isAncestor, [control]: _isAncestor }; } // set the flag that it is indeed breaking let isCTransfer = true; // this flag is to capture // switch(0) { case 0: while(1) if (x) break; } let possibleRunTimeControlTransfer = false; // and compute if it's breaking the correct thing let parent = cPath.parentPath; while (parent !== stmt.parentPath) { // loops and nested switch cases if (parent.isLoop() || parent.isSwitchCase()) { // invalidate all the possible runtime breaks captured // while (1) { if (x) break; } possibleRunTimeControlTransfer = false; // and set that it's not breaking our switch statement isCTransfer = false; break; } // // this is a special case and depends on // the fact that SwitchStatement is handled in the // exit hook of the traverse // // switch (0) { // case 0: if (x) break; // } // // here `x` is runtime only. // in this case, we need to bail out. So we depend on exit hook // of switch so that, it would have visited the IfStatement first // before the SwitchStatement and would have removed the // IfStatement if it was a compile time determined // if (parent.isIfStatement()) { possibleRunTimeControlTransfer = true; } parent = parent.parentPath; } return { [control]: possibleRunTimeControlTransfer || isCTransfer, bail: possibleRunTimeControlTransfer }; } }
javascript
function isControlTransfer(stmt, path, control = "break") { const { [control]: type } = { break: "BreakStatement", continue: "ContinueStatement" }; if (!type) { throw new Error("Can only handle break and continue statements"); } const checker = `is${type}`; if (stmt[checker]()) { return _isControlTransfer(stmt, path); } let isTransferred = false; let result = { [control]: false, bail: false }; stmt.traverse({ [type](cPath) { // if we already detected a break/continue statement, if (isTransferred) return; result = _isControlTransfer(cPath, path); if (result.bail || result[control]) { isTransferred = true; } } }); return result; function _isControlTransfer(cPath, path) { const label = cPath.get("label"); if (label.node !== null) { // labels are fn scoped and not accessible by inner functions // path is the switch statement if (!isSameFunctionScope(path, cPath)) { // we don't have to worry about this break statement return { break: false, bail: false }; } // here we handle the break labels // if they are outside switch, we bail out // if they are within the case, we keep them let labelPath; if (path.scope.getLabel) { labelPath = getLabel(label.node.name, path); } else { labelPath = path.scope.getBinding(label.node.name).path; } const _isAncestor = isAncestor(labelPath, path); return { bail: _isAncestor, [control]: _isAncestor }; } // set the flag that it is indeed breaking let isCTransfer = true; // this flag is to capture // switch(0) { case 0: while(1) if (x) break; } let possibleRunTimeControlTransfer = false; // and compute if it's breaking the correct thing let parent = cPath.parentPath; while (parent !== stmt.parentPath) { // loops and nested switch cases if (parent.isLoop() || parent.isSwitchCase()) { // invalidate all the possible runtime breaks captured // while (1) { if (x) break; } possibleRunTimeControlTransfer = false; // and set that it's not breaking our switch statement isCTransfer = false; break; } // // this is a special case and depends on // the fact that SwitchStatement is handled in the // exit hook of the traverse // // switch (0) { // case 0: if (x) break; // } // // here `x` is runtime only. // in this case, we need to bail out. So we depend on exit hook // of switch so that, it would have visited the IfStatement first // before the SwitchStatement and would have removed the // IfStatement if it was a compile time determined // if (parent.isIfStatement()) { possibleRunTimeControlTransfer = true; } parent = parent.parentPath; } return { [control]: possibleRunTimeControlTransfer || isCTransfer, bail: possibleRunTimeControlTransfer }; } }
[ "function", "isControlTransfer", "(", "stmt", ",", "path", ",", "control", "=", "\"break\"", ")", "{", "const", "{", "[", "control", "]", ":", "type", "}", "=", "{", "break", ":", "\"BreakStatement\"", ",", "continue", ":", "\"ContinueStatement\"", "}", ";...
tells if a "stmt" is a break/continue statement
[ "tells", "if", "a", "stmt", "is", "a", "break", "/", "continue", "statement" ]
274e76d731d7f158141287e31cbd51f092d472c5
https://github.com/NervJS/taro/blob/274e76d731d7f158141287e31cbd51f092d472c5/packages/taro-transformer-wx/src/plugins/remove-dead-code.js#L1189-L1302
train
Checks if a statement is a break or continue statement
[ 30522, 3853, 2003, 8663, 13181, 7096, 5521, 22747, 2121, 1006, 2358, 20492, 1010, 4130, 1010, 2491, 1027, 1000, 3338, 1000, 1007, 1063, 9530, 3367, 1063, 1031, 2491, 1033, 1024, 2828, 1065, 1027, 1063, 3338, 1024, 1000, 7807, 12259, 3672, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function (name, attrs, text) { var child = Strophe.xmlElement(name, attrs, text); this.node.appendChild(child); if (!text) { this.node = child; } return this; }
javascript
function (name, attrs, text) { var child = Strophe.xmlElement(name, attrs, text); this.node.appendChild(child); if (!text) { this.node = child; } return this; }
[ "function", "(", "name", ",", "attrs", ",", "text", ")", "{", "var", "child", "=", "Strophe", ".", "xmlElement", "(", "name", ",", "attrs", ",", "text", ")", ";", "this", ".", "node", ".", "appendChild", "(", "child", ")", ";", "if", "(", "!", "t...
Function: c Add a child to the current element and make it the new current element. This function moves the current element pointer to the child, unless text is provided. If you need to add another child, it is necessary to use up() to go back to the parent in the tree. Parameters: (String) name - The name of the child. (Object) attrs - The attributes of the child in object notation. (String) text - The text to add to the child. Returns: The Strophe.Builder object.
[ "Function", ":", "c", "Add", "a", "child", "to", "the", "current", "element", "and", "make", "it", "the", "new", "current", "element", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L1686-L1694
train
Creates a new tag with the specified name and attributes.
[ 30522, 3853, 1006, 2171, 1010, 2012, 16344, 2015, 1010, 3793, 1007, 1063, 13075, 2775, 1027, 2358, 18981, 5369, 1012, 20950, 12260, 3672, 1006, 2171, 1010, 2012, 16344, 2015, 1010, 3793, 1007, 1025, 2023, 1012, 13045, 1012, 10439, 10497, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
didi/cube-ui
build/build.js
buildPack
function buildPack(webpackConfig, cb, spinnerText) { var spinner = ora(spinnerText || 'building for uncompressed files...') spinner.start() webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) { throw err } process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n') cb && cb() }) }
javascript
function buildPack(webpackConfig, cb, spinnerText) { var spinner = ora(spinnerText || 'building for uncompressed files...') spinner.start() webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) { throw err } process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n') cb && cb() }) }
[ "function", "buildPack", "(", "webpackConfig", ",", "cb", ",", "spinnerText", ")", "{", "var", "spinner", "=", "ora", "(", "spinnerText", "||", "'building for uncompressed files...'", ")", "spinner", ".", "start", "(", ")", "webpack", "(", "webpackConfig", ",", ...
cp('-R', 'static/*', assetsPath)
[ "cp", "(", "-", "R", "static", "/", "*", "assetsPath", ")" ]
29096d1fe600c699237db8039255f74126730157
https://github.com/didi/cube-ui/blob/29096d1fe600c699237db8039255f74126730157/build/build.js#L22-L39
train
buildPack - build the webpack webpack
[ 30522, 3853, 3857, 23947, 1006, 4773, 23947, 8663, 8873, 2290, 1010, 17324, 1010, 6714, 3678, 18209, 1007, 1063, 13075, 6714, 3678, 1027, 2030, 2050, 1006, 6714, 3678, 18209, 1064, 1064, 1005, 2311, 2005, 4895, 9006, 19811, 6764, 1012, 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/base/i18n/ResourceBundle.js
splitUrl
function splitUrl(sUrl) { var m = rUrl.exec(sUrl); if ( !m || A_VALID_FILE_TYPES.indexOf( m[2] ) < 0 ) { throw new Error("resource URL '" + sUrl + "' has unknown type (should be one of " + A_VALID_FILE_TYPES.join(",") + ")"); } return { url : sUrl, prefix : m[1], ext : m[2], query: m[4], hash: (m[5] || ""), suffix : m[2] + (m[3] || "") }; }
javascript
function splitUrl(sUrl) { var m = rUrl.exec(sUrl); if ( !m || A_VALID_FILE_TYPES.indexOf( m[2] ) < 0 ) { throw new Error("resource URL '" + sUrl + "' has unknown type (should be one of " + A_VALID_FILE_TYPES.join(",") + ")"); } return { url : sUrl, prefix : m[1], ext : m[2], query: m[4], hash: (m[5] || ""), suffix : m[2] + (m[3] || "") }; }
[ "function", "splitUrl", "(", "sUrl", ")", "{", "var", "m", "=", "rUrl", ".", "exec", "(", "sUrl", ")", ";", "if", "(", "!", "m", "||", "A_VALID_FILE_TYPES", ".", "indexOf", "(", "m", "[", "2", "]", ")", "<", "0", ")", "{", "throw", "new", "Erro...
Helper to split a URL with the above regex. Either returns an object with the parts or undefined. @param {string} sUrl URL to analyze / split into pieces. @returns {object} an object with properties for the individual URL parts
[ "Helper", "to", "split", "a", "URL", "with", "the", "above", "regex", ".", "Either", "returns", "an", "object", "with", "the", "parts", "or", "undefined", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js#L197-L203
train
Split a URL into prefix ext query and suffix
[ 30522, 3853, 3975, 3126, 2140, 1006, 7505, 2140, 1007, 1063, 13075, 1049, 1027, 21766, 12190, 1012, 4654, 8586, 1006, 7505, 2140, 1007, 1025, 2065, 1006, 999, 1049, 1064, 1064, 1037, 1035, 9398, 1035, 5371, 1035, 4127, 1012, 5950, 11253, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
features/extra/helpers.js
request
function request(svc, operation, params, next, extra) { var world = this; if (!svc) svc = this.service; if (typeof svc === 'string') svc = this[svc]; svc[operation](params, function(err, data) { world.response = this; world.error = err; world.data = data; try { if (typeof next.condition === 'function') { var condition = next.condition.call(world, world); if (!condition) { next.fail(new Error('Request success condition failed')); return; } } if (extra) { extra.call(world, world.response); next.call(world); } else if (extra !== false && err) { world.unexpectedError(world.response, next); } else { next.call(world); } } catch (err) { next.fail(err); } }); }
javascript
function request(svc, operation, params, next, extra) { var world = this; if (!svc) svc = this.service; if (typeof svc === 'string') svc = this[svc]; svc[operation](params, function(err, data) { world.response = this; world.error = err; world.data = data; try { if (typeof next.condition === 'function') { var condition = next.condition.call(world, world); if (!condition) { next.fail(new Error('Request success condition failed')); return; } } if (extra) { extra.call(world, world.response); next.call(world); } else if (extra !== false && err) { world.unexpectedError(world.response, next); } else { next.call(world); } } catch (err) { next.fail(err); } }); }
[ "function", "request", "(", "svc", ",", "operation", ",", "params", ",", "next", ",", "extra", ")", "{", "var", "world", "=", "this", ";", "if", "(", "!", "svc", ")", "svc", "=", "this", ".", "service", ";", "if", "(", "typeof", "svc", "===", "'s...
A short-cut for calling a service operation and waiting for it to finish execution before moving onto the next step in the scenario.
[ "A", "short", "-", "cut", "for", "calling", "a", "service", "operation", "and", "waiting", "for", "it", "to", "finish", "execution", "before", "moving", "onto", "the", "next", "step", "in", "the", "scenario", "." ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/features/extra/helpers.js#L65-L98
train
request function
[ 30522, 3853, 5227, 1006, 17917, 2278, 1010, 3169, 1010, 11498, 5244, 1010, 2279, 1010, 4469, 1007, 1063, 13075, 2088, 1027, 2023, 1025, 2065, 1006, 999, 17917, 2278, 1007, 17917, 2278, 1027, 2023, 1012, 2326, 1025, 2065, 1006, 2828, 11253, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/material.js
function (material) { var el = this.el; var mesh; var system = this.system; if (this.material) { disposeMaterial(this.material, system); } this.material = material; system.registerMaterial(material); // Set on mesh. If mesh does not exist, wait for it. mesh = el.getObject3D('mesh'); if (mesh) { mesh.material = material; } else { el.addEventListener('object3dset', function waitForMesh (evt) { if (evt.detail.type !== 'mesh' || evt.target !== el) { return; } el.getObject3D('mesh').material = material; el.removeEventListener('object3dset', waitForMesh); }); } }
javascript
function (material) { var el = this.el; var mesh; var system = this.system; if (this.material) { disposeMaterial(this.material, system); } this.material = material; system.registerMaterial(material); // Set on mesh. If mesh does not exist, wait for it. mesh = el.getObject3D('mesh'); if (mesh) { mesh.material = material; } else { el.addEventListener('object3dset', function waitForMesh (evt) { if (evt.detail.type !== 'mesh' || evt.target !== el) { return; } el.getObject3D('mesh').material = material; el.removeEventListener('object3dset', waitForMesh); }); } }
[ "function", "(", "material", ")", "{", "var", "el", "=", "this", ".", "el", ";", "var", "mesh", ";", "var", "system", "=", "this", ".", "system", ";", "if", "(", "this", ".", "material", ")", "{", "disposeMaterial", "(", "this", ".", "material", ",...
(Re)create new material. Has side-effects of setting `this.material` and updating material registration in scene. @param {object} data - Material component data. @param {object} type - Material type to create. @returns {object} Material.
[ "(", "Re", ")", "create", "new", "material", ".", "Has", "side", "-", "effects", "of", "setting", "this", ".", "material", "and", "updating", "material", "registration", "in", "scene", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/material.js#L171-L192
train
Set material on the mesh
[ 30522, 3853, 1006, 3430, 1007, 1063, 13075, 3449, 1027, 2023, 1012, 3449, 1025, 13075, 20437, 1025, 13075, 2291, 1027, 2023, 1012, 2291, 1025, 2065, 1006, 2023, 1012, 3430, 1007, 1063, 27764, 8585, 14482, 1006, 2023, 1012, 3430, 1010, 2291,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
babel/babel
packages/babel-plugin-transform-template-literals/src/index.js
buildConcatCallExpressions
function buildConcatCallExpressions(items) { let avail = true; return items.reduce(function(left, right) { let canBeInserted = t.isLiteral(right); if (!canBeInserted && avail) { canBeInserted = true; avail = false; } if (canBeInserted && t.isCallExpression(left)) { left.arguments.push(right); return left; } return t.callExpression( t.memberExpression(left, t.identifier("concat")), [right], ); }); }
javascript
function buildConcatCallExpressions(items) { let avail = true; return items.reduce(function(left, right) { let canBeInserted = t.isLiteral(right); if (!canBeInserted && avail) { canBeInserted = true; avail = false; } if (canBeInserted && t.isCallExpression(left)) { left.arguments.push(right); return left; } return t.callExpression( t.memberExpression(left, t.identifier("concat")), [right], ); }); }
[ "function", "buildConcatCallExpressions", "(", "items", ")", "{", "let", "avail", "=", "true", ";", "return", "items", ".", "reduce", "(", "function", "(", "left", ",", "right", ")", "{", "let", "canBeInserted", "=", "t", ".", "isLiteral", "(", "right", ...
This function groups the objects into multiple calls to `.concat()` in order to preserve execution order of the primitive conversion, e.g. "".concat(obj.foo, "foo", obj2.foo, "foo2") would evaluate both member expressions _first_ then, `concat` will convert each one to a primitive, whereas "".concat(obj.foo, "foo").concat(obj2.foo, "foo2") would evaluate the member, then convert it to a primitive, then evaluate the second member and convert that one, which reflects the spec behavior of template literals.
[ "This", "function", "groups", "the", "objects", "into", "multiple", "calls", "to", ".", "concat", "()", "in", "order", "to", "preserve", "execution", "order", "of", "the", "primitive", "conversion", "e", ".", "g", "." ]
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-plugin-transform-template-literals/src/index.js#L26-L44
train
Build concat call expressions
[ 30522, 3853, 3857, 8663, 11266, 9289, 2571, 2595, 20110, 8496, 1006, 5167, 1007, 1063, 2292, 24608, 1027, 2995, 1025, 2709, 5167, 1012, 5547, 1006, 3853, 1006, 2187, 1010, 2157, 1007, 1063, 2292, 2064, 19205, 12325, 17724, 1027, 1056, 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...
fengyuanchen/cropper
dist/cropper.common.js
getCroppedCanvas
function getCroppedCanvas() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (!this.ready || !window.HTMLCanvasElement) { return null; } var canvasData = this.canvasData; var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped. if (!this.cropped) { return source; } var _getData = this.getData(), initialX = _getData.x, initialY = _getData.y, initialWidth = _getData.width, initialHeight = _getData.height; var ratio = source.width / Math.floor(canvasData.naturalWidth); if (ratio !== 1) { initialX *= ratio; initialY *= ratio; initialWidth *= ratio; initialHeight *= ratio; } var aspectRatio = initialWidth / initialHeight; var maxSizes = getAdjustedSizes({ aspectRatio: aspectRatio, width: options.maxWidth || Infinity, height: options.maxHeight || Infinity }); var minSizes = getAdjustedSizes({ aspectRatio: aspectRatio, width: options.minWidth || 0, height: options.minHeight || 0 }, 'cover'); var _getAdjustedSizes = getAdjustedSizes({ aspectRatio: aspectRatio, width: options.width || (ratio !== 1 ? source.width : initialWidth), height: options.height || (ratio !== 1 ? source.height : initialHeight) }), width = _getAdjustedSizes.width, height = _getAdjustedSizes.height; width = Math.min(maxSizes.width, Math.max(minSizes.width, width)); height = Math.min(maxSizes.height, Math.max(minSizes.height, height)); var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); canvas.width = normalizeDecimalNumber(width); canvas.height = normalizeDecimalNumber(height); context.fillStyle = options.fillColor || 'transparent'; context.fillRect(0, 0, width, height); var _options$imageSmoothi = options.imageSmoothingEnabled, imageSmoothingEnabled = _options$imageSmoothi === undefined ? true : _options$imageSmoothi, imageSmoothingQuality = options.imageSmoothingQuality; context.imageSmoothingEnabled = imageSmoothingEnabled; if (imageSmoothingQuality) { context.imageSmoothingQuality = imageSmoothingQuality; } // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage var sourceWidth = source.width; var sourceHeight = source.height; // Source canvas parameters var srcX = initialX; var srcY = initialY; var srcWidth = void 0; var srcHeight = void 0; // Destination canvas parameters var dstX = void 0; var dstY = void 0; var dstWidth = void 0; var dstHeight = void 0; if (srcX <= -initialWidth || srcX > sourceWidth) { srcX = 0; srcWidth = 0; dstX = 0; dstWidth = 0; } else if (srcX <= 0) { dstX = -srcX; srcX = 0; srcWidth = Math.min(sourceWidth, initialWidth + srcX); dstWidth = srcWidth; } else if (srcX <= sourceWidth) { dstX = 0; srcWidth = Math.min(initialWidth, sourceWidth - srcX); dstWidth = srcWidth; } if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) { srcY = 0; srcHeight = 0; dstY = 0; dstHeight = 0; } else if (srcY <= 0) { dstY = -srcY; srcY = 0; srcHeight = Math.min(sourceHeight, initialHeight + srcY); dstHeight = srcHeight; } else if (srcY <= sourceHeight) { dstY = 0; srcHeight = Math.min(initialHeight, sourceHeight - srcY); dstHeight = srcHeight; } var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid "IndexSizeError" if (dstWidth > 0 && dstHeight > 0) { var scale = width / initialWidth; params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale); } // All the numerical parameters should be integer for `drawImage` // https://github.com/fengyuanchen/cropper/issues/476 context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) { return Math.floor(normalizeDecimalNumber(param)); })))); return canvas; }
javascript
function getCroppedCanvas() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (!this.ready || !window.HTMLCanvasElement) { return null; } var canvasData = this.canvasData; var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped. if (!this.cropped) { return source; } var _getData = this.getData(), initialX = _getData.x, initialY = _getData.y, initialWidth = _getData.width, initialHeight = _getData.height; var ratio = source.width / Math.floor(canvasData.naturalWidth); if (ratio !== 1) { initialX *= ratio; initialY *= ratio; initialWidth *= ratio; initialHeight *= ratio; } var aspectRatio = initialWidth / initialHeight; var maxSizes = getAdjustedSizes({ aspectRatio: aspectRatio, width: options.maxWidth || Infinity, height: options.maxHeight || Infinity }); var minSizes = getAdjustedSizes({ aspectRatio: aspectRatio, width: options.minWidth || 0, height: options.minHeight || 0 }, 'cover'); var _getAdjustedSizes = getAdjustedSizes({ aspectRatio: aspectRatio, width: options.width || (ratio !== 1 ? source.width : initialWidth), height: options.height || (ratio !== 1 ? source.height : initialHeight) }), width = _getAdjustedSizes.width, height = _getAdjustedSizes.height; width = Math.min(maxSizes.width, Math.max(minSizes.width, width)); height = Math.min(maxSizes.height, Math.max(minSizes.height, height)); var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); canvas.width = normalizeDecimalNumber(width); canvas.height = normalizeDecimalNumber(height); context.fillStyle = options.fillColor || 'transparent'; context.fillRect(0, 0, width, height); var _options$imageSmoothi = options.imageSmoothingEnabled, imageSmoothingEnabled = _options$imageSmoothi === undefined ? true : _options$imageSmoothi, imageSmoothingQuality = options.imageSmoothingQuality; context.imageSmoothingEnabled = imageSmoothingEnabled; if (imageSmoothingQuality) { context.imageSmoothingQuality = imageSmoothingQuality; } // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage var sourceWidth = source.width; var sourceHeight = source.height; // Source canvas parameters var srcX = initialX; var srcY = initialY; var srcWidth = void 0; var srcHeight = void 0; // Destination canvas parameters var dstX = void 0; var dstY = void 0; var dstWidth = void 0; var dstHeight = void 0; if (srcX <= -initialWidth || srcX > sourceWidth) { srcX = 0; srcWidth = 0; dstX = 0; dstWidth = 0; } else if (srcX <= 0) { dstX = -srcX; srcX = 0; srcWidth = Math.min(sourceWidth, initialWidth + srcX); dstWidth = srcWidth; } else if (srcX <= sourceWidth) { dstX = 0; srcWidth = Math.min(initialWidth, sourceWidth - srcX); dstWidth = srcWidth; } if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) { srcY = 0; srcHeight = 0; dstY = 0; dstHeight = 0; } else if (srcY <= 0) { dstY = -srcY; srcY = 0; srcHeight = Math.min(sourceHeight, initialHeight + srcY); dstHeight = srcHeight; } else if (srcY <= sourceHeight) { dstY = 0; srcHeight = Math.min(initialHeight, sourceHeight - srcY); dstHeight = srcHeight; } var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid "IndexSizeError" if (dstWidth > 0 && dstHeight > 0) { var scale = width / initialWidth; params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale); } // All the numerical parameters should be integer for `drawImage` // https://github.com/fengyuanchen/cropper/issues/476 context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) { return Math.floor(normalizeDecimalNumber(param)); })))); return canvas; }
[ "function", "getCroppedCanvas", "(", ")", "{", "var", "options", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "{", "}", ";", "if", "(", "!", "this", ".", "rea...
Get a canvas drawn the cropped image. @param {Object} [options={}] - The config options. @returns {HTMLCanvasElement} - The result canvas.
[ "Get", "a", "canvas", "drawn", "the", "cropped", "image", "." ]
6677332a6a375b647f58808dfc24ea09f5804041
https://github.com/fengyuanchen/cropper/blob/6677332a6a375b647f58808dfc24ea09f5804041/dist/cropper.common.js#L3057-L3195
train
Returns the canvas element that is cropped to the specified size.
[ 30522, 3853, 2131, 26775, 27288, 9336, 12044, 1006, 1007, 1063, 13075, 7047, 1027, 9918, 1012, 3091, 1028, 1014, 1004, 1004, 9918, 1031, 1014, 1033, 999, 1027, 1027, 6151, 28344, 1029, 9918, 1031, 1014, 1033, 1024, 1063, 1065, 1025, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/layout/PositionContainer.js
function(oThis, sChangeType) { var oLayout = oThis.getParent(); if (oLayout) { oLayout.contentChanged(oThis, sChangeType); } }
javascript
function(oThis, sChangeType) { var oLayout = oThis.getParent(); if (oLayout) { oLayout.contentChanged(oThis, sChangeType); } }
[ "function", "(", "oThis", ",", "sChangeType", ")", "{", "var", "oLayout", "=", "oThis", ".", "getParent", "(", ")", ";", "if", "(", "oLayout", ")", "{", "oLayout", ".", "contentChanged", "(", "oThis", ",", "sChangeType", ")", ";", "}", "}" ]
Notifies the layout of this container about the change of the given type. @private
[ "Notifies", "the", "layout", "of", "this", "container", "about", "the", "change", "of", "the", "given", "type", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/PositionContainer.js#L349-L354
train
called when the content of the layout changes
[ 30522, 3853, 1006, 27178, 24158, 1010, 8040, 18003, 27405, 5051, 1007, 1063, 13075, 19330, 28852, 4904, 1027, 27178, 24158, 1012, 2131, 19362, 4765, 1006, 1007, 1025, 2065, 1006, 19330, 28852, 4904, 1007, 1063, 19330, 28852, 4904, 1012, 4180,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/plugins/findInstalled.js
findInstalled
function findInstalled(folder) { var options = { dev: false, log: function() {}, depth: 4 }; var results = Immutable.OrderedMap(); function onPackage(pkg, parent) { if (!pkg.name) return; var name = pkg.name; var version = pkg.version; var pkgPath = pkg.realPath; var depth = pkg.depth; var dependencies = pkg.dependencies; var pluginName = name.slice(PREFIX.length); if (!validateId(name)){ if (parent) return; } else { results = results.set(pluginName, Plugin({ name: pluginName, version: version, path: pkgPath, depth: depth, parent: parent })); } Immutable.Map(dependencies).forEach(function(dep) { onPackage(dep, pluginName); }); } // Search for gitbook-plugins in node_modules folder var node_modules = path.join(folder, 'node_modules'); // List all folders in node_modules return fs.readdir(node_modules) .fail(function() { return Promise([]); }) .then(function(modules) { return Promise.serie(modules, function(module) { // Not a gitbook-plugin if (!validateId(module)) { return Promise(); } // Read gitbook-plugin package details var module_folder = path.join(node_modules, module); return Promise.nfcall(readInstalled, module_folder, options) .then(function(data) { onPackage(data); }); }); }) .then(function() { // Return installed plugins return results; }); }
javascript
function findInstalled(folder) { var options = { dev: false, log: function() {}, depth: 4 }; var results = Immutable.OrderedMap(); function onPackage(pkg, parent) { if (!pkg.name) return; var name = pkg.name; var version = pkg.version; var pkgPath = pkg.realPath; var depth = pkg.depth; var dependencies = pkg.dependencies; var pluginName = name.slice(PREFIX.length); if (!validateId(name)){ if (parent) return; } else { results = results.set(pluginName, Plugin({ name: pluginName, version: version, path: pkgPath, depth: depth, parent: parent })); } Immutable.Map(dependencies).forEach(function(dep) { onPackage(dep, pluginName); }); } // Search for gitbook-plugins in node_modules folder var node_modules = path.join(folder, 'node_modules'); // List all folders in node_modules return fs.readdir(node_modules) .fail(function() { return Promise([]); }) .then(function(modules) { return Promise.serie(modules, function(module) { // Not a gitbook-plugin if (!validateId(module)) { return Promise(); } // Read gitbook-plugin package details var module_folder = path.join(node_modules, module); return Promise.nfcall(readInstalled, module_folder, options) .then(function(data) { onPackage(data); }); }); }) .then(function() { // Return installed plugins return results; }); }
[ "function", "findInstalled", "(", "folder", ")", "{", "var", "options", "=", "{", "dev", ":", "false", ",", "log", ":", "function", "(", ")", "{", "}", ",", "depth", ":", "4", "}", ";", "var", "results", "=", "Immutable", ".", "OrderedMap", "(", ")...
List all packages installed inside a folder @param {String} folder @return {OrderedMap<String:Plugin>}
[ "List", "all", "packages", "installed", "inside", "a", "folder" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/plugins/findInstalled.js#L26-L89
train
Find installed gitbook - plugins in a folder
[ 30522, 3853, 2424, 7076, 9080, 3709, 1006, 19622, 1007, 1063, 13075, 7047, 1027, 1063, 16475, 1024, 6270, 1010, 8833, 1024, 3853, 1006, 1007, 1063, 1065, 1010, 5995, 1024, 1018, 1065, 1025, 13075, 3463, 1027, 10047, 28120, 3085, 1012, 3641,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TopicDetailInitial.controller.js
function () { BaseController.prototype.onInit.call(this); // manually call the handler once at startup as device API won't do this for us this._onOrientationChange({ landscape: Device.orientation.landscape }); this.handleDocumentationDisclaimer(); }
javascript
function () { BaseController.prototype.onInit.call(this); // manually call the handler once at startup as device API won't do this for us this._onOrientationChange({ landscape: Device.orientation.landscape }); this.handleDocumentationDisclaimer(); }
[ "function", "(", ")", "{", "BaseController", ".", "prototype", ".", "onInit", ".", "call", "(", "this", ")", ";", "// manually call the handler once at startup as device API won't do this for us", "this", ".", "_onOrientationChange", "(", "{", "landscape", ":", "Device"...
Called when the controller is instantiated. @public
[ "Called", "when", "the", "controller", "is", "instantiated", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js#L19-L28
train
This controller is called when the device is initialized
[ 30522, 3853, 1006, 1007, 1063, 2918, 8663, 13181, 10820, 1012, 8773, 1012, 2006, 5498, 2102, 1012, 2655, 1006, 2023, 1007, 1025, 1013, 1013, 21118, 2655, 1996, 28213, 2320, 2012, 22752, 2004, 5080, 17928, 2180, 1005, 1056, 2079, 2023, 2005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/semi.js
report
function report(node, missing) { const lastToken = sourceCode.getLastToken(node); let message, fix, loc = lastToken.loc; if (!missing) { message = "Missing semicolon."; loc = loc.end; fix = function(fixer) { return fixer.insertTextAfter(lastToken, ";"); }; } else { message = "Extra semicolon."; loc = loc.start; fix = function(fixer) { /* * Expand the replacement range to include the surrounding * tokens to avoid conflicting with no-extra-semi. * https://github.com/eslint/eslint/issues/7928 */ return new FixTracker(fixer, sourceCode) .retainSurroundingTokens(lastToken) .remove(lastToken); }; } context.report({ node, loc, message, fix }); }
javascript
function report(node, missing) { const lastToken = sourceCode.getLastToken(node); let message, fix, loc = lastToken.loc; if (!missing) { message = "Missing semicolon."; loc = loc.end; fix = function(fixer) { return fixer.insertTextAfter(lastToken, ";"); }; } else { message = "Extra semicolon."; loc = loc.start; fix = function(fixer) { /* * Expand the replacement range to include the surrounding * tokens to avoid conflicting with no-extra-semi. * https://github.com/eslint/eslint/issues/7928 */ return new FixTracker(fixer, sourceCode) .retainSurroundingTokens(lastToken) .remove(lastToken); }; } context.report({ node, loc, message, fix }); }
[ "function", "report", "(", "node", ",", "missing", ")", "{", "const", "lastToken", "=", "sourceCode", ".", "getLastToken", "(", "node", ")", ";", "let", "message", ",", "fix", ",", "loc", "=", "lastToken", ".", "loc", ";", "if", "(", "!", "missing", ...
-------------------------------------------------------------------------- Helpers -------------------------------------------------------------------------- Reports a semicolon error with appropriate location and message. @param {ASTNode} node The node with an extra or missing semicolon. @param {boolean} missing True if the semicolon is missing. @returns {void}
[ "--------------------------------------------------------------------------", "Helpers", "--------------------------------------------------------------------------", "Reports", "a", "semicolon", "error", "with", "appropriate", "location", "and", "message", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/semi.js#L92-L127
train
Reports a node with a semicolon.
[ 30522, 3853, 3189, 1006, 13045, 1010, 4394, 1007, 1063, 9530, 3367, 2197, 18715, 2368, 1027, 3120, 16044, 1012, 2131, 8523, 9284, 7520, 1006, 13045, 1007, 1025, 2292, 4471, 1010, 8081, 1010, 8840, 2278, 1027, 2197, 18715, 2368, 1012, 8840, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
setupAutoUpdate
function setupAutoUpdate() { updateJsonHandler = new StateHandler(updateJsonPath); updateDomain.on('data', receiveMessageFromNode); updateDomain.exec('initNode', { messageIds: MessageIds, updateDir: updateDir, requester: domainID }); }
javascript
function setupAutoUpdate() { updateJsonHandler = new StateHandler(updateJsonPath); updateDomain.on('data', receiveMessageFromNode); updateDomain.exec('initNode', { messageIds: MessageIds, updateDir: updateDir, requester: domainID }); }
[ "function", "setupAutoUpdate", "(", ")", "{", "updateJsonHandler", "=", "new", "StateHandler", "(", "updateJsonPath", ")", ";", "updateDomain", ".", "on", "(", "'data'", ",", "receiveMessageFromNode", ")", ";", "updateDomain", ".", "exec", "(", "'initNode'", ","...
Sets up the Auto Update environment
[ "Sets", "up", "the", "Auto", "Update", "environment" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L320-L329
train
Setup auto update
[ 30522, 3853, 16437, 4887, 24826, 17299, 3686, 1006, 1007, 1063, 10651, 22578, 2239, 11774, 3917, 1027, 2047, 2110, 11774, 3917, 1006, 10651, 22578, 2239, 15069, 1007, 1025, 7172, 9626, 2378, 1012, 2006, 1006, 1005, 2951, 1005, 1010, 4374, 7...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/select/select.js
announceClosed
function announceClosed(opts) { var mdSelect = opts.selectCtrl; if (mdSelect) { var menuController = opts.selectEl.controller('mdSelectMenu'); mdSelect.setLabelText(menuController ? menuController.selectedLabels() : ''); mdSelect.triggerClose(); } }
javascript
function announceClosed(opts) { var mdSelect = opts.selectCtrl; if (mdSelect) { var menuController = opts.selectEl.controller('mdSelectMenu'); mdSelect.setLabelText(menuController ? menuController.selectedLabels() : ''); mdSelect.triggerClose(); } }
[ "function", "announceClosed", "(", "opts", ")", "{", "var", "mdSelect", "=", "opts", ".", "selectCtrl", ";", "if", "(", "mdSelect", ")", "{", "var", "menuController", "=", "opts", ".", "selectEl", ".", "controller", "(", "'mdSelectMenu'", ")", ";", "mdSele...
To notify listeners that the Select menu has closed, trigger the [optional] user-defined expression
[ "To", "notify", "listeners", "that", "the", "Select", "menu", "has", "closed", "trigger", "the", "[", "optional", "]", "user", "-", "defined", "expression" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/select/select.js#L1615-L1622
train
announce closed event
[ 30522, 3853, 14970, 20464, 24768, 1006, 23569, 2015, 1007, 1063, 13075, 9108, 11246, 22471, 1027, 23569, 2015, 1012, 7276, 6593, 12190, 1025, 2065, 1006, 9108, 11246, 22471, 1007, 1063, 13075, 12183, 8663, 13181, 10820, 1027, 23569, 2015, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (vValue, sType) { if (vValue === undefined) { throw new Error("Illegal value: undefined"); } if (vValue === null) { return "null"; } switch (sType) { case "Edm.Binary": return "binary'" + vValue + "'"; case "Edm.Boolean": case "Edm.Byte": case "Edm.Double": case "Edm.Int16": case "Edm.Int32": case "Edm.SByte": case "Edm.Single": return String(vValue); case "Edm.Date": case "Edm.DateTimeOffset": case "Edm.Decimal": case "Edm.Guid": case "Edm.Int64": case "Edm.TimeOfDay": return vValue; case "Edm.Duration": return "duration'" + vValue + "'"; case "Edm.String": return "'" + vValue.replace(rSingleQuote, "''") + "'"; default: throw new Error("Unsupported type: " + sType); } }
javascript
function (vValue, sType) { if (vValue === undefined) { throw new Error("Illegal value: undefined"); } if (vValue === null) { return "null"; } switch (sType) { case "Edm.Binary": return "binary'" + vValue + "'"; case "Edm.Boolean": case "Edm.Byte": case "Edm.Double": case "Edm.Int16": case "Edm.Int32": case "Edm.SByte": case "Edm.Single": return String(vValue); case "Edm.Date": case "Edm.DateTimeOffset": case "Edm.Decimal": case "Edm.Guid": case "Edm.Int64": case "Edm.TimeOfDay": return vValue; case "Edm.Duration": return "duration'" + vValue + "'"; case "Edm.String": return "'" + vValue.replace(rSingleQuote, "''") + "'"; default: throw new Error("Unsupported type: " + sType); } }
[ "function", "(", "vValue", ",", "sType", ")", "{", "if", "(", "vValue", "===", "undefined", ")", "{", "throw", "new", "Error", "(", "\"Illegal value: undefined\"", ")", ";", "}", "if", "(", "vValue", "===", "null", ")", "{", "return", "\"null\"", ";", ...
Formats a given internal value into a literal suitable for usage in URLs. @param {any} vValue The value according to "OData JSON Format Version 4.0" section "7.1 Primitive Value" @param {string} sType The OData Edm type, e.g. "Edm.String" @returns {string} The literal according to "OData Version 4.0 Part 2: URL Conventions" section "5.1.1.6.1 Primitive Literals" @throws {Error} If the value is undefined or the type is not supported
[ "Formats", "a", "given", "internal", "value", "into", "a", "literal", "suitable", "for", "usage", "in", "URLs", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L446-L484
train
Returns the value of an object in the specified type.
[ 30522, 3853, 1006, 1058, 10175, 5657, 1010, 2358, 18863, 1007, 1063, 2065, 1006, 1058, 10175, 5657, 1027, 1027, 1027, 6151, 28344, 1007, 1063, 5466, 2047, 7561, 1006, 1000, 6206, 3643, 1024, 6151, 28344, 1000, 1007, 1025, 1065, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/HTMLRenderer.js
function(oRM, oControl) { // render an invisible, but easily identifiable placeholder for the content oRM.write("<div id=\"" + RenderPrefixes.Dummy + oControl.getId() + "\" style=\"display:none\">"); // Note: we do not render the content string here, but only in onAfterRendering // This has the advantage that syntax errors don't affect the whole control tree // but only this control... oRM.write("</div>"); }
javascript
function(oRM, oControl) { // render an invisible, but easily identifiable placeholder for the content oRM.write("<div id=\"" + RenderPrefixes.Dummy + oControl.getId() + "\" style=\"display:none\">"); // Note: we do not render the content string here, but only in onAfterRendering // This has the advantage that syntax errors don't affect the whole control tree // but only this control... oRM.write("</div>"); }
[ "function", "(", "oRM", ",", "oControl", ")", "{", "// render an invisible, but easily identifiable placeholder for the content", "oRM", ".", "write", "(", "\"<div id=\\\"\"", "+", "RenderPrefixes", ".", "Dummy", "+", "oControl", ".", "getId", "(", ")", "+", "\"\\\" s...
Renders either the configured content or a dummy div that will be replaced after rendering @param {sap.ui.core.RenderManager} [oRM] The RenderManager instance @param {sap.ui.core.Control} [oControl] The instance of the invisible control
[ "Renders", "either", "the", "configured", "content", "or", "a", "dummy", "div", "that", "will", "be", "replaced", "after", "rendering" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/HTMLRenderer.js#L21-L30
train
Renders the content of the control tree
[ 30522, 3853, 1006, 2030, 2213, 1010, 1051, 8663, 13181, 2140, 1007, 1063, 1013, 1013, 17552, 2019, 8841, 1010, 2021, 4089, 27800, 2173, 14528, 2005, 1996, 4180, 2030, 2213, 1012, 4339, 1006, 1000, 1026, 4487, 2615, 8909, 1027, 1032, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
NervJS/taro
packages/taro-components/src/components/swiper/swiper.js
parseType
function parseType (props) { const { current } = props // 抛出错误信息 const throwErrorMsg = type => { throw new TypeError(type + ' must be number') } if (current) isNumber(current) ? '' : throwErrorMsg('current') }
javascript
function parseType (props) { const { current } = props // 抛出错误信息 const throwErrorMsg = type => { throw new TypeError(type + ' must be number') } if (current) isNumber(current) ? '' : throwErrorMsg('current') }
[ "function", "parseType", "(", "props", ")", "{", "const", "{", "current", "}", "=", "props", "// 抛出错误信息", "const", "throwErrorMsg", "=", "type", "=>", "{", "throw", "new", "TypeError", "(", "type", "+", "' must be number'", ")", "}", "if", "(", "current", ...
props 类型检测 @param {Object} props
[ "props", "类型检测" ]
274e76d731d7f158141287e31cbd51f092d472c5
https://github.com/NervJS/taro/blob/274e76d731d7f158141287e31cbd51f092d472c5/packages/taro-components/src/components/swiper/swiper.js#L11-L22
train
parse type
[ 30522, 3853, 11968, 13462, 18863, 1006, 24387, 1007, 1063, 9530, 3367, 1063, 2783, 1065, 1027, 24387, 1013, 1013, 100, 1774, 100, 100, 1767, 100, 9530, 3367, 5466, 2121, 29165, 5244, 2290, 1027, 2828, 1027, 1028, 1063, 5466, 2047, 2828, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/NavigationAndHistory/NavigationProvider.js
_handleActiveEditorChange
function _handleActiveEditorChange(event, current, previous) { if (previous && previous._paneId) { // Handle only full editors previous.off("beforeSelectionChange", _recordJumpDef); _captureFrame(previous); _validateNavigationCmds(); } if (current && current._paneId) { // Handle only full editors activePosNotSynced = true; current.off("beforeSelectionChange", _recordJumpDef); current.on("beforeSelectionChange", _recordJumpDef); current.off("beforeDestroy", _handleEditorCleanup); current.on("beforeDestroy", _handleEditorCleanup); } }
javascript
function _handleActiveEditorChange(event, current, previous) { if (previous && previous._paneId) { // Handle only full editors previous.off("beforeSelectionChange", _recordJumpDef); _captureFrame(previous); _validateNavigationCmds(); } if (current && current._paneId) { // Handle only full editors activePosNotSynced = true; current.off("beforeSelectionChange", _recordJumpDef); current.on("beforeSelectionChange", _recordJumpDef); current.off("beforeDestroy", _handleEditorCleanup); current.on("beforeDestroy", _handleEditorCleanup); } }
[ "function", "_handleActiveEditorChange", "(", "event", ",", "current", ",", "previous", ")", "{", "if", "(", "previous", "&&", "previous", ".", "_paneId", ")", "{", "// Handle only full editors", "previous", ".", "off", "(", "\"beforeSelectionChange\"", ",", "_rec...
Handle Active Editor change to update navigation information @private
[ "Handle", "Active", "Editor", "change", "to", "update", "navigation", "information" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/NavigationProvider.js#L522-L536
train
Handle active editor change
[ 30522, 3853, 1035, 5047, 19620, 2098, 15660, 22305, 2063, 1006, 2724, 1010, 2783, 1010, 3025, 1007, 1063, 2065, 1006, 3025, 1004, 1004, 3025, 1012, 1035, 6090, 7416, 2094, 1007, 1063, 1013, 1013, 5047, 2069, 2440, 10195, 3025, 1012, 2125, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/polar/Polar.js
function (point) { var coord = this.pointToCoord(point); return this._radiusAxis.contain(coord[0]) && this._angleAxis.contain(coord[1]); }
javascript
function (point) { var coord = this.pointToCoord(point); return this._radiusAxis.contain(coord[0]) && this._angleAxis.contain(coord[1]); }
[ "function", "(", "point", ")", "{", "var", "coord", "=", "this", ".", "pointToCoord", "(", "point", ")", ";", "return", "this", ".", "_radiusAxis", ".", "contain", "(", "coord", "[", "0", "]", ")", "&&", "this", ".", "_angleAxis", ".", "contain", "("...
If contain coord @param {Array.<number>} point @return {boolean}
[ "If", "contain", "coord" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/polar/Polar.js#L90-L94
train
Returns true if the given point is on the region of the region
[ 30522, 3853, 1006, 2391, 1007, 1063, 13075, 2522, 8551, 1027, 2023, 1012, 2391, 3406, 3597, 8551, 1006, 2391, 1007, 1025, 2709, 2023, 1012, 1035, 12177, 8528, 2483, 1012, 5383, 1006, 2522, 8551, 1031, 1014, 1033, 1007, 1004, 1004, 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...
expressjs/express
lib/router/index.js
appendMethods
function appendMethods(list, addition) { for (var i = 0; i < addition.length; i++) { var method = addition[i]; if (list.indexOf(method) === -1) { list.push(method); } } }
javascript
function appendMethods(list, addition) { for (var i = 0; i < addition.length; i++) { var method = addition[i]; if (list.indexOf(method) === -1) { list.push(method); } } }
[ "function", "appendMethods", "(", "list", ",", "addition", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "addition", ".", "length", ";", "i", "++", ")", "{", "var", "method", "=", "addition", "[", "i", "]", ";", "if", "(", "list", ...
append methods to a list of methods
[ "append", "methods", "to", "a", "list", "of", "methods" ]
dc538f6e810bd462c98ee7e6aae24c64d4b1da93
https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/lib/router/index.js#L516-L523
train
Append methods to the list
[ 30522, 3853, 10439, 10497, 11368, 6806, 5104, 1006, 2862, 1010, 2804, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 2804, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 13075, 4118, 1027, 2804, 1031, 1045, 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...