repo
stringclasses
195 values
path
stringlengths
4
99
func_name
stringlengths
0
41
original_string
stringlengths
72
56.1k
language
stringclasses
1 value
code
stringlengths
72
56.1k
code_tokens
listlengths
25
8.12k
docstring
stringlengths
2
12.5k
docstring_tokens
listlengths
1
449
sha
stringclasses
197 values
url
stringlengths
88
186
partition
stringclasses
1 value
summary
stringlengths
8
338
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js
function( el, defaultTheme ) { var e = el[ 0 ], ltr = "", re = /ui-(bar|body|overlay)-([a-z])\b/, c, m; while ( e ) { c = e.className || ""; if ( c && ( m = re.exec( c ) ) && ( ltr = m[ 2 ] ) ) { // We found a parent with a theme class // on it so bail from this loop. break; } e = e.parentNode; } // Return the theme letter we found, if none, return the // specified default. return ltr || defaultTheme || "a"; }
javascript
function( el, defaultTheme ) { var e = el[ 0 ], ltr = "", re = /ui-(bar|body|overlay)-([a-z])\b/, c, m; while ( e ) { c = e.className || ""; if ( c && ( m = re.exec( c ) ) && ( ltr = m[ 2 ] ) ) { // We found a parent with a theme class // on it so bail from this loop. break; } e = e.parentNode; } // Return the theme letter we found, if none, return the // specified default. return ltr || defaultTheme || "a"; }
[ "function", "(", "el", ",", "defaultTheme", ")", "{", "var", "e", "=", "el", "[", "0", "]", ",", "ltr", "=", "\"\"", ",", "re", "=", "/", "ui-(bar|body|overlay)-([a-z])\\b", "/", ",", "c", ",", "m", ";", "while", "(", "e", ")", "{", "c", "=", "...
Find the closest parent with a theme class on it. Note that we are not using $.fn.closest() on purpose here because this method gets called quite a bit and we need it to be as fast as possible.
[ "Find", "the", "closest", "parent", "with", "a", "theme", "class", "on", "it", ".", "Note", "that", "we", "are", "not", "using", "$", ".", "fn", ".", "closest", "()", "on", "purpose", "here", "because", "this", "method", "gets", "called", "quite", "a",...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js#L474-L495
train
Returns the theme letter of the specified element.
[ 30522, 3853, 1006, 3449, 1010, 12398, 10760, 4168, 1007, 1063, 13075, 1041, 1027, 3449, 1031, 1014, 1033, 30524, 1027, 1041, 1012, 2465, 18442, 1064, 1064, 1000, 1000, 1025, 2065, 1006, 1039, 1004, 1004, 1006, 1049, 1027, 2128, 1012, 4654, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/autocomplete/js/autocompleteController.js
cleanup
function cleanup () { if (!ctrl.hidden) { $mdUtil.enableScrolling(); } angular.element($window).off('resize', debouncedOnResize); if (elements){ var items = ['ul', 'scroller', 'scrollContainer', 'input']; angular.forEach(items, function(key){ elements.$[key].remove(); }); } }
javascript
function cleanup () { if (!ctrl.hidden) { $mdUtil.enableScrolling(); } angular.element($window).off('resize', debouncedOnResize); if (elements){ var items = ['ul', 'scroller', 'scrollContainer', 'input']; angular.forEach(items, function(key){ elements.$[key].remove(); }); } }
[ "function", "cleanup", "(", ")", "{", "if", "(", "!", "ctrl", ".", "hidden", ")", "{", "$mdUtil", ".", "enableScrolling", "(", ")", ";", "}", "angular", ".", "element", "(", "$window", ")", ".", "off", "(", "'resize'", ",", "debouncedOnResize", ")", ...
Removes any events or leftover elements created by this controller
[ "Removes", "any", "events", "or", "leftover", "elements", "created", "by", "this", "controller" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L254-L267
train
Removes all elements
[ 30522, 3853, 27686, 1006, 1007, 1063, 2065, 1006, 999, 14931, 12190, 1012, 5023, 1007, 1063, 1002, 9108, 21823, 2140, 1012, 12939, 26775, 14511, 2075, 1006, 1007, 1025, 1065, 16108, 1012, 5783, 1006, 1002, 3332, 1007, 1012, 2125, 1006, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
knsv/mermaid
src/mermaidAPI.js
function (id, txt, cb, container) { if (typeof container !== 'undefined') { container.innerHTML = '' d3.select(container).append('div') .attr('id', 'd' + id) .append('svg') .attr('id', id) .attr('width', '100%') .attr('xmlns', 'http://www.w3.org/2000/svg') .append('g') } else { const element = document.querySelector('#' + 'd' + id) if (element) { element.innerHTML = '' } d3.select('body').append('div') .attr('id', 'd' + id) .append('svg') .attr('id', id) .attr('width', '100%') .attr('xmlns', 'http://www.w3.org/2000/svg') .append('g') } window.txt = txt txt = encodeEntities(txt) const element = d3.select('#d' + id).node() const graphType = utils.detectType(txt) // insert inline style into svg const svg = element.firstChild const firstChild = svg.firstChild // pre-defined theme let style = themes[config.theme] if (style === undefined) { style = '' } // user provided theme CSS if (config.themeCSS !== undefined) { style += `\n${config.themeCSS}` } // classDef if (graphType === 'flowchart') { const classes = flowRenderer.getClasses(txt) for (const className in classes) { style += `\n.${className} > * { ${classes[className].styles.join(' !important; ')} !important; }` } } const style1 = document.createElement('style') style1.innerHTML = scope(style, `#${id}`) svg.insertBefore(style1, firstChild) const style2 = document.createElement('style') const cs = window.getComputedStyle(svg) style2.innerHTML = `#${id} { color: ${cs.color}; font: ${cs.font}; }` svg.insertBefore(style2, firstChild) switch (graphType) { case 'git': config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute gitGraphRenderer.setConf(config.git) gitGraphRenderer.draw(txt, id, false) break case 'flowchart': config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute flowRenderer.setConf(config.flowchart) flowRenderer.draw(txt, id, false) break case 'sequence': config.sequence.arrowMarkerAbsolute = config.arrowMarkerAbsolute if (config.sequenceDiagram) { // backwards compatibility sequenceRenderer.setConf(Object.assign(config.sequence, config.sequenceDiagram)) console.error('`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.') } else { sequenceRenderer.setConf(config.sequence) } sequenceRenderer.draw(txt, id) break case 'gantt': config.gantt.arrowMarkerAbsolute = config.arrowMarkerAbsolute ganttRenderer.setConf(config.gantt) ganttRenderer.draw(txt, id) break case 'class': config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute classRenderer.setConf(config.class) classRenderer.draw(txt, id) break } d3.select(`[id="${id}"]`).selectAll('foreignobject > *').attr('xmlns', 'http://www.w3.org/1999/xhtml') let url = '' if (config.arrowMarkerAbsolute) { url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search url = url.replace(/\(/g, '\\(') url = url.replace(/\)/g, '\\)') } // Fix for when the base tag is used let svgCode = d3.select('#d' + id).node().innerHTML.replace(/url\(#arrowhead/g, 'url(' + url + '#arrowhead', 'g') svgCode = decodeEntities(svgCode) if (typeof cb !== 'undefined') { cb(svgCode, flowDb.bindFunctions) } else { logger.warn('CB = undefined!') } const node = d3.select('#d' + id).node() if (node !== null && typeof node.remove === 'function') { d3.select('#d' + id).node().remove() } return svgCode }
javascript
function (id, txt, cb, container) { if (typeof container !== 'undefined') { container.innerHTML = '' d3.select(container).append('div') .attr('id', 'd' + id) .append('svg') .attr('id', id) .attr('width', '100%') .attr('xmlns', 'http://www.w3.org/2000/svg') .append('g') } else { const element = document.querySelector('#' + 'd' + id) if (element) { element.innerHTML = '' } d3.select('body').append('div') .attr('id', 'd' + id) .append('svg') .attr('id', id) .attr('width', '100%') .attr('xmlns', 'http://www.w3.org/2000/svg') .append('g') } window.txt = txt txt = encodeEntities(txt) const element = d3.select('#d' + id).node() const graphType = utils.detectType(txt) // insert inline style into svg const svg = element.firstChild const firstChild = svg.firstChild // pre-defined theme let style = themes[config.theme] if (style === undefined) { style = '' } // user provided theme CSS if (config.themeCSS !== undefined) { style += `\n${config.themeCSS}` } // classDef if (graphType === 'flowchart') { const classes = flowRenderer.getClasses(txt) for (const className in classes) { style += `\n.${className} > * { ${classes[className].styles.join(' !important; ')} !important; }` } } const style1 = document.createElement('style') style1.innerHTML = scope(style, `#${id}`) svg.insertBefore(style1, firstChild) const style2 = document.createElement('style') const cs = window.getComputedStyle(svg) style2.innerHTML = `#${id} { color: ${cs.color}; font: ${cs.font}; }` svg.insertBefore(style2, firstChild) switch (graphType) { case 'git': config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute gitGraphRenderer.setConf(config.git) gitGraphRenderer.draw(txt, id, false) break case 'flowchart': config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute flowRenderer.setConf(config.flowchart) flowRenderer.draw(txt, id, false) break case 'sequence': config.sequence.arrowMarkerAbsolute = config.arrowMarkerAbsolute if (config.sequenceDiagram) { // backwards compatibility sequenceRenderer.setConf(Object.assign(config.sequence, config.sequenceDiagram)) console.error('`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.') } else { sequenceRenderer.setConf(config.sequence) } sequenceRenderer.draw(txt, id) break case 'gantt': config.gantt.arrowMarkerAbsolute = config.arrowMarkerAbsolute ganttRenderer.setConf(config.gantt) ganttRenderer.draw(txt, id) break case 'class': config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute classRenderer.setConf(config.class) classRenderer.draw(txt, id) break } d3.select(`[id="${id}"]`).selectAll('foreignobject > *').attr('xmlns', 'http://www.w3.org/1999/xhtml') let url = '' if (config.arrowMarkerAbsolute) { url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search url = url.replace(/\(/g, '\\(') url = url.replace(/\)/g, '\\)') } // Fix for when the base tag is used let svgCode = d3.select('#d' + id).node().innerHTML.replace(/url\(#arrowhead/g, 'url(' + url + '#arrowhead', 'g') svgCode = decodeEntities(svgCode) if (typeof cb !== 'undefined') { cb(svgCode, flowDb.bindFunctions) } else { logger.warn('CB = undefined!') } const node = d3.select('#d' + id).node() if (node !== null && typeof node.remove === 'function') { d3.select('#d' + id).node().remove() } return svgCode }
[ "function", "(", "id", ",", "txt", ",", "cb", ",", "container", ")", "{", "if", "(", "typeof", "container", "!==", "'undefined'", ")", "{", "container", ".", "innerHTML", "=", "''", "d3", ".", "select", "(", "container", ")", ".", "append", "(", "'di...
##render Function that renders an svg with a graph from a chart definition. Usage example below. ``` mermaidAPI.initialize({ startOnLoad:true }); $(function(){ const graphDefinition = 'graph TB\na-->b'; const cb = function(svgGraph){ console.log(svgGraph); }; mermaidAPI.render('id1',graphDefinition,cb); }); ``` @param id the id of the element to be rendered @param txt the graph definition @param cb callback which is called after rendering is finished with the svg code as inparam. @param container selector to element in which a div with the graph temporarily will be inserted. In one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed.
[ "##render", "Function", "that", "renders", "an", "svg", "with", "a", "graph", "from", "a", "chart", "definition", ".", "Usage", "example", "below", "." ]
7d3578b31aeea3bc9bbc618dcda57d82574eaffb
https://github.com/knsv/mermaid/blob/7d3578b31aeea3bc9bbc618dcda57d82574eaffb/src/mermaidAPI.js#L334-L460
train
create a new node
[ 30522, 3853, 1006, 8909, 1010, 19067, 2102, 1010, 17324, 1010, 11661, 1007, 1063, 2065, 1006, 2828, 11253, 11661, 999, 1027, 1027, 1005, 6151, 28344, 1005, 1007, 1063, 11661, 1012, 5110, 11039, 19968, 1027, 1005, 1005, 1040, 2509, 1012, 727...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/hand-controls.js
function (gesture, lastGesture) { if (gesture) { this.playAnimation(gesture || ANIMATIONS.open, lastGesture, false); return; } // If no gesture, then reverse the current gesture back to open pose. this.playAnimation(lastGesture, lastGesture, true); }
javascript
function (gesture, lastGesture) { if (gesture) { this.playAnimation(gesture || ANIMATIONS.open, lastGesture, false); return; } // If no gesture, then reverse the current gesture back to open pose. this.playAnimation(lastGesture, lastGesture, true); }
[ "function", "(", "gesture", ",", "lastGesture", ")", "{", "if", "(", "gesture", ")", "{", "this", ".", "playAnimation", "(", "gesture", "||", "ANIMATIONS", ".", "open", ",", "lastGesture", ",", "false", ")", ";", "return", ";", "}", "// If no gesture, then...
Play gesture animation. @param {string} gesture - Which pose to animate to. If absent, then animate to open. @param {string} lastGesture - Previous gesture, to reverse back to open if needed.
[ "Play", "gesture", "animation", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/hand-controls.js#L291-L299
train
Play the specified animation
[ 30522, 3853, 1006, 9218, 1010, 2197, 8449, 11244, 1007, 1063, 2065, 1006, 9218, 1007, 1063, 2023, 1012, 2377, 7088, 28649, 1006, 9218, 1064, 1064, 7284, 2015, 1012, 2330, 1010, 2197, 8449, 11244, 1010, 6270, 1007, 1025, 2709, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
goldfire/howler.js
examples/sprite/sprite.js
function(key) { var self = this; var sprite = self._spriteMap[key]; // Play the sprite sound and capture the ID. var id = self.sound.play(sprite); // Create a progress element and begin visually tracking it. var elm = document.createElement('div'); elm.className = 'progress'; elm.id = id; elm.dataset.sprite = sprite; window[key].appendChild(elm); self.sounds.push(elm); // When this sound is finished, remove the progress element. self.sound.once('end', function() { var index = self.sounds.indexOf(elm); if (index >= 0) { self.sounds.splice(index, 1); window[key].removeChild(elm); } }, id); }
javascript
function(key) { var self = this; var sprite = self._spriteMap[key]; // Play the sprite sound and capture the ID. var id = self.sound.play(sprite); // Create a progress element and begin visually tracking it. var elm = document.createElement('div'); elm.className = 'progress'; elm.id = id; elm.dataset.sprite = sprite; window[key].appendChild(elm); self.sounds.push(elm); // When this sound is finished, remove the progress element. self.sound.once('end', function() { var index = self.sounds.indexOf(elm); if (index >= 0) { self.sounds.splice(index, 1); window[key].removeChild(elm); } }, id); }
[ "function", "(", "key", ")", "{", "var", "self", "=", "this", ";", "var", "sprite", "=", "self", ".", "_spriteMap", "[", "key", "]", ";", "// Play the sprite sound and capture the ID.", "var", "id", "=", "self", ".", "sound", ".", "play", "(", "sprite", ...
Play a sprite when clicked and track the progress. @param {String} key Key in the sprite map object.
[ "Play", "a", "sprite", "when", "clicked", "and", "track", "the", "progress", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/sprite/sprite.js#L67-L90
train
Play the sprite sound and track the ID of the sprite.
[ 30522, 3853, 1006, 3145, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 11867, 17625, 1027, 2969, 1012, 1035, 11867, 17625, 2863, 2361, 1031, 3145, 1033, 1025, 1013, 1013, 2377, 1996, 11867, 17625, 2614, 1998, 5425, 1996, 8909, 1012, 130...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
exceljs/exceljs
lib/xlsx/xform/style/styles-xform.js
function(fill) { var xml = this.map.fill.toXml(fill); var index = this.index.fill[xml]; if (index === undefined) { index = this.index.fill[xml] = this.model.fills.length; this.model.fills.push(xml); } return index; }
javascript
function(fill) { var xml = this.map.fill.toXml(fill); var index = this.index.fill[xml]; if (index === undefined) { index = this.index.fill[xml] = this.model.fills.length; this.model.fills.push(xml); } return index; }
[ "function", "(", "fill", ")", "{", "var", "xml", "=", "this", ".", "map", ".", "fill", ".", "toXml", "(", "fill", ")", ";", "var", "index", "=", "this", ".", "index", ".", "fill", "[", "xml", "]", ";", "if", "(", "index", "===", "undefined", ")...
========================================================================= Fills
[ "=========================================================================", "Fills" ]
c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2
https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/xlsx/xform/style/styles-xform.js#L391-L399
train
Returns the index of the filled element
[ 30522, 3853, 1006, 6039, 1007, 1063, 13075, 20950, 1027, 2023, 1012, 4949, 1012, 6039, 1012, 2000, 2595, 19968, 1006, 6039, 1007, 1025, 13075, 5950, 1027, 2023, 1012, 5950, 1012, 6039, 1031, 20950, 1033, 1025, 2065, 1006, 5950, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/gridList/grid-list.js
GridListDirective
function GridListDirective($interpolate, $mdConstant, $mdGridLayout, $mdMedia) { return { restrict: 'E', controller: GridListController, scope: { mdOnLayout: '&' }, link: postLink }; function postLink(scope, element, attrs, ctrl) { element.addClass('_md'); // private md component indicator for styling // Apply semantics element.attr('role', 'list'); // Provide the controller with a way to trigger layouts. ctrl.layoutDelegate = layoutDelegate; var invalidateLayout = angular.bind(ctrl, ctrl.invalidateLayout), unwatchAttrs = watchMedia(); scope.$on('$destroy', unwatchMedia); /** * Watches for changes in media, invalidating layout as necessary. */ function watchMedia() { for (var mediaName in $mdConstant.MEDIA) { $mdMedia(mediaName); // initialize $mdMedia.getQuery($mdConstant.MEDIA[mediaName]) .addListener(invalidateLayout); } return $mdMedia.watchResponsiveAttributes( ['md-cols', 'md-row-height', 'md-gutter'], attrs, layoutIfMediaMatch); } function unwatchMedia() { ctrl.layoutDelegate = angular.noop; unwatchAttrs(); for (var mediaName in $mdConstant.MEDIA) { $mdMedia.getQuery($mdConstant.MEDIA[mediaName]) .removeListener(invalidateLayout); } } /** * Performs grid layout if the provided mediaName matches the currently * active media type. */ function layoutIfMediaMatch(mediaName) { if (mediaName == null) { // TODO(shyndman): It would be nice to only layout if we have // instances of attributes using this media type ctrl.invalidateLayout(); } else if ($mdMedia(mediaName)) { ctrl.invalidateLayout(); } } var lastLayoutProps; /** * Invokes the layout engine, and uses its results to lay out our * tile elements. * * @param {boolean} tilesInvalidated Whether tiles have been * added/removed/moved since the last layout. This is to avoid situations * where tiles are replaced with properties identical to their removed * counterparts. */ function layoutDelegate(tilesInvalidated) { var tiles = getTileElements(); var props = { tileSpans: getTileSpans(tiles), colCount: getColumnCount(), rowMode: getRowMode(), rowHeight: getRowHeight(), gutter: getGutter() }; if (!tilesInvalidated && angular.equals(props, lastLayoutProps)) { return; } var performance = $mdGridLayout(props.colCount, props.tileSpans, tiles) .map(function(tilePositions, rowCount) { return { grid: { element: element, style: getGridStyle(props.colCount, rowCount, props.gutter, props.rowMode, props.rowHeight) }, tiles: tilePositions.map(function(ps, i) { return { element: angular.element(tiles[i]), style: getTileStyle(ps.position, ps.spans, props.colCount, rowCount, props.gutter, props.rowMode, props.rowHeight) }; }) }; }) .reflow() .performance(); // Report layout scope.mdOnLayout({ $event: { performance: performance } }); lastLayoutProps = props; } // Use $interpolate to do some simple string interpolation as a convenience. var startSymbol = $interpolate.startSymbol(); var endSymbol = $interpolate.endSymbol(); // Returns an expression wrapped in the interpolator's start and end symbols. function expr(exprStr) { return startSymbol + exprStr + endSymbol; } // The amount of space a single 1x1 tile would take up (either width or height), used as // a basis for other calculations. This consists of taking the base size percent (as would be // if evenly dividing the size between cells), and then subtracting the size of one gutter. // However, since there are no gutters on the edges, each tile only uses a fration // (gutterShare = numGutters / numCells) of the gutter size. (Imagine having one gutter per // tile, and then breaking up the extra gutter on the edge evenly among the cells). var UNIT = $interpolate(expr('share') + '% - (' + expr('gutter') + ' * ' + expr('gutterShare') + ')'); // The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value. // The position comes the size of a 1x1 tile plus gutter for each previous tile in the // row/column (offset). var POSITION = $interpolate('calc((' + expr('unit') + ' + ' + expr('gutter') + ') * ' + expr('offset') + ')'); // The actual size of a tile, e.g., width or height, taking rowSpan or colSpan into account. // This is computed by multiplying the base unit by the rowSpan/colSpan, and then adding back // in the space that the gutter would normally have used (which was already accounted for in // the base unit calculation). var DIMENSION = $interpolate('calc((' + expr('unit') + ') * ' + expr('span') + ' + (' + expr('span') + ' - 1) * ' + expr('gutter') + ')'); /** * Gets the styles applied to a tile element described by the given parameters. * @param {{row: number, col: number}} position The row and column indices of the tile. * @param {{row: number, col: number}} spans The rowSpan and colSpan of the tile. * @param {number} colCount The number of columns. * @param {number} rowCount The number of rows. * @param {string} gutter The amount of space between tiles. This will be something like * '5px' or '2em'. * @param {string} rowMode The row height mode. Can be one of: * 'fixed': all rows have a fixed size, given by rowHeight, * 'ratio': row height defined as a ratio to width, or * 'fit': fit to the grid-list element height, divinding evenly among rows. * @param {string|number} rowHeight The height of a row. This is only used for 'fixed' mode and * for 'ratio' mode. For 'ratio' mode, this is the *ratio* of width-to-height (e.g., 0.75). * @returns {Object} Map of CSS properties to be applied to the style element. Will define * values for top, left, width, height, marginTop, and paddingTop. */ function getTileStyle(position, spans, colCount, rowCount, gutter, rowMode, rowHeight) { // TODO(shyndman): There are style caching opportunities here. // Percent of the available horizontal space that one column takes up. var hShare = (1 / colCount) * 100; // Fraction of the gutter size that each column takes up. var hGutterShare = (colCount - 1) / colCount; // Base horizontal size of a column. var hUnit = UNIT({share: hShare, gutterShare: hGutterShare, gutter: gutter}); // The width and horizontal position of each tile is always calculated the same way, but the // height and vertical position depends on the rowMode. var ltr = document.dir != 'rtl' && document.body.dir != 'rtl'; var style = ltr ? { left: POSITION({ unit: hUnit, offset: position.col, gutter: gutter }), width: DIMENSION({ unit: hUnit, span: spans.col, gutter: gutter }), // resets paddingTop: '', marginTop: '', top: '', height: '' } : { right: POSITION({ unit: hUnit, offset: position.col, gutter: gutter }), width: DIMENSION({ unit: hUnit, span: spans.col, gutter: gutter }), // resets paddingTop: '', marginTop: '', top: '', height: '' }; switch (rowMode) { case 'fixed': // In fixed mode, simply use the given rowHeight. style.top = POSITION({ unit: rowHeight, offset: position.row, gutter: gutter }); style.height = DIMENSION({ unit: rowHeight, span: spans.row, gutter: gutter }); break; case 'ratio': // Percent of the available vertical space that one row takes up. Here, rowHeight holds // the ratio value. For example, if the width:height ratio is 4:3, rowHeight = 1.333. var vShare = hShare / rowHeight; // Base veritcal size of a row. var vUnit = UNIT({ share: vShare, gutterShare: hGutterShare, gutter: gutter }); // padidngTop and marginTop are used to maintain the given aspect ratio, as // a percentage-based value for these properties is applied to the *width* of the // containing block. See http://www.w3.org/TR/CSS2/box.html#margin-properties style.paddingTop = DIMENSION({ unit: vUnit, span: spans.row, gutter: gutter}); style.marginTop = POSITION({ unit: vUnit, offset: position.row, gutter: gutter }); break; case 'fit': // Fraction of the gutter size that each column takes up. var vGutterShare = (rowCount - 1) / rowCount; // Percent of the available vertical space that one row takes up. vShare = (1 / rowCount) * 100; // Base vertical size of a row. vUnit = UNIT({share: vShare, gutterShare: vGutterShare, gutter: gutter}); style.top = POSITION({unit: vUnit, offset: position.row, gutter: gutter}); style.height = DIMENSION({unit: vUnit, span: spans.row, gutter: gutter}); break; } return style; } function getGridStyle(colCount, rowCount, gutter, rowMode, rowHeight) { var style = {}; switch (rowMode) { case 'fixed': style.height = DIMENSION({ unit: rowHeight, span: rowCount, gutter: gutter }); style.paddingBottom = ''; break; case 'ratio': // rowHeight is width / height var hGutterShare = colCount === 1 ? 0 : (colCount - 1) / colCount, hShare = (1 / colCount) * 100, vShare = hShare * (1 / rowHeight), vUnit = UNIT({ share: vShare, gutterShare: hGutterShare, gutter: gutter }); style.height = ''; style.paddingBottom = DIMENSION({ unit: vUnit, span: rowCount, gutter: gutter}); break; case 'fit': // noop, as the height is user set break; } return style; } function getTileElements() { return [].filter.call(element.children(), function(ele) { return ele.tagName == 'MD-GRID-TILE' && !ele.$$mdDestroyed; }); } /** * Gets an array of objects containing the rowspan and colspan for each tile. * @returns {Array<{row: number, col: number}>} */ function getTileSpans(tileElements) { return [].map.call(tileElements, function(ele) { var ctrl = angular.element(ele).controller('mdGridTile'); return { row: parseInt( $mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-rowspan'), 10) || 1, col: parseInt( $mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-colspan'), 10) || 1 }; }); } function getColumnCount() { var colCount = parseInt($mdMedia.getResponsiveAttribute(attrs, 'md-cols'), 10); if (isNaN(colCount)) { throw 'md-grid-list: md-cols attribute was not found, or contained a non-numeric value'; } return colCount; } function getGutter() { return applyDefaultUnit($mdMedia.getResponsiveAttribute(attrs, 'md-gutter') || 1); } function getRowHeight() { var rowHeight = $mdMedia.getResponsiveAttribute(attrs, 'md-row-height'); if (!rowHeight) { throw 'md-grid-list: md-row-height attribute was not found'; } switch (getRowMode()) { case 'fixed': return applyDefaultUnit(rowHeight); case 'ratio': var whRatio = rowHeight.split(':'); return parseFloat(whRatio[0]) / parseFloat(whRatio[1]); case 'fit': return 0; // N/A } } function getRowMode() { var rowHeight = $mdMedia.getResponsiveAttribute(attrs, 'md-row-height'); if (!rowHeight) { throw 'md-grid-list: md-row-height attribute was not found'; } if (rowHeight == 'fit') { return 'fit'; } else if (rowHeight.indexOf(':') !== -1) { return 'ratio'; } else { return 'fixed'; } } function applyDefaultUnit(val) { return /\D$/.test(val) ? val : val + 'px'; } } }
javascript
function GridListDirective($interpolate, $mdConstant, $mdGridLayout, $mdMedia) { return { restrict: 'E', controller: GridListController, scope: { mdOnLayout: '&' }, link: postLink }; function postLink(scope, element, attrs, ctrl) { element.addClass('_md'); // private md component indicator for styling // Apply semantics element.attr('role', 'list'); // Provide the controller with a way to trigger layouts. ctrl.layoutDelegate = layoutDelegate; var invalidateLayout = angular.bind(ctrl, ctrl.invalidateLayout), unwatchAttrs = watchMedia(); scope.$on('$destroy', unwatchMedia); /** * Watches for changes in media, invalidating layout as necessary. */ function watchMedia() { for (var mediaName in $mdConstant.MEDIA) { $mdMedia(mediaName); // initialize $mdMedia.getQuery($mdConstant.MEDIA[mediaName]) .addListener(invalidateLayout); } return $mdMedia.watchResponsiveAttributes( ['md-cols', 'md-row-height', 'md-gutter'], attrs, layoutIfMediaMatch); } function unwatchMedia() { ctrl.layoutDelegate = angular.noop; unwatchAttrs(); for (var mediaName in $mdConstant.MEDIA) { $mdMedia.getQuery($mdConstant.MEDIA[mediaName]) .removeListener(invalidateLayout); } } /** * Performs grid layout if the provided mediaName matches the currently * active media type. */ function layoutIfMediaMatch(mediaName) { if (mediaName == null) { // TODO(shyndman): It would be nice to only layout if we have // instances of attributes using this media type ctrl.invalidateLayout(); } else if ($mdMedia(mediaName)) { ctrl.invalidateLayout(); } } var lastLayoutProps; /** * Invokes the layout engine, and uses its results to lay out our * tile elements. * * @param {boolean} tilesInvalidated Whether tiles have been * added/removed/moved since the last layout. This is to avoid situations * where tiles are replaced with properties identical to their removed * counterparts. */ function layoutDelegate(tilesInvalidated) { var tiles = getTileElements(); var props = { tileSpans: getTileSpans(tiles), colCount: getColumnCount(), rowMode: getRowMode(), rowHeight: getRowHeight(), gutter: getGutter() }; if (!tilesInvalidated && angular.equals(props, lastLayoutProps)) { return; } var performance = $mdGridLayout(props.colCount, props.tileSpans, tiles) .map(function(tilePositions, rowCount) { return { grid: { element: element, style: getGridStyle(props.colCount, rowCount, props.gutter, props.rowMode, props.rowHeight) }, tiles: tilePositions.map(function(ps, i) { return { element: angular.element(tiles[i]), style: getTileStyle(ps.position, ps.spans, props.colCount, rowCount, props.gutter, props.rowMode, props.rowHeight) }; }) }; }) .reflow() .performance(); // Report layout scope.mdOnLayout({ $event: { performance: performance } }); lastLayoutProps = props; } // Use $interpolate to do some simple string interpolation as a convenience. var startSymbol = $interpolate.startSymbol(); var endSymbol = $interpolate.endSymbol(); // Returns an expression wrapped in the interpolator's start and end symbols. function expr(exprStr) { return startSymbol + exprStr + endSymbol; } // The amount of space a single 1x1 tile would take up (either width or height), used as // a basis for other calculations. This consists of taking the base size percent (as would be // if evenly dividing the size between cells), and then subtracting the size of one gutter. // However, since there are no gutters on the edges, each tile only uses a fration // (gutterShare = numGutters / numCells) of the gutter size. (Imagine having one gutter per // tile, and then breaking up the extra gutter on the edge evenly among the cells). var UNIT = $interpolate(expr('share') + '% - (' + expr('gutter') + ' * ' + expr('gutterShare') + ')'); // The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value. // The position comes the size of a 1x1 tile plus gutter for each previous tile in the // row/column (offset). var POSITION = $interpolate('calc((' + expr('unit') + ' + ' + expr('gutter') + ') * ' + expr('offset') + ')'); // The actual size of a tile, e.g., width or height, taking rowSpan or colSpan into account. // This is computed by multiplying the base unit by the rowSpan/colSpan, and then adding back // in the space that the gutter would normally have used (which was already accounted for in // the base unit calculation). var DIMENSION = $interpolate('calc((' + expr('unit') + ') * ' + expr('span') + ' + (' + expr('span') + ' - 1) * ' + expr('gutter') + ')'); /** * Gets the styles applied to a tile element described by the given parameters. * @param {{row: number, col: number}} position The row and column indices of the tile. * @param {{row: number, col: number}} spans The rowSpan and colSpan of the tile. * @param {number} colCount The number of columns. * @param {number} rowCount The number of rows. * @param {string} gutter The amount of space between tiles. This will be something like * '5px' or '2em'. * @param {string} rowMode The row height mode. Can be one of: * 'fixed': all rows have a fixed size, given by rowHeight, * 'ratio': row height defined as a ratio to width, or * 'fit': fit to the grid-list element height, divinding evenly among rows. * @param {string|number} rowHeight The height of a row. This is only used for 'fixed' mode and * for 'ratio' mode. For 'ratio' mode, this is the *ratio* of width-to-height (e.g., 0.75). * @returns {Object} Map of CSS properties to be applied to the style element. Will define * values for top, left, width, height, marginTop, and paddingTop. */ function getTileStyle(position, spans, colCount, rowCount, gutter, rowMode, rowHeight) { // TODO(shyndman): There are style caching opportunities here. // Percent of the available horizontal space that one column takes up. var hShare = (1 / colCount) * 100; // Fraction of the gutter size that each column takes up. var hGutterShare = (colCount - 1) / colCount; // Base horizontal size of a column. var hUnit = UNIT({share: hShare, gutterShare: hGutterShare, gutter: gutter}); // The width and horizontal position of each tile is always calculated the same way, but the // height and vertical position depends on the rowMode. var ltr = document.dir != 'rtl' && document.body.dir != 'rtl'; var style = ltr ? { left: POSITION({ unit: hUnit, offset: position.col, gutter: gutter }), width: DIMENSION({ unit: hUnit, span: spans.col, gutter: gutter }), // resets paddingTop: '', marginTop: '', top: '', height: '' } : { right: POSITION({ unit: hUnit, offset: position.col, gutter: gutter }), width: DIMENSION({ unit: hUnit, span: spans.col, gutter: gutter }), // resets paddingTop: '', marginTop: '', top: '', height: '' }; switch (rowMode) { case 'fixed': // In fixed mode, simply use the given rowHeight. style.top = POSITION({ unit: rowHeight, offset: position.row, gutter: gutter }); style.height = DIMENSION({ unit: rowHeight, span: spans.row, gutter: gutter }); break; case 'ratio': // Percent of the available vertical space that one row takes up. Here, rowHeight holds // the ratio value. For example, if the width:height ratio is 4:3, rowHeight = 1.333. var vShare = hShare / rowHeight; // Base veritcal size of a row. var vUnit = UNIT({ share: vShare, gutterShare: hGutterShare, gutter: gutter }); // padidngTop and marginTop are used to maintain the given aspect ratio, as // a percentage-based value for these properties is applied to the *width* of the // containing block. See http://www.w3.org/TR/CSS2/box.html#margin-properties style.paddingTop = DIMENSION({ unit: vUnit, span: spans.row, gutter: gutter}); style.marginTop = POSITION({ unit: vUnit, offset: position.row, gutter: gutter }); break; case 'fit': // Fraction of the gutter size that each column takes up. var vGutterShare = (rowCount - 1) / rowCount; // Percent of the available vertical space that one row takes up. vShare = (1 / rowCount) * 100; // Base vertical size of a row. vUnit = UNIT({share: vShare, gutterShare: vGutterShare, gutter: gutter}); style.top = POSITION({unit: vUnit, offset: position.row, gutter: gutter}); style.height = DIMENSION({unit: vUnit, span: spans.row, gutter: gutter}); break; } return style; } function getGridStyle(colCount, rowCount, gutter, rowMode, rowHeight) { var style = {}; switch (rowMode) { case 'fixed': style.height = DIMENSION({ unit: rowHeight, span: rowCount, gutter: gutter }); style.paddingBottom = ''; break; case 'ratio': // rowHeight is width / height var hGutterShare = colCount === 1 ? 0 : (colCount - 1) / colCount, hShare = (1 / colCount) * 100, vShare = hShare * (1 / rowHeight), vUnit = UNIT({ share: vShare, gutterShare: hGutterShare, gutter: gutter }); style.height = ''; style.paddingBottom = DIMENSION({ unit: vUnit, span: rowCount, gutter: gutter}); break; case 'fit': // noop, as the height is user set break; } return style; } function getTileElements() { return [].filter.call(element.children(), function(ele) { return ele.tagName == 'MD-GRID-TILE' && !ele.$$mdDestroyed; }); } /** * Gets an array of objects containing the rowspan and colspan for each tile. * @returns {Array<{row: number, col: number}>} */ function getTileSpans(tileElements) { return [].map.call(tileElements, function(ele) { var ctrl = angular.element(ele).controller('mdGridTile'); return { row: parseInt( $mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-rowspan'), 10) || 1, col: parseInt( $mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-colspan'), 10) || 1 }; }); } function getColumnCount() { var colCount = parseInt($mdMedia.getResponsiveAttribute(attrs, 'md-cols'), 10); if (isNaN(colCount)) { throw 'md-grid-list: md-cols attribute was not found, or contained a non-numeric value'; } return colCount; } function getGutter() { return applyDefaultUnit($mdMedia.getResponsiveAttribute(attrs, 'md-gutter') || 1); } function getRowHeight() { var rowHeight = $mdMedia.getResponsiveAttribute(attrs, 'md-row-height'); if (!rowHeight) { throw 'md-grid-list: md-row-height attribute was not found'; } switch (getRowMode()) { case 'fixed': return applyDefaultUnit(rowHeight); case 'ratio': var whRatio = rowHeight.split(':'); return parseFloat(whRatio[0]) / parseFloat(whRatio[1]); case 'fit': return 0; // N/A } } function getRowMode() { var rowHeight = $mdMedia.getResponsiveAttribute(attrs, 'md-row-height'); if (!rowHeight) { throw 'md-grid-list: md-row-height attribute was not found'; } if (rowHeight == 'fit') { return 'fit'; } else if (rowHeight.indexOf(':') !== -1) { return 'ratio'; } else { return 'fixed'; } } function applyDefaultUnit(val) { return /\D$/.test(val) ? val : val + 'px'; } } }
[ "function", "GridListDirective", "(", "$interpolate", ",", "$mdConstant", ",", "$mdGridLayout", ",", "$mdMedia", ")", "{", "return", "{", "restrict", ":", "'E'", ",", "controller", ":", "GridListController", ",", "scope", ":", "{", "mdOnLayout", ":", "'&'", "}...
@ngdoc directive @name mdGridList @module material.components.gridList @restrict E @description Grid lists are an alternative to standard list views. Grid lists are distinct from grids used for layouts and other visual presentations. A grid list is best suited to presenting a homogenous data type, typically images, and is optimized for visual comprehension and differentiating between like data types. A grid list is a continuous element consisting of tessellated, regular subdivisions called cells that contain tiles (`md-grid-tile`). <img src="//material-design.storage.googleapis.com/publish/v_2/material_ext_publish/0Bx4BSt6jniD7OVlEaXZ5YmU1Xzg/components_grids_usage2.png" style="width: 300px; height: auto; margin-right: 16px;" alt="Concept of grid explained visually"> <img src="//material-design.storage.googleapis.com/publish/v_2/material_ext_publish/0Bx4BSt6jniD7VGhsOE5idWlJWXM/components_grids_usage3.png" style="width: 300px; height: auto;" alt="Grid concepts legend"> Cells are arrayed vertically and horizontally within the grid. Tiles hold content and can span one or more cells vertically or horizontally. ### Responsive Attributes The `md-grid-list` directive supports "responsive" attributes, which allow different `md-cols`, `md-gutter` and `md-row-height` values depending on the currently matching media query. In order to set a responsive attribute, first define the fallback value with the standard attribute name, then add additional attributes with the following convention: `{base-attribute-name}-{media-query-name}="{value}"` (ie. `md-cols-lg="8"`) @param {number} md-cols Number of columns in the grid. @param {string} md-row-height One of <ul> <li>CSS length - Fixed height rows (eg. `8px` or `1rem`)</li> <li>`{width}:{height}` - Ratio of width to height (eg. `md-row-height="16:9"`)</li> <li>`"fit"` - Height will be determined by subdividing the available height by the number of rows</li> </ul> @param {string=} md-gutter The amount of space between tiles in CSS units (default 1px) @param {expression=} md-on-layout Expression to evaluate after layout. Event object is available as `$event`, and contains performance information. @usage Basic: <hljs lang="html"> <md-grid-list md-cols="5" md-gutter="1em" md-row-height="4:3"> <md-grid-tile></md-grid-tile> </md-grid-list> </hljs> Fixed-height rows: <hljs lang="html"> <md-grid-list md-cols="4" md-row-height="200px" ...> <md-grid-tile></md-grid-tile> </md-grid-list> </hljs> Fit rows: <hljs lang="html"> <md-grid-list md-cols="4" md-row-height="fit" style="height: 400px;" ...> <md-grid-tile></md-grid-tile> </md-grid-list> </hljs> Using responsive attributes: <hljs lang="html"> <md-grid-list md-cols-sm="2" md-cols-md="4" md-cols-lg="8" md-cols-gt-lg="12" ...> <md-grid-tile></md-grid-tile> </md-grid-list> </hljs>
[ "@ngdoc", "directive", "@name", "mdGridList", "@module", "material", ".", "components", ".", "gridList", "@restrict", "E", "@description", "Grid", "lists", "are", "an", "alternative", "to", "standard", "list", "views", ".", "Grid", "lists", "are", "distinct", "f...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L96-L430
train
A directive that can be used to create a list of items.
[ 30522, 3853, 8370, 9863, 4305, 2890, 15277, 1006, 1002, 6970, 18155, 3686, 1010, 1002, 9108, 8663, 12693, 2102, 1010, 1002, 9108, 16523, 3593, 8485, 5833, 1010, 1002, 9108, 16969, 1007, 1063, 2709, 1063, 21573, 1024, 1005, 1041, 1005, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js
receiveMessageFromBrackets
function receiveMessageFromBrackets(msgObj) { var argList = msgObj.args; argList.unshift(msgObj.requester || ""); functionMap[msgObj.fn].apply(null, argList); }
javascript
function receiveMessageFromBrackets(msgObj) { var argList = msgObj.args; argList.unshift(msgObj.requester || ""); functionMap[msgObj.fn].apply(null, argList); }
[ "function", "receiveMessageFromBrackets", "(", "msgObj", ")", "{", "var", "argList", "=", "msgObj", ".", "args", ";", "argList", ".", "unshift", "(", "msgObj", ".", "requester", "||", "\"\"", ")", ";", "functionMap", "[", "msgObj", ".", "fn", "]", ".", "...
Receives messages from brackets @param {object} msgObj - json containing - { fn - function to execute on node side args - arguments to the above function }
[ "Receives", "messages", "from", "brackets" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js#L444-L448
train
receive message from brackets
[ 30522, 3853, 4374, 7834, 3736, 3351, 19699, 5358, 10024, 19869, 3215, 1006, 5796, 3995, 2497, 3501, 1007, 1063, 13075, 12098, 25394, 3367, 1027, 5796, 3995, 2497, 3501, 1012, 12098, 5620, 1025, 12098, 25394, 3367, 1012, 4895, 6182, 6199, 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...
muaz-khan/RTCMultiConnection
dev/MediaStreamRecorder.js
WhammyRecorderHelper
function WhammyRecorderHelper(mediaStream, root) { this.record = function(timeSlice) { if (!this.width) { this.width = 320; } if (!this.height) { this.height = 240; } if (this.video && this.video instanceof HTMLVideoElement) { if (!this.width) { this.width = video.videoWidth || video.clientWidth || 320; } if (!this.height) { this.height = video.videoHeight || video.clientHeight || 240; } } if (!this.video) { this.video = { width: this.width, height: this.height }; } if (!this.canvas || !this.canvas.width || !this.canvas.height) { this.canvas = { width: this.width, height: this.height }; } canvas.width = this.canvas.width; canvas.height = this.canvas.height; // setting defaults if (this.video && this.video instanceof HTMLVideoElement) { this.isHTMLObject = true; video = this.video.cloneNode(); } else { video = document.createElement('video'); video.src = URL.createObjectURL(mediaStream); video.width = this.video.width; video.height = this.video.height; } video.muted = true; video.play(); lastTime = new Date().getTime(); whammy = new Whammy.Video(root.speed, root.quality); console.log('canvas resolutions', canvas.width, '*', canvas.height); console.log('video width/height', video.width || canvas.width, '*', video.height || canvas.height); drawFrames(); }; this.clearOldRecordedFrames = function() { whammy.frames = []; }; var requestDataInvoked = false; this.requestData = function() { if (isPaused) { return; } if (!whammy.frames.length) { requestDataInvoked = false; return; } requestDataInvoked = true; // clone stuff var internalFrames = whammy.frames.slice(0); // reset the frames for the new recording whammy.frames = dropBlackFrames(internalFrames, -1); whammy.compile(function(whammyBlob) { root.ondataavailable(whammyBlob); console.debug('video recorded blob size:', bytesToSize(whammyBlob.size)); }); whammy.frames = []; requestDataInvoked = false; }; var isOnStartedDrawingNonBlankFramesInvoked = false; function drawFrames() { if (isPaused) { lastTime = new Date().getTime(); setTimeout(drawFrames, 500); return; } if (isStopDrawing) { return; } if (requestDataInvoked) { return setTimeout(drawFrames, 100); } var duration = new Date().getTime() - lastTime; if (!duration) { return drawFrames(); } // via webrtc-experiment#206, by Jack i.e. @Seymourr lastTime = new Date().getTime(); if (!self.isHTMLObject && video.paused) { video.play(); // Android } context.drawImage(video, 0, 0, canvas.width, canvas.height); if (!isStopDrawing) { whammy.frames.push({ duration: duration, image: canvas.toDataURL('image/webp') }); } if (!isOnStartedDrawingNonBlankFramesInvoked && !isBlankFrame(whammy.frames[whammy.frames.length - 1])) { isOnStartedDrawingNonBlankFramesInvoked = true; root.onStartedDrawingNonBlankFrames(); } setTimeout(drawFrames, 10); } var isStopDrawing = false; this.stop = function() { isStopDrawing = true; this.requestData(); this.onstop(); }; var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); var video; var lastTime; var whammy; var self = this; function isBlankFrame(frame, _pixTolerance, _frameTolerance) { var localCanvas = document.createElement('canvas'); localCanvas.width = canvas.width; localCanvas.height = canvas.height; var context2d = localCanvas.getContext('2d'); var sampleColor = { r: 0, g: 0, b: 0 }; var maxColorDifference = Math.sqrt( Math.pow(255, 2) + Math.pow(255, 2) + Math.pow(255, 2) ); var pixTolerance = _pixTolerance && _pixTolerance >= 0 && _pixTolerance <= 1 ? _pixTolerance : 0; var frameTolerance = _frameTolerance && _frameTolerance >= 0 && _frameTolerance <= 1 ? _frameTolerance : 0; var matchPixCount, endPixCheck, maxPixCount; var image = new Image(); image.src = frame.image; context2d.drawImage(image, 0, 0, canvas.width, canvas.height); var imageData = context2d.getImageData(0, 0, canvas.width, canvas.height); matchPixCount = 0; endPixCheck = imageData.data.length; maxPixCount = imageData.data.length / 4; for (var pix = 0; pix < endPixCheck; pix += 4) { var currentColor = { r: imageData.data[pix], g: imageData.data[pix + 1], b: imageData.data[pix + 2] }; var colorDifference = Math.sqrt( Math.pow(currentColor.r - sampleColor.r, 2) + Math.pow(currentColor.g - sampleColor.g, 2) + Math.pow(currentColor.b - sampleColor.b, 2) ); // difference in color it is difference in color vectors (r1,g1,b1) <=> (r2,g2,b2) if (colorDifference <= maxColorDifference * pixTolerance) { matchPixCount++; } } if (maxPixCount - matchPixCount <= maxPixCount * frameTolerance) { return false; } else { return true; } } function dropBlackFrames(_frames, _framesToCheck, _pixTolerance, _frameTolerance) { var localCanvas = document.createElement('canvas'); localCanvas.width = canvas.width; localCanvas.height = canvas.height; var context2d = localCanvas.getContext('2d'); var resultFrames = []; var checkUntilNotBlack = _framesToCheck === -1; var endCheckFrame = (_framesToCheck && _framesToCheck > 0 && _framesToCheck <= _frames.length) ? _framesToCheck : _frames.length; var sampleColor = { r: 0, g: 0, b: 0 }; var maxColorDifference = Math.sqrt( Math.pow(255, 2) + Math.pow(255, 2) + Math.pow(255, 2) ); var pixTolerance = _pixTolerance && _pixTolerance >= 0 && _pixTolerance <= 1 ? _pixTolerance : 0; var frameTolerance = _frameTolerance && _frameTolerance >= 0 && _frameTolerance <= 1 ? _frameTolerance : 0; var doNotCheckNext = false; for (var f = 0; f < endCheckFrame; f++) { var matchPixCount, endPixCheck, maxPixCount; if (!doNotCheckNext) { var image = new Image(); image.src = _frames[f].image; context2d.drawImage(image, 0, 0, canvas.width, canvas.height); var imageData = context2d.getImageData(0, 0, canvas.width, canvas.height); matchPixCount = 0; endPixCheck = imageData.data.length; maxPixCount = imageData.data.length / 4; for (var pix = 0; pix < endPixCheck; pix += 4) { var currentColor = { r: imageData.data[pix], g: imageData.data[pix + 1], b: imageData.data[pix + 2] }; var colorDifference = Math.sqrt( Math.pow(currentColor.r - sampleColor.r, 2) + Math.pow(currentColor.g - sampleColor.g, 2) + Math.pow(currentColor.b - sampleColor.b, 2) ); // difference in color it is difference in color vectors (r1,g1,b1) <=> (r2,g2,b2) if (colorDifference <= maxColorDifference * pixTolerance) { matchPixCount++; } } } if (!doNotCheckNext && maxPixCount - matchPixCount <= maxPixCount * frameTolerance) { // console.log('removed black frame : ' + f + ' ; frame duration ' + _frames[f].duration); } else { // console.log('frame is passed : ' + f); if (checkUntilNotBlack) { doNotCheckNext = true; } resultFrames.push(_frames[f]); } } resultFrames = resultFrames.concat(_frames.slice(endCheckFrame)); if (resultFrames.length <= 0) { // at least one last frame should be available for next manipulation // if total duration of all frames will be < 1000 than ffmpeg doesn't work well... resultFrames.push(_frames[_frames.length - 1]); } return resultFrames; } var isPaused = false; this.pause = function() { isPaused = true; }; this.resume = function() { isPaused = false; }; this.onstop = function() {}; }
javascript
function WhammyRecorderHelper(mediaStream, root) { this.record = function(timeSlice) { if (!this.width) { this.width = 320; } if (!this.height) { this.height = 240; } if (this.video && this.video instanceof HTMLVideoElement) { if (!this.width) { this.width = video.videoWidth || video.clientWidth || 320; } if (!this.height) { this.height = video.videoHeight || video.clientHeight || 240; } } if (!this.video) { this.video = { width: this.width, height: this.height }; } if (!this.canvas || !this.canvas.width || !this.canvas.height) { this.canvas = { width: this.width, height: this.height }; } canvas.width = this.canvas.width; canvas.height = this.canvas.height; // setting defaults if (this.video && this.video instanceof HTMLVideoElement) { this.isHTMLObject = true; video = this.video.cloneNode(); } else { video = document.createElement('video'); video.src = URL.createObjectURL(mediaStream); video.width = this.video.width; video.height = this.video.height; } video.muted = true; video.play(); lastTime = new Date().getTime(); whammy = new Whammy.Video(root.speed, root.quality); console.log('canvas resolutions', canvas.width, '*', canvas.height); console.log('video width/height', video.width || canvas.width, '*', video.height || canvas.height); drawFrames(); }; this.clearOldRecordedFrames = function() { whammy.frames = []; }; var requestDataInvoked = false; this.requestData = function() { if (isPaused) { return; } if (!whammy.frames.length) { requestDataInvoked = false; return; } requestDataInvoked = true; // clone stuff var internalFrames = whammy.frames.slice(0); // reset the frames for the new recording whammy.frames = dropBlackFrames(internalFrames, -1); whammy.compile(function(whammyBlob) { root.ondataavailable(whammyBlob); console.debug('video recorded blob size:', bytesToSize(whammyBlob.size)); }); whammy.frames = []; requestDataInvoked = false; }; var isOnStartedDrawingNonBlankFramesInvoked = false; function drawFrames() { if (isPaused) { lastTime = new Date().getTime(); setTimeout(drawFrames, 500); return; } if (isStopDrawing) { return; } if (requestDataInvoked) { return setTimeout(drawFrames, 100); } var duration = new Date().getTime() - lastTime; if (!duration) { return drawFrames(); } // via webrtc-experiment#206, by Jack i.e. @Seymourr lastTime = new Date().getTime(); if (!self.isHTMLObject && video.paused) { video.play(); // Android } context.drawImage(video, 0, 0, canvas.width, canvas.height); if (!isStopDrawing) { whammy.frames.push({ duration: duration, image: canvas.toDataURL('image/webp') }); } if (!isOnStartedDrawingNonBlankFramesInvoked && !isBlankFrame(whammy.frames[whammy.frames.length - 1])) { isOnStartedDrawingNonBlankFramesInvoked = true; root.onStartedDrawingNonBlankFrames(); } setTimeout(drawFrames, 10); } var isStopDrawing = false; this.stop = function() { isStopDrawing = true; this.requestData(); this.onstop(); }; var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); var video; var lastTime; var whammy; var self = this; function isBlankFrame(frame, _pixTolerance, _frameTolerance) { var localCanvas = document.createElement('canvas'); localCanvas.width = canvas.width; localCanvas.height = canvas.height; var context2d = localCanvas.getContext('2d'); var sampleColor = { r: 0, g: 0, b: 0 }; var maxColorDifference = Math.sqrt( Math.pow(255, 2) + Math.pow(255, 2) + Math.pow(255, 2) ); var pixTolerance = _pixTolerance && _pixTolerance >= 0 && _pixTolerance <= 1 ? _pixTolerance : 0; var frameTolerance = _frameTolerance && _frameTolerance >= 0 && _frameTolerance <= 1 ? _frameTolerance : 0; var matchPixCount, endPixCheck, maxPixCount; var image = new Image(); image.src = frame.image; context2d.drawImage(image, 0, 0, canvas.width, canvas.height); var imageData = context2d.getImageData(0, 0, canvas.width, canvas.height); matchPixCount = 0; endPixCheck = imageData.data.length; maxPixCount = imageData.data.length / 4; for (var pix = 0; pix < endPixCheck; pix += 4) { var currentColor = { r: imageData.data[pix], g: imageData.data[pix + 1], b: imageData.data[pix + 2] }; var colorDifference = Math.sqrt( Math.pow(currentColor.r - sampleColor.r, 2) + Math.pow(currentColor.g - sampleColor.g, 2) + Math.pow(currentColor.b - sampleColor.b, 2) ); // difference in color it is difference in color vectors (r1,g1,b1) <=> (r2,g2,b2) if (colorDifference <= maxColorDifference * pixTolerance) { matchPixCount++; } } if (maxPixCount - matchPixCount <= maxPixCount * frameTolerance) { return false; } else { return true; } } function dropBlackFrames(_frames, _framesToCheck, _pixTolerance, _frameTolerance) { var localCanvas = document.createElement('canvas'); localCanvas.width = canvas.width; localCanvas.height = canvas.height; var context2d = localCanvas.getContext('2d'); var resultFrames = []; var checkUntilNotBlack = _framesToCheck === -1; var endCheckFrame = (_framesToCheck && _framesToCheck > 0 && _framesToCheck <= _frames.length) ? _framesToCheck : _frames.length; var sampleColor = { r: 0, g: 0, b: 0 }; var maxColorDifference = Math.sqrt( Math.pow(255, 2) + Math.pow(255, 2) + Math.pow(255, 2) ); var pixTolerance = _pixTolerance && _pixTolerance >= 0 && _pixTolerance <= 1 ? _pixTolerance : 0; var frameTolerance = _frameTolerance && _frameTolerance >= 0 && _frameTolerance <= 1 ? _frameTolerance : 0; var doNotCheckNext = false; for (var f = 0; f < endCheckFrame; f++) { var matchPixCount, endPixCheck, maxPixCount; if (!doNotCheckNext) { var image = new Image(); image.src = _frames[f].image; context2d.drawImage(image, 0, 0, canvas.width, canvas.height); var imageData = context2d.getImageData(0, 0, canvas.width, canvas.height); matchPixCount = 0; endPixCheck = imageData.data.length; maxPixCount = imageData.data.length / 4; for (var pix = 0; pix < endPixCheck; pix += 4) { var currentColor = { r: imageData.data[pix], g: imageData.data[pix + 1], b: imageData.data[pix + 2] }; var colorDifference = Math.sqrt( Math.pow(currentColor.r - sampleColor.r, 2) + Math.pow(currentColor.g - sampleColor.g, 2) + Math.pow(currentColor.b - sampleColor.b, 2) ); // difference in color it is difference in color vectors (r1,g1,b1) <=> (r2,g2,b2) if (colorDifference <= maxColorDifference * pixTolerance) { matchPixCount++; } } } if (!doNotCheckNext && maxPixCount - matchPixCount <= maxPixCount * frameTolerance) { // console.log('removed black frame : ' + f + ' ; frame duration ' + _frames[f].duration); } else { // console.log('frame is passed : ' + f); if (checkUntilNotBlack) { doNotCheckNext = true; } resultFrames.push(_frames[f]); } } resultFrames = resultFrames.concat(_frames.slice(endCheckFrame)); if (resultFrames.length <= 0) { // at least one last frame should be available for next manipulation // if total duration of all frames will be < 1000 than ffmpeg doesn't work well... resultFrames.push(_frames[_frames.length - 1]); } return resultFrames; } var isPaused = false; this.pause = function() { isPaused = true; }; this.resume = function() { isPaused = false; }; this.onstop = function() {}; }
[ "function", "WhammyRecorderHelper", "(", "mediaStream", ",", "root", ")", "{", "this", ".", "record", "=", "function", "(", "timeSlice", ")", "{", "if", "(", "!", "this", ".", "width", ")", "{", "this", ".", "width", "=", "320", ";", "}", "if", "(", ...
========================== WhammyRecorderHelper.js
[ "==========================", "WhammyRecorderHelper", ".", "js" ]
2032ce949bde30b43a3d2666e0f1e5afbf337f3d
https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/MediaStreamRecorder.js#L1762-L2057
train
WhammyRecorderHelper - This function is the main entry point for the recorder
[ 30522, 3853, 1059, 3511, 8029, 2890, 27108, 4063, 16001, 4842, 1006, 2865, 21422, 1010, 7117, 1007, 1063, 2023, 1012, 2501, 1027, 3853, 1006, 2335, 13231, 1007, 1063, 2065, 1006, 999, 2023, 1012, 9381, 1007, 1063, 2023, 1012, 9381, 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...
angular/material
src/components/tabs/js/tabsController.js
refreshIndex
function refreshIndex () { ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex); ctrl.focusIndex = getNearestSafeIndex(ctrl.focusIndex); }
javascript
function refreshIndex () { ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex); ctrl.focusIndex = getNearestSafeIndex(ctrl.focusIndex); }
[ "function", "refreshIndex", "(", ")", "{", "ctrl", ".", "selectedIndex", "=", "getNearestSafeIndex", "(", "ctrl", ".", "selectedIndex", ")", ";", "ctrl", ".", "focusIndex", "=", "getNearestSafeIndex", "(", "ctrl", ".", "focusIndex", ")", ";", "}" ]
Moves the indexes to their nearest valid values.
[ "Moves", "the", "indexes", "to", "their", "nearest", "valid", "values", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L783-L786
train
Refreshes the index of the nearest item in the list
[ 30522, 3853, 25416, 21898, 22254, 10288, 1006, 1007, 1063, 14931, 12190, 1012, 3479, 22254, 10288, 1027, 2131, 22084, 28533, 3736, 7959, 22254, 10288, 1006, 14931, 12190, 1012, 3479, 22254, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
loadNextPropertiesAsync
function loadNextPropertiesAsync(oBundle) { if ( oBundle._sNextLocale != null ) { return tryToLoadNextProperties(oBundle, true).then(function(oProps) { // if props could not be loaded, try next fallback locale return oProps || loadNextPropertiesAsync(oBundle); }); } // no more fallback locales: give up return Promise.resolve(null); }
javascript
function loadNextPropertiesAsync(oBundle) { if ( oBundle._sNextLocale != null ) { return tryToLoadNextProperties(oBundle, true).then(function(oProps) { // if props could not be loaded, try next fallback locale return oProps || loadNextPropertiesAsync(oBundle); }); } // no more fallback locales: give up return Promise.resolve(null); }
[ "function", "loadNextPropertiesAsync", "(", "oBundle", ")", "{", "if", "(", "oBundle", ".", "_sNextLocale", "!=", "null", ")", "{", "return", "tryToLoadNextProperties", "(", "oBundle", ",", "true", ")", ".", "then", "(", "function", "(", "oProps", ")", "{", ...
/* Tries to load properties files asynchronously until one could be loaded successfully or until there are no more fallback locales.
[ "/", "*", "Tries", "to", "load", "properties", "files", "asynchronously", "until", "one", "could", "be", "loaded", "successfully", "or", "until", "there", "are", "no", "more", "fallback", "locales", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js#L449-L458
train
Loads the next locale properties from the bundle
[ 30522, 3853, 7170, 2638, 18413, 21572, 4842, 7368, 3022, 6038, 2278, 1006, 27885, 8630, 2571, 1007, 1063, 2065, 1006, 27885, 8630, 2571, 1012, 1035, 1055, 2638, 18413, 4135, 9289, 2063, 999, 1027, 19701, 1007, 1063, 2709, 3046, 3406, 11066,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
function (fnVisitor, sNamespace, sLocalName) { var fnOldVisitor = mVisitors[sNamespace]; if (fnVisitor !== null && typeof fnVisitor !== "function" || fnVisitor === visitNodeWrapper) { throw new Error("Invalid visitor: " + fnVisitor); } if (!sNamespace || sNamespace === sNAMESPACE || sNamespace === "sap.ui.core" || sNamespace.indexOf(" ") >= 0) { throw new Error("Invalid namespace: " + sNamespace); } Log.debug("Plug-in visitor for namespace '" + sNamespace + "', local name '" + sLocalName + "'", fnVisitor, sXMLPreprocessor); if (sLocalName) { sNamespace = sNamespace + " " + sLocalName; fnOldVisitor = mVisitors[sNamespace] || fnOldVisitor; } mVisitors[sNamespace] = fnVisitor; return fnOldVisitor || visitNodeWrapper; }
javascript
function (fnVisitor, sNamespace, sLocalName) { var fnOldVisitor = mVisitors[sNamespace]; if (fnVisitor !== null && typeof fnVisitor !== "function" || fnVisitor === visitNodeWrapper) { throw new Error("Invalid visitor: " + fnVisitor); } if (!sNamespace || sNamespace === sNAMESPACE || sNamespace === "sap.ui.core" || sNamespace.indexOf(" ") >= 0) { throw new Error("Invalid namespace: " + sNamespace); } Log.debug("Plug-in visitor for namespace '" + sNamespace + "', local name '" + sLocalName + "'", fnVisitor, sXMLPreprocessor); if (sLocalName) { sNamespace = sNamespace + " " + sLocalName; fnOldVisitor = mVisitors[sNamespace] || fnOldVisitor; } mVisitors[sNamespace] = fnVisitor; return fnOldVisitor || visitNodeWrapper; }
[ "function", "(", "fnVisitor", ",", "sNamespace", ",", "sLocalName", ")", "{", "var", "fnOldVisitor", "=", "mVisitors", "[", "sNamespace", "]", ";", "if", "(", "fnVisitor", "!==", "null", "&&", "typeof", "fnVisitor", "!==", "\"function\"", "||", "fnVisitor", ...
Plug-in the given visitor which is called for each matching XML element. @param {function} [fnVisitor] Visitor function, will be called with the matching XML DOM element and a {@link sap.ui.core.util.XMLPreprocessor.ICallback callback interface} which uses a map of currently known variables; must return <code>undefined</code>. Must be either a function or <code>null</code>, nothing else. @param {string} sNamespace The expected namespace URI; must not contain spaces; "http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1" and "sap.ui.core" are reserved @param {string} [sLocalName] The expected local name; if it is missing, the local name is ignored for a match. @returns {function} The visitor function which previously matched elements with the given namespace and local name, or a function which calls "visitNode" but never <code>null</code> so that you can safely delegate to it. In general, you cannot restore the previous state by calling <code>plugIn</code> again with this function. @throws {Error} If visitor or namespace is invalid @private
[ "Plug", "-", "in", "the", "given", "visitor", "which", "is", "called", "for", "each", "matching", "XML", "element", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L531-L550
train
Plug - in a visitor function.
[ 30522, 3853, 1006, 1042, 2078, 11365, 15660, 1010, 1055, 18442, 23058, 1010, 22889, 24755, 19666, 14074, 1007, 1063, 13075, 1042, 3630, 6392, 11365, 15660, 1027, 19842, 17417, 6591, 1031, 1055, 18442, 23058, 1033, 1025, 2065, 1006, 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...
aframevr/aframe
src/components/look-controls.js
function () { if (!this.el.sceneEl.checkHeadsetConnected()) { return; } this.saveCameraPose(); this.el.object3D.position.set(0, 0, 0); this.el.object3D.updateMatrix(); }
javascript
function () { if (!this.el.sceneEl.checkHeadsetConnected()) { return; } this.saveCameraPose(); this.el.object3D.position.set(0, 0, 0); this.el.object3D.updateMatrix(); }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "el", ".", "sceneEl", ".", "checkHeadsetConnected", "(", ")", ")", "{", "return", ";", "}", "this", ".", "saveCameraPose", "(", ")", ";", "this", ".", "el", ".", "object3D", ".", "position", "...
Save pose.
[ "Save", "pose", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/look-controls.js#L345-L350
train
Update camera pose
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 999, 2023, 1012, 3449, 1012, 3496, 2884, 1012, 4638, 13038, 3388, 24230, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 2023, 1012, 3828, 28727, 6906, 20688, 1006, 1007, 1025, 2023, 1012, 3449, 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...
GitbookIO/gitbook
lib/utils/location.js
toAbsolute
function toAbsolute(_href, dir, outdir) { if (isExternal(_href) || isDataURI(_href)) { return _href; } outdir = outdir == undefined? dir : outdir; _href = normalize(_href); dir = normalize(dir); outdir = normalize(outdir); // Path "_href" inside the base folder var hrefInRoot = normalize(path.join(dir, _href)); if (_href[0] == '/') { hrefInRoot = normalize(_href.slice(1)); } // Make it relative to output _href = path.relative(outdir, hrefInRoot); // Normalize windows paths _href = normalize(_href); return _href; }
javascript
function toAbsolute(_href, dir, outdir) { if (isExternal(_href) || isDataURI(_href)) { return _href; } outdir = outdir == undefined? dir : outdir; _href = normalize(_href); dir = normalize(dir); outdir = normalize(outdir); // Path "_href" inside the base folder var hrefInRoot = normalize(path.join(dir, _href)); if (_href[0] == '/') { hrefInRoot = normalize(_href.slice(1)); } // Make it relative to output _href = path.relative(outdir, hrefInRoot); // Normalize windows paths _href = normalize(_href); return _href; }
[ "function", "toAbsolute", "(", "_href", ",", "dir", ",", "outdir", ")", "{", "if", "(", "isExternal", "(", "_href", ")", "||", "isDataURI", "(", "_href", ")", ")", "{", "return", "_href", ";", "}", "outdir", "=", "outdir", "==", "undefined", "?", "di...
Convert a relative path to absolute @param {String} href @param {String} dir: directory parent of the file currently in rendering process @param {String} outdir: directory parent from the html output @return {String}
[ "Convert", "a", "relative", "path", "to", "absolute" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/location.js#L65-L89
train
Convert a href to an absolute path
[ 30522, 3853, 2000, 7875, 19454, 10421, 1006, 1035, 17850, 12879, 1010, 16101, 1010, 2041, 4305, 2099, 1007, 1063, 2065, 1006, 2003, 10288, 16451, 2389, 1006, 1035, 17850, 12879, 1007, 1064, 1064, 2003, 2850, 2696, 9496, 1006, 1035, 17850, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/tabs/js/tabsController.js
getElements
function getElements () { var elements = {}; var node = $element[0]; // gather tab bar elements elements.wrapper = node.querySelector('md-tabs-wrapper'); elements.canvas = elements.wrapper.querySelector('md-tabs-canvas'); elements.paging = elements.canvas.querySelector('md-pagination-wrapper'); elements.inkBar = elements.paging.querySelector('md-ink-bar'); elements.nextButton = node.querySelector('md-next-button'); elements.prevButton = node.querySelector('md-prev-button'); elements.contents = node.querySelectorAll('md-tabs-content-wrapper > md-tab-content'); elements.tabs = elements.paging.querySelectorAll('md-tab-item'); elements.dummies = elements.canvas.querySelectorAll('md-dummy-tab'); return elements; }
javascript
function getElements () { var elements = {}; var node = $element[0]; // gather tab bar elements elements.wrapper = node.querySelector('md-tabs-wrapper'); elements.canvas = elements.wrapper.querySelector('md-tabs-canvas'); elements.paging = elements.canvas.querySelector('md-pagination-wrapper'); elements.inkBar = elements.paging.querySelector('md-ink-bar'); elements.nextButton = node.querySelector('md-next-button'); elements.prevButton = node.querySelector('md-prev-button'); elements.contents = node.querySelectorAll('md-tabs-content-wrapper > md-tab-content'); elements.tabs = elements.paging.querySelectorAll('md-tab-item'); elements.dummies = elements.canvas.querySelectorAll('md-dummy-tab'); return elements; }
[ "function", "getElements", "(", ")", "{", "var", "elements", "=", "{", "}", ";", "var", "node", "=", "$element", "[", "0", "]", ";", "// gather tab bar elements", "elements", ".", "wrapper", "=", "node", ".", "querySelector", "(", "'md-tabs-wrapper'", ")", ...
Getter methods Gathers references to all of the DOM elements used by this controller. @returns {Object}
[ "Getter", "methods", "Gathers", "references", "to", "all", "of", "the", "DOM", "elements", "used", "by", "this", "controller", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L489-L506
train
Get all elements
[ 30522, 3853, 2131, 12260, 8163, 1006, 1007, 1063, 13075, 3787, 1027, 1063, 1065, 1025, 13075, 13045, 1027, 1002, 5783, 1031, 1014, 1033, 1025, 1013, 1013, 8587, 21628, 3347, 3787, 3787, 1012, 10236, 4842, 1027, 13045, 1012, 23032, 11246, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-traverse/src/path/conversion.js
getSuperBinding
function getSuperBinding(thisEnvFn) { return getBinding(thisEnvFn, "supercall", () => { const argsBinding = thisEnvFn.scope.generateUidIdentifier("args"); return t.arrowFunctionExpression( [t.restElement(argsBinding)], t.callExpression(t.super(), [ t.spreadElement(t.identifier(argsBinding.name)), ]), ); }); }
javascript
function getSuperBinding(thisEnvFn) { return getBinding(thisEnvFn, "supercall", () => { const argsBinding = thisEnvFn.scope.generateUidIdentifier("args"); return t.arrowFunctionExpression( [t.restElement(argsBinding)], t.callExpression(t.super(), [ t.spreadElement(t.identifier(argsBinding.name)), ]), ); }); }
[ "function", "getSuperBinding", "(", "thisEnvFn", ")", "{", "return", "getBinding", "(", "thisEnvFn", ",", "\"supercall\"", ",", "(", ")", "=>", "{", "const", "argsBinding", "=", "thisEnvFn", ".", "scope", ".", "generateUidIdentifier", "(", "\"args\"", ")", ";"...
Create a binding for a function that will call "super()" with arguments passed through.
[ "Create", "a", "binding", "for", "a", "function", "that", "will", "call", "super", "()", "with", "arguments", "passed", "through", "." ]
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-traverse/src/path/conversion.js#L476-L486
train
Get the superbinding of thisEnvFn
[ 30522, 3853, 4152, 6279, 2121, 8428, 4667, 1006, 2023, 2368, 2615, 2546, 2078, 1007, 1063, 2709, 2131, 8428, 4667, 1006, 2023, 2368, 2615, 2546, 2078, 1010, 1000, 3565, 9289, 2140, 1000, 1010, 1006, 1007, 1027, 1028, 1063, 9530, 3367, 120...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jhipster/generator-jhipster
generators/docker-base.js
loadConfigs
function loadConfigs() { this.appConfigs = []; this.gatewayNb = 0; this.monolithicNb = 0; this.microserviceNb = 0; this.uaaNb = 0; // Loading configs this.debug(`Apps folders: ${this.appsFolders}`); this.appsFolders.forEach(appFolder => { const path = this.destinationPath(`${this.directoryPath + appFolder}/.yo-rc.json`); const fileData = this.fs.readJSON(path); if (fileData) { const config = fileData['generator-jhipster']; if (config.applicationType === 'monolith') { this.monolithicNb++; } else if (config.applicationType === 'gateway') { this.gatewayNb++; } else if (config.applicationType === 'microservice') { this.microserviceNb++; } else if (config.applicationType === 'uaa') { this.uaaNb++; } this.portsToBind = this.monolithicNb + this.gatewayNb; config.appFolder = appFolder; this.appConfigs.push(config); } else { this.error(`Application '${appFolder}' is not found in the path '${this.directoryPath}'`); } }); }
javascript
function loadConfigs() { this.appConfigs = []; this.gatewayNb = 0; this.monolithicNb = 0; this.microserviceNb = 0; this.uaaNb = 0; // Loading configs this.debug(`Apps folders: ${this.appsFolders}`); this.appsFolders.forEach(appFolder => { const path = this.destinationPath(`${this.directoryPath + appFolder}/.yo-rc.json`); const fileData = this.fs.readJSON(path); if (fileData) { const config = fileData['generator-jhipster']; if (config.applicationType === 'monolith') { this.monolithicNb++; } else if (config.applicationType === 'gateway') { this.gatewayNb++; } else if (config.applicationType === 'microservice') { this.microserviceNb++; } else if (config.applicationType === 'uaa') { this.uaaNb++; } this.portsToBind = this.monolithicNb + this.gatewayNb; config.appFolder = appFolder; this.appConfigs.push(config); } else { this.error(`Application '${appFolder}' is not found in the path '${this.directoryPath}'`); } }); }
[ "function", "loadConfigs", "(", ")", "{", "this", ".", "appConfigs", "=", "[", "]", ";", "this", ".", "gatewayNb", "=", "0", ";", "this", ".", "monolithicNb", "=", "0", ";", "this", ".", "microserviceNb", "=", "0", ";", "this", ".", "uaaNb", "=", "...
Load config from this.appFolders
[ "Load", "config", "from", "this", ".", "appFolders" ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-base.js#L96-L128
train
Load configs from the. yo - rc. json file
[ 30522, 3853, 7170, 8663, 8873, 5620, 1006, 1007, 1063, 2023, 1012, 10439, 8663, 8873, 5620, 1027, 1031, 1033, 1025, 2023, 1012, 11909, 27698, 1027, 1014, 1025, 2023, 1012, 18847, 28508, 27698, 1027, 1014, 1025, 2023, 1012, 12702, 8043, 7903...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
websockets/ws
lib/extension.js
parse
function parse(header) { const offers = Object.create(null); if (header === undefined || header === '') return offers; let params = Object.create(null); let mustUnescape = false; let isEscaping = false; let inQuotes = false; let extensionName; let paramName; let start = -1; let end = -1; let i = 0; for (; i < header.length; i++) { const code = header.charCodeAt(i); if (extensionName === undefined) { if (end === -1 && tokenChars[code] === 1) { if (start === -1) start = i; } else if (code === 0x20 /* ' ' */ || code === 0x09 /* '\t' */) { if (end === -1 && start !== -1) end = i; } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) { if (start === -1) { throw new SyntaxError(`Unexpected character at index ${i}`); } if (end === -1) end = i; const name = header.slice(start, end); if (code === 0x2c) { push(offers, name, params); params = Object.create(null); } else { extensionName = name; } start = end = -1; } else { throw new SyntaxError(`Unexpected character at index ${i}`); } } else if (paramName === undefined) { if (end === -1 && tokenChars[code] === 1) { if (start === -1) start = i; } else if (code === 0x20 || code === 0x09) { if (end === -1 && start !== -1) end = i; } else if (code === 0x3b || code === 0x2c) { if (start === -1) { throw new SyntaxError(`Unexpected character at index ${i}`); } if (end === -1) end = i; push(params, header.slice(start, end), true); if (code === 0x2c) { push(offers, extensionName, params); params = Object.create(null); extensionName = undefined; } start = end = -1; } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) { paramName = header.slice(start, i); start = end = -1; } else { throw new SyntaxError(`Unexpected character at index ${i}`); } } else { // // The value of a quoted-string after unescaping must conform to the // token ABNF, so only token characters are valid. // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 // if (isEscaping) { if (tokenChars[code] !== 1) { throw new SyntaxError(`Unexpected character at index ${i}`); } if (start === -1) start = i; else if (!mustUnescape) mustUnescape = true; isEscaping = false; } else if (inQuotes) { if (tokenChars[code] === 1) { if (start === -1) start = i; } else if (code === 0x22 /* '"' */ && start !== -1) { inQuotes = false; end = i; } else if (code === 0x5c /* '\' */) { isEscaping = true; } else { throw new SyntaxError(`Unexpected character at index ${i}`); } } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { inQuotes = true; } else if (end === -1 && tokenChars[code] === 1) { if (start === -1) start = i; } else if (start !== -1 && (code === 0x20 || code === 0x09)) { if (end === -1) end = i; } else if (code === 0x3b || code === 0x2c) { if (start === -1) { throw new SyntaxError(`Unexpected character at index ${i}`); } if (end === -1) end = i; let value = header.slice(start, end); if (mustUnescape) { value = value.replace(/\\/g, ''); mustUnescape = false; } push(params, paramName, value); if (code === 0x2c) { push(offers, extensionName, params); params = Object.create(null); extensionName = undefined; } paramName = undefined; start = end = -1; } else { throw new SyntaxError(`Unexpected character at index ${i}`); } } } if (start === -1 || inQuotes) { throw new SyntaxError('Unexpected end of input'); } if (end === -1) end = i; const token = header.slice(start, end); if (extensionName === undefined) { push(offers, token, params); } else { if (paramName === undefined) { push(params, token, true); } else if (mustUnescape) { push(params, paramName, token.replace(/\\/g, '')); } else { push(params, paramName, token); } push(offers, extensionName, params); } return offers; }
javascript
function parse(header) { const offers = Object.create(null); if (header === undefined || header === '') return offers; let params = Object.create(null); let mustUnescape = false; let isEscaping = false; let inQuotes = false; let extensionName; let paramName; let start = -1; let end = -1; let i = 0; for (; i < header.length; i++) { const code = header.charCodeAt(i); if (extensionName === undefined) { if (end === -1 && tokenChars[code] === 1) { if (start === -1) start = i; } else if (code === 0x20 /* ' ' */ || code === 0x09 /* '\t' */) { if (end === -1 && start !== -1) end = i; } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) { if (start === -1) { throw new SyntaxError(`Unexpected character at index ${i}`); } if (end === -1) end = i; const name = header.slice(start, end); if (code === 0x2c) { push(offers, name, params); params = Object.create(null); } else { extensionName = name; } start = end = -1; } else { throw new SyntaxError(`Unexpected character at index ${i}`); } } else if (paramName === undefined) { if (end === -1 && tokenChars[code] === 1) { if (start === -1) start = i; } else if (code === 0x20 || code === 0x09) { if (end === -1 && start !== -1) end = i; } else if (code === 0x3b || code === 0x2c) { if (start === -1) { throw new SyntaxError(`Unexpected character at index ${i}`); } if (end === -1) end = i; push(params, header.slice(start, end), true); if (code === 0x2c) { push(offers, extensionName, params); params = Object.create(null); extensionName = undefined; } start = end = -1; } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) { paramName = header.slice(start, i); start = end = -1; } else { throw new SyntaxError(`Unexpected character at index ${i}`); } } else { // // The value of a quoted-string after unescaping must conform to the // token ABNF, so only token characters are valid. // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 // if (isEscaping) { if (tokenChars[code] !== 1) { throw new SyntaxError(`Unexpected character at index ${i}`); } if (start === -1) start = i; else if (!mustUnescape) mustUnescape = true; isEscaping = false; } else if (inQuotes) { if (tokenChars[code] === 1) { if (start === -1) start = i; } else if (code === 0x22 /* '"' */ && start !== -1) { inQuotes = false; end = i; } else if (code === 0x5c /* '\' */) { isEscaping = true; } else { throw new SyntaxError(`Unexpected character at index ${i}`); } } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { inQuotes = true; } else if (end === -1 && tokenChars[code] === 1) { if (start === -1) start = i; } else if (start !== -1 && (code === 0x20 || code === 0x09)) { if (end === -1) end = i; } else if (code === 0x3b || code === 0x2c) { if (start === -1) { throw new SyntaxError(`Unexpected character at index ${i}`); } if (end === -1) end = i; let value = header.slice(start, end); if (mustUnescape) { value = value.replace(/\\/g, ''); mustUnescape = false; } push(params, paramName, value); if (code === 0x2c) { push(offers, extensionName, params); params = Object.create(null); extensionName = undefined; } paramName = undefined; start = end = -1; } else { throw new SyntaxError(`Unexpected character at index ${i}`); } } } if (start === -1 || inQuotes) { throw new SyntaxError('Unexpected end of input'); } if (end === -1) end = i; const token = header.slice(start, end); if (extensionName === undefined) { push(offers, token, params); } else { if (paramName === undefined) { push(params, token, true); } else if (mustUnescape) { push(params, paramName, token.replace(/\\/g, '')); } else { push(params, paramName, token); } push(offers, extensionName, params); } return offers; }
[ "function", "parse", "(", "header", ")", "{", "const", "offers", "=", "Object", ".", "create", "(", "null", ")", ";", "if", "(", "header", "===", "undefined", "||", "header", "===", "''", ")", "return", "offers", ";", "let", "params", "=", "Object", ...
Parses the `Sec-WebSocket-Extensions` header into an object. @param {String} header The field value of the header @return {Object} The parsed object @public
[ "Parses", "the", "Sec", "-", "WebSocket", "-", "Extensions", "header", "into", "an", "object", "." ]
995c527c87d0d4833d8093c18dcfa2e4a41d9582
https://github.com/websockets/ws/blob/995c527c87d0d4833d8093c18dcfa2e4a41d9582/lib/extension.js#L48-L190
train
Parse the given header
[ 30522, 3853, 11968, 3366, 1006, 20346, 1007, 1063, 9530, 3367, 4107, 1027, 4874, 1012, 30524, 1064, 20346, 1027, 1027, 1027, 1005, 1005, 1007, 2709, 4107, 1025, 2292, 11498, 5244, 1027, 4874, 1012, 3443, 1006, 19701, 1007, 1025, 2292, 2442,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
parcel-bundler/parcel
packages/core/parcel-bundler/src/utils/isAccessedVarChanged.js
isAccessedVarChanged
function isAccessedVarChanged(cacheData) { for (let key in cacheData.env) { if (cacheData.env[key] !== process.env[key]) { return true; } } return false; }
javascript
function isAccessedVarChanged(cacheData) { for (let key in cacheData.env) { if (cacheData.env[key] !== process.env[key]) { return true; } } return false; }
[ "function", "isAccessedVarChanged", "(", "cacheData", ")", "{", "for", "(", "let", "key", "in", "cacheData", ".", "env", ")", "{", "if", "(", "cacheData", ".", "env", "[", "key", "]", "!==", "process", ".", "env", "[", "key", "]", ")", "{", "return",...
/* Checks if any of the used variable from process.env is changed
[ "/", "*", "Checks", "if", "any", "of", "the", "used", "variable", "from", "process", ".", "env", "is", "changed" ]
84b308511f87d4b69da62bcd352f0ff2f7bd4f1b
https://github.com/parcel-bundler/parcel/blob/84b308511f87d4b69da62bcd352f0ff2f7bd4f1b/packages/core/parcel-bundler/src/utils/isAccessedVarChanged.js#L4-L12
train
Check if the environment variable is changed
[ 30522, 3853, 18061, 9468, 23656, 10755, 22305, 2098, 1006, 17053, 2850, 2696, 1007, 1063, 2005, 1006, 2292, 3145, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/tracing_examples/string_convert.js
uint6ToB64
function uint6ToB64 (nUint6) { return nUint6 < 26 ? nUint6 + 65 : nUint6 < 52 ? nUint6 + 71 : nUint6 < 62 ? nUint6 - 4 : nUint6 === 62 ? 43 : nUint6 === 63 ? 47 : 65; }
javascript
function uint6ToB64 (nUint6) { return nUint6 < 26 ? nUint6 + 65 : nUint6 < 52 ? nUint6 + 71 : nUint6 < 62 ? nUint6 - 4 : nUint6 === 62 ? 43 : nUint6 === 63 ? 47 : 65; }
[ "function", "uint6ToB64", "(", "nUint6", ")", "{", "return", "nUint6", "<", "26", "?", "nUint6", "+", "65", ":", "nUint6", "<", "52", "?", "nUint6", "+", "71", ":", "nUint6", "<", "62", "?", "nUint6", "-", "4", ":", "nUint6", "===", "62", "?", "4...
/* Base64 string to array encoding
[ "/", "*", "Base64", "string", "to", "array", "encoding" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/tracing_examples/string_convert.js#L53-L68
train
Convert a uint6 to a 64 - bit integer
[ 30522, 3853, 21318, 3372, 2575, 3406, 2497, 21084, 1006, 16371, 18447, 2575, 1007, 1063, 2709, 16371, 18447, 2575, 1026, 2656, 1029, 16371, 18447, 2575, 1009, 3515, 1024, 16371, 18447, 2575, 1026, 4720, 1029, 16371, 18447, 2575, 1009, 6390, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/utils.js
jsonStringify
function jsonStringify(object, spaces, depth) { if (typeof spaces === 'undefined') { // primitive types return _stringify(object); } depth = depth || 1; var space = spaces * depth; var str = Array.isArray(object) ? '[' : '{'; var end = Array.isArray(object) ? ']' : '}'; var length = typeof object.length === 'number' ? object.length : Object.keys(object).length; // `.repeat()` polyfill function repeat(s, n) { return new Array(n).join(s); } function _stringify(val) { switch (type(val)) { case 'null': case 'undefined': val = '[' + val + ']'; break; case 'array': case 'object': val = jsonStringify(val, spaces, depth + 1); break; case 'boolean': case 'regexp': case 'symbol': case 'number': val = val === 0 && 1 / val === -Infinity // `-0` ? '-0' : val.toString(); break; case 'date': var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString(); val = '[Date: ' + sDate + ']'; break; case 'buffer': var json = val.toJSON(); // Based on the toJSON result json = json.data && json.type ? json.data : json; val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']'; break; default: val = val === '[Function]' || val === '[Circular]' ? val : JSON.stringify(val); // string } return val; } for (var i in object) { if (!Object.prototype.hasOwnProperty.call(object, i)) { continue; // not my business } --length; str += '\n ' + repeat(' ', space) + (Array.isArray(object) ? '' : '"' + i + '": ') + // key _stringify(object[i]) + // value (length ? ',' : ''); // comma } return ( str + // [], {} (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end) ); }
javascript
function jsonStringify(object, spaces, depth) { if (typeof spaces === 'undefined') { // primitive types return _stringify(object); } depth = depth || 1; var space = spaces * depth; var str = Array.isArray(object) ? '[' : '{'; var end = Array.isArray(object) ? ']' : '}'; var length = typeof object.length === 'number' ? object.length : Object.keys(object).length; // `.repeat()` polyfill function repeat(s, n) { return new Array(n).join(s); } function _stringify(val) { switch (type(val)) { case 'null': case 'undefined': val = '[' + val + ']'; break; case 'array': case 'object': val = jsonStringify(val, spaces, depth + 1); break; case 'boolean': case 'regexp': case 'symbol': case 'number': val = val === 0 && 1 / val === -Infinity // `-0` ? '-0' : val.toString(); break; case 'date': var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString(); val = '[Date: ' + sDate + ']'; break; case 'buffer': var json = val.toJSON(); // Based on the toJSON result json = json.data && json.type ? json.data : json; val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']'; break; default: val = val === '[Function]' || val === '[Circular]' ? val : JSON.stringify(val); // string } return val; } for (var i in object) { if (!Object.prototype.hasOwnProperty.call(object, i)) { continue; // not my business } --length; str += '\n ' + repeat(' ', space) + (Array.isArray(object) ? '' : '"' + i + '": ') + // key _stringify(object[i]) + // value (length ? ',' : ''); // comma } return ( str + // [], {} (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end) ); }
[ "function", "jsonStringify", "(", "object", ",", "spaces", ",", "depth", ")", "{", "if", "(", "typeof", "spaces", "===", "'undefined'", ")", "{", "// primitive types", "return", "_stringify", "(", "object", ")", ";", "}", "depth", "=", "depth", "||", "1", ...
like JSON.stringify but more sense. @private @param {Object} object @param {number=} spaces @param {number=} depth @returns {*}
[ "like", "JSON", ".", "stringify", "but", "more", "sense", "." ]
9b00fedb610241e33f7592c40164e42a38a793cf
https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/utils.js#L357-L432
train
Stringify an object
[ 30522, 3853, 1046, 23345, 18886, 3070, 8757, 1006, 4874, 1010, 7258, 1010, 5995, 1007, 1063, 2065, 1006, 2828, 11253, 7258, 1027, 1027, 1027, 1005, 6151, 28344, 1005, 1007, 1063, 1013, 1013, 10968, 4127, 2709, 1035, 5164, 8757, 1006, 4874, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/credentials/web_identity_credentials.js
WebIdentityCredentials
function WebIdentityCredentials(params, clientConfig) { AWS.Credentials.call(this); this.expired = true; this.params = params; this.params.RoleSessionName = this.params.RoleSessionName || 'web-identity'; this.data = null; this._clientConfig = AWS.util.copy(clientConfig || {}); }
javascript
function WebIdentityCredentials(params, clientConfig) { AWS.Credentials.call(this); this.expired = true; this.params = params; this.params.RoleSessionName = this.params.RoleSessionName || 'web-identity'; this.data = null; this._clientConfig = AWS.util.copy(clientConfig || {}); }
[ "function", "WebIdentityCredentials", "(", "params", ",", "clientConfig", ")", "{", "AWS", ".", "Credentials", ".", "call", "(", "this", ")", ";", "this", ".", "expired", "=", "true", ";", "this", ".", "params", "=", "params", ";", "this", ".", "params",...
Creates a new credentials object. @param (see AWS.STS.assumeRoleWithWebIdentity) @example Creating a new credentials object AWS.config.credentials = new AWS.WebIdentityCredentials({ RoleArn: 'arn:aws:iam::1234567890:role/WebIdentity', WebIdentityToken: 'ABCDEFGHIJKLMNOP', // token from identity service RoleSessionName: 'web' // optional name, defaults to web-identity }, { // optionally provide configuration to apply to the underlying AWS.STS service client // if configuration is not provided, then configuration will be pulled from AWS.config // specify timeout options httpOptions: { timeout: 100 } }); @see AWS.STS.assumeRoleWithWebIdentity @see AWS.Config
[ "Creates", "a", "new", "credentials", "object", ".", "@param", "(", "see", "AWS", ".", "STS", ".", "assumeRoleWithWebIdentity", ")", "@example", "Creating", "a", "new", "credentials", "object", "AWS", ".", "config", ".", "credentials", "=", "new", "AWS", "."...
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/credentials/web_identity_credentials.js#L64-L71
train
A WebIdentityCredentials is a wrapper around AWS. Credentials.
[ 30522, 3853, 4773, 30524, 1012, 11498, 5244, 1027, 11498, 5244, 1025, 2023, 1012, 11498, 5244, 1012, 4395, 7971, 3258, 18442, 1027, 2023, 1012, 11498, 5244, 1012, 4395, 7971, 3258, 18442, 1064, 1064, 1005, 4773, 1011, 4767, 1005, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/LocaleData.js
getCLDRCalendarName
function getCLDRCalendarName(sCalendarType) { if (!sCalendarType) { sCalendarType = sap.ui.getCore().getConfiguration().getCalendarType(); } return "ca-" + sCalendarType.toLowerCase(); }
javascript
function getCLDRCalendarName(sCalendarType) { if (!sCalendarType) { sCalendarType = sap.ui.getCore().getConfiguration().getCalendarType(); } return "ca-" + sCalendarType.toLowerCase(); }
[ "function", "getCLDRCalendarName", "(", "sCalendarType", ")", "{", "if", "(", "!", "sCalendarType", ")", "{", "sCalendarType", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getCalendarType", "(", ")", ";", "}", ...
Returns the corresponding calendar name in CLDR of the given calendar type, or the calendar type from the configuration, in case sCalendarType is undefined. @param {sap.ui.core.CalendarType} sCalendarType the type defined in {@link sap.ui.core.CalendarType}. @private
[ "Returns", "the", "corresponding", "calendar", "name", "in", "CLDR", "of", "the", "given", "calendar", "type", "or", "the", "calendar", "type", "from", "the", "configuration", "in", "case", "sCalendarType", "is", "undefined", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L3190-L3195
train
Returns the name of the calendar
[ 30522, 3853, 2131, 20464, 13626, 9289, 10497, 2906, 18442, 1006, 4094, 8943, 5339, 18863, 1007, 1063, 2065, 1006, 999, 4094, 8943, 5339, 18863, 1007, 1063, 4094, 8943, 5339, 18863, 1027, 20066, 1012, 21318, 1012, 2131, 17345, 1006, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { var oRowActionTemplate = oTable ? oTable.getRowActionTemplate() : null; return oRowActionTemplate != null && (oRowActionTemplate.isBound("visible") || oRowActionTemplate.getVisible()) && TableUtils.getRowActionCount(oTable) > 0; }
javascript
function(oTable) { var oRowActionTemplate = oTable ? oTable.getRowActionTemplate() : null; return oRowActionTemplate != null && (oRowActionTemplate.isBound("visible") || oRowActionTemplate.getVisible()) && TableUtils.getRowActionCount(oTable) > 0; }
[ "function", "(", "oTable", ")", "{", "var", "oRowActionTemplate", "=", "oTable", "?", "oTable", ".", "getRowActionTemplate", "(", ")", ":", "null", ";", "return", "oRowActionTemplate", "!=", "null", "&&", "(", "oRowActionTemplate", ".", "isBound", "(", "\"visi...
Returns whether the table has a row action column. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the table has row actions.
[ "Returns", "whether", "the", "table", "has", "a", "row", "action", "column", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L291-L297
train
Returns true if the table has row actions
[ 30522, 3853, 1006, 27178, 3085, 1007, 1063, 13075, 20298, 4213, 7542, 18532, 15725, 1027, 27178, 3085, 1029, 27178, 3085, 1012, 2131, 10524, 18908, 3258, 18532, 15725, 1006, 1007, 1024, 19701, 1025, 2709, 20298, 4213, 7542, 18532, 15725, 999,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jhipster/generator-jhipster
generators/aws-containers/prompts.js
askPerformances
function askPerformances() { if (this.abort) return null; const done = this.async(); const chainPromises = index => { if (index === this.appConfigs.length) { done(); return null; } const config = this.appConfigs[index]; const awsConfig = this.aws.apps.find(a => a.baseName === config.baseName) || { baseName: config.baseName }; return promptPerformance.call(this, config, awsConfig).then(performance => { awsConfig.performance = performance; awsConfig.fargate = { ...awsConfig.fargate, ...PERF_TO_CONFIG[performance].fargate }; awsConfig.database = { ...awsConfig.database, ...PERF_TO_CONFIG[performance].database }; _.remove(this.aws.apps, a => _.isEqual(a, awsConfig)); this.aws.apps.push(awsConfig); return chainPromises(index + 1); }); }; return chainPromises(0); }
javascript
function askPerformances() { if (this.abort) return null; const done = this.async(); const chainPromises = index => { if (index === this.appConfigs.length) { done(); return null; } const config = this.appConfigs[index]; const awsConfig = this.aws.apps.find(a => a.baseName === config.baseName) || { baseName: config.baseName }; return promptPerformance.call(this, config, awsConfig).then(performance => { awsConfig.performance = performance; awsConfig.fargate = { ...awsConfig.fargate, ...PERF_TO_CONFIG[performance].fargate }; awsConfig.database = { ...awsConfig.database, ...PERF_TO_CONFIG[performance].database }; _.remove(this.aws.apps, a => _.isEqual(a, awsConfig)); this.aws.apps.push(awsConfig); return chainPromises(index + 1); }); }; return chainPromises(0); }
[ "function", "askPerformances", "(", ")", "{", "if", "(", "this", ".", "abort", ")", "return", "null", ";", "const", "done", "=", "this", ".", "async", "(", ")", ";", "const", "chainPromises", "=", "index", "=>", "{", "if", "(", "index", "===", "this"...
As user to select AWS performance.
[ "As", "user", "to", "select", "AWS", "performance", "." ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/prompts.js#L220-L243
train
Ask Performances
[ 30522, 3853, 3198, 4842, 14192, 26755, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 11113, 11589, 1007, 2709, 19701, 1025, 9530, 3367, 2589, 1027, 2023, 1012, 2004, 6038, 2278, 1006, 1007, 1025, 9530, 3367, 4677, 21572, 28732, 2015, 1027, 5950...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/qunit.js
extractStacktrace
function extractStacktrace( e, offset ) { offset = offset === undefined ? 4 : offset; var stack, include, i; if ( e.stack ) { stack = e.stack.split( "\n" ); if ( /^error$/i.test( stack[ 0 ] ) ) { stack.shift(); } if ( fileName ) { include = []; for ( i = offset; i < stack.length; i++ ) { if ( stack[ i ].indexOf( fileName ) !== -1 ) { break; } include.push( stack[ i ] ); } if ( include.length ) { return include.join( "\n" ); } } return stack[ offset ]; // Support: Safari <=6 only } else if ( e.sourceURL ) { // exclude useless self-reference for generated Error objects if ( /qunit.js$/.test( e.sourceURL ) ) { return; } // for actual exceptions, this is useful return e.sourceURL + ":" + e.line; } }
javascript
function extractStacktrace( e, offset ) { offset = offset === undefined ? 4 : offset; var stack, include, i; if ( e.stack ) { stack = e.stack.split( "\n" ); if ( /^error$/i.test( stack[ 0 ] ) ) { stack.shift(); } if ( fileName ) { include = []; for ( i = offset; i < stack.length; i++ ) { if ( stack[ i ].indexOf( fileName ) !== -1 ) { break; } include.push( stack[ i ] ); } if ( include.length ) { return include.join( "\n" ); } } return stack[ offset ]; // Support: Safari <=6 only } else if ( e.sourceURL ) { // exclude useless self-reference for generated Error objects if ( /qunit.js$/.test( e.sourceURL ) ) { return; } // for actual exceptions, this is useful return e.sourceURL + ":" + e.line; } }
[ "function", "extractStacktrace", "(", "e", ",", "offset", ")", "{", "offset", "=", "offset", "===", "undefined", "?", "4", ":", "offset", ";", "var", "stack", ",", "include", ",", "i", ";", "if", "(", "e", ".", "stack", ")", "{", "stack", "=", "e",...
Doesn't support IE6 to IE9, it will return undefined on these browsers See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
[ "Doesn", "t", "support", "IE6", "to", "IE9", "it", "will", "return", "undefined", "on", "these", "browsers", "See", "also", "https", ":", "//", "developer", ".", "mozilla", ".", "org", "/", "en", "/", "JavaScript", "/", "Reference", "/", "Global_Objects", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L512-L547
train
Extract the stacktrace from an Error object
[ 30522, 3853, 27059, 2696, 3600, 6494, 3401, 1006, 1041, 1010, 16396, 1007, 1063, 16396, 1027, 16396, 1027, 1027, 1027, 6151, 28344, 1029, 1018, 1024, 16396, 1025, 13075, 9991, 1010, 2421, 1010, 1045, 1025, 2065, 1006, 1041, 1012, 9991, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/space-unary-ops.js
verifyNonWordsDontHaveSpaces
function verifyNonWordsDontHaveSpaces(node, firstToken, secondToken) { if (node.prefix) { if (secondToken.range[0] > firstToken.range[1]) { context.report({ node, messageId: "unexpectedAfter", data: { operator: firstToken.value }, fix(fixer) { if (astUtils.canTokensBeAdjacent(firstToken, secondToken)) { return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); } return null; } }); } } else { if (secondToken.range[0] > firstToken.range[1]) { context.report({ node, messageId: "unexpectedBefore", data: { operator: secondToken.value }, fix(fixer) { return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); } }); } } }
javascript
function verifyNonWordsDontHaveSpaces(node, firstToken, secondToken) { if (node.prefix) { if (secondToken.range[0] > firstToken.range[1]) { context.report({ node, messageId: "unexpectedAfter", data: { operator: firstToken.value }, fix(fixer) { if (astUtils.canTokensBeAdjacent(firstToken, secondToken)) { return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); } return null; } }); } } else { if (secondToken.range[0] > firstToken.range[1]) { context.report({ node, messageId: "unexpectedBefore", data: { operator: secondToken.value }, fix(fixer) { return fixer.removeRange([firstToken.range[1], secondToken.range[0]]); } }); } } }
[ "function", "verifyNonWordsDontHaveSpaces", "(", "node", ",", "firstToken", ",", "secondToken", ")", "{", "if", "(", "node", ".", "prefix", ")", "{", "if", "(", "secondToken", ".", "range", "[", "0", "]", ">", "firstToken", ".", "range", "[", "1", "]", ...
Verifies UnaryExpression, UpdateExpression and NewExpression don't have spaces before or after the operator @param {ASTnode} node AST node @param {Object} firstToken First token in the expression @param {Object} secondToken Second token in the expression @returns {void}
[ "Verifies", "UnaryExpression", "UpdateExpression", "and", "NewExpression", "don", "t", "have", "spaces", "before", "or", "after", "the", "operator" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-unary-ops.js#L243-L274
train
Verify that the firstToken and secondToken are not spaces
[ 30522, 3853, 20410, 8540, 22104, 5280, 8322, 6961, 15327, 2015, 1006, 13045, 1010, 2034, 18715, 2368, 1010, 2117, 18715, 2368, 1007, 1063, 2065, 1006, 13045, 1012, 17576, 1007, 1063, 2065, 1006, 2117, 18715, 2368, 1012, 2846, 1031, 1014, 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...
apache/incubator-echarts
src/coord/Axis.js
function (data, clamp) { var extent = this._extent; var scale = this.scale; data = scale.normalize(data); if (this.onBand && scale.type === 'ordinal') { extent = extent.slice(); fixExtentWithBands(extent, scale.count()); } return linearMap(data, NORMALIZED_EXTENT, extent, clamp); }
javascript
function (data, clamp) { var extent = this._extent; var scale = this.scale; data = scale.normalize(data); if (this.onBand && scale.type === 'ordinal') { extent = extent.slice(); fixExtentWithBands(extent, scale.count()); } return linearMap(data, NORMALIZED_EXTENT, extent, clamp); }
[ "function", "(", "data", ",", "clamp", ")", "{", "var", "extent", "=", "this", ".", "_extent", ";", "var", "scale", "=", "this", ".", "scale", ";", "data", "=", "scale", ".", "normalize", "(", "data", ")", ";", "if", "(", "this", ".", "onBand", "...
Convert data to coord. Data is the rank if it has an ordinal scale @param {number} data @param {boolean} clamp @return {number}
[ "Convert", "data", "to", "coord", ".", "Data", "is", "the", "rank", "if", "it", "has", "an", "ordinal", "scale" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/Axis.js#L128-L139
train
Normalize the data
[ 30522, 3853, 1006, 2951, 1010, 18856, 16613, 1007, 1063, 13075, 6698, 1027, 2023, 1012, 1035, 6698, 1025, 13075, 4094, 1027, 2023, 1012, 4094, 1025, 2951, 1027, 4094, 1012, 3671, 4697, 1006, 2951, 1007, 1025, 2065, 1006, 2023, 1012, 2006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/vars-on-top.js
blockScopeVarCheck
function blockScopeVarCheck(node, parent, grandParent) { if (!(/Function/u.test(grandParent.type) && parent.type === "BlockStatement" && isVarOnTop(node, parent.body))) { context.report({ node, messageId: "top" }); } }
javascript
function blockScopeVarCheck(node, parent, grandParent) { if (!(/Function/u.test(grandParent.type) && parent.type === "BlockStatement" && isVarOnTop(node, parent.body))) { context.report({ node, messageId: "top" }); } }
[ "function", "blockScopeVarCheck", "(", "node", ",", "parent", ",", "grandParent", ")", "{", "if", "(", "!", "(", "/", "Function", "/", "u", ".", "test", "(", "grandParent", ".", "type", ")", "&&", "parent", ".", "type", "===", "\"BlockStatement\"", "&&",...
Checks whether variable is on top at functional block scope level @param {ASTNode} node - The node to check @param {ASTNode} parent - Parent of the node @param {ASTNode} grandParent - Parent of the node's parent @returns {void}
[ "Checks", "whether", "variable", "is", "on", "top", "at", "functional", "block", "scope", "level" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/vars-on-top.js#L119-L125
train
Check if variable is on top of block
[ 30522, 3853, 5991, 16186, 10755, 5403, 3600, 1006, 13045, 1010, 6687, 1010, 15310, 22787, 1007, 1063, 2065, 1006, 999, 1006, 1013, 3853, 1013, 1057, 1012, 3231, 1006, 15310, 22787, 1012, 2828, 1007, 1004, 1004, 6687, 1012, 2828, 1027, 1027,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/keyword-spacing.js
expectSpaceAfter
function expectSpaceAfter(token, pattern) { const nextToken = sourceCode.getTokenAfter(token); if (nextToken && (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && !isCloseParenOfTemplate(nextToken) && astUtils.isTokenOnSameLine(token, nextToken) && !sourceCode.isSpaceBetweenTokens(token, nextToken) ) { context.report({ loc: token.loc.start, messageId: "expectedAfter", data: token, fix(fixer) { return fixer.insertTextAfter(token, " "); } }); } }
javascript
function expectSpaceAfter(token, pattern) { const nextToken = sourceCode.getTokenAfter(token); if (nextToken && (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && !isCloseParenOfTemplate(nextToken) && astUtils.isTokenOnSameLine(token, nextToken) && !sourceCode.isSpaceBetweenTokens(token, nextToken) ) { context.report({ loc: token.loc.start, messageId: "expectedAfter", data: token, fix(fixer) { return fixer.insertTextAfter(token, " "); } }); } }
[ "function", "expectSpaceAfter", "(", "token", ",", "pattern", ")", "{", "const", "nextToken", "=", "sourceCode", ".", "getTokenAfter", "(", "token", ")", ";", "if", "(", "nextToken", "&&", "(", "CHECK_TYPE", ".", "test", "(", "nextToken", ".", "type", ")",...
Reports a given token if there are not space(s) after the token. @param {Token} token - A token to report. @param {RegExp} pattern - A pattern of the next token to check. @returns {void}
[ "Reports", "a", "given", "token", "if", "there", "are", "not", "space", "(", "s", ")", "after", "the", "token", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/keyword-spacing.js#L176-L194
train
Check if a space is after a token
[ 30522, 3853, 24273, 15327, 10354, 3334, 1006, 19204, 1010, 5418, 1007, 1063, 9530, 3367, 2279, 18715, 2368, 1027, 3120, 16044, 1012, 2131, 18715, 8189, 6199, 2121, 1006, 19204, 1007, 1025, 2065, 1006, 2279, 18715, 2368, 1004, 1004, 1006, 46...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/RecentProjects/main.js
parsePath
function parsePath(path) { var lastSlash = path.lastIndexOf("/"), folder, rest; if (lastSlash === path.length - 1) { lastSlash = path.slice(0, path.length - 1).lastIndexOf("/"); } if (lastSlash >= 0) { rest = " - " + (lastSlash ? path.slice(0, lastSlash) : "/"); folder = path.slice(lastSlash + 1); } else { rest = "/"; folder = path; } return {path: path, folder: folder, rest: rest}; }
javascript
function parsePath(path) { var lastSlash = path.lastIndexOf("/"), folder, rest; if (lastSlash === path.length - 1) { lastSlash = path.slice(0, path.length - 1).lastIndexOf("/"); } if (lastSlash >= 0) { rest = " - " + (lastSlash ? path.slice(0, lastSlash) : "/"); folder = path.slice(lastSlash + 1); } else { rest = "/"; folder = path; } return {path: path, folder: folder, rest: rest}; }
[ "function", "parsePath", "(", "path", ")", "{", "var", "lastSlash", "=", "path", ".", "lastIndexOf", "(", "\"/\"", ")", ",", "folder", ",", "rest", ";", "if", "(", "lastSlash", "===", "path", ".", "length", "-", "1", ")", "{", "lastSlash", "=", "path...
Parses the path and returns an object with the full path, the folder name and the path without the folder. @param {string} path The full path to the folder. @return {{path: string, folder: string, rest: string}}
[ "Parses", "the", "path", "and", "returns", "an", "object", "with", "the", "full", "path", "the", "folder", "name", "and", "the", "path", "without", "the", "folder", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/RecentProjects/main.js#L334-L348
train
parsePath - parse path
[ 30522, 3853, 11968, 3366, 15069, 1006, 4130, 1007, 1063, 13075, 16180, 27067, 1027, 4130, 1012, 2197, 22254, 10288, 11253, 1006, 30524, 1000, 1007, 1025, 1065, 2065, 1006, 16180, 27067, 1028, 1027, 1014, 1007, 1063, 2717, 1027, 1000, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
NetEase/pomelo
lib/server/server.js
function(isGlobal, server, err, msg, session, resp, opts, cb) { if(isGlobal) { cb(err, resp, opts); // after filter should not interfere response afterFilter(isGlobal, server, err, msg, session, resp, opts, cb); } else { afterFilter(isGlobal, server, err, msg, session, resp, opts, cb); } }
javascript
function(isGlobal, server, err, msg, session, resp, opts, cb) { if(isGlobal) { cb(err, resp, opts); // after filter should not interfere response afterFilter(isGlobal, server, err, msg, session, resp, opts, cb); } else { afterFilter(isGlobal, server, err, msg, session, resp, opts, cb); } }
[ "function", "(", "isGlobal", ",", "server", ",", "err", ",", "msg", ",", "session", ",", "resp", ",", "opts", ",", "cb", ")", "{", "if", "(", "isGlobal", ")", "{", "cb", "(", "err", ",", "resp", ",", "opts", ")", ";", "// after filter should not inte...
Send response to client and fire after filter chain if any.
[ "Send", "response", "to", "client", "and", "fire", "after", "filter", "chain", "if", "any", "." ]
defcf019631ed399cc4dad932d3b028a04a039a4
https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/server/server.js#L297-L305
train
after filter is not interferee response
[ 30522, 3853, 1006, 2003, 23296, 16429, 2389, 1010, 8241, 1010, 9413, 2099, 1010, 5796, 2290, 1010, 5219, 1010, 24501, 2361, 1010, 23569, 2015, 1010, 17324, 1007, 1063, 2065, 1006, 2003, 23296, 16429, 2389, 1007, 1063, 17324, 1006, 9413, 209...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/util/animation/animate.js
function (element) { var bounds = angular.element(element)[0].getBoundingClientRect(); var isPositiveSizeClientRect = function (rect) { return rect && (rect.width > 0) && (rect.height > 0); }; // If the event origin element has zero size, it has probably been hidden. return isPositiveSizeClientRect(bounds) ? self.copyRect(bounds) : null; }
javascript
function (element) { var bounds = angular.element(element)[0].getBoundingClientRect(); var isPositiveSizeClientRect = function (rect) { return rect && (rect.width > 0) && (rect.height > 0); }; // If the event origin element has zero size, it has probably been hidden. return isPositiveSizeClientRect(bounds) ? self.copyRect(bounds) : null; }
[ "function", "(", "element", ")", "{", "var", "bounds", "=", "angular", ".", "element", "(", "element", ")", "[", "0", "]", ".", "getBoundingClientRect", "(", ")", ";", "var", "isPositiveSizeClientRect", "=", "function", "(", "rect", ")", "{", "return", "...
Calculate ClientRect of element; return null if hidden or zero size
[ "Calculate", "ClientRect", "of", "element", ";", "return", "null", "if", "hidden", "or", "zero", "size" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L238-L246
train
Returns the bounding rect of the element
[ 30522, 3853, 1006, 5783, 1007, 1063, 13075, 19202, 1027, 16108, 1012, 5783, 1006, 5783, 1007, 1031, 1014, 1033, 1012, 2131, 15494, 2075, 20464, 11638, 2890, 6593, 1006, 1007, 1025, 13075, 2003, 6873, 28032, 24653, 4697, 20464, 11638, 2890, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/parse/walkSummary.js
walkSummary
function walkSummary(summary, fn) { var parts = summary.getParts(); return Promise.forEach(parts, function(part) { return walkArticles(part.getArticles(), fn); }); }
javascript
function walkSummary(summary, fn) { var parts = summary.getParts(); return Promise.forEach(parts, function(part) { return walkArticles(part.getArticles(), fn); }); }
[ "function", "walkSummary", "(", "summary", ",", "fn", ")", "{", "var", "parts", "=", "summary", ".", "getParts", "(", ")", ";", "return", "Promise", ".", "forEach", "(", "parts", ",", "function", "(", "part", ")", "{", "return", "walkArticles", "(", "p...
Walk over summary and execute "fn" on each article @param {Summary} summary @param {Function(article)} @return {Promise}
[ "Walk", "over", "summary", "and", "execute", "fn", "on", "each", "article" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/parse/walkSummary.js#L26-L32
train
Walk summary and return a promise
[ 30522, 3853, 7365, 2819, 7849, 2100, 1006, 12654, 1010, 1042, 2078, 1007, 1063, 13075, 3033, 1027, 12654, 1012, 2131, 26950, 1006, 1007, 1025, 2709, 4872, 1012, 18921, 6776, 1006, 3033, 1010, 3853, 1006, 2112, 1007, 1063, 2709, 3328, 8445, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/geo/Geo.js
function (coord) { var regions = this.regions; for (var i = 0; i < regions.length; i++) { if (regions[i].contain(coord)) { return true; } } return false; }
javascript
function (coord) { var regions = this.regions; for (var i = 0; i < regions.length; i++) { if (regions[i].contain(coord)) { return true; } } return false; }
[ "function", "(", "coord", ")", "{", "var", "regions", "=", "this", ".", "regions", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "regions", ".", "length", ";", "i", "++", ")", "{", "if", "(", "regions", "[", "i", "]", ".", "contain", ...
If contain given lng,lat coord @param {Array.<number>} @readOnly
[ "If", "contain", "given", "lng", "lat", "coord" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/geo/Geo.js#L82-L90
train
returns true if the region contains the given region
[ 30522, 3853, 1006, 2522, 8551, 1007, 1063, 13075, 4655, 1027, 2023, 1012, 4655, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 4655, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 2065, 1006, 4655, 1031, 1045, 1033, 1012, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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 (jid) { var bare = Strophe.getBareJidFromJid(jid); if (bare.indexOf("@") < 0) { return bare; } else { var parts = bare.split("@"); parts.splice(0, 1); return parts.join('@'); } }
javascript
function (jid) { var bare = Strophe.getBareJidFromJid(jid); if (bare.indexOf("@") < 0) { return bare; } else { var parts = bare.split("@"); parts.splice(0, 1); return parts.join('@'); } }
[ "function", "(", "jid", ")", "{", "var", "bare", "=", "Strophe", ".", "getBareJidFromJid", "(", "jid", ")", ";", "if", "(", "bare", ".", "indexOf", "(", "\"@\"", ")", "<", "0", ")", "{", "return", "bare", ";", "}", "else", "{", "var", "parts", "=...
Function: getDomainFromJid Get the domain portion of a JID String. Parameters: (String) jid - A JID. Returns: A String containing the domain.
[ "Function", ":", "getDomainFromJid", "Get", "the", "domain", "portion", "of", "a", "JID", "String", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L1320-L1330
train
Returns the bare jid of the specified xsd
[ 30522, 3853, 1006, 10147, 2094, 1007, 1063, 13075, 6436, 1027, 2358, 18981, 5369, 1012, 2131, 8237, 20518, 3593, 19699, 5358, 4478, 2094, 1006, 10147, 2094, 1007, 1025, 2065, 1006, 6436, 1012, 5950, 11253, 1006, 1000, 1030, 1000, 1007, 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...
angular/material
src/core/services/gesture/gesture.js
typesMatch
function typesMatch(ev, pointer) { return ev && pointer && ev.type.charAt(0) === pointer.type; }
javascript
function typesMatch(ev, pointer) { return ev && pointer && ev.type.charAt(0) === pointer.type; }
[ "function", "typesMatch", "(", "ev", ",", "pointer", ")", "{", "return", "ev", "&&", "pointer", "&&", "ev", ".", "type", ".", "charAt", "(", "0", ")", "===", "pointer", ".", "type", ";", "}" ]
/* return whether the pointer's type matches the event's type. Eg if a touch event happens but the pointer has a mouse type, return false.
[ "/", "*", "return", "whether", "the", "pointer", "s", "type", "matches", "the", "event", "s", "type", ".", "Eg", "if", "a", "touch", "event", "happens", "but", "the", "pointer", "has", "a", "mouse", "type", "return", "false", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L721-L723
train
Returns true if the event type matches the pointer type
[ 30522, 3853, 4127, 18900, 2818, 1006, 23408, 1010, 20884, 1007, 1063, 2709, 23408, 1004, 1004, 20884, 1004, 1004, 23408, 1012, 2828, 1012, 25869, 4017, 1006, 1014, 1007, 1027, 1027, 1027, 20884, 1012, 2828, 1025, 1065, 102, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
avajs/ava
lib/babel-pipeline.js
wantsStage4
function wantsStage4(userOptions, projectDir) { if (!userOptions) { return false; } if (!userOptions.testOptions.presets) { return true; } const stage4 = require('../stage-4'); return userOptions.testOptions.presets.every(arr => { if (!Array.isArray(arr)) { return true; // There aren't any preset options. } const [ref, options] = arr; // Require the preset given the aliasing `ava/stage-4` does towards // `@ava/babel-preset-stage-4`. const resolved = require(babel.resolvePreset(ref, projectDir)); return resolved !== stage4 || options !== false; }); }
javascript
function wantsStage4(userOptions, projectDir) { if (!userOptions) { return false; } if (!userOptions.testOptions.presets) { return true; } const stage4 = require('../stage-4'); return userOptions.testOptions.presets.every(arr => { if (!Array.isArray(arr)) { return true; // There aren't any preset options. } const [ref, options] = arr; // Require the preset given the aliasing `ava/stage-4` does towards // `@ava/babel-preset-stage-4`. const resolved = require(babel.resolvePreset(ref, projectDir)); return resolved !== stage4 || options !== false; }); }
[ "function", "wantsStage4", "(", "userOptions", ",", "projectDir", ")", "{", "if", "(", "!", "userOptions", ")", "{", "return", "false", ";", "}", "if", "(", "!", "userOptions", ".", "testOptions", ".", "presets", ")", "{", "return", "true", ";", "}", "...
Assume the stage-4 preset is wanted if there are `userOptions`, but there is no declaration of a stage-` preset that comes with `false` for its options. Ideally we'd detect the stage-4 preset anywhere in the configuration hierarchy, but Babel's loadPartialConfig() does not return disabled presets. See <https://github.com/babel/babel/issues/7920>.
[ "Assume", "the", "stage", "-", "4", "preset", "is", "wanted", "if", "there", "are", "userOptions", "but", "there", "is", "no", "declaration", "of", "a", "stage", "-", "preset", "that", "comes", "with", "false", "for", "its", "options", ".", "Ideally", "w...
08e99e516e13af75d3ebe70f12194a89b610217c
https://github.com/avajs/ava/blob/08e99e516e13af75d3ebe70f12194a89b610217c/lib/babel-pipeline.js#L82-L103
train
Checks if the user wants stage - 4
[ 30522, 3853, 4122, 9153, 3351, 2549, 1006, 5310, 7361, 9285, 1010, 2622, 4305, 2099, 1007, 1063, 2065, 1006, 999, 5310, 7361, 9285, 1007, 1063, 2709, 6270, 1025, 1065, 2065, 1006, 999, 5310, 7361, 9285, 1012, 3231, 7361, 9285, 1012, 3653,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/node/FindInFilesDomain.js
getNextPage
function getNextPage() { var send_object = { "results": {}, "numMatches": 0, "foundMaximum": foundMaximum, "exceedsMaximum": exceedsMaximum }; if (!savedSearchObject) { return send_object; } savedSearchObject.startFileIndex = lastSearchedIndex; return doSearch(savedSearchObject, true); }
javascript
function getNextPage() { var send_object = { "results": {}, "numMatches": 0, "foundMaximum": foundMaximum, "exceedsMaximum": exceedsMaximum }; if (!savedSearchObject) { return send_object; } savedSearchObject.startFileIndex = lastSearchedIndex; return doSearch(savedSearchObject, true); }
[ "function", "getNextPage", "(", ")", "{", "var", "send_object", "=", "{", "\"results\"", ":", "{", "}", ",", "\"numMatches\"", ":", "0", ",", "\"foundMaximum\"", ":", "foundMaximum", ",", "\"exceedsMaximum\"", ":", "exceedsMaximum", "}", ";", "if", "(", "!",...
Gets the next page of results of the ongoing search @return {Object} search results
[ "Gets", "the", "next", "page", "of", "results", "of", "the", "ongoing", "search" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/node/FindInFilesDomain.js#L526-L538
train
Get the next page
[ 30522, 3853, 2131, 2638, 18413, 13704, 1006, 1007, 1063, 13075, 4604, 1035, 4874, 1027, 1063, 1000, 3463, 1000, 1024, 1063, 1065, 1010, 1000, 16371, 14760, 10649, 2229, 1000, 1024, 1014, 1010, 1000, 2179, 17848, 28591, 1000, 1024, 2179, 178...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/InlineTimingFunctionEditor/TimingFunctionUtils.js
_validateCubicBezierParams
function _validateCubicBezierParams(match) { var x1 = _convertToNumber(match[1]), y1 = _convertToNumber(match[2]), x2 = _convertToNumber(match[3]), y2 = _convertToNumber(match[4]); // Verify all params are numbers if (!x1.isNumber || !y1.isNumber || !x2.isNumber || !y2.isNumber) { return false; } // Verify x params are in 0-1 range if (x1.value < 0 || x1.value > 1 || x2.value < 0 || x2.value > 1) { return false; } return true; }
javascript
function _validateCubicBezierParams(match) { var x1 = _convertToNumber(match[1]), y1 = _convertToNumber(match[2]), x2 = _convertToNumber(match[3]), y2 = _convertToNumber(match[4]); // Verify all params are numbers if (!x1.isNumber || !y1.isNumber || !x2.isNumber || !y2.isNumber) { return false; } // Verify x params are in 0-1 range if (x1.value < 0 || x1.value > 1 || x2.value < 0 || x2.value > 1) { return false; } return true; }
[ "function", "_validateCubicBezierParams", "(", "match", ")", "{", "var", "x1", "=", "_convertToNumber", "(", "match", "[", "1", "]", ")", ",", "y1", "=", "_convertToNumber", "(", "match", "[", "2", "]", ")", ",", "x2", "=", "_convertToNumber", "(", "matc...
Validate cubic-bezier function parameters that are not already validated by regex: @param {RegExp.match} match RegExp Match object with cubic-bezier function parameters in array positions 1-4. @return {boolean} true if all parameters are valid, otherwise, false
[ "Validate", "cubic", "-", "bezier", "function", "parameters", "that", "are", "not", "already", "validated", "by", "regex", ":" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js#L145-L162
train
Validate cubic bezier params
[ 30522, 3853, 1035, 9398, 3686, 10841, 13592, 4783, 21548, 28689, 5244, 1006, 2674, 1007, 1063, 13075, 1060, 2487, 1027, 1035, 10463, 2669, 29440, 1006, 2674, 1031, 1015, 1033, 1007, 1010, 1061, 2487, 1027, 1035, 10463, 2669, 29440, 1006, 26...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/flow
packages/flow-remove-types/index.js
generateSourceMappings
function generateSourceMappings(removedNodes) { var mappings = ''; if (!removedNodes || removedNodes.length === '') { return mappings; } var end = {line: 1, column: 0}; for (var i = 0; i < removedNodes.length; i++) { var start = removedNodes[i].loc.start; var lineDiff = start.line - end.line; var columnDiff = start.column - end.column; if (lineDiff) { for (var l = 0; l !== lineDiff; l++) { mappings += ';'; } mappings += vlq.encode([start.column, 0, lineDiff, columnDiff]); } else if (columnDiff) { if (i) { mappings += ','; } mappings += vlq.encode([columnDiff, 0, lineDiff, columnDiff]); } end = removedNodes[i].loc.end; mappings += ','; mappings += vlq.encode([ 0, 0, end.line - start.line, end.column - start.column, ]); } return mappings; }
javascript
function generateSourceMappings(removedNodes) { var mappings = ''; if (!removedNodes || removedNodes.length === '') { return mappings; } var end = {line: 1, column: 0}; for (var i = 0; i < removedNodes.length; i++) { var start = removedNodes[i].loc.start; var lineDiff = start.line - end.line; var columnDiff = start.column - end.column; if (lineDiff) { for (var l = 0; l !== lineDiff; l++) { mappings += ';'; } mappings += vlq.encode([start.column, 0, lineDiff, columnDiff]); } else if (columnDiff) { if (i) { mappings += ','; } mappings += vlq.encode([columnDiff, 0, lineDiff, columnDiff]); } end = removedNodes[i].loc.end; mappings += ','; mappings += vlq.encode([ 0, 0, end.line - start.line, end.column - start.column, ]); } return mappings; }
[ "function", "generateSourceMappings", "(", "removedNodes", ")", "{", "var", "mappings", "=", "''", ";", "if", "(", "!", "removedNodes", "||", "removedNodes", ".", "length", "===", "''", ")", "{", "return", "mappings", ";", "}", "var", "end", "=", "{", "l...
Generate a source map when *removing* nodes rather than replacing them with spaces.
[ "Generate", "a", "source", "map", "when", "*", "removing", "*", "nodes", "rather", "than", "replacing", "them", "with", "spaces", "." ]
25bc6aba258658eaf21ccc4722ef7124724a1d2b
https://github.com/facebook/flow/blob/25bc6aba258658eaf21ccc4722ef7124724a1d2b/packages/flow-remove-types/index.js#L538-L573
train
Generate source mappings from removed nodes
[ 30522, 3853, 19421, 8162, 3401, 2863, 14853, 2015, 1006, 3718, 3630, 6155, 1007, 1063, 13075, 12375, 2015, 1027, 1005, 1005, 1025, 2065, 1006, 999, 3718, 3630, 6155, 1064, 1064, 3718, 3630, 6155, 1012, 3091, 1027, 1027, 1027, 1005, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
lib/cldr-openui5/lib/generate.js
Generator
function Generator(sOutputFolder, bPrettyPrint) { if (!(this instanceof Generator)) { return new Generator(sOutputFolder, bPrettyPrint); } this._sOutputFolder = sOutputFolder; this._bPrettyPrint = bPrettyPrint; events.EventEmitter.call(this); }
javascript
function Generator(sOutputFolder, bPrettyPrint) { if (!(this instanceof Generator)) { return new Generator(sOutputFolder, bPrettyPrint); } this._sOutputFolder = sOutputFolder; this._bPrettyPrint = bPrettyPrint; events.EventEmitter.call(this); }
[ "function", "Generator", "(", "sOutputFolder", ",", "bPrettyPrint", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Generator", ")", ")", "{", "return", "new", "Generator", "(", "sOutputFolder", ",", "bPrettyPrint", ")", ";", "}", "this", ".", "_sOut...
Generates the UI5 locale JSON files using the original JSON files.
[ "Generates", "the", "UI5", "locale", "JSON", "files", "using", "the", "original", "JSON", "files", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/cldr-openui5/lib/generate.js#L27-L34
train
Creates a new Generator instance.
[ 30522, 3853, 13103, 1006, 2061, 4904, 18780, 10371, 2121, 1010, 17531, 13465, 3723, 16550, 1007, 1063, 2065, 1006, 999, 1006, 2023, 6013, 11253, 13103, 1007, 1007, 1063, 2709, 2047, 13103, 1006, 2061, 4904, 18780, 10371, 2121, 1010, 17531, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
verdaccio/verdaccio
src/lib/plugin-loader.js
tryLoad
function tryLoad(path: string) { try { return require(path); } catch (err) { if (err.code === MODULE_NOT_FOUND) { return null; } throw err; } }
javascript
function tryLoad(path: string) { try { return require(path); } catch (err) { if (err.code === MODULE_NOT_FOUND) { return null; } throw err; } }
[ "function", "tryLoad", "(", "path", ":", "string", ")", "{", "try", "{", "return", "require", "(", "path", ")", ";", "}", "catch", "(", "err", ")", "{", "if", "(", "err", ".", "code", "===", "MODULE_NOT_FOUND", ")", "{", "return", "null", ";", "}",...
Requires a module. @param {*} path the module's path @return {Object}
[ "Requires", "a", "module", "." ]
daa7e897b6d093bf8282ff12df3f450bcd73476c
https://github.com/verdaccio/verdaccio/blob/daa7e897b6d093bf8282ff12df3f450bcd73476c/src/lib/plugin-loader.js#L17-L26
train
Try to load a node module
[ 30522, 3853, 3046, 11066, 1006, 4130, 1024, 5164, 1007, 1063, 3046, 1063, 2709, 5478, 1006, 4130, 1007, 1025, 1065, 4608, 30524, 2025, 1035, 2179, 1007, 1063, 2709, 19701, 1025, 1065, 5466, 9413, 2099, 1025, 1065, 1065, 102, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/command/DefaultMenus.js
_setMenuItemsVisible
function _setMenuItemsVisible() { var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE); if (file) { file.exists(function (err, isPresent) { if (err) { return err; } _setContextMenuItemsVisible(isPresent, [Commands.FILE_RENAME, Commands.NAVIGATE_SHOW_IN_FILE_TREE, Commands.NAVIGATE_SHOW_IN_OS]); }); } }
javascript
function _setMenuItemsVisible() { var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE); if (file) { file.exists(function (err, isPresent) { if (err) { return err; } _setContextMenuItemsVisible(isPresent, [Commands.FILE_RENAME, Commands.NAVIGATE_SHOW_IN_FILE_TREE, Commands.NAVIGATE_SHOW_IN_OS]); }); } }
[ "function", "_setMenuItemsVisible", "(", ")", "{", "var", "file", "=", "MainViewManager", ".", "getCurrentlyViewedFile", "(", "MainViewManager", ".", "ACTIVE_PANE", ")", ";", "if", "(", "file", ")", "{", "file", ".", "exists", "(", "function", "(", "err", ",...
Checks if file saved and present on system and disables menu items accordingly
[ "Checks", "if", "file", "saved", "and", "present", "on", "system", "and", "disables", "menu", "items", "accordingly" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/DefaultMenus.js#L53-L63
train
Set the menu items visible in the current file tree
[ 30522, 3853, 1035, 2275, 3549, 14663, 6633, 2015, 11365, 7028, 1006, 1007, 1063, 13075, 5371, 1027, 2364, 8584, 24805, 4590, 1012, 2131, 10841, 14343, 20630, 8584, 2098, 8873, 2571, 1006, 2364, 8584, 24805, 4590, 1012, 3161, 1035, 6090, 206...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ion.rangeSlider/js/ion.rangeSlider.js
function (is_update) { this.no_diapason = false; this.coords.p_step = this.convertToPercent(this.options.step, true); this.target = "base"; this.toggleInput(); this.append(); this.setMinMax(); if (is_update) { this.force_redraw = true; this.calc(true); // callbacks called this.callOnUpdate(); } else { this.force_redraw = true; this.calc(true); // callbacks called this.callOnStart(); } this.updateScene(); }
javascript
function (is_update) { this.no_diapason = false; this.coords.p_step = this.convertToPercent(this.options.step, true); this.target = "base"; this.toggleInput(); this.append(); this.setMinMax(); if (is_update) { this.force_redraw = true; this.calc(true); // callbacks called this.callOnUpdate(); } else { this.force_redraw = true; this.calc(true); // callbacks called this.callOnStart(); } this.updateScene(); }
[ "function", "(", "is_update", ")", "{", "this", ".", "no_diapason", "=", "false", ";", "this", ".", "coords", ".", "p_step", "=", "this", ".", "convertToPercent", "(", "this", ".", "options", ".", "step", ",", "true", ")", ";", "this", ".", "target", ...
Starts or updates the plugin instance @param [is_update] {boolean}
[ "Starts", "or", "updates", "the", "plugin", "instance" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L477-L502
train
set parameters
[ 30522, 3853, 1006, 2003, 1035, 10651, 1007, 1063, 2023, 1012, 2053, 1035, 22939, 19707, 2239, 1027, 6270, 1025, 2023, 1012, 2522, 8551, 2015, 1012, 1052, 1035, 3357, 1027, 2023, 1012, 10463, 14399, 2121, 13013, 1006, 2023, 1012, 7047, 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.documentation/src/sap/ui/documentation/sdk/controller/LiveEditor.controller.js
function () { this._oSrcFileContent = {}; this._oViewModel = new JSONModel({ autoPreview: true, selectedFileName: SRC_FILE_NAMES.XML, // initially select the xml file selectedFileType: SRC_FILE_TYPES[SRC_FILE_NAMES.XML], selectedFileContent: "" }); this.getView().setModel(this._oViewModel, "viewModel"); // fetch the initial content of the sample files new JSONModel(sap.ui.require.toUrl('sap/ui/documentation/sdk/model') + '/LiveEditorData.json').attachRequestCompleted(function (oEvent) { var oData = oEvent.getSource().getData(), sCoreUrl = new URI(sap.ui.require.toUrl("sap-ui-core.js"), document.baseURI).href(); if (oData[SRC_FILE_NAMES.HTML]) { oData[SRC_FILE_NAMES.HTML] = oData[SRC_FILE_NAMES.HTML].replace(/&sol;/g, "/").replace("resources/sap-ui-core.js", sCoreUrl); } this._oSrcFileContent = oData; this.showFileInEditor(SRC_FILE_NAMES.XML); // initially show the xml file }.bind(this)); this.getView().byId("resultBox").addEventDelegate({ onAfterRendering: this.requestExecuteCurrentSrc.bind(this) }); // flags for minor performance optimization: // indicators to temporarily suppress the processing of the editor content // (while switching the currently displayed file in the editor) this._bSuppressRemoveOnce = false; this._bSuppressInsertOnce = false; // additional performance optimization: // throttle the output of src changes this._oThrottledTask = null; }
javascript
function () { this._oSrcFileContent = {}; this._oViewModel = new JSONModel({ autoPreview: true, selectedFileName: SRC_FILE_NAMES.XML, // initially select the xml file selectedFileType: SRC_FILE_TYPES[SRC_FILE_NAMES.XML], selectedFileContent: "" }); this.getView().setModel(this._oViewModel, "viewModel"); // fetch the initial content of the sample files new JSONModel(sap.ui.require.toUrl('sap/ui/documentation/sdk/model') + '/LiveEditorData.json').attachRequestCompleted(function (oEvent) { var oData = oEvent.getSource().getData(), sCoreUrl = new URI(sap.ui.require.toUrl("sap-ui-core.js"), document.baseURI).href(); if (oData[SRC_FILE_NAMES.HTML]) { oData[SRC_FILE_NAMES.HTML] = oData[SRC_FILE_NAMES.HTML].replace(/&sol;/g, "/").replace("resources/sap-ui-core.js", sCoreUrl); } this._oSrcFileContent = oData; this.showFileInEditor(SRC_FILE_NAMES.XML); // initially show the xml file }.bind(this)); this.getView().byId("resultBox").addEventDelegate({ onAfterRendering: this.requestExecuteCurrentSrc.bind(this) }); // flags for minor performance optimization: // indicators to temporarily suppress the processing of the editor content // (while switching the currently displayed file in the editor) this._bSuppressRemoveOnce = false; this._bSuppressInsertOnce = false; // additional performance optimization: // throttle the output of src changes this._oThrottledTask = null; }
[ "function", "(", ")", "{", "this", ".", "_oSrcFileContent", "=", "{", "}", ";", "this", ".", "_oViewModel", "=", "new", "JSONModel", "(", "{", "autoPreview", ":", "true", ",", "selectedFileName", ":", "SRC_FILE_NAMES", ".", "XML", ",", "// initially select t...
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/LiveEditor.controller.js#L42-L78
train
Initializes the model of the model
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1035, 9808, 11890, 8873, 2571, 8663, 6528, 2102, 1027, 1063, 1065, 1025, 2023, 1012, 1035, 1051, 8584, 5302, 9247, 1027, 2047, 1046, 3385, 5302, 9247, 1006, 1063, 8285, 28139, 8584, 1024, 2995, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js
convertLocaleToBCP47
function convertLocaleToBCP47(sLocale) { var m; if ( typeof sLocale === 'string' && (m = rLocale.exec(sLocale.replace(/_/g, '-'))) ) { var sLanguage = m[1].toLowerCase(); sLanguage = M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage; return sLanguage + (m[3] ? "-" + m[3].toUpperCase() + (m[4] ? "-" + m[4].slice(1).replace("_","-") : "") : ""); } }
javascript
function convertLocaleToBCP47(sLocale) { var m; if ( typeof sLocale === 'string' && (m = rLocale.exec(sLocale.replace(/_/g, '-'))) ) { var sLanguage = m[1].toLowerCase(); sLanguage = M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage; return sLanguage + (m[3] ? "-" + m[3].toUpperCase() + (m[4] ? "-" + m[4].slice(1).replace("_","-") : "") : ""); } }
[ "function", "convertLocaleToBCP47", "(", "sLocale", ")", "{", "var", "m", ";", "if", "(", "typeof", "sLocale", "===", "'string'", "&&", "(", "m", "=", "rLocale", ".", "exec", "(", "sLocale", ".", "replace", "(", "/", "_", "/", "g", ",", "'-'", ")", ...
Helper to normalize the given locale (java.util.Locale format) to the BCP-47 syntax. @param {string} sLocale locale to convert @returns {string} Normalized locale or undefined if the locale can't be normalized
[ "Helper", "to", "normalize", "the", "given", "locale", "(", "java", ".", "util", ".", "Locale", "format", ")", "to", "the", "BCP", "-", "47", "syntax", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js#L157-L164
train
Converts a locale string to BCP47 language
[ 30522, 3853, 10463, 4135, 9289, 18903, 9818, 2361, 22610, 1006, 22889, 24755, 2571, 1007, 1063, 13075, 1049, 1025, 2065, 1006, 2828, 11253, 22889, 24755, 2571, 1027, 1027, 1027, 1005, 5164, 1005, 1004, 1004, 1006, 1049, 1027, 1054, 4135, 92...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
function(state, source, target, points, result) { var graph = state.view.graph; var sourceEdge = source == null ? false : graph.getModel().isEdge(source.cell); var targetEdge = target == null ? false : graph.getModel().isEdge(target.cell); var pts = state.absolutePoints; var p0 = pts[0]; var pe = pts[pts.length-1]; var sourceX = source != null ? source.x : p0.x; var sourceY = source != null ? source.y : p0.y; var sourceWidth = source != null ? source.width : 0; var sourceHeight = source != null ? source.height : 0; var targetX = target != null ? target.x : pe.x; var targetY = target != null ? target.y : pe.y; var targetWidth = target != null ? target.width : 0; var targetHeight = target != null ? target.height : 0; var scaledSourceBuffer = state.view.scale * mxEdgeStyle.getJettySize(state, source, target, points, true); var scaledTargetBuffer = state.view.scale * mxEdgeStyle.getJettySize(state, source, target, points, false); // Workaround for loop routing within buffer zone if (source != null && target == source) { scaledTargetBuffer = Math.max(scaledSourceBuffer, scaledTargetBuffer); scaledSourceBuffer = scaledTargetBuffer; } var totalBuffer = scaledTargetBuffer + scaledSourceBuffer; var tooShort = false; // Checks minimum distance for fixed points and falls back to segment connector if (p0 != null && pe != null) { var dx = pe.x - p0.x; var dy = pe.y - p0.y; tooShort = dx * dx + dy * dy < totalBuffer * totalBuffer; } if (tooShort || (mxEdgeStyle.orthPointsFallback && (points != null && points.length > 0)) || sourceEdge || targetEdge) { mxEdgeStyle.SegmentConnector(state, source, target, points, result); return; } // Determine the side(s) of the source and target vertices // that the edge may connect to // portConstraint [source, target] var portConstraint = [mxConstants.DIRECTION_MASK_ALL, mxConstants.DIRECTION_MASK_ALL]; var rotation = 0; if (source != null) { portConstraint[0] = mxUtils.getPortConstraints(source, state, true, mxConstants.DIRECTION_MASK_ALL); rotation = mxUtils.getValue(source.style, mxConstants.STYLE_ROTATION, 0); if (rotation != 0) { var newRect = mxUtils.getBoundingBox(new mxRectangle(sourceX, sourceY, sourceWidth, sourceHeight), rotation); sourceX = newRect.x; sourceY = newRect.y; sourceWidth = newRect.width; sourceHeight = newRect.height; } } if (target != null) { portConstraint[1] = mxUtils.getPortConstraints(target, state, false, mxConstants.DIRECTION_MASK_ALL); rotation = mxUtils.getValue(target.style, mxConstants.STYLE_ROTATION, 0); if (rotation != 0) { var newRect = mxUtils.getBoundingBox(new mxRectangle(targetX, targetY, targetWidth, targetHeight), rotation); targetX = newRect.x; targetY = newRect.y; targetWidth = newRect.width; targetHeight = newRect.height; } } // Avoids floating point number errors sourceX = Math.round(sourceX * 10) / 10; sourceY = Math.round(sourceY * 10) / 10; sourceWidth = Math.round(sourceWidth * 10) / 10; sourceHeight = Math.round(sourceHeight * 10) / 10; targetX = Math.round(targetX * 10) / 10; targetY = Math.round(targetY * 10) / 10; targetWidth = Math.round(targetWidth * 10) / 10; targetHeight = Math.round(targetHeight * 10) / 10; var dir = [0, 0]; // Work out which faces of the vertices present against each other // in a way that would allow a 3-segment connection if port constraints // permitted. // geo -> [source, target] [x, y, width, height] var geo = [ [sourceX, sourceY, sourceWidth, sourceHeight] , [targetX, targetY, targetWidth, targetHeight] ]; var buffer = [scaledSourceBuffer, scaledTargetBuffer]; for (var i = 0; i < 2; i++) { mxEdgeStyle.limits[i][1] = geo[i][0] - buffer[i]; mxEdgeStyle.limits[i][2] = geo[i][1] - buffer[i]; mxEdgeStyle.limits[i][4] = geo[i][0] + geo[i][2] + buffer[i]; mxEdgeStyle.limits[i][8] = geo[i][1] + geo[i][3] + buffer[i]; } // Work out which quad the target is in var sourceCenX = geo[0][0] + geo[0][2] / 2.0; var sourceCenY = geo[0][1] + geo[0][3] / 2.0; var targetCenX = geo[1][0] + geo[1][2] / 2.0; var targetCenY = geo[1][1] + geo[1][3] / 2.0; var dx = sourceCenX - targetCenX; var dy = sourceCenY - targetCenY; var quad = 0; if (dx < 0) { if (dy < 0) { quad = 2; } else { quad = 1; } } else { if (dy <= 0) { quad = 3; // Special case on x = 0 and negative y if (dx == 0) { quad = 2; } } } // Check for connection constraints var currentTerm = null; if (source != null) { currentTerm = p0; } var constraint = [ [0.5, 0.5] , [0.5, 0.5] ]; for (var i = 0; i < 2; i++) { if (currentTerm != null) { constraint[i][0] = (currentTerm.x - geo[i][0]) / geo[i][2]; if (Math.abs(currentTerm.x - geo[i][0]) <= 1) { dir[i] = mxConstants.DIRECTION_MASK_WEST; } else if (Math.abs(currentTerm.x - geo[i][0] - geo[i][2]) <= 1) { dir[i] = mxConstants.DIRECTION_MASK_EAST; } constraint[i][1] = (currentTerm.y - geo[i][1]) / geo[i][3]; if (Math.abs(currentTerm.y - geo[i][1]) <= 1) { dir[i] = mxConstants.DIRECTION_MASK_NORTH; } else if (Math.abs(currentTerm.y - geo[i][1] - geo[i][3]) <= 1) { dir[i] = mxConstants.DIRECTION_MASK_SOUTH; } } currentTerm = null; if (target != null) { currentTerm = pe; } } var sourceTopDist = geo[0][1] - (geo[1][1] + geo[1][3]); var sourceLeftDist = geo[0][0] - (geo[1][0] + geo[1][2]); var sourceBottomDist = geo[1][1] - (geo[0][1] + geo[0][3]); var sourceRightDist = geo[1][0] - (geo[0][0] + geo[0][2]); mxEdgeStyle.vertexSeperations[1] = Math.max(sourceLeftDist - totalBuffer, 0); mxEdgeStyle.vertexSeperations[2] = Math.max(sourceTopDist - totalBuffer, 0); mxEdgeStyle.vertexSeperations[4] = Math.max(sourceBottomDist - totalBuffer, 0); mxEdgeStyle.vertexSeperations[3] = Math.max(sourceRightDist - totalBuffer, 0); //============================================================== // Start of source and target direction determination // Work through the preferred orientations by relative positioning // of the vertices and list them in preferred and available order var dirPref = []; var horPref = []; var vertPref = []; horPref[0] = (sourceLeftDist >= sourceRightDist) ? mxConstants.DIRECTION_MASK_WEST : mxConstants.DIRECTION_MASK_EAST; vertPref[0] = (sourceTopDist >= sourceBottomDist) ? mxConstants.DIRECTION_MASK_NORTH : mxConstants.DIRECTION_MASK_SOUTH; horPref[1] = mxUtils.reversePortConstraints(horPref[0]); vertPref[1] = mxUtils.reversePortConstraints(vertPref[0]); var preferredHorizDist = sourceLeftDist >= sourceRightDist ? sourceLeftDist : sourceRightDist; var preferredVertDist = sourceTopDist >= sourceBottomDist ? sourceTopDist : sourceBottomDist; var prefOrdering = [ [0, 0] , [0, 0] ]; var preferredOrderSet = false; // If the preferred port isn't available, switch it for (var i = 0; i < 2; i++) { if (dir[i] != 0x0) { continue; } if ((horPref[i] & portConstraint[i]) == 0) { horPref[i] = mxUtils.reversePortConstraints(horPref[i]); } if ((vertPref[i] & portConstraint[i]) == 0) { vertPref[i] = mxUtils .reversePortConstraints(vertPref[i]); } prefOrdering[i][0] = vertPref[i]; prefOrdering[i][1] = horPref[i]; } if (preferredVertDist > 0 && preferredHorizDist > 0) { // Possibility of two segment edge connection if (((horPref[0] & portConstraint[0]) > 0) && ((vertPref[1] & portConstraint[1]) > 0)) { prefOrdering[0][0] = horPref[0]; prefOrdering[0][1] = vertPref[0]; prefOrdering[1][0] = vertPref[1]; prefOrdering[1][1] = horPref[1]; preferredOrderSet = true; } else if (((vertPref[0] & portConstraint[0]) > 0) && ((horPref[1] & portConstraint[1]) > 0)) { prefOrdering[0][0] = vertPref[0]; prefOrdering[0][1] = horPref[0]; prefOrdering[1][0] = horPref[1]; prefOrdering[1][1] = vertPref[1]; preferredOrderSet = true; } } if (preferredVertDist > 0 && !preferredOrderSet) { prefOrdering[0][0] = vertPref[0]; prefOrdering[0][1] = horPref[0]; prefOrdering[1][0] = vertPref[1]; prefOrdering[1][1] = horPref[1]; preferredOrderSet = true; } if (preferredHorizDist > 0 && !preferredOrderSet) { prefOrdering[0][0] = horPref[0]; prefOrdering[0][1] = vertPref[0]; prefOrdering[1][0] = horPref[1]; prefOrdering[1][1] = vertPref[1]; preferredOrderSet = true; } // The source and target prefs are now an ordered list of // the preferred port selections // It the list can contain gaps, compact it for (var i = 0; i < 2; i++) { if (dir[i] != 0x0) { continue; } if ((prefOrdering[i][0] & portConstraint[i]) == 0) { prefOrdering[i][0] = prefOrdering[i][1]; } dirPref[i] = prefOrdering[i][0] & portConstraint[i]; dirPref[i] |= (prefOrdering[i][1] & portConstraint[i]) << 8; dirPref[i] |= (prefOrdering[1 - i][i] & portConstraint[i]) << 16; dirPref[i] |= (prefOrdering[1 - i][1 - i] & portConstraint[i]) << 24; if ((dirPref[i] & 0xF) == 0) { dirPref[i] = dirPref[i] << 8; } if ((dirPref[i] & 0xF00) == 0) { dirPref[i] = (dirPref[i] & 0xF) | dirPref[i] >> 8; } if ((dirPref[i] & 0xF0000) == 0) { dirPref[i] = (dirPref[i] & 0xFFFF) | ((dirPref[i] & 0xF000000) >> 8); } dir[i] = dirPref[i] & 0xF; if (portConstraint[i] == mxConstants.DIRECTION_MASK_WEST || portConstraint[i] == mxConstants.DIRECTION_MASK_NORTH || portConstraint[i] == mxConstants.DIRECTION_MASK_EAST || portConstraint[i] == mxConstants.DIRECTION_MASK_SOUTH) { dir[i] = portConstraint[i]; } } //============================================================== // End of source and target direction determination var sourceIndex = dir[0] == mxConstants.DIRECTION_MASK_EAST ? 3 : dir[0]; var targetIndex = dir[1] == mxConstants.DIRECTION_MASK_EAST ? 3 : dir[1]; sourceIndex -= quad; targetIndex -= quad; if (sourceIndex < 1) { sourceIndex += 4; } if (targetIndex < 1) { targetIndex += 4; } var routePattern = mxEdgeStyle.routePatterns[sourceIndex - 1][targetIndex - 1]; mxEdgeStyle.wayPoints1[0][0] = geo[0][0]; mxEdgeStyle.wayPoints1[0][1] = geo[0][1]; switch (dir[0]) { case mxConstants.DIRECTION_MASK_WEST: mxEdgeStyle.wayPoints1[0][0] -= scaledSourceBuffer; mxEdgeStyle.wayPoints1[0][1] += constraint[0][1] * geo[0][3]; break; case mxConstants.DIRECTION_MASK_SOUTH: mxEdgeStyle.wayPoints1[0][0] += constraint[0][0] * geo[0][2]; mxEdgeStyle.wayPoints1[0][1] += geo[0][3] + scaledSourceBuffer; break; case mxConstants.DIRECTION_MASK_EAST: mxEdgeStyle.wayPoints1[0][0] += geo[0][2] + scaledSourceBuffer; mxEdgeStyle.wayPoints1[0][1] += constraint[0][1] * geo[0][3]; break; case mxConstants.DIRECTION_MASK_NORTH: mxEdgeStyle.wayPoints1[0][0] += constraint[0][0] * geo[0][2]; mxEdgeStyle.wayPoints1[0][1] -= scaledSourceBuffer; break; } var currentIndex = 0; // Orientation, 0 horizontal, 1 vertical var lastOrientation = (dir[0] & (mxConstants.DIRECTION_MASK_EAST | mxConstants.DIRECTION_MASK_WEST)) > 0 ? 0 : 1; var initialOrientation = lastOrientation; var currentOrientation = 0; for (var i = 0; i < routePattern.length; i++) { var nextDirection = routePattern[i] & 0xF; // Rotate the index of this direction by the quad // to get the real direction var directionIndex = nextDirection == mxConstants.DIRECTION_MASK_EAST ? 3 : nextDirection; directionIndex += quad; if (directionIndex > 4) { directionIndex -= 4; } var direction = mxEdgeStyle.dirVectors[directionIndex - 1]; currentOrientation = (directionIndex % 2 > 0) ? 0 : 1; // Only update the current index if the point moved // in the direction of the current segment move, // otherwise the same point is moved until there is // a segment direction change if (currentOrientation != lastOrientation) { currentIndex++; // Copy the previous way point into the new one // We can't base the new position on index - 1 // because sometime elbows turn out not to exist, // then we'd have to rewind. mxEdgeStyle.wayPoints1[currentIndex][0] = mxEdgeStyle.wayPoints1[currentIndex - 1][0]; mxEdgeStyle.wayPoints1[currentIndex][1] = mxEdgeStyle.wayPoints1[currentIndex - 1][1]; } var tar = (routePattern[i] & mxEdgeStyle.TARGET_MASK) > 0; var sou = (routePattern[i] & mxEdgeStyle.SOURCE_MASK) > 0; var side = (routePattern[i] & mxEdgeStyle.SIDE_MASK) >> 5; side = side << quad; if (side > 0xF) { side = side >> 4; } var center = (routePattern[i] & mxEdgeStyle.CENTER_MASK) > 0; if ((sou || tar) && side < 9) { var limit = 0; var souTar = sou ? 0 : 1; if (center && currentOrientation == 0) { limit = geo[souTar][0] + constraint[souTar][0] * geo[souTar][2]; } else if (center) { limit = geo[souTar][1] + constraint[souTar][1] * geo[souTar][3]; } else { limit = mxEdgeStyle.limits[souTar][side]; } if (currentOrientation == 0) { var lastX = mxEdgeStyle.wayPoints1[currentIndex][0]; var deltaX = (limit - lastX) * direction[0]; if (deltaX > 0) { mxEdgeStyle.wayPoints1[currentIndex][0] += direction[0] * deltaX; } } else { var lastY = mxEdgeStyle.wayPoints1[currentIndex][1]; var deltaY = (limit - lastY) * direction[1]; if (deltaY > 0) { mxEdgeStyle.wayPoints1[currentIndex][1] += direction[1] * deltaY; } } } else if (center) { // Which center we're travelling to depend on the current direction mxEdgeStyle.wayPoints1[currentIndex][0] += direction[0] * Math.abs(mxEdgeStyle.vertexSeperations[directionIndex] / 2); mxEdgeStyle.wayPoints1[currentIndex][1] += direction[1] * Math.abs(mxEdgeStyle.vertexSeperations[directionIndex] / 2); } if (currentIndex > 0 && mxEdgeStyle.wayPoints1[currentIndex][currentOrientation] == mxEdgeStyle.wayPoints1[currentIndex - 1][currentOrientation]) { currentIndex--; } else { lastOrientation = currentOrientation; } } for (var i = 0; i <= currentIndex; i++) { if (i == currentIndex) { // Last point can cause last segment to be in // same direction as jetty/approach. If so, // check the number of points is consistent // with the relative orientation of source and target // jx. Same orientation requires an even // number of turns (points), different requires // odd. var targetOrientation = (dir[1] & (mxConstants.DIRECTION_MASK_EAST | mxConstants.DIRECTION_MASK_WEST)) > 0 ? 0 : 1; var sameOrient = targetOrientation == initialOrientation ? 0 : 1; // (currentIndex + 1) % 2 is 0 for even number of points, // 1 for odd if (sameOrient != (currentIndex + 1) % 2) { // The last point isn't required break; } } result.push(new mxPoint(Math.round(mxEdgeStyle.wayPoints1[i][0]), Math.round(mxEdgeStyle.wayPoints1[i][1]))); } // Removes duplicates var index = 1; while (index < result.length) { if (result[index - 1] == null || result[index] == null || result[index - 1].x != result[index].x || result[index - 1].y != result[index].y) { index++; } else { result.splice(index, 1); } } }
javascript
function(state, source, target, points, result) { var graph = state.view.graph; var sourceEdge = source == null ? false : graph.getModel().isEdge(source.cell); var targetEdge = target == null ? false : graph.getModel().isEdge(target.cell); var pts = state.absolutePoints; var p0 = pts[0]; var pe = pts[pts.length-1]; var sourceX = source != null ? source.x : p0.x; var sourceY = source != null ? source.y : p0.y; var sourceWidth = source != null ? source.width : 0; var sourceHeight = source != null ? source.height : 0; var targetX = target != null ? target.x : pe.x; var targetY = target != null ? target.y : pe.y; var targetWidth = target != null ? target.width : 0; var targetHeight = target != null ? target.height : 0; var scaledSourceBuffer = state.view.scale * mxEdgeStyle.getJettySize(state, source, target, points, true); var scaledTargetBuffer = state.view.scale * mxEdgeStyle.getJettySize(state, source, target, points, false); // Workaround for loop routing within buffer zone if (source != null && target == source) { scaledTargetBuffer = Math.max(scaledSourceBuffer, scaledTargetBuffer); scaledSourceBuffer = scaledTargetBuffer; } var totalBuffer = scaledTargetBuffer + scaledSourceBuffer; var tooShort = false; // Checks minimum distance for fixed points and falls back to segment connector if (p0 != null && pe != null) { var dx = pe.x - p0.x; var dy = pe.y - p0.y; tooShort = dx * dx + dy * dy < totalBuffer * totalBuffer; } if (tooShort || (mxEdgeStyle.orthPointsFallback && (points != null && points.length > 0)) || sourceEdge || targetEdge) { mxEdgeStyle.SegmentConnector(state, source, target, points, result); return; } // Determine the side(s) of the source and target vertices // that the edge may connect to // portConstraint [source, target] var portConstraint = [mxConstants.DIRECTION_MASK_ALL, mxConstants.DIRECTION_MASK_ALL]; var rotation = 0; if (source != null) { portConstraint[0] = mxUtils.getPortConstraints(source, state, true, mxConstants.DIRECTION_MASK_ALL); rotation = mxUtils.getValue(source.style, mxConstants.STYLE_ROTATION, 0); if (rotation != 0) { var newRect = mxUtils.getBoundingBox(new mxRectangle(sourceX, sourceY, sourceWidth, sourceHeight), rotation); sourceX = newRect.x; sourceY = newRect.y; sourceWidth = newRect.width; sourceHeight = newRect.height; } } if (target != null) { portConstraint[1] = mxUtils.getPortConstraints(target, state, false, mxConstants.DIRECTION_MASK_ALL); rotation = mxUtils.getValue(target.style, mxConstants.STYLE_ROTATION, 0); if (rotation != 0) { var newRect = mxUtils.getBoundingBox(new mxRectangle(targetX, targetY, targetWidth, targetHeight), rotation); targetX = newRect.x; targetY = newRect.y; targetWidth = newRect.width; targetHeight = newRect.height; } } // Avoids floating point number errors sourceX = Math.round(sourceX * 10) / 10; sourceY = Math.round(sourceY * 10) / 10; sourceWidth = Math.round(sourceWidth * 10) / 10; sourceHeight = Math.round(sourceHeight * 10) / 10; targetX = Math.round(targetX * 10) / 10; targetY = Math.round(targetY * 10) / 10; targetWidth = Math.round(targetWidth * 10) / 10; targetHeight = Math.round(targetHeight * 10) / 10; var dir = [0, 0]; // Work out which faces of the vertices present against each other // in a way that would allow a 3-segment connection if port constraints // permitted. // geo -> [source, target] [x, y, width, height] var geo = [ [sourceX, sourceY, sourceWidth, sourceHeight] , [targetX, targetY, targetWidth, targetHeight] ]; var buffer = [scaledSourceBuffer, scaledTargetBuffer]; for (var i = 0; i < 2; i++) { mxEdgeStyle.limits[i][1] = geo[i][0] - buffer[i]; mxEdgeStyle.limits[i][2] = geo[i][1] - buffer[i]; mxEdgeStyle.limits[i][4] = geo[i][0] + geo[i][2] + buffer[i]; mxEdgeStyle.limits[i][8] = geo[i][1] + geo[i][3] + buffer[i]; } // Work out which quad the target is in var sourceCenX = geo[0][0] + geo[0][2] / 2.0; var sourceCenY = geo[0][1] + geo[0][3] / 2.0; var targetCenX = geo[1][0] + geo[1][2] / 2.0; var targetCenY = geo[1][1] + geo[1][3] / 2.0; var dx = sourceCenX - targetCenX; var dy = sourceCenY - targetCenY; var quad = 0; if (dx < 0) { if (dy < 0) { quad = 2; } else { quad = 1; } } else { if (dy <= 0) { quad = 3; // Special case on x = 0 and negative y if (dx == 0) { quad = 2; } } } // Check for connection constraints var currentTerm = null; if (source != null) { currentTerm = p0; } var constraint = [ [0.5, 0.5] , [0.5, 0.5] ]; for (var i = 0; i < 2; i++) { if (currentTerm != null) { constraint[i][0] = (currentTerm.x - geo[i][0]) / geo[i][2]; if (Math.abs(currentTerm.x - geo[i][0]) <= 1) { dir[i] = mxConstants.DIRECTION_MASK_WEST; } else if (Math.abs(currentTerm.x - geo[i][0] - geo[i][2]) <= 1) { dir[i] = mxConstants.DIRECTION_MASK_EAST; } constraint[i][1] = (currentTerm.y - geo[i][1]) / geo[i][3]; if (Math.abs(currentTerm.y - geo[i][1]) <= 1) { dir[i] = mxConstants.DIRECTION_MASK_NORTH; } else if (Math.abs(currentTerm.y - geo[i][1] - geo[i][3]) <= 1) { dir[i] = mxConstants.DIRECTION_MASK_SOUTH; } } currentTerm = null; if (target != null) { currentTerm = pe; } } var sourceTopDist = geo[0][1] - (geo[1][1] + geo[1][3]); var sourceLeftDist = geo[0][0] - (geo[1][0] + geo[1][2]); var sourceBottomDist = geo[1][1] - (geo[0][1] + geo[0][3]); var sourceRightDist = geo[1][0] - (geo[0][0] + geo[0][2]); mxEdgeStyle.vertexSeperations[1] = Math.max(sourceLeftDist - totalBuffer, 0); mxEdgeStyle.vertexSeperations[2] = Math.max(sourceTopDist - totalBuffer, 0); mxEdgeStyle.vertexSeperations[4] = Math.max(sourceBottomDist - totalBuffer, 0); mxEdgeStyle.vertexSeperations[3] = Math.max(sourceRightDist - totalBuffer, 0); //============================================================== // Start of source and target direction determination // Work through the preferred orientations by relative positioning // of the vertices and list them in preferred and available order var dirPref = []; var horPref = []; var vertPref = []; horPref[0] = (sourceLeftDist >= sourceRightDist) ? mxConstants.DIRECTION_MASK_WEST : mxConstants.DIRECTION_MASK_EAST; vertPref[0] = (sourceTopDist >= sourceBottomDist) ? mxConstants.DIRECTION_MASK_NORTH : mxConstants.DIRECTION_MASK_SOUTH; horPref[1] = mxUtils.reversePortConstraints(horPref[0]); vertPref[1] = mxUtils.reversePortConstraints(vertPref[0]); var preferredHorizDist = sourceLeftDist >= sourceRightDist ? sourceLeftDist : sourceRightDist; var preferredVertDist = sourceTopDist >= sourceBottomDist ? sourceTopDist : sourceBottomDist; var prefOrdering = [ [0, 0] , [0, 0] ]; var preferredOrderSet = false; // If the preferred port isn't available, switch it for (var i = 0; i < 2; i++) { if (dir[i] != 0x0) { continue; } if ((horPref[i] & portConstraint[i]) == 0) { horPref[i] = mxUtils.reversePortConstraints(horPref[i]); } if ((vertPref[i] & portConstraint[i]) == 0) { vertPref[i] = mxUtils .reversePortConstraints(vertPref[i]); } prefOrdering[i][0] = vertPref[i]; prefOrdering[i][1] = horPref[i]; } if (preferredVertDist > 0 && preferredHorizDist > 0) { // Possibility of two segment edge connection if (((horPref[0] & portConstraint[0]) > 0) && ((vertPref[1] & portConstraint[1]) > 0)) { prefOrdering[0][0] = horPref[0]; prefOrdering[0][1] = vertPref[0]; prefOrdering[1][0] = vertPref[1]; prefOrdering[1][1] = horPref[1]; preferredOrderSet = true; } else if (((vertPref[0] & portConstraint[0]) > 0) && ((horPref[1] & portConstraint[1]) > 0)) { prefOrdering[0][0] = vertPref[0]; prefOrdering[0][1] = horPref[0]; prefOrdering[1][0] = horPref[1]; prefOrdering[1][1] = vertPref[1]; preferredOrderSet = true; } } if (preferredVertDist > 0 && !preferredOrderSet) { prefOrdering[0][0] = vertPref[0]; prefOrdering[0][1] = horPref[0]; prefOrdering[1][0] = vertPref[1]; prefOrdering[1][1] = horPref[1]; preferredOrderSet = true; } if (preferredHorizDist > 0 && !preferredOrderSet) { prefOrdering[0][0] = horPref[0]; prefOrdering[0][1] = vertPref[0]; prefOrdering[1][0] = horPref[1]; prefOrdering[1][1] = vertPref[1]; preferredOrderSet = true; } // The source and target prefs are now an ordered list of // the preferred port selections // It the list can contain gaps, compact it for (var i = 0; i < 2; i++) { if (dir[i] != 0x0) { continue; } if ((prefOrdering[i][0] & portConstraint[i]) == 0) { prefOrdering[i][0] = prefOrdering[i][1]; } dirPref[i] = prefOrdering[i][0] & portConstraint[i]; dirPref[i] |= (prefOrdering[i][1] & portConstraint[i]) << 8; dirPref[i] |= (prefOrdering[1 - i][i] & portConstraint[i]) << 16; dirPref[i] |= (prefOrdering[1 - i][1 - i] & portConstraint[i]) << 24; if ((dirPref[i] & 0xF) == 0) { dirPref[i] = dirPref[i] << 8; } if ((dirPref[i] & 0xF00) == 0) { dirPref[i] = (dirPref[i] & 0xF) | dirPref[i] >> 8; } if ((dirPref[i] & 0xF0000) == 0) { dirPref[i] = (dirPref[i] & 0xFFFF) | ((dirPref[i] & 0xF000000) >> 8); } dir[i] = dirPref[i] & 0xF; if (portConstraint[i] == mxConstants.DIRECTION_MASK_WEST || portConstraint[i] == mxConstants.DIRECTION_MASK_NORTH || portConstraint[i] == mxConstants.DIRECTION_MASK_EAST || portConstraint[i] == mxConstants.DIRECTION_MASK_SOUTH) { dir[i] = portConstraint[i]; } } //============================================================== // End of source and target direction determination var sourceIndex = dir[0] == mxConstants.DIRECTION_MASK_EAST ? 3 : dir[0]; var targetIndex = dir[1] == mxConstants.DIRECTION_MASK_EAST ? 3 : dir[1]; sourceIndex -= quad; targetIndex -= quad; if (sourceIndex < 1) { sourceIndex += 4; } if (targetIndex < 1) { targetIndex += 4; } var routePattern = mxEdgeStyle.routePatterns[sourceIndex - 1][targetIndex - 1]; mxEdgeStyle.wayPoints1[0][0] = geo[0][0]; mxEdgeStyle.wayPoints1[0][1] = geo[0][1]; switch (dir[0]) { case mxConstants.DIRECTION_MASK_WEST: mxEdgeStyle.wayPoints1[0][0] -= scaledSourceBuffer; mxEdgeStyle.wayPoints1[0][1] += constraint[0][1] * geo[0][3]; break; case mxConstants.DIRECTION_MASK_SOUTH: mxEdgeStyle.wayPoints1[0][0] += constraint[0][0] * geo[0][2]; mxEdgeStyle.wayPoints1[0][1] += geo[0][3] + scaledSourceBuffer; break; case mxConstants.DIRECTION_MASK_EAST: mxEdgeStyle.wayPoints1[0][0] += geo[0][2] + scaledSourceBuffer; mxEdgeStyle.wayPoints1[0][1] += constraint[0][1] * geo[0][3]; break; case mxConstants.DIRECTION_MASK_NORTH: mxEdgeStyle.wayPoints1[0][0] += constraint[0][0] * geo[0][2]; mxEdgeStyle.wayPoints1[0][1] -= scaledSourceBuffer; break; } var currentIndex = 0; // Orientation, 0 horizontal, 1 vertical var lastOrientation = (dir[0] & (mxConstants.DIRECTION_MASK_EAST | mxConstants.DIRECTION_MASK_WEST)) > 0 ? 0 : 1; var initialOrientation = lastOrientation; var currentOrientation = 0; for (var i = 0; i < routePattern.length; i++) { var nextDirection = routePattern[i] & 0xF; // Rotate the index of this direction by the quad // to get the real direction var directionIndex = nextDirection == mxConstants.DIRECTION_MASK_EAST ? 3 : nextDirection; directionIndex += quad; if (directionIndex > 4) { directionIndex -= 4; } var direction = mxEdgeStyle.dirVectors[directionIndex - 1]; currentOrientation = (directionIndex % 2 > 0) ? 0 : 1; // Only update the current index if the point moved // in the direction of the current segment move, // otherwise the same point is moved until there is // a segment direction change if (currentOrientation != lastOrientation) { currentIndex++; // Copy the previous way point into the new one // We can't base the new position on index - 1 // because sometime elbows turn out not to exist, // then we'd have to rewind. mxEdgeStyle.wayPoints1[currentIndex][0] = mxEdgeStyle.wayPoints1[currentIndex - 1][0]; mxEdgeStyle.wayPoints1[currentIndex][1] = mxEdgeStyle.wayPoints1[currentIndex - 1][1]; } var tar = (routePattern[i] & mxEdgeStyle.TARGET_MASK) > 0; var sou = (routePattern[i] & mxEdgeStyle.SOURCE_MASK) > 0; var side = (routePattern[i] & mxEdgeStyle.SIDE_MASK) >> 5; side = side << quad; if (side > 0xF) { side = side >> 4; } var center = (routePattern[i] & mxEdgeStyle.CENTER_MASK) > 0; if ((sou || tar) && side < 9) { var limit = 0; var souTar = sou ? 0 : 1; if (center && currentOrientation == 0) { limit = geo[souTar][0] + constraint[souTar][0] * geo[souTar][2]; } else if (center) { limit = geo[souTar][1] + constraint[souTar][1] * geo[souTar][3]; } else { limit = mxEdgeStyle.limits[souTar][side]; } if (currentOrientation == 0) { var lastX = mxEdgeStyle.wayPoints1[currentIndex][0]; var deltaX = (limit - lastX) * direction[0]; if (deltaX > 0) { mxEdgeStyle.wayPoints1[currentIndex][0] += direction[0] * deltaX; } } else { var lastY = mxEdgeStyle.wayPoints1[currentIndex][1]; var deltaY = (limit - lastY) * direction[1]; if (deltaY > 0) { mxEdgeStyle.wayPoints1[currentIndex][1] += direction[1] * deltaY; } } } else if (center) { // Which center we're travelling to depend on the current direction mxEdgeStyle.wayPoints1[currentIndex][0] += direction[0] * Math.abs(mxEdgeStyle.vertexSeperations[directionIndex] / 2); mxEdgeStyle.wayPoints1[currentIndex][1] += direction[1] * Math.abs(mxEdgeStyle.vertexSeperations[directionIndex] / 2); } if (currentIndex > 0 && mxEdgeStyle.wayPoints1[currentIndex][currentOrientation] == mxEdgeStyle.wayPoints1[currentIndex - 1][currentOrientation]) { currentIndex--; } else { lastOrientation = currentOrientation; } } for (var i = 0; i <= currentIndex; i++) { if (i == currentIndex) { // Last point can cause last segment to be in // same direction as jetty/approach. If so, // check the number of points is consistent // with the relative orientation of source and target // jx. Same orientation requires an even // number of turns (points), different requires // odd. var targetOrientation = (dir[1] & (mxConstants.DIRECTION_MASK_EAST | mxConstants.DIRECTION_MASK_WEST)) > 0 ? 0 : 1; var sameOrient = targetOrientation == initialOrientation ? 0 : 1; // (currentIndex + 1) % 2 is 0 for even number of points, // 1 for odd if (sameOrient != (currentIndex + 1) % 2) { // The last point isn't required break; } } result.push(new mxPoint(Math.round(mxEdgeStyle.wayPoints1[i][0]), Math.round(mxEdgeStyle.wayPoints1[i][1]))); } // Removes duplicates var index = 1; while (index < result.length) { if (result[index - 1] == null || result[index] == null || result[index - 1].x != result[index].x || result[index - 1].y != result[index].y) { index++; } else { result.splice(index, 1); } } }
[ "function", "(", "state", ",", "source", ",", "target", ",", "points", ",", "result", ")", "{", "var", "graph", "=", "state", ".", "view", ".", "graph", ";", "var", "sourceEdge", "=", "source", "==", "null", "?", "false", ":", "graph", ".", "getModel...
Function: OrthConnector Implements a local orthogonal router between the given cells. Parameters: state - <mxCellState> that represents the edge to be updated. source - <mxCellState> that represents the source terminal. target - <mxCellState> that represents the target terminal. points - List of relative control points. result - Array of <mxPoints> that represent the actual points of the edge.
[ "Function", ":", "OrthConnector" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L50405-L50958
train
Calculates the distance between two vertices of the source and target.
[ 30522, 3853, 1006, 2110, 1010, 3120, 1010, 4539, 1010, 2685, 1010, 2765, 1007, 1063, 13075, 10629, 1027, 2110, 1012, 3193, 1012, 10629, 1025, 13075, 3120, 24225, 1027, 3120, 1027, 1027, 19701, 1029, 6270, 1024, 10629, 1012, 2131, 5302, 9247...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
tgriesser/knex
src/seed/Seeder.js
Seeder
function Seeder(knex) { this.knex = knex; this.config = this.setConfig(knex.client.config.seeds); }
javascript
function Seeder(knex) { this.knex = knex; this.config = this.setConfig(knex.client.config.seeds); }
[ "function", "Seeder", "(", "knex", ")", "{", "this", ".", "knex", "=", "knex", ";", "this", ".", "config", "=", "this", ".", "setConfig", "(", "knex", ".", "client", ".", "config", ".", "seeds", ")", ";", "}" ]
The new seeds we're performing, typically called from the `knex.seed` interface on the main `knex` object. Passes the `knex` instance performing the seeds.
[ "The", "new", "seeds", "we", "re", "performing", "typically", "called", "from", "the", "knex", ".", "seed", "interface", "on", "the", "main", "knex", "object", ".", "Passes", "the", "knex", "instance", "performing", "the", "seeds", "." ]
6a4fecfe7822442ee5c43d924958eadfe6e17a93
https://github.com/tgriesser/knex/blob/6a4fecfe7822442ee5c43d924958eadfe6e17a93/src/seed/Seeder.js#L13-L16
train
Seeder constructor.
[ 30522, 3853, 6534, 2121, 1006, 14161, 10288, 1007, 1063, 2023, 1012, 14161, 10288, 1027, 14161, 10288, 1025, 2023, 1012, 9530, 8873, 2290, 1027, 2023, 1012, 2275, 8663, 8873, 2290, 1006, 14161, 10288, 1012, 7396, 1012, 9530, 8873, 2290, 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...
postcss/autoprefixer
lib/hacks/grid-utils.js
selectorsEqual
function selectorsEqual (ruleA, ruleB) { return ruleA.selectors.some(sel => { return ruleB.selectors.some(s => s === sel) }) }
javascript
function selectorsEqual (ruleA, ruleB) { return ruleA.selectors.some(sel => { return ruleB.selectors.some(s => s === sel) }) }
[ "function", "selectorsEqual", "(", "ruleA", ",", "ruleB", ")", "{", "return", "ruleA", ".", "selectors", ".", "some", "(", "sel", "=>", "{", "return", "ruleB", ".", "selectors", ".", "some", "(", "s", "=>", "s", "===", "sel", ")", "}", ")", "}" ]
check if selector of rules are equal @param {Rule} ruleA @param {Rule} ruleB @return {Boolean}
[ "check", "if", "selector", "of", "rules", "are", "equal" ]
24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32
https://github.com/postcss/autoprefixer/blob/24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32/lib/hacks/grid-utils.js#L340-L344
train
Check if ruleA and ruleB have the same selectors
[ 30522, 3853, 27000, 3366, 26426, 1006, 3627, 2050, 1010, 3627, 2497, 1007, 1063, 2709, 3627, 2050, 1012, 27000, 2015, 1012, 2070, 1006, 7367, 2140, 1027, 1028, 1063, 2709, 3627, 2497, 1012, 27000, 2015, 1012, 2070, 1006, 1055, 1027, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mochajs/mocha
lib/reporters/base.js
Base
function Base(runner, options) { var failures = (this.failures = []); if (!runner) { throw new TypeError('Missing runner argument'); } this.options = options || {}; this.runner = runner; this.stats = runner.stats; // assigned so Reporters keep a closer reference runner.on(EVENT_TEST_PASS, function(test) { if (test.duration > test.slow()) { test.speed = 'slow'; } else if (test.duration > test.slow() / 2) { test.speed = 'medium'; } else { test.speed = 'fast'; } }); runner.on(EVENT_TEST_FAIL, function(test, err) { if (showDiff(err)) { stringifyDiffObjs(err); } test.err = err; failures.push(test); }); }
javascript
function Base(runner, options) { var failures = (this.failures = []); if (!runner) { throw new TypeError('Missing runner argument'); } this.options = options || {}; this.runner = runner; this.stats = runner.stats; // assigned so Reporters keep a closer reference runner.on(EVENT_TEST_PASS, function(test) { if (test.duration > test.slow()) { test.speed = 'slow'; } else if (test.duration > test.slow() / 2) { test.speed = 'medium'; } else { test.speed = 'fast'; } }); runner.on(EVENT_TEST_FAIL, function(test, err) { if (showDiff(err)) { stringifyDiffObjs(err); } test.err = err; failures.push(test); }); }
[ "function", "Base", "(", "runner", ",", "options", ")", "{", "var", "failures", "=", "(", "this", ".", "failures", "=", "[", "]", ")", ";", "if", "(", "!", "runner", ")", "{", "throw", "new", "TypeError", "(", "'Missing runner argument'", ")", ";", "...
Constructs a new `Base` reporter instance. @description All other reporters generally inherit from this reporter. @public @class @memberof Mocha.reporters @param {Runner} runner - Instance triggers reporter actions. @param {Object} [options] - runner options
[ "Constructs", "a", "new", "Base", "reporter", "instance", "." ]
9b00fedb610241e33f7592c40164e42a38a793cf
https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/base.js#L272-L299
train
Base class for all the tests
[ 30522, 3853, 2918, 1006, 5479, 1010, 7047, 1007, 1063, 13075, 15428, 1027, 1006, 2023, 1012, 15428, 1027, 1031, 1033, 1007, 1025, 2065, 1006, 999, 5479, 1007, 1063, 5466, 2047, 2828, 2121, 29165, 1006, 1005, 4394, 5479, 6685, 1005, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-regex-spaces.js
checkFunction
function checkFunction(node) { const scope = context.getScope(); const regExpVar = astUtils.getVariableByName(scope, "RegExp"); const shadowed = regExpVar && regExpVar.defs.length > 0; if (node.callee.type === "Identifier" && node.callee.name === "RegExp" && isString(node.arguments[0]) && !shadowed) { checkRegex(node, node.arguments[0].value, node.arguments[0].range[0] + 1); } }
javascript
function checkFunction(node) { const scope = context.getScope(); const regExpVar = astUtils.getVariableByName(scope, "RegExp"); const shadowed = regExpVar && regExpVar.defs.length > 0; if (node.callee.type === "Identifier" && node.callee.name === "RegExp" && isString(node.arguments[0]) && !shadowed) { checkRegex(node, node.arguments[0].value, node.arguments[0].range[0] + 1); } }
[ "function", "checkFunction", "(", "node", ")", "{", "const", "scope", "=", "context", ".", "getScope", "(", ")", ";", "const", "regExpVar", "=", "astUtils", ".", "getVariableByName", "(", "scope", ",", "\"RegExp\"", ")", ";", "const", "shadowed", "=", "reg...
Validate strings passed to the RegExp constructor @param {ASTNode} node node to validate @returns {void} @private
[ "Validate", "strings", "passed", "to", "the", "RegExp", "constructor" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-regex-spaces.js#L99-L107
train
Check if a function is a RegExp
[ 30522, 3853, 4638, 11263, 27989, 1006, 13045, 1007, 1063, 9530, 3367, 9531, 1027, 6123, 1012, 4152, 16186, 1006, 1007, 1025, 9530, 3367, 19723, 10288, 2361, 10755, 1027, 2004, 8525, 3775, 4877, 1012, 2131, 10755, 19210, 3762, 18442, 1006, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/core/a-assets.js
fixUpMediaElement
function fixUpMediaElement (mediaEl) { // Cross-origin. var newMediaEl = setCrossOrigin(mediaEl); // Plays inline for mobile. if (newMediaEl.tagName && newMediaEl.tagName.toLowerCase() === 'video') { newMediaEl.setAttribute('playsinline', ''); newMediaEl.setAttribute('webkit-playsinline', ''); } if (newMediaEl !== mediaEl) { mediaEl.parentNode.appendChild(newMediaEl); mediaEl.parentNode.removeChild(mediaEl); } return newMediaEl; }
javascript
function fixUpMediaElement (mediaEl) { // Cross-origin. var newMediaEl = setCrossOrigin(mediaEl); // Plays inline for mobile. if (newMediaEl.tagName && newMediaEl.tagName.toLowerCase() === 'video') { newMediaEl.setAttribute('playsinline', ''); newMediaEl.setAttribute('webkit-playsinline', ''); } if (newMediaEl !== mediaEl) { mediaEl.parentNode.appendChild(newMediaEl); mediaEl.parentNode.removeChild(mediaEl); } return newMediaEl; }
[ "function", "fixUpMediaElement", "(", "mediaEl", ")", "{", "// Cross-origin.", "var", "newMediaEl", "=", "setCrossOrigin", "(", "mediaEl", ")", ";", "// Plays inline for mobile.", "if", "(", "newMediaEl", ".", "tagName", "&&", "newMediaEl", ".", "tagName", ".", "t...
Automatically add attributes to media elements where convenient. crossorigin, playsinline.
[ "Automatically", "add", "attributes", "to", "media", "elements", "where", "convenient", ".", "crossorigin", "playsinline", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/a-assets.js#L180-L195
train
Fixes up the media element
[ 30522, 3853, 8081, 6279, 16969, 12260, 3672, 1006, 2865, 2884, 1007, 1063, 1013, 1013, 2892, 1011, 4761, 1012, 13075, 2047, 16969, 2884, 1027, 2275, 16458, 10050, 11528, 1006, 2865, 2884, 1007, 1025, 1013, 1013, 3248, 23881, 2005, 4684, 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...
GitbookIO/gitbook
lib/modifiers/config/hasPlugin.js
hasPlugin
function hasPlugin(deps, pluginName, version) { return !!deps.find(function(dep) { return dep.getName() === pluginName && (!version || dep.getVersion() === version); }); }
javascript
function hasPlugin(deps, pluginName, version) { return !!deps.find(function(dep) { return dep.getName() === pluginName && (!version || dep.getVersion() === version); }); }
[ "function", "hasPlugin", "(", "deps", ",", "pluginName", ",", "version", ")", "{", "return", "!", "!", "deps", ".", "find", "(", "function", "(", "dep", ")", "{", "return", "dep", ".", "getName", "(", ")", "===", "pluginName", "&&", "(", "!", "versio...
Test if a plugin is listed @param { {List<PluginDependency}} deps @param {String} plugin @param {String} version @return {Boolean}
[ "Test", "if", "a", "plugin", "is", "listed" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/modifiers/config/hasPlugin.js#L9-L13
train
Check if a dependency is a plugin
[ 30522, 3853, 2038, 24759, 30524, 4523, 1012, 2424, 1006, 3853, 1006, 2139, 2361, 1007, 1063, 2709, 2139, 2361, 1012, 2131, 18442, 1006, 1007, 1027, 1027, 1027, 13354, 23111, 14074, 1004, 1004, 1006, 999, 2544, 1064, 1064, 2139, 2361, 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...
apache/incubator-echarts
src/coord/single/singleCreator.js
create
function create(ecModel, api) { var singles = []; ecModel.eachComponent('singleAxis', function (axisModel, idx) { var single = new Single(axisModel, ecModel, api); single.name = 'single_' + idx; single.resize(axisModel, api); axisModel.coordinateSystem = single; singles.push(single); }); ecModel.eachSeries(function (seriesModel) { if (seriesModel.get('coordinateSystem') === 'singleAxis') { var singleAxisModel = ecModel.queryComponents({ mainType: 'singleAxis', index: seriesModel.get('singleAxisIndex'), id: seriesModel.get('singleAxisId') })[0]; seriesModel.coordinateSystem = singleAxisModel && singleAxisModel.coordinateSystem; } }); return singles; }
javascript
function create(ecModel, api) { var singles = []; ecModel.eachComponent('singleAxis', function (axisModel, idx) { var single = new Single(axisModel, ecModel, api); single.name = 'single_' + idx; single.resize(axisModel, api); axisModel.coordinateSystem = single; singles.push(single); }); ecModel.eachSeries(function (seriesModel) { if (seriesModel.get('coordinateSystem') === 'singleAxis') { var singleAxisModel = ecModel.queryComponents({ mainType: 'singleAxis', index: seriesModel.get('singleAxisIndex'), id: seriesModel.get('singleAxisId') })[0]; seriesModel.coordinateSystem = singleAxisModel && singleAxisModel.coordinateSystem; } }); return singles; }
[ "function", "create", "(", "ecModel", ",", "api", ")", "{", "var", "singles", "=", "[", "]", ";", "ecModel", ".", "eachComponent", "(", "'singleAxis'", ",", "function", "(", "axisModel", ",", "idx", ")", "{", "var", "single", "=", "new", "Single", "(",...
Create single coordinate system and inject it into seriesModel. @param {module:echarts/model/Global} ecModel @param {module:echarts/ExtensionAPI} api @return {Array.<module:echarts/coord/single/Single>}
[ "Create", "single", "coordinate", "system", "and", "inject", "it", "into", "seriesModel", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/single/singleCreator.js#L34-L59
train
Create single series
[ 30522, 3853, 3443, 1006, 14925, 5302, 9247, 1010, 17928, 1007, 1063, 13075, 3895, 1027, 1031, 1033, 1025, 14925, 5302, 9247, 1012, 2169, 9006, 29513, 3372, 1006, 1005, 2309, 8528, 2483, 1005, 1010, 3853, 1006, 8123, 5302, 9247, 1010, 8909, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/command/KeyBindingManager.js
addBinding
function addBinding(command, keyBindings, platform) { var commandID = "", results; if (!command) { console.error("addBinding(): missing required parameter: command"); return; } if (!keyBindings) { return; } if (typeof (command) === "string") { commandID = command; } else { commandID = command.getID(); } if (Array.isArray(keyBindings)) { var keyBinding; results = []; // process platform-specific bindings first keyBindings.sort(_sortByPlatform); keyBindings.forEach(function addSingleBinding(keyBindingRequest) { // attempt to add keybinding keyBinding = _addBinding(commandID, keyBindingRequest, keyBindingRequest.platform); if (keyBinding) { results.push(keyBinding); } }); } else { results = _addBinding(commandID, keyBindings, platform); } return results; }
javascript
function addBinding(command, keyBindings, platform) { var commandID = "", results; if (!command) { console.error("addBinding(): missing required parameter: command"); return; } if (!keyBindings) { return; } if (typeof (command) === "string") { commandID = command; } else { commandID = command.getID(); } if (Array.isArray(keyBindings)) { var keyBinding; results = []; // process platform-specific bindings first keyBindings.sort(_sortByPlatform); keyBindings.forEach(function addSingleBinding(keyBindingRequest) { // attempt to add keybinding keyBinding = _addBinding(commandID, keyBindingRequest, keyBindingRequest.platform); if (keyBinding) { results.push(keyBinding); } }); } else { results = _addBinding(commandID, keyBindings, platform); } return results; }
[ "function", "addBinding", "(", "command", ",", "keyBindings", ",", "platform", ")", "{", "var", "commandID", "=", "\"\"", ",", "results", ";", "if", "(", "!", "command", ")", "{", "console", ".", "error", "(", "\"addBinding(): missing required parameter: command...
Add one or more key bindings to a particular Command. @param {!string | Command} command - A command ID or command object @param {?({key: string, displayKey: string}|Array.<{key: string, displayKey: string, platform: string}>)} keyBindings A single key binding or an array of keybindings. Example: "Shift-Cmd-F". Mac and Win key equivalents are automatically mapped to each other. Use displayKey property to display a different string (e.g. "CMD+" instead of "CMD="). @param {?string} platform The target OS of the keyBindings either "mac", "win" or "linux". If undefined, all platforms not explicitly defined will use the key binding. NOTE: If platform is not specified, Ctrl will be replaced by Cmd for "mac" platform @return {{key: string, displayKey:String}|Array.<{key: string, displayKey:String}>} Returns record(s) for valid key binding(s)
[ "Add", "one", "or", "more", "key", "bindings", "to", "a", "particular", "Command", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L850-L887
train
Add a key binding to the specified command
[ 30522, 3853, 5587, 8428, 4667, 1006, 3094, 1010, 3145, 8428, 4667, 2015, 1010, 4132, 1007, 1063, 13075, 3094, 3593, 1027, 1000, 1000, 1010, 3463, 1025, 2065, 1006, 999, 3094, 1007, 1063, 10122, 1012, 7561, 1006, 1000, 5587, 8428, 4667, 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.commons/src/sap/ui/commons/layout/AbsoluteLayout.js
function(oPosition, bRegisterOnly) { var oChildControl = oPosition.getControl(); if (oChildControl) { AbsoluteLayout.cleanUpControl(oChildControl); if (!bRegisterOnly) { adaptControlSize(oChildControl); } var oDelegate = (function(oControl) { return { onAfterRendering: function(){ adaptControlSize(oControl); } }; }(oChildControl)); oChildControl[SAVED_DELEGATOR] = oDelegate; oChildControl.addDelegate(oDelegate, true); } }
javascript
function(oPosition, bRegisterOnly) { var oChildControl = oPosition.getControl(); if (oChildControl) { AbsoluteLayout.cleanUpControl(oChildControl); if (!bRegisterOnly) { adaptControlSize(oChildControl); } var oDelegate = (function(oControl) { return { onAfterRendering: function(){ adaptControlSize(oControl); } }; }(oChildControl)); oChildControl[SAVED_DELEGATOR] = oDelegate; oChildControl.addDelegate(oDelegate, true); } }
[ "function", "(", "oPosition", ",", "bRegisterOnly", ")", "{", "var", "oChildControl", "=", "oPosition", ".", "getControl", "(", ")", ";", "if", "(", "oChildControl", ")", "{", "AbsoluteLayout", ".", "cleanUpControl", "(", "oChildControl", ")", ";", "if", "("...
(Re-)Initialize listening to child rerendering @private
[ "(", "Re", "-", ")", "Initialize", "listening", "to", "child", "rerendering" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js#L536-L556
train
Adds a delegate to the control that is not already registered.
[ 30522, 3853, 1006, 6728, 19234, 1010, 7987, 13910, 12911, 2239, 2135, 1007, 1063, 13075, 28166, 4014, 16409, 12162, 13153, 1027, 6728, 19234, 1012, 2131, 8663, 13181, 2140, 1006, 1007, 1025, 2065, 1006, 28166, 4014, 16409, 12162, 13153, 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...
apache/incubator-echarts
src/chart/sunburst/sunburstLayout.js
initChildren
function initChildren(node, isAsc) { var children = node.children || []; node.children = sort(children, isAsc); // Init children recursively if (children.length) { zrUtil.each(node.children, function (child) { initChildren(child, isAsc); }); } }
javascript
function initChildren(node, isAsc) { var children = node.children || []; node.children = sort(children, isAsc); // Init children recursively if (children.length) { zrUtil.each(node.children, function (child) { initChildren(child, isAsc); }); } }
[ "function", "initChildren", "(", "node", ",", "isAsc", ")", "{", "var", "children", "=", "node", ".", "children", "||", "[", "]", ";", "node", ".", "children", "=", "sort", "(", "children", ",", "isAsc", ")", ";", "// Init children recursively", "if", "(...
Init node children by order and update visual @param {TreeNode} node root node @param {boolean} isAsc if is in ascendant order
[ "Init", "node", "children", "by", "order", "and", "update", "visual" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/sunburst/sunburstLayout.js#L175-L186
train
Recursively init children recursively
[ 30522, 3853, 1999, 20189, 4014, 16200, 2078, 1006, 13045, 1010, 18061, 11020, 1007, 1063, 13075, 2336, 1027, 13045, 1012, 2336, 1064, 1064, 1031, 1033, 1025, 13045, 1012, 2336, 1027, 4066, 1006, 2336, 1010, 18061, 11020, 1007, 1025, 1013, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/services/theming/theming.js
generateAllThemes
function generateAllThemes($injector, $mdTheming) { var head = document.head; var firstChild = head ? head.firstElementChild : null; var themeCss = !themeConfig.disableTheming && $injector.has('$MD_THEME_CSS') ? $injector.get('$MD_THEME_CSS') : ''; // Append our custom registered styles to the theme stylesheet. themeCss += themeConfig.registeredStyles.join(''); if (!firstChild) return; if (themeCss.length === 0) return; // no rules, so no point in running this expensive task // Expose contrast colors for palettes to ensure that text is always readable angular.forEach(PALETTES, sanitizePalette); // MD_THEME_CSS is a string generated by the build process that includes all the themable // components as templates // Break the CSS into individual rules var rules = themeCss .split(/\}(?!(\}|'|"|;))/) .filter(function(rule) { return rule && rule.trim().length; }) .map(function(rule) { return rule.trim() + '}'; }); THEME_COLOR_TYPES.forEach(function(type) { rulesByType[type] = ''; }); // Sort the rules based on type, allowing us to do color substitution on a per-type basis rules.forEach(function(rule) { // First: test that if the rule has '.md-accent', it goes into the accent set of rules for (var i = 0, type; type = THEME_COLOR_TYPES[i]; i++) { if (rule.indexOf('.md-' + type) > -1) { return rulesByType[type] += rule; } } // If no eg 'md-accent' class is found, try to just find 'accent' in the rule and guess from // there for (i = 0; type = THEME_COLOR_TYPES[i]; i++) { if (rule.indexOf(type) > -1) { return rulesByType[type] += rule; } } // Default to the primary array return rulesByType[DEFAULT_COLOR_TYPE] += rule; }); // If themes are being generated on-demand, quit here. The user will later manually // call generateTheme to do this on a theme-by-theme basis. if (themeConfig.generateOnDemand) return; angular.forEach($mdTheming.THEMES, function(theme) { if (!GENERATED[theme.name] && !($mdTheming.defaultTheme() !== 'default' && theme.name === 'default')) { generateTheme(theme, theme.name, themeConfig.nonce); } }); // ************************* // Internal functions // ************************* // The user specifies a 'default' contrast color as either light or dark, // then explicitly lists which hues are the opposite contrast (eg. A100 has dark, A200 has light) function sanitizePalette(palette, name) { var defaultContrast = palette.contrastDefaultColor; var lightColors = palette.contrastLightColors || []; var strongLightColors = palette.contrastStrongLightColors || []; var darkColors = palette.contrastDarkColors || []; // These colors are provided as space-separated lists if (typeof lightColors === 'string') lightColors = lightColors.split(' '); if (typeof strongLightColors === 'string') strongLightColors = strongLightColors.split(' '); if (typeof darkColors === 'string') darkColors = darkColors.split(' '); // Cleanup after ourselves delete palette.contrastDefaultColor; delete palette.contrastLightColors; delete palette.contrastStrongLightColors; delete palette.contrastDarkColors; // Change { 'A100': '#fffeee' } to { 'A100': { value: '#fffeee', contrast:DARK_CONTRAST_COLOR } angular.forEach(palette, function(hueValue, hueName) { if (angular.isObject(hueValue)) return; // Already converted // Map everything to rgb colors var rgbValue = colorToRgbaArray(hueValue); if (!rgbValue) { throw new Error("Color %1, in palette %2's hue %3, is invalid. Hex or rgb(a) color expected." .replace('%1', hueValue) .replace('%2', palette.name) .replace('%3', hueName)); } palette[hueName] = { hex: palette[hueName], value: rgbValue, contrast: getContrastColor() }; function getContrastColor() { if (defaultContrast === 'light') { if (darkColors.indexOf(hueName) > -1) { return DARK_CONTRAST_COLOR; } else { return strongLightColors.indexOf(hueName) > -1 ? STRONG_LIGHT_CONTRAST_COLOR : LIGHT_CONTRAST_COLOR; } } else { if (lightColors.indexOf(hueName) > -1) { return strongLightColors.indexOf(hueName) > -1 ? STRONG_LIGHT_CONTRAST_COLOR : LIGHT_CONTRAST_COLOR; } else { return DARK_CONTRAST_COLOR; } } } }); } }
javascript
function generateAllThemes($injector, $mdTheming) { var head = document.head; var firstChild = head ? head.firstElementChild : null; var themeCss = !themeConfig.disableTheming && $injector.has('$MD_THEME_CSS') ? $injector.get('$MD_THEME_CSS') : ''; // Append our custom registered styles to the theme stylesheet. themeCss += themeConfig.registeredStyles.join(''); if (!firstChild) return; if (themeCss.length === 0) return; // no rules, so no point in running this expensive task // Expose contrast colors for palettes to ensure that text is always readable angular.forEach(PALETTES, sanitizePalette); // MD_THEME_CSS is a string generated by the build process that includes all the themable // components as templates // Break the CSS into individual rules var rules = themeCss .split(/\}(?!(\}|'|"|;))/) .filter(function(rule) { return rule && rule.trim().length; }) .map(function(rule) { return rule.trim() + '}'; }); THEME_COLOR_TYPES.forEach(function(type) { rulesByType[type] = ''; }); // Sort the rules based on type, allowing us to do color substitution on a per-type basis rules.forEach(function(rule) { // First: test that if the rule has '.md-accent', it goes into the accent set of rules for (var i = 0, type; type = THEME_COLOR_TYPES[i]; i++) { if (rule.indexOf('.md-' + type) > -1) { return rulesByType[type] += rule; } } // If no eg 'md-accent' class is found, try to just find 'accent' in the rule and guess from // there for (i = 0; type = THEME_COLOR_TYPES[i]; i++) { if (rule.indexOf(type) > -1) { return rulesByType[type] += rule; } } // Default to the primary array return rulesByType[DEFAULT_COLOR_TYPE] += rule; }); // If themes are being generated on-demand, quit here. The user will later manually // call generateTheme to do this on a theme-by-theme basis. if (themeConfig.generateOnDemand) return; angular.forEach($mdTheming.THEMES, function(theme) { if (!GENERATED[theme.name] && !($mdTheming.defaultTheme() !== 'default' && theme.name === 'default')) { generateTheme(theme, theme.name, themeConfig.nonce); } }); // ************************* // Internal functions // ************************* // The user specifies a 'default' contrast color as either light or dark, // then explicitly lists which hues are the opposite contrast (eg. A100 has dark, A200 has light) function sanitizePalette(palette, name) { var defaultContrast = palette.contrastDefaultColor; var lightColors = palette.contrastLightColors || []; var strongLightColors = palette.contrastStrongLightColors || []; var darkColors = palette.contrastDarkColors || []; // These colors are provided as space-separated lists if (typeof lightColors === 'string') lightColors = lightColors.split(' '); if (typeof strongLightColors === 'string') strongLightColors = strongLightColors.split(' '); if (typeof darkColors === 'string') darkColors = darkColors.split(' '); // Cleanup after ourselves delete palette.contrastDefaultColor; delete palette.contrastLightColors; delete palette.contrastStrongLightColors; delete palette.contrastDarkColors; // Change { 'A100': '#fffeee' } to { 'A100': { value: '#fffeee', contrast:DARK_CONTRAST_COLOR } angular.forEach(palette, function(hueValue, hueName) { if (angular.isObject(hueValue)) return; // Already converted // Map everything to rgb colors var rgbValue = colorToRgbaArray(hueValue); if (!rgbValue) { throw new Error("Color %1, in palette %2's hue %3, is invalid. Hex or rgb(a) color expected." .replace('%1', hueValue) .replace('%2', palette.name) .replace('%3', hueName)); } palette[hueName] = { hex: palette[hueName], value: rgbValue, contrast: getContrastColor() }; function getContrastColor() { if (defaultContrast === 'light') { if (darkColors.indexOf(hueName) > -1) { return DARK_CONTRAST_COLOR; } else { return strongLightColors.indexOf(hueName) > -1 ? STRONG_LIGHT_CONTRAST_COLOR : LIGHT_CONTRAST_COLOR; } } else { if (lightColors.indexOf(hueName) > -1) { return strongLightColors.indexOf(hueName) > -1 ? STRONG_LIGHT_CONTRAST_COLOR : LIGHT_CONTRAST_COLOR; } else { return DARK_CONTRAST_COLOR; } } } }); } }
[ "function", "generateAllThemes", "(", "$injector", ",", "$mdTheming", ")", "{", "var", "head", "=", "document", ".", "head", ";", "var", "firstChild", "=", "head", "?", "head", ".", "firstElementChild", ":", "null", ";", "var", "themeCss", "=", "!", "theme...
Generate our themes at run time given the state of THEMES and PALETTES
[ "Generate", "our", "themes", "at", "run", "time", "given", "the", "state", "of", "THEMES", "and", "PALETTES" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L1033-L1151
train
Generate all the theme styles
[ 30522, 3853, 9699, 8095, 10760, 7834, 1006, 1002, 1999, 20614, 2953, 1010, 1002, 9108, 10760, 6562, 1007, 1063, 13075, 2132, 1027, 6254, 1012, 2132, 1025, 13075, 2034, 19339, 1027, 2132, 1029, 2132, 1012, 2034, 12260, 3672, 19339, 1024, 197...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
function() { var data = this.elementToChange || {}, fields = this.container.querySelectorAll(SELECTOR_FIELDS), length = fields.length, i = 0; for (; i<length; i++) { data[fields[i].getAttribute(ATTRIBUTE_FIELDS)] = fields[i].value; } return data; }
javascript
function() { var data = this.elementToChange || {}, fields = this.container.querySelectorAll(SELECTOR_FIELDS), length = fields.length, i = 0; for (; i<length; i++) { data[fields[i].getAttribute(ATTRIBUTE_FIELDS)] = fields[i].value; } return data; }
[ "function", "(", ")", "{", "var", "data", "=", "this", ".", "elementToChange", "||", "{", "}", ",", "fields", "=", "this", ".", "container", ".", "querySelectorAll", "(", "SELECTOR_FIELDS", ")", ",", "length", "=", "fields", ".", "length", ",", "i", "=...
Grabs all fields in the dialog and puts them in key=>value style in an object which then gets returned
[ "Grabs", "all", "fields", "in", "the", "dialog", "and", "puts", "them", "in", "key", "=", ">", "value", "style", "in", "an", "object", "which", "then", "gets", "returned" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13537-L13547
train
Get the data structure for the current page
[ 30522, 3853, 1006, 1007, 1063, 13075, 2951, 1027, 2023, 1012, 5783, 3406, 22305, 2063, 1064, 1064, 1063, 1065, 1010, 4249, 1027, 2023, 1012, 11661, 1012, 23032, 11246, 22471, 6525, 3363, 1006, 27000, 1035, 4249, 1007, 1010, 3091, 1027, 4249...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ion.rangeSlider/js/ion.rangeSlider.js
function () { if (this.options.type === "single") { if (this.options.values.length) { this.$cache.input.prop("value", this.result.from_value); } else { this.$cache.input.prop("value", this.result.from); } this.$cache.input.data("from", this.result.from); } else { if (this.options.values.length) { this.$cache.input.prop("value", this.result.from_value + this.options.input_values_separator + this.result.to_value); } else { this.$cache.input.prop("value", this.result.from + this.options.input_values_separator + this.result.to); } this.$cache.input.data("from", this.result.from); this.$cache.input.data("to", this.result.to); } }
javascript
function () { if (this.options.type === "single") { if (this.options.values.length) { this.$cache.input.prop("value", this.result.from_value); } else { this.$cache.input.prop("value", this.result.from); } this.$cache.input.data("from", this.result.from); } else { if (this.options.values.length) { this.$cache.input.prop("value", this.result.from_value + this.options.input_values_separator + this.result.to_value); } else { this.$cache.input.prop("value", this.result.from + this.options.input_values_separator + this.result.to); } this.$cache.input.data("from", this.result.from); this.$cache.input.data("to", this.result.to); } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "options", ".", "type", "===", "\"single\"", ")", "{", "if", "(", "this", ".", "options", ".", "values", ".", "length", ")", "{", "this", ".", "$cache", ".", "input", ".", "prop", "(", "\"value\"",...
Write values to input element
[ "Write", "values", "to", "input", "element" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1649-L1666
train
set the value of the key
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 7047, 1012, 2828, 1027, 1027, 1027, 1000, 2309, 1000, 1007, 1063, 2065, 1006, 2023, 1012, 7047, 1012, 5300, 1012, 3091, 1007, 1063, 2023, 1012, 1002, 17053, 1012, 7953, 1012, 17678, 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...
marcuswestin/store.js
plugins/events.js
set
function set(super_fn, key, val) { var oldVal = this.get(key) super_fn() pubsub.fire(key, val, oldVal) }
javascript
function set(super_fn, key, val) { var oldVal = this.get(key) super_fn() pubsub.fire(key, val, oldVal) }
[ "function", "set", "(", "super_fn", ",", "key", ",", "val", ")", "{", "var", "oldVal", "=", "this", ".", "get", "(", "key", ")", "super_fn", "(", ")", "pubsub", ".", "fire", "(", "key", ",", "val", ",", "oldVal", ")", "}" ]
overwrite function to fire when appropriate
[ "overwrite", "function", "to", "fire", "when", "appropriate" ]
b8e22fea8738fc19da4d9e7dbf1cda6e5185c481
https://github.com/marcuswestin/store.js/blob/b8e22fea8738fc19da4d9e7dbf1cda6e5185c481/plugins/events.js#L34-L38
train
set is a wrapper around set
[ 30522, 3853, 2275, 1006, 3565, 1035, 1042, 2078, 1010, 3145, 1010, 11748, 1007, 1063, 13075, 2214, 10175, 1027, 2023, 1012, 2131, 1006, 3145, 1007, 3565, 1035, 1042, 2078, 1006, 1007, 23598, 12083, 1012, 2543, 1006, 3145, 1010, 11748, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dequelabs/axe-core
lib/commons/text/accessible-text-virtual.js
shouldIgnoreHidden
function shouldIgnoreHidden({ actualNode }, context) { if ( // If the parent isn't ignored, the text node should not be either actualNode.nodeType !== 1 || // If the target of aria-labelledby is hidden, ignore all descendents context.includeHidden ) { return false; } return !dom.isVisible(actualNode, true); }
javascript
function shouldIgnoreHidden({ actualNode }, context) { if ( // If the parent isn't ignored, the text node should not be either actualNode.nodeType !== 1 || // If the target of aria-labelledby is hidden, ignore all descendents context.includeHidden ) { return false; } return !dom.isVisible(actualNode, true); }
[ "function", "shouldIgnoreHidden", "(", "{", "actualNode", "}", ",", "context", ")", "{", "if", "(", "// If the parent isn't ignored, the text node should not be either", "actualNode", ".", "nodeType", "!==", "1", "||", "// If the target of aria-labelledby is hidden, ignore all ...
Check if the @param {VirtualNode} element @param {Object} context @property {VirtualNode[]} processed @return {Boolean}
[ "Check", "if", "the" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/commons/text/accessible-text-virtual.js#L88-L99
train
Returns true if the node should be ignored
[ 30522, 3853, 2323, 23773, 5686, 27511, 4181, 1006, 1063, 5025, 3630, 3207, 1065, 1010, 6123, 1007, 1063, 2065, 1006, 1013, 1013, 2065, 1996, 6687, 3475, 1005, 1056, 6439, 1010, 1996, 3793, 13045, 2323, 2025, 2022, 2593, 5025, 3630, 3207, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/FileFilters.js
filterFileList
function filterFileList(compiledFilter, files) { if (!compiledFilter) { return files; } var re = new RegExp(compiledFilter); return files.filter(function (f) { return !re.test(f.fullPath); }); }
javascript
function filterFileList(compiledFilter, files) { if (!compiledFilter) { return files; } var re = new RegExp(compiledFilter); return files.filter(function (f) { return !re.test(f.fullPath); }); }
[ "function", "filterFileList", "(", "compiledFilter", ",", "files", ")", "{", "if", "(", "!", "compiledFilter", ")", "{", "return", "files", ";", "}", "var", "re", "=", "new", "RegExp", "(", "compiledFilter", ")", ";", "return", "files", ".", "filter", "(...
Returns a copy of 'files' filtered to just those that don't match any of the exclusion globs in the filter. @param {?string} compiledFilter 'Compiled' filter object as returned by compile(), or null to no-op @param {!Array.<File>} files @return {!Array.<File>}
[ "Returns", "a", "copy", "of", "files", "filtered", "to", "just", "those", "that", "don", "t", "match", "any", "of", "the", "exclusion", "globs", "in", "the", "filter", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FileFilters.js#L285-L294
train
filter the files
[ 30522, 3853, 11307, 8873, 2571, 9863, 1006, 9227, 8873, 21928, 1010, 6764, 1007, 1063, 2065, 1006, 999, 9227, 8873, 21928, 1007, 1063, 2709, 6764, 1025, 1065, 13075, 2128, 1027, 2047, 19723, 10288, 2361, 1006, 9227, 8873, 21928, 1007, 1025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/prefer-promise-reject-errors.js
isPromiseRejectCall
function isPromiseRejectCall(node) { return node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "Promise" && node.callee.property.type === "Identifier" && node.callee.property.name === "reject"; }
javascript
function isPromiseRejectCall(node) { return node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "Promise" && node.callee.property.type === "Identifier" && node.callee.property.name === "reject"; }
[ "function", "isPromiseRejectCall", "(", "node", ")", "{", "return", "node", ".", "callee", ".", "type", "===", "\"MemberExpression\"", "&&", "node", ".", "callee", ".", "object", ".", "type", "===", "\"Identifier\"", "&&", "node", ".", "callee", ".", "object...
Determines whether a function call is a Promise.reject() call @param {ASTNode} node A CallExpression node @returns {boolean} `true` if the call is a Promise.reject() call
[ "Determines", "whether", "a", "function", "call", "is", "a", "Promise", ".", "reject", "()", "call" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-promise-reject-errors.js#L71-L75
train
Returns true if the given node is a call to Promise. reject
[ 30522, 3853, 2003, 21572, 28732, 2890, 20614, 9289, 2140, 1006, 13045, 1007, 1063, 2709, 13045, 1012, 2655, 4402, 1012, 2828, 1027, 1027, 1027, 1000, 2266, 10288, 20110, 3258, 1000, 1004, 1004, 13045, 1012, 2655, 4402, 1012, 4874, 1012, 282...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
MithrilJS/mithril.js
render/render.js
updateEvent
function updateEvent(vnode, key, value) { if (vnode.events != null) { if (vnode.events[key] === value) return if (value != null && (typeof value === "function" || typeof value === "object")) { if (vnode.events[key] == null) vnode.dom.addEventListener(key.slice(2), vnode.events, false) vnode.events[key] = value } else { if (vnode.events[key] != null) vnode.dom.removeEventListener(key.slice(2), vnode.events, false) vnode.events[key] = undefined } } else if (value != null && (typeof value === "function" || typeof value === "object")) { vnode.events = new EventDict() vnode.dom.addEventListener(key.slice(2), vnode.events, false) vnode.events[key] = value } }
javascript
function updateEvent(vnode, key, value) { if (vnode.events != null) { if (vnode.events[key] === value) return if (value != null && (typeof value === "function" || typeof value === "object")) { if (vnode.events[key] == null) vnode.dom.addEventListener(key.slice(2), vnode.events, false) vnode.events[key] = value } else { if (vnode.events[key] != null) vnode.dom.removeEventListener(key.slice(2), vnode.events, false) vnode.events[key] = undefined } } else if (value != null && (typeof value === "function" || typeof value === "object")) { vnode.events = new EventDict() vnode.dom.addEventListener(key.slice(2), vnode.events, false) vnode.events[key] = value } }
[ "function", "updateEvent", "(", "vnode", ",", "key", ",", "value", ")", "{", "if", "(", "vnode", ".", "events", "!=", "null", ")", "{", "if", "(", "vnode", ".", "events", "[", "key", "]", "===", "value", ")", "return", "if", "(", "value", "!=", "...
event
[ "event" ]
6d36fe09d129928c6b460720e08d9ed321fcd62b
https://github.com/MithrilJS/mithril.js/blob/6d36fe09d129928c6b460720e08d9ed321fcd62b/render/render.js#L848-L863
train
Updates an event on a DOM node
[ 30522, 3853, 10651, 18697, 3372, 1006, 1058, 3630, 3207, 1010, 3145, 1010, 3643, 1007, 1063, 2065, 1006, 1058, 3630, 3207, 1012, 2824, 999, 1027, 19701, 1007, 1063, 2065, 1006, 1058, 3630, 3207, 1012, 2824, 1031, 3145, 1033, 1027, 1027, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/component/helper/BrushTargetManager.js
function (foundCpts, targetInfo) { var xAxisModel = foundCpts.xAxisModel; var yAxisModel = foundCpts.yAxisModel; var gridModel = foundCpts.gridModel; !gridModel && xAxisModel && (gridModel = xAxisModel.axis.grid.model); !gridModel && yAxisModel && (gridModel = yAxisModel.axis.grid.model); return gridModel && gridModel === targetInfo.gridModel; }
javascript
function (foundCpts, targetInfo) { var xAxisModel = foundCpts.xAxisModel; var yAxisModel = foundCpts.yAxisModel; var gridModel = foundCpts.gridModel; !gridModel && xAxisModel && (gridModel = xAxisModel.axis.grid.model); !gridModel && yAxisModel && (gridModel = yAxisModel.axis.grid.model); return gridModel && gridModel === targetInfo.gridModel; }
[ "function", "(", "foundCpts", ",", "targetInfo", ")", "{", "var", "xAxisModel", "=", "foundCpts", ".", "xAxisModel", ";", "var", "yAxisModel", "=", "foundCpts", ".", "yAxisModel", ";", "var", "gridModel", "=", "foundCpts", ".", "gridModel", ";", "!", "gridMo...
grid
[ "grid" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/helper/BrushTargetManager.js#L332-L341
train
Returns true if the given chart is a grid model
[ 30522, 3853, 1006, 2179, 21906, 3215, 1010, 4539, 2378, 14876, 1007, 1063, 13075, 1060, 8528, 2964, 10244, 2140, 1027, 2179, 21906, 3215, 1012, 1060, 8528, 2964, 10244, 2140, 1025, 13075, 8038, 9048, 25855, 9247, 1027, 2179, 21906, 3215, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js
function (oResult, bExpression, bWithType) { var vValue = oResult.value; function binding(bAddType) { var sConstraints, sResult; bAddType = bAddType && !oResult.ignoreTypeInPath && oResult.type; if (bAddType || rBadChars.test(vValue)) { sResult = "{path:" + Basics.toJSON(vValue); if (bAddType) { sResult += ",type:'" + mUi5TypeForEdmType[oResult.type] + "'"; sConstraints = Basics.toJSON(oResult.constraints); if (sConstraints && sConstraints !== "{}") { sResult += ",constraints:" + sConstraints; } } return sResult + "}"; } return "{" + vValue + "}"; } function constant(oResult) { switch (oResult.type) { case "Edm.Boolean": case "Edm.Double": case "Edm.Int32": return String(oResult.value); default: return Basics.toJSON(oResult.value); } } switch (oResult.result) { case "binding": return (bExpression ? "$" : "") + binding(bWithType); case "composite": if (bExpression) { throw new Error( "Trying to embed a composite binding into an expression binding"); } return vValue; // Note: it's already a composite binding string case "constant": if (oResult.type === "edm:Null") { return bExpression ? "null" : null; } if (bExpression) { return constant(oResult); } return typeof vValue === "string" ? BindingParser.complexParser.escape(vValue) : String(vValue); case "expression": return bExpression ? vValue : "{=" + vValue + "}"; // no default } }
javascript
function (oResult, bExpression, bWithType) { var vValue = oResult.value; function binding(bAddType) { var sConstraints, sResult; bAddType = bAddType && !oResult.ignoreTypeInPath && oResult.type; if (bAddType || rBadChars.test(vValue)) { sResult = "{path:" + Basics.toJSON(vValue); if (bAddType) { sResult += ",type:'" + mUi5TypeForEdmType[oResult.type] + "'"; sConstraints = Basics.toJSON(oResult.constraints); if (sConstraints && sConstraints !== "{}") { sResult += ",constraints:" + sConstraints; } } return sResult + "}"; } return "{" + vValue + "}"; } function constant(oResult) { switch (oResult.type) { case "Edm.Boolean": case "Edm.Double": case "Edm.Int32": return String(oResult.value); default: return Basics.toJSON(oResult.value); } } switch (oResult.result) { case "binding": return (bExpression ? "$" : "") + binding(bWithType); case "composite": if (bExpression) { throw new Error( "Trying to embed a composite binding into an expression binding"); } return vValue; // Note: it's already a composite binding string case "constant": if (oResult.type === "edm:Null") { return bExpression ? "null" : null; } if (bExpression) { return constant(oResult); } return typeof vValue === "string" ? BindingParser.complexParser.escape(vValue) : String(vValue); case "expression": return bExpression ? vValue : "{=" + vValue + "}"; // no default } }
[ "function", "(", "oResult", ",", "bExpression", ",", "bWithType", ")", "{", "var", "vValue", "=", "oResult", ".", "value", ";", "function", "binding", "(", "bAddType", ")", "{", "var", "sConstraints", ",", "sResult", ";", "bAddType", "=", "bAddType", "&&",...
Converts the result's value to a string. @param {object} oResult an object with the following properties: result: "constant", "binding", "composite" or "expression" value: {any} the value to write into the resulting string depending on result: when "constant": the constant value as a string (from the annotation) when "binding": the binding path when "expression": a binding expression not wrapped (no "{=" and "}") when "composite": a composite binding string type: an EDM data type (like "Edm.String") constraints: {object} optional type constraints when result is "binding" @param {boolean} bExpression if true the value is to be embedded into a binding expression, otherwise in a composite binding @param {boolean} [bWithType=false] if <code>true</code> and <code>oResult.result</code> is "binding", type and constraint information is written to the resulting binding string @returns {string} the resulting string to embed into a composite binding or a binding expression
[ "Converts", "the", "result", "s", "value", "to", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js#L333-L392
train
Creates a binding string for the given value.
[ 30522, 3853, 1006, 10848, 23722, 2102, 1010, 2022, 2595, 20110, 3258, 1010, 1038, 24415, 13874, 1007, 1063, 13075, 1058, 10175, 5657, 1027, 10848, 23722, 2102, 1012, 3643, 1025, 3853, 8031, 1006, 2919, 11927, 18863, 1007, 1063, 13075, 8040, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jhipster/generator-jhipster
generators/docker-prompts.js
askForApps
function askForApps() { if (this.regenerate) return; const done = this.async(); const messageAskForApps = 'Which applications do you want to include in your configuration?'; const prompts = [ { type: 'checkbox', name: 'chosenApps', message: messageAskForApps, choices: this.appsFolders, default: this.defaultAppsFolders, validate: input => (input.length === 0 ? 'Please choose at least one application' : true) } ]; this.prompt(prompts).then(props => { this.appsFolders = props.chosenApps; loadConfigs.call(this); done(); }); }
javascript
function askForApps() { if (this.regenerate) return; const done = this.async(); const messageAskForApps = 'Which applications do you want to include in your configuration?'; const prompts = [ { type: 'checkbox', name: 'chosenApps', message: messageAskForApps, choices: this.appsFolders, default: this.defaultAppsFolders, validate: input => (input.length === 0 ? 'Please choose at least one application' : true) } ]; this.prompt(prompts).then(props => { this.appsFolders = props.chosenApps; loadConfigs.call(this); done(); }); }
[ "function", "askForApps", "(", ")", "{", "if", "(", "this", ".", "regenerate", ")", "return", ";", "const", "done", "=", "this", ".", "async", "(", ")", ";", "const", "messageAskForApps", "=", "'Which applications do you want to include in your configuration?'", "...
Ask For Apps
[ "Ask", "For", "Apps" ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-prompts.js#L168-L191
train
Ask For Apps
[ 30522, 3853, 3198, 29278, 29098, 2015, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 19723, 24454, 3686, 1007, 2709, 1025, 9530, 3367, 2589, 1027, 2023, 1012, 2004, 6038, 2278, 1006, 1007, 1025, 9530, 3367, 4471, 19895, 29278, 29098, 2015, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
parse_PtgAttrIfError
function parse_PtgAttrIfError(blob) { var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0; blob.l += 2; return [bitIf, blob.read_shift(2)]; }
javascript
function parse_PtgAttrIfError(blob) { var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0; blob.l += 2; return [bitIf, blob.read_shift(2)]; }
[ "function", "parse_PtgAttrIfError", "(", "blob", ")", "{", "var", "bitIf", "=", "(", "blob", "[", "blob", ".", "l", "+", "1", "]", "&", "0xFF", ")", "?", "1", ":", "0", ";", "blob", ".", "l", "+=", "2", ";", "return", "[", "bitIf", ",", "blob",...
/* [MS-XLSB] 2.5.97.28
[ "/", "*", "[", "MS", "-", "XLSB", "]", "2", ".", "5", ".", "97", ".", "28" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L10390-L10394
train
Parse an error in the PTG attribute
[ 30522, 3853, 11968, 3366, 1035, 13866, 20697, 18886, 7512, 29165, 1006, 1038, 4135, 2497, 1007, 1063, 13075, 2978, 10128, 1027, 1006, 1038, 4135, 2497, 1031, 1038, 4135, 2497, 1012, 1048, 1009, 1015, 1033, 1004, 1014, 2595, 4246, 1007, 1029...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/video/zy.media.js
detectType
function detectType(media, options, src) { var mediaFiles = []; var i; var n; var isCanPlay; // Get URL and type if (options.type) { // Accept either string or array of types if (typeof options.type == 'string') { mediaFiles.push({ type: options.type, url: src }); } else { for (i = 0; i < options.type.length; i++) { mediaFiles.push({ type: options.type[i], url: src }); } } } else if (src !== null) { // If src attribute mediaFiles.push({ type: getType(src, media.getAttribute('type')), url: src }); } else { // If <source> elements for (i = 0; i < media.children.length; i++) { n = media.children[i]; if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') { src = n.getAttribute('src'); mediaFiles.push({ type: getType(src, n.getAttribute('type')), url: src }); } } } // For Android which doesn't implement the canPlayType function (always returns '') if (zyMedia.features.isBustedAndroid) { media.canPlayType = function(type) { return /video\/(mp4|m4v)/i.test(type) ? 'maybe' : '' }; } // For Chromium to specify natively supported video codecs (i.e. WebM and Theora) if (zyMedia.features.isChromium) { media.canPlayType = function(type) { return /video\/(webm|ogv|ogg)/i.test(type) ? 'maybe' : '' }; } if (zyMedia.features.supportsCanPlayType) { for (i = 0; i < mediaFiles.length; i++) { // Normal detect if (mediaFiles[i].type == "video/m3u8" || media.canPlayType(mediaFiles[i].type).replace(/no/, '') !== '' // For Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg') || media.canPlayType(mediaFiles[i].type.replace(/mp3/, 'mpeg')).replace(/no/, '') !== '' // For m4a supported by detecting mp4 support || media.canPlayType(mediaFiles[i].type.replace(/m4a/, 'mp4')).replace(/no/, '') !== '') { isCanPlay = true; break } } } return isCanPlay }
javascript
function detectType(media, options, src) { var mediaFiles = []; var i; var n; var isCanPlay; // Get URL and type if (options.type) { // Accept either string or array of types if (typeof options.type == 'string') { mediaFiles.push({ type: options.type, url: src }); } else { for (i = 0; i < options.type.length; i++) { mediaFiles.push({ type: options.type[i], url: src }); } } } else if (src !== null) { // If src attribute mediaFiles.push({ type: getType(src, media.getAttribute('type')), url: src }); } else { // If <source> elements for (i = 0; i < media.children.length; i++) { n = media.children[i]; if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') { src = n.getAttribute('src'); mediaFiles.push({ type: getType(src, n.getAttribute('type')), url: src }); } } } // For Android which doesn't implement the canPlayType function (always returns '') if (zyMedia.features.isBustedAndroid) { media.canPlayType = function(type) { return /video\/(mp4|m4v)/i.test(type) ? 'maybe' : '' }; } // For Chromium to specify natively supported video codecs (i.e. WebM and Theora) if (zyMedia.features.isChromium) { media.canPlayType = function(type) { return /video\/(webm|ogv|ogg)/i.test(type) ? 'maybe' : '' }; } if (zyMedia.features.supportsCanPlayType) { for (i = 0; i < mediaFiles.length; i++) { // Normal detect if (mediaFiles[i].type == "video/m3u8" || media.canPlayType(mediaFiles[i].type).replace(/no/, '') !== '' // For Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg') || media.canPlayType(mediaFiles[i].type.replace(/mp3/, 'mpeg')).replace(/no/, '') !== '' // For m4a supported by detecting mp4 support || media.canPlayType(mediaFiles[i].type.replace(/m4a/, 'mp4')).replace(/no/, '') !== '') { isCanPlay = true; break } } } return isCanPlay }
[ "function", "detectType", "(", "media", ",", "options", ",", "src", ")", "{", "var", "mediaFiles", "=", "[", "]", ";", "var", "i", ";", "var", "n", ";", "var", "isCanPlay", ";", "// Get URL and type", "if", "(", "options", ".", "type", ")", "{", "// ...
Detect if current type is supported
[ "Detect", "if", "current", "type", "is", "supported" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/video/zy.media.js#L212-L283
train
Detects the type of a media
[ 30522, 3853, 11487, 13874, 1006, 2865, 1010, 7047, 1010, 5034, 2278, 1007, 1063, 13075, 2865, 8873, 4244, 1027, 1031, 1033, 1025, 13075, 1045, 1025, 13075, 1050, 1025, 13075, 2003, 9336, 13068, 1025, 1013, 1013, 2131, 24471, 2140, 1998, 282...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
vuejs/vuepress
packages/@vuepress/core/lib/node/build/index.js
workaroundEmptyStyleChunk
async function workaroundEmptyStyleChunk (stats, outDir) { const styleChunk = stats.children[0].assets.find(a => { return /styles\.\w{8}\.js$/.test(a.name) }) if (!styleChunk) return const styleChunkPath = path.resolve(outDir, styleChunk.name) const styleChunkContent = await fs.readFile(styleChunkPath, 'utf-8') await fs.remove(styleChunkPath) // prepend it to app.js. // this is necessary for the webpack runtime to work properly. const appChunk = stats.children[0].assets.find(a => { return /app\.\w{8}\.js$/.test(a.name) }) const appChunkPath = path.resolve(outDir, appChunk.name) const appChunkContent = await fs.readFile(appChunkPath, 'utf-8') await fs.writeFile(appChunkPath, styleChunkContent + appChunkContent) }
javascript
async function workaroundEmptyStyleChunk (stats, outDir) { const styleChunk = stats.children[0].assets.find(a => { return /styles\.\w{8}\.js$/.test(a.name) }) if (!styleChunk) return const styleChunkPath = path.resolve(outDir, styleChunk.name) const styleChunkContent = await fs.readFile(styleChunkPath, 'utf-8') await fs.remove(styleChunkPath) // prepend it to app.js. // this is necessary for the webpack runtime to work properly. const appChunk = stats.children[0].assets.find(a => { return /app\.\w{8}\.js$/.test(a.name) }) const appChunkPath = path.resolve(outDir, appChunk.name) const appChunkContent = await fs.readFile(appChunkPath, 'utf-8') await fs.writeFile(appChunkPath, styleChunkContent + appChunkContent) }
[ "async", "function", "workaroundEmptyStyleChunk", "(", "stats", ",", "outDir", ")", "{", "const", "styleChunk", "=", "stats", ".", "children", "[", "0", "]", ".", "assets", ".", "find", "(", "a", "=>", "{", "return", "/", "styles\\.\\w{8}\\.js$", "/", ".",...
find and remove empty style chunk caused by https://github.com/webpack-contrib/mini-css-extract-plugin/issues/85 TODO remove when it's fixed @param {Object} stats @param {String} outDir @returns {Promise<void>}
[ "find", "and", "remove", "empty", "style", "chunk", "caused", "by", "https", ":", "//", "github", ".", "com", "/", "webpack", "-", "contrib", "/", "mini", "-", "css", "-", "extract", "-", "plugin", "/", "issues", "/", "85", "TODO", "remove", "when", ...
15784acc0cf2e87de3c147895b2c3977b0195d78
https://github.com/vuejs/vuepress/blob/15784acc0cf2e87de3c147895b2c3977b0195d78/packages/@vuepress/core/lib/node/build/index.js#L255-L271
train
fixes empty style chunks
[ 30522, 2004, 6038, 2278, 3853, 2147, 24490, 6633, 13876, 27268, 12844, 20760, 8950, 1006, 26319, 1010, 2041, 4305, 2099, 1007, 1063, 9530, 3367, 2806, 20760, 8950, 1027, 26319, 1012, 2336, 1031, 1014, 1033, 1012, 7045, 1012, 2424, 1006, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Core.js
function() { var oLocale = this.oConfiguration.getLocale(); oLocale ? html.setAttribute("lang", oLocale.toString()) : html.removeAttribute("lang"); }
javascript
function() { var oLocale = this.oConfiguration.getLocale(); oLocale ? html.setAttribute("lang", oLocale.toString()) : html.removeAttribute("lang"); }
[ "function", "(", ")", "{", "var", "oLocale", "=", "this", ".", "oConfiguration", ".", "getLocale", "(", ")", ";", "oLocale", "?", "html", ".", "setAttribute", "(", "\"lang\"", ",", "oLocale", ".", "toString", "(", ")", ")", ":", "html", ".", "removeAtt...
append the lang info to the document (required for ARIA support)
[ "append", "the", "lang", "info", "to", "the", "document", "(", "required", "for", "ARIA", "support", ")" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L821-L824
train
Sets the lang attribute of the HTML markup.
[ 30522, 3853, 1006, 1007, 1063, 13075, 19330, 24755, 2571, 1027, 2023, 1012, 1051, 30524, 2571, 1012, 2000, 3367, 4892, 1006, 1007, 1007, 1024, 16129, 1012, 6366, 19321, 3089, 8569, 2618, 1006, 1000, 11374, 1000, 1007, 1025, 1065, 102, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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 (isLess) { var index = i, $re = _$re, elements, extendList, c, e, extend, when, condition; while ((isLess && (extend = this.extend())) || (isLess && (when = $re(/^when/))) || (e = this.element())) { if (when) { condition = expect(this.conditions, 'expected condition'); } else if (condition) { error("CSS guard can only be used at the end of selector"); } else if (extend) { if (extendList) { extendList.push(extend); } else { extendList = [ extend ]; } } else { if (extendList) { error("Extend can only be used at the end of selector"); } c = input.charAt(i); if (elements) { elements.push(e); } else { elements = [ e ]; } e = null; } if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') { break; } } if (elements) { return new(tree.Selector)(elements, extendList, condition, index, env.currentFileInfo); } if (extendList) { error("Extend must be used to extend a selector, it cannot be used on its own"); } }
javascript
function (isLess) { var index = i, $re = _$re, elements, extendList, c, e, extend, when, condition; while ((isLess && (extend = this.extend())) || (isLess && (when = $re(/^when/))) || (e = this.element())) { if (when) { condition = expect(this.conditions, 'expected condition'); } else if (condition) { error("CSS guard can only be used at the end of selector"); } else if (extend) { if (extendList) { extendList.push(extend); } else { extendList = [ extend ]; } } else { if (extendList) { error("Extend can only be used at the end of selector"); } c = input.charAt(i); if (elements) { elements.push(e); } else { elements = [ e ]; } e = null; } if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') { break; } } if (elements) { return new(tree.Selector)(elements, extendList, condition, index, env.currentFileInfo); } if (extendList) { error("Extend must be used to extend a selector, it cannot be used on its own"); } }
[ "function", "(", "isLess", ")", "{", "var", "index", "=", "i", ",", "$re", "=", "_$re", ",", "elements", ",", "extendList", ",", "c", ",", "e", ",", "extend", ",", "when", ",", "condition", ";", "while", "(", "(", "isLess", "&&", "(", "extend", "...
A CSS Selector .class > div + h1 li a:hover Selectors are made out of one or more Elements, see above.
[ "A", "CSS", "Selector", ".", "class", ">", "div", "+", "h1", "li", "a", ":", "hover", "Selectors", "are", "made", "out", "of", "one", "or", "more", "Elements", "see", "above", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L1417-L1440
train
returns the selector
[ 30522, 3853, 1006, 14195, 2015, 1007, 1063, 13075, 5950, 1027, 1045, 1010, 1002, 2128, 1027, 1035, 1002, 2128, 1010, 3787, 1010, 7949, 9863, 1010, 1039, 1010, 1041, 1010, 7949, 1010, 2043, 1010, 4650, 1025, 2096, 1006, 1006, 14195, 2015, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/Agents/RemoteFunctions.js
Menu
function Menu(element) { this.element = element; _trigger(this.element, "showgoto", 1, true); window.setTimeout(window.remoteShowGoto); this.remove = this.remove.bind(this); }
javascript
function Menu(element) { this.element = element; _trigger(this.element, "showgoto", 1, true); window.setTimeout(window.remoteShowGoto); this.remove = this.remove.bind(this); }
[ "function", "Menu", "(", "element", ")", "{", "this", ".", "element", "=", "element", ";", "_trigger", "(", "this", ".", "element", ",", "\"showgoto\"", ",", "1", ",", "true", ")", ";", "window", ".", "setTimeout", "(", "window", ".", "remoteShowGoto", ...
construct the info menu
[ "construct", "the", "info", "menu" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/RemoteFunctions.js#L139-L144
train
Menu constructor.
[ 30522, 3853, 12183, 1006, 5783, 1007, 1063, 2023, 1012, 5783, 1027, 5783, 1025, 1035, 9495, 1006, 2023, 1012, 5783, 1010, 1000, 2265, 3995, 3406, 1000, 1010, 1015, 1010, 2995, 1007, 1025, 3332, 1012, 2275, 7292, 5833, 1006, 3332, 1012, 65...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.layout/src/sap/ui/layout/form/SimpleForm.js
_createFormContainer
function _createFormContainer(oTitle) { var oContainer = new FormContainer(); _createContainerLayoutData.call(this, oContainer); oContainer.getAriaLabelledBy = function() { // use aria-label of toolbar var oToolbar = this.getToolbar(); if (oToolbar) { return oToolbar.getAriaLabelledBy(); } else { return []; } }; if (oTitle) { if (oTitle.isA("sap.ui.core.Title")) { oContainer.setTitle(oTitle); } else if (oTitle.isA("sap.ui.core.Toolbar")) { oContainer.setToolbar(oTitle); } } return oContainer; }
javascript
function _createFormContainer(oTitle) { var oContainer = new FormContainer(); _createContainerLayoutData.call(this, oContainer); oContainer.getAriaLabelledBy = function() { // use aria-label of toolbar var oToolbar = this.getToolbar(); if (oToolbar) { return oToolbar.getAriaLabelledBy(); } else { return []; } }; if (oTitle) { if (oTitle.isA("sap.ui.core.Title")) { oContainer.setTitle(oTitle); } else if (oTitle.isA("sap.ui.core.Toolbar")) { oContainer.setToolbar(oTitle); } } return oContainer; }
[ "function", "_createFormContainer", "(", "oTitle", ")", "{", "var", "oContainer", "=", "new", "FormContainer", "(", ")", ";", "_createContainerLayoutData", ".", "call", "(", "this", ",", "oContainer", ")", ";", "oContainer", ".", "getAriaLabelledBy", "=", "funct...
/* Creates a new FormContainer and adds the given title to it. @param {sap.ui.core.Title || sap.ui.core.Toolbar} optional The title or toolbar of the FormContainer @returns {sap.ui.layout.form.FormContainer} The newly created FormContainer @private
[ "/", "*", "Creates", "a", "new", "FormContainer", "and", "adds", "the", "given", "title", "to", "it", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/SimpleForm.js#L1670-L1694
train
Creates a new FormContainer with the given title and toolbar.
[ 30522, 3853, 1035, 3443, 14192, 8663, 18249, 2121, 1006, 27178, 4183, 2571, 1007, 1063, 13075, 1051, 8663, 18249, 2121, 1027, 2047, 2433, 8663, 18249, 2121, 1006, 1007, 1025, 1035, 3443, 8663, 18249, 2121, 8485, 5833, 2850, 2696, 1012, 2655...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
visitAttribute
function visitAttribute(oElement, oAttribute, oWithControl) { if (fnSupportInfo) { fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", before: {name: oAttribute.name, value: oAttribute.value}}}); } return resolveAttributeBinding(oElement, oAttribute, oWithControl) .then(function () { if (fnSupportInfo) { fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", after: {name: oAttribute.name, value: oAttribute.value}}}); } }); }
javascript
function visitAttribute(oElement, oAttribute, oWithControl) { if (fnSupportInfo) { fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", before: {name: oAttribute.name, value: oAttribute.value}}}); } return resolveAttributeBinding(oElement, oAttribute, oWithControl) .then(function () { if (fnSupportInfo) { fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", after: {name: oAttribute.name, value: oAttribute.value}}}); } }); }
[ "function", "visitAttribute", "(", "oElement", ",", "oAttribute", ",", "oWithControl", ")", "{", "if", "(", "fnSupportInfo", ")", "{", "fnSupportInfo", "(", "{", "context", ":", "undefined", "/*context from node clone*/", ",", "env", ":", "{", "caller", ":", "...
Visits the given attribute of the given element. If the attribute value represents a binding expression that can be resolved, it is replaced with the resulting value. @param {Element} oElement the XML DOM element @param {Attr} oAttribute one of the element's attribute nodes @param {sap.ui.core.template._with} oWithControl the "with" control @returns {sap.ui.base.SyncPromise} A sync promise which resolves with <code>undefined</code> as soon as the attribute's value has been replaced, or is rejected with a corresponding error if getting the binding's value fails.
[ "Visits", "the", "given", "attribute", "of", "the", "given", "element", ".", "If", "the", "attribute", "value", "represents", "a", "binding", "expression", "that", "can", "be", "resolved", "it", "is", "replaced", "with", "the", "resulting", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1726-L1736
train
Visit an attribute binding
[ 30522, 3853, 3942, 19321, 3089, 8569, 2618, 1006, 1051, 12260, 3672, 1010, 1051, 19321, 3089, 8569, 2618, 1010, 27593, 8939, 8663, 13181, 2140, 1007, 1063, 2065, 1006, 1042, 3619, 6279, 6442, 2378, 14876, 1007, 1063, 1042, 3619, 6279, 6442,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mui-org/material-ui
dangerfile.js
generateMDTable
function generateMDTable(headers, body) { const headerRow = headers.map(header => header.label); const alignmentRow = headers.map(header => { if (header.align === 'right') { return ' ---:'; } if (header.align === 'center') { return ':---:'; } return ' --- '; }); return [headerRow, alignmentRow, ...body].map(row => row.join(' | ')).join('\n'); }
javascript
function generateMDTable(headers, body) { const headerRow = headers.map(header => header.label); const alignmentRow = headers.map(header => { if (header.align === 'right') { return ' ---:'; } if (header.align === 'center') { return ':---:'; } return ' --- '; }); return [headerRow, alignmentRow, ...body].map(row => row.join(' | ')).join('\n'); }
[ "function", "generateMDTable", "(", "headers", ",", "body", ")", "{", "const", "headerRow", "=", "headers", ".", "map", "(", "header", "=>", "header", ".", "label", ")", ";", "const", "alignmentRow", "=", "headers", ".", "map", "(", "header", "=>", "{", ...
Generates a Markdown table @param {{ label: string, align: 'left' | 'center' | 'right'}[]} headers @param {string[][]} body @returns {string}
[ "Generates", "a", "Markdown", "table" ]
1555e52367835946382fbf2a8f681de71318915d
https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/dangerfile.js#L85-L98
train
Generate MD table
[ 30522, 3853, 9699, 26876, 10880, 1006, 20346, 2015, 1010, 2303, 1007, 1063, 9530, 3367, 20346, 10524, 1027, 20346, 2015, 1012, 4949, 1006, 20346, 1027, 1028, 20346, 1012, 3830, 1007, 1025, 9530, 3367, 12139, 10524, 1027, 20346, 2015, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/wysiwygCommands/codeBlock.js
getCodeBlockBody
function getCodeBlockBody(range, wwe) { const mgr = wwe.componentManager.getManager('codeblock'); let codeBlock; if (range.collapsed) { codeBlock = '<br>'; } else { const contents = range.extractContents(); const nodes = util.toArray(contents.childNodes); const tempDiv = $('<div>').append(mgr.prepareToPasteOnCodeblock(nodes)); codeBlock = tempDiv.html(); } return codeBlock; }
javascript
function getCodeBlockBody(range, wwe) { const mgr = wwe.componentManager.getManager('codeblock'); let codeBlock; if (range.collapsed) { codeBlock = '<br>'; } else { const contents = range.extractContents(); const nodes = util.toArray(contents.childNodes); const tempDiv = $('<div>').append(mgr.prepareToPasteOnCodeblock(nodes)); codeBlock = tempDiv.html(); } return codeBlock; }
[ "function", "getCodeBlockBody", "(", "range", ",", "wwe", ")", "{", "const", "mgr", "=", "wwe", ".", "componentManager", ".", "getManager", "(", "'codeblock'", ")", ";", "let", "codeBlock", ";", "if", "(", "range", ".", "collapsed", ")", "{", "codeBlock", ...
getCodeBlockBody get text wrapped by code @param {object} range range object @param {object} wwe wysiwyg editor @returns {string}
[ "getCodeBlockBody", "get", "text", "wrapped", "by", "code" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/codeBlock.js#L70-L83
train
Get code block body
[ 30522, 3853, 2131, 16044, 23467, 23684, 1006, 2846, 1010, 11700, 1007, 1063, 9530, 3367, 11460, 2099, 1027, 11700, 1012, 6922, 24805, 4590, 1012, 2131, 24805, 4590, 1006, 1005, 3642, 23467, 1005, 1007, 1025, 2292, 3642, 23467, 1025, 2065, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.m/src/sap/m/BarRenderer.js
writeWidthIfContentOccupiesWholeArea
function writeWidthIfContentOccupiesWholeArea(sArea, oRm, oControl) { var bContentLeft = !!oControl.getContentLeft().length, bContentMiddle = !!oControl.getContentMiddle().length, bContentRight = !!oControl.getContentRight().length; function writeAndUpdate() { oRm.addStyle("width", "100%"); oRm.writeStyles(); } switch (sArea.toLowerCase()) { case "left": if (bContentLeft && !bContentMiddle && !bContentRight) { writeAndUpdate(); } break; case "middle": if (bContentMiddle && !bContentLeft && !bContentRight) { writeAndUpdate(); } break; case "right" : if (bContentRight && !bContentLeft && !bContentMiddle) { writeAndUpdate(); } break; default: Log.error("Cannot determine which of the three content aggregations is alone"); } }
javascript
function writeWidthIfContentOccupiesWholeArea(sArea, oRm, oControl) { var bContentLeft = !!oControl.getContentLeft().length, bContentMiddle = !!oControl.getContentMiddle().length, bContentRight = !!oControl.getContentRight().length; function writeAndUpdate() { oRm.addStyle("width", "100%"); oRm.writeStyles(); } switch (sArea.toLowerCase()) { case "left": if (bContentLeft && !bContentMiddle && !bContentRight) { writeAndUpdate(); } break; case "middle": if (bContentMiddle && !bContentLeft && !bContentRight) { writeAndUpdate(); } break; case "right" : if (bContentRight && !bContentLeft && !bContentMiddle) { writeAndUpdate(); } break; default: Log.error("Cannot determine which of the three content aggregations is alone"); } }
[ "function", "writeWidthIfContentOccupiesWholeArea", "(", "sArea", ",", "oRm", ",", "oControl", ")", "{", "var", "bContentLeft", "=", "!", "!", "oControl", ".", "getContentLeft", "(", ")", ".", "length", ",", "bContentMiddle", "=", "!", "!", "oControl", ".", ...
Adds width style to 100% in case of the given content container is the only container with content amongst the three (left, middle, right) @param {string} sArea The content container - one of the left, middle or right @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the Render-Output-Buffer. @param {sap.ui.core.Control} oControl the Bar instance @private
[ "Adds", "width", "style", "to", "100%", "in", "case", "of", "the", "given", "content", "container", "is", "the", "only", "container", "with", "content", "amongst", "the", "three", "(", "left", "middle", "right", ")" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/BarRenderer.js#L174-L202
train
Writes width of the content area if the content is not empty
[ 30522, 3853, 4339, 9148, 11927, 4048, 11329, 28040, 13663, 9468, 6279, 3111, 2860, 11484, 12069, 2050, 1006, 18906, 5243, 1010, 2030, 2213, 1010, 1051, 8663, 13181, 2140, 1007, 1063, 13075, 4647, 28040, 3372, 2571, 6199, 1027, 999, 999, 105...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/mergedTableUI.js
updateContextMenu
function updateContextMenu(popupTableUtils, eventManager, selectionManager) { _changeContent(popupTableUtils); _bindEvents(popupTableUtils, eventManager, selectionManager); }
javascript
function updateContextMenu(popupTableUtils, eventManager, selectionManager) { _changeContent(popupTableUtils); _bindEvents(popupTableUtils, eventManager, selectionManager); }
[ "function", "updateContextMenu", "(", "popupTableUtils", ",", "eventManager", ",", "selectionManager", ")", "{", "_changeContent", "(", "popupTableUtils", ")", ";", "_bindEvents", "(", "popupTableUtils", ",", "eventManager", ",", "selectionManager", ")", ";", "}" ]
Update contextmenu UI. @param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table @param {object} eventManager - event manager instance of editor @param {object} selectionManager - table selection manager instance @ignore
[ "Update", "contextmenu", "UI", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableUI.js#L89-L92
train
Updates the context menu with the current content.
[ 30522, 3853, 10651, 8663, 18209, 3549, 2226, 1006, 3769, 29441, 3085, 21823, 4877, 1010, 2724, 24805, 4590, 1010, 4989, 24805, 4590, 1007, 1063, 1035, 2689, 8663, 6528, 2102, 1006, 3769, 29441, 3085, 21823, 4877, 1007, 1025, 1035, 14187, 18...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
plugins/input-mask/jquery.inputmask.numeric.extensions.js
function (buffer, greedy, repeat, currentBuffer, opts) { //custom getMaskLength to take the groupSeparator into account var calculatedLength = buffer.length; if (!greedy) { if (repeat == "*") { calculatedLength = currentBuffer.length + 1; } else if (repeat > 1) { calculatedLength += (buffer.length * (repeat - 1)); } } var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); var escapedRadixPoint = $.inputmask.escapeRegex.call(this, opts.radixPoint); var currentBufferStr = currentBuffer.join(''), strippedBufferStr = currentBufferStr.replace(new RegExp(escapedGroupSeparator, "g"), "").replace(new RegExp(escapedRadixPoint), ""), groupOffset = currentBufferStr.length - strippedBufferStr.length; return calculatedLength + groupOffset; }
javascript
function (buffer, greedy, repeat, currentBuffer, opts) { //custom getMaskLength to take the groupSeparator into account var calculatedLength = buffer.length; if (!greedy) { if (repeat == "*") { calculatedLength = currentBuffer.length + 1; } else if (repeat > 1) { calculatedLength += (buffer.length * (repeat - 1)); } } var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator); var escapedRadixPoint = $.inputmask.escapeRegex.call(this, opts.radixPoint); var currentBufferStr = currentBuffer.join(''), strippedBufferStr = currentBufferStr.replace(new RegExp(escapedGroupSeparator, "g"), "").replace(new RegExp(escapedRadixPoint), ""), groupOffset = currentBufferStr.length - strippedBufferStr.length; return calculatedLength + groupOffset; }
[ "function", "(", "buffer", ",", "greedy", ",", "repeat", ",", "currentBuffer", ",", "opts", ")", "{", "//custom getMaskLength to take the groupSeparator into account", "var", "calculatedLength", "=", "buffer", ".", "length", ";", "if", "(", "!", "greedy", ")", "{"...
todo
[ "todo" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/input-mask/jquery.inputmask.numeric.extensions.js#L34-L50
train
Returns the number of characters in the buffer
[ 30522, 3853, 1006, 17698, 1010, 20505, 1010, 9377, 1010, 2783, 8569, 12494, 1010, 23569, 2015, 1007, 1063, 1013, 1013, 7661, 2131, 9335, 19099, 3070, 2705, 2000, 2202, 1996, 2967, 13699, 25879, 2953, 2046, 4070, 13075, 10174, 7770, 13512, 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...
google/material-design-icons
gulpfile.babel.js
getCategoryColorPairs
function getCategoryColorPairs() { return _(ICON_CATEGORIES) .map((category) => _.zip(_.times(PNG_COLORS.length, () => category), PNG_COLORS)) .flatten() // flattens 1 level .value(); }
javascript
function getCategoryColorPairs() { return _(ICON_CATEGORIES) .map((category) => _.zip(_.times(PNG_COLORS.length, () => category), PNG_COLORS)) .flatten() // flattens 1 level .value(); }
[ "function", "getCategoryColorPairs", "(", ")", "{", "return", "_", "(", "ICON_CATEGORIES", ")", ".", "map", "(", "(", "category", ")", "=>", "_", ".", "zip", "(", "_", ".", "times", "(", "PNG_COLORS", ".", "length", ",", "(", ")", "=>", "category", "...
Returns the catesian product of categories and colors.
[ "Returns", "the", "catesian", "product", "of", "categories", "and", "colors", "." ]
224895a86501195e7a7ff3dde18e39f00b8e3d5a
https://github.com/google/material-design-icons/blob/224895a86501195e7a7ff3dde18e39f00b8e3d5a/gulpfile.babel.js#L160-L166
train
Get the category color pairs
[ 30522, 3853, 2131, 16280, 20255, 2100, 18717, 4502, 18894, 1006, 1007, 1063, 2709, 1035, 1006, 12696, 1035, 7236, 1007, 1012, 4949, 1006, 1006, 4696, 1007, 1027, 1028, 1035, 1012, 14101, 1006, 1035, 1012, 2335, 1006, 1052, 3070, 1035, 6087,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/qunit.js
function( handler ) { var hooks = []; // Hooks are ignored on skipped tests if ( this.skip ) { return hooks; } if ( this.module.testEnvironment && QUnit.objectType( this.module.testEnvironment[ handler ] ) === "function" ) { hooks.push( this.queueHook( this.module.testEnvironment[ handler ], handler ) ); } return hooks; }
javascript
function( handler ) { var hooks = []; // Hooks are ignored on skipped tests if ( this.skip ) { return hooks; } if ( this.module.testEnvironment && QUnit.objectType( this.module.testEnvironment[ handler ] ) === "function" ) { hooks.push( this.queueHook( this.module.testEnvironment[ handler ], handler ) ); } return hooks; }
[ "function", "(", "handler", ")", "{", "var", "hooks", "=", "[", "]", ";", "// Hooks are ignored on skipped tests", "if", "(", "this", ".", "skip", ")", "{", "return", "hooks", ";", "}", "if", "(", "this", ".", "module", ".", "testEnvironment", "&&", "QUn...
Currently only used for module level hooks, can be used to add global level ones
[ "Currently", "only", "used", "for", "module", "level", "hooks", "can", "be", "used", "to", "add", "global", "level", "ones" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L947-L961
train
Add a hook to the test environment
[ 30522, 3853, 1006, 28213, 1007, 1063, 13075, 18008, 1027, 1031, 1033, 1025, 1013, 1013, 18008, 2024, 6439, 2006, 16791, 5852, 2065, 1006, 2023, 1012, 13558, 1007, 1063, 2709, 18008, 1025, 1065, 2065, 1006, 2023, 1012, 11336, 1012, 3231, 236...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wangfupeng1988/wangEditor
src/js/command/index.js
function ($elem) { const editor = this.editor const range = editor.selection.getRange() if (range.insertNode) { range.deleteContents() range.insertNode($elem[0]) } }
javascript
function ($elem) { const editor = this.editor const range = editor.selection.getRange() if (range.insertNode) { range.deleteContents() range.insertNode($elem[0]) } }
[ "function", "(", "$elem", ")", "{", "const", "editor", "=", "this", ".", "editor", "const", "range", "=", "editor", ".", "selection", ".", "getRange", "(", ")", "if", "(", "range", ".", "insertNode", ")", "{", "range", ".", "deleteContents", "(", ")", ...
插入 elem
[ "插入", "elem" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/command/index.js#L75-L83
train
insert a node in the current language
[ 30522, 3853, 1006, 1002, 3449, 6633, 1007, 1063, 9530, 3367, 3559, 1027, 2023, 1012, 3559, 9530, 3367, 2846, 1027, 3559, 1012, 4989, 1012, 2131, 24388, 2063, 1006, 1007, 2065, 1006, 2846, 1012, 19274, 3630, 3207, 1007, 1063, 2846, 1012, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js
function (oNode) { // if there are subnodes added to the current node -> traverse them first (added nodes are at the top, before any children) if (oNode.addedSubtrees.length > 0 && !oNode.nodeState.collapsed) { // an added subtree can be either a deep or a flat tree (depending on the addContexts) call for (var j = 0; j < oNode.addedSubtrees.length; j++) { var oSubtreeHandle = oNode.addedSubtrees[j]; fnTraverseAddedSubtree(oNode, oSubtreeHandle); if (oRecursionBreaker.broken) { return; } } } }
javascript
function (oNode) { // if there are subnodes added to the current node -> traverse them first (added nodes are at the top, before any children) if (oNode.addedSubtrees.length > 0 && !oNode.nodeState.collapsed) { // an added subtree can be either a deep or a flat tree (depending on the addContexts) call for (var j = 0; j < oNode.addedSubtrees.length; j++) { var oSubtreeHandle = oNode.addedSubtrees[j]; fnTraverseAddedSubtree(oNode, oSubtreeHandle); if (oRecursionBreaker.broken) { return; } } } }
[ "function", "(", "oNode", ")", "{", "// if there are subnodes added to the current node -> traverse them first (added nodes are at the top, before any children)", "if", "(", "oNode", ".", "addedSubtrees", ".", "length", ">", "0", "&&", "!", "oNode", ".", "nodeState", ".", "...
Helper function to iterate all added subtrees of a node.
[ "Helper", "function", "to", "iterate", "all", "added", "subtrees", "of", "a", "node", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js#L302-L314
train
Traverse the added subnodes of the current node
[ 30522, 3853, 1006, 21058, 3207, 1007, 1063, 1013, 1013, 2065, 2045, 2024, 4942, 3630, 6155, 2794, 2000, 1996, 2783, 13045, 1011, 1028, 20811, 2068, 2034, 1006, 2794, 14164, 2024, 2012, 1996, 2327, 1010, 2077, 2151, 2336, 1007, 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...
airyland/vux
src/components/range/lib/closest.js
closest
function closest (el, selector, scope) { scope = scope || document.documentElement // walk up the dom while (el && el !== scope) { if (matches(el, selector)) return el el = el.parentNode } // check scope for match return matches(el, selector) ? el : null }
javascript
function closest (el, selector, scope) { scope = scope || document.documentElement // walk up the dom while (el && el !== scope) { if (matches(el, selector)) return el el = el.parentNode } // check scope for match return matches(el, selector) ? el : null }
[ "function", "closest", "(", "el", ",", "selector", ",", "scope", ")", "{", "scope", "=", "scope", "||", "document", ".", "documentElement", "// walk up the dom", "while", "(", "el", "&&", "el", "!==", "scope", ")", "{", "if", "(", "matches", "(", "el", ...
Closest @param {Element} el @param {String} selector @param {Element} scope (optional)
[ "Closest" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/range/lib/closest.js#L21-L32
train
Find the closest element to selector
[ 30522, 3853, 7541, 1006, 3449, 1010, 27000, 1010, 9531, 1007, 1063, 9531, 1027, 9531, 1064, 1064, 6254, 1012, 6254, 12260, 3672, 1013, 1013, 3328, 2039, 1996, 14383, 2096, 1006, 3449, 1004, 1004, 3449, 999, 1027, 1027, 9531, 1007, 1063, 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.m/src/sap/m/HyphenationSupport.js
isValidTextKey
function isValidTextKey(oControl, sKey) { var mTexts = oControl.getTextsToBeHyphenated(); if (typeof mTexts !== "object") { Log.error("[UI5 Hyphenation] The result of getTextsToBeHyphenated method is not a map object.", oControl.getId()); return false; } if (Object.keys(mTexts).indexOf(sKey) < 0) { Log.error("[UI5 Hyphenation] The key " + sKey + " is not found in the result of getTextsToBeHyphenated method.", oControl.getId()); return false; } return true; }
javascript
function isValidTextKey(oControl, sKey) { var mTexts = oControl.getTextsToBeHyphenated(); if (typeof mTexts !== "object") { Log.error("[UI5 Hyphenation] The result of getTextsToBeHyphenated method is not a map object.", oControl.getId()); return false; } if (Object.keys(mTexts).indexOf(sKey) < 0) { Log.error("[UI5 Hyphenation] The key " + sKey + " is not found in the result of getTextsToBeHyphenated method.", oControl.getId()); return false; } return true; }
[ "function", "isValidTextKey", "(", "oControl", ",", "sKey", ")", "{", "var", "mTexts", "=", "oControl", ".", "getTextsToBeHyphenated", "(", ")", ";", "if", "(", "typeof", "mTexts", "!==", "\"object\"", ")", "{", "Log", ".", "error", "(", "\"[UI5 Hyphenation]...
Checks if the required text key is present in the texts map. @param {sap.m.IHyphenation} oControl The control to be checked @param {string} sKey The key to look for @returns {boolean} True if the key is correct @private
[ "Checks", "if", "the", "required", "text", "key", "is", "present", "in", "the", "texts", "map", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/HyphenationSupport.js#L47-L61
train
Checks if the given text key is valid
[ 30522, 3853, 2003, 10175, 3593, 18209, 14839, 1006, 1051, 8663, 13181, 2140, 1010, 15315, 3240, 1007, 1063, 13075, 11047, 10288, 3215, 1027, 1051, 8663, 13181, 2140, 1012, 2131, 18209, 16033, 4783, 10536, 8458, 8189, 3064, 1006, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
openlayers/openlayers
examples/color-manipulation.js
hcl2rgb
function hcl2rgb(pixel) { const h = pixel[0]; const c = pixel[1]; const l = pixel[2]; const a = Math.cos(h) * c; const b = Math.sin(h) * c; let y = (l + 16) / 116; let x = isNaN(a) ? y : y + a / 500; let z = isNaN(b) ? y : y - b / 200; y = Yn * lab2xyz(y); x = Xn * lab2xyz(x); z = Zn * lab2xyz(z); pixel[0] = xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z); pixel[1] = xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z); pixel[2] = xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z); return pixel; }
javascript
function hcl2rgb(pixel) { const h = pixel[0]; const c = pixel[1]; const l = pixel[2]; const a = Math.cos(h) * c; const b = Math.sin(h) * c; let y = (l + 16) / 116; let x = isNaN(a) ? y : y + a / 500; let z = isNaN(b) ? y : y - b / 200; y = Yn * lab2xyz(y); x = Xn * lab2xyz(x); z = Zn * lab2xyz(z); pixel[0] = xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z); pixel[1] = xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z); pixel[2] = xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z); return pixel; }
[ "function", "hcl2rgb", "(", "pixel", ")", "{", "const", "h", "=", "pixel", "[", "0", "]", ";", "const", "c", "=", "pixel", "[", "1", "]", ";", "const", "l", "=", "pixel", "[", "2", "]", ";", "const", "a", "=", "Math", ".", "cos", "(", "h", ...
Convert an HCL pixel into an RGB pixel. @param {Array<number>} pixel A pixel in HCL space. @return {Array<number>} A pixel in RGB space.
[ "Convert", "an", "HCL", "pixel", "into", "an", "RGB", "pixel", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/color-manipulation.js#L61-L82
train
Convert pixel from HCL to RGB
[ 30522, 3853, 16731, 2140, 2475, 10623, 2497, 1006, 22138, 1007, 1063, 9530, 3367, 1044, 1027, 22138, 1031, 1014, 1033, 1025, 9530, 3367, 1039, 1027, 22138, 1031, 1015, 1033, 1025, 9530, 3367, 1048, 1027, 22138, 1031, 1016, 1033, 1025, 9530,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
swimlane/ngx-datatable
release/utils/camel-case.js
camelCase
function camelCase(str) { // Replace special characters with a space str = str.replace(/[^a-zA-Z0-9 ]/g, ' '); // put a space before an uppercase letter str = str.replace(/([a-z](?=[A-Z]))/g, '$1 '); // Lower case first character and some other stuff str = str.replace(/([^a-zA-Z0-9 ])|^[0-9]+/g, '').trim().toLowerCase(); // uppercase characters preceded by a space or number str = str.replace(/([ 0-9]+)([a-zA-Z])/g, function (a, b, c) { return b.trim() + c.toUpperCase(); }); return str; }
javascript
function camelCase(str) { // Replace special characters with a space str = str.replace(/[^a-zA-Z0-9 ]/g, ' '); // put a space before an uppercase letter str = str.replace(/([a-z](?=[A-Z]))/g, '$1 '); // Lower case first character and some other stuff str = str.replace(/([^a-zA-Z0-9 ])|^[0-9]+/g, '').trim().toLowerCase(); // uppercase characters preceded by a space or number str = str.replace(/([ 0-9]+)([a-zA-Z])/g, function (a, b, c) { return b.trim() + c.toUpperCase(); }); return str; }
[ "function", "camelCase", "(", "str", ")", "{", "// Replace special characters with a space", "str", "=", "str", ".", "replace", "(", "/", "[^a-zA-Z0-9 ]", "/", "g", ",", "' '", ")", ";", "// put a space before an uppercase letter", "str", "=", "str", ".", "replace...
Converts strings from something to camel case http://stackoverflow.com/questions/10425287/convert-dash-separated-string-to-camelcase
[ "Converts", "strings", "from", "something", "to", "camel", "case", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "10425287", "/", "convert", "-", "dash", "-", "separated", "-", "string", "-", "to", "-", "camelcase" ]
d7df15a070282a169524dba51d9572008b74804c
https://github.com/swimlane/ngx-datatable/blob/d7df15a070282a169524dba51d9572008b74804c/release/utils/camel-case.js#L7-L19
train
Convert a string to camelCase
[ 30522, 3853, 19130, 18382, 1006, 2358, 2099, 1007, 1063, 1013, 1013, 5672, 2569, 3494, 2007, 1037, 2686, 2358, 2099, 1027, 2358, 2099, 1012, 5672, 1006, 1013, 1031, 1034, 1037, 1011, 23564, 1011, 1062, 2692, 1011, 1023, 1033, 1013, 1043, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ecomfe/zrender
src/tool/path.js
createPathProxyFromString
function createPathProxyFromString(data) { if (!data) { return new PathProxy(); } // var data = data.replace(/-/g, ' -') // .replace(/ /g, ' ') // .replace(/ /g, ',') // .replace(/,,/g, ','); // var n; // create pipes so that we can split the data // for (n = 0; n < cc.length; n++) { // cs = cs.replace(new RegExp(cc[n], 'g'), '|' + cc[n]); // } // data = data.replace(/-/g, ',-'); // create array // var arr = cs.split('|'); // init context point var cpx = 0; var cpy = 0; var subpathX = cpx; var subpathY = cpy; var prevCmd; var path = new PathProxy(); var CMD = PathProxy.CMD; // commandReg.lastIndex = 0; // var cmdResult; // while ((cmdResult = commandReg.exec(data)) != null) { // var cmdStr = cmdResult[1]; // var cmdContent = cmdResult[2]; var cmdList = data.match(commandReg); for (var l = 0; l < cmdList.length; l++) { var cmdText = cmdList[l]; var cmdStr = cmdText.charAt(0); var cmd; // String#split is faster a little bit than String#replace or RegExp#exec. // var p = cmdContent.split(valueSplitReg); // var pLen = 0; // for (var i = 0; i < p.length; i++) { // // '' and other invalid str => NaN // var val = parseFloat(p[i]); // !isNaN(val) && (p[pLen++] = val); // } var p = cmdText.match(numberReg) || []; var pLen = p.length; for (var i = 0; i < pLen; i++) { p[i] = parseFloat(p[i]); } var off = 0; while (off < pLen) { var ctlPtx; var ctlPty; var rx; var ry; var psi; var fa; var fs; var x1 = cpx; var y1 = cpy; // convert l, H, h, V, and v to L switch (cmdStr) { case 'l': cpx += p[off++]; cpy += p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'L': cpx = p[off++]; cpy = p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'm': cpx += p[off++]; cpy += p[off++]; cmd = CMD.M; path.addData(cmd, cpx, cpy); subpathX = cpx; subpathY = cpy; cmdStr = 'l'; break; case 'M': cpx = p[off++]; cpy = p[off++]; cmd = CMD.M; path.addData(cmd, cpx, cpy); subpathX = cpx; subpathY = cpy; cmdStr = 'L'; break; case 'h': cpx += p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'H': cpx = p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'v': cpy += p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'V': cpy = p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'C': cmd = CMD.C; path.addData( cmd, p[off++], p[off++], p[off++], p[off++], p[off++], p[off++] ); cpx = p[off - 2]; cpy = p[off - 1]; break; case 'c': cmd = CMD.C; path.addData( cmd, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy ); cpx += p[off - 2]; cpy += p[off - 1]; break; case 'S': ctlPtx = cpx; ctlPty = cpy; var len = path.len(); var pathData = path.data; if (prevCmd === CMD.C) { ctlPtx += cpx - pathData[len - 4]; ctlPty += cpy - pathData[len - 3]; } cmd = CMD.C; x1 = p[off++]; y1 = p[off++]; cpx = p[off++]; cpy = p[off++]; path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy); break; case 's': ctlPtx = cpx; ctlPty = cpy; var len = path.len(); var pathData = path.data; if (prevCmd === CMD.C) { ctlPtx += cpx - pathData[len - 4]; ctlPty += cpy - pathData[len - 3]; } cmd = CMD.C; x1 = cpx + p[off++]; y1 = cpy + p[off++]; cpx += p[off++]; cpy += p[off++]; path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy); break; case 'Q': x1 = p[off++]; y1 = p[off++]; cpx = p[off++]; cpy = p[off++]; cmd = CMD.Q; path.addData(cmd, x1, y1, cpx, cpy); break; case 'q': x1 = p[off++] + cpx; y1 = p[off++] + cpy; cpx += p[off++]; cpy += p[off++]; cmd = CMD.Q; path.addData(cmd, x1, y1, cpx, cpy); break; case 'T': ctlPtx = cpx; ctlPty = cpy; var len = path.len(); var pathData = path.data; if (prevCmd === CMD.Q) { ctlPtx += cpx - pathData[len - 4]; ctlPty += cpy - pathData[len - 3]; } cpx = p[off++]; cpy = p[off++]; cmd = CMD.Q; path.addData(cmd, ctlPtx, ctlPty, cpx, cpy); break; case 't': ctlPtx = cpx; ctlPty = cpy; var len = path.len(); var pathData = path.data; if (prevCmd === CMD.Q) { ctlPtx += cpx - pathData[len - 4]; ctlPty += cpy - pathData[len - 3]; } cpx += p[off++]; cpy += p[off++]; cmd = CMD.Q; path.addData(cmd, ctlPtx, ctlPty, cpx, cpy); break; case 'A': rx = p[off++]; ry = p[off++]; psi = p[off++]; fa = p[off++]; fs = p[off++]; x1 = cpx, y1 = cpy; cpx = p[off++]; cpy = p[off++]; cmd = CMD.A; processArc( x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path ); break; case 'a': rx = p[off++]; ry = p[off++]; psi = p[off++]; fa = p[off++]; fs = p[off++]; x1 = cpx, y1 = cpy; cpx += p[off++]; cpy += p[off++]; cmd = CMD.A; processArc( x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path ); break; } } if (cmdStr === 'z' || cmdStr === 'Z') { cmd = CMD.Z; path.addData(cmd); // z may be in the middle of the path. cpx = subpathX; cpy = subpathY; } prevCmd = cmd; } path.toStatic(); return path; }
javascript
function createPathProxyFromString(data) { if (!data) { return new PathProxy(); } // var data = data.replace(/-/g, ' -') // .replace(/ /g, ' ') // .replace(/ /g, ',') // .replace(/,,/g, ','); // var n; // create pipes so that we can split the data // for (n = 0; n < cc.length; n++) { // cs = cs.replace(new RegExp(cc[n], 'g'), '|' + cc[n]); // } // data = data.replace(/-/g, ',-'); // create array // var arr = cs.split('|'); // init context point var cpx = 0; var cpy = 0; var subpathX = cpx; var subpathY = cpy; var prevCmd; var path = new PathProxy(); var CMD = PathProxy.CMD; // commandReg.lastIndex = 0; // var cmdResult; // while ((cmdResult = commandReg.exec(data)) != null) { // var cmdStr = cmdResult[1]; // var cmdContent = cmdResult[2]; var cmdList = data.match(commandReg); for (var l = 0; l < cmdList.length; l++) { var cmdText = cmdList[l]; var cmdStr = cmdText.charAt(0); var cmd; // String#split is faster a little bit than String#replace or RegExp#exec. // var p = cmdContent.split(valueSplitReg); // var pLen = 0; // for (var i = 0; i < p.length; i++) { // // '' and other invalid str => NaN // var val = parseFloat(p[i]); // !isNaN(val) && (p[pLen++] = val); // } var p = cmdText.match(numberReg) || []; var pLen = p.length; for (var i = 0; i < pLen; i++) { p[i] = parseFloat(p[i]); } var off = 0; while (off < pLen) { var ctlPtx; var ctlPty; var rx; var ry; var psi; var fa; var fs; var x1 = cpx; var y1 = cpy; // convert l, H, h, V, and v to L switch (cmdStr) { case 'l': cpx += p[off++]; cpy += p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'L': cpx = p[off++]; cpy = p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'm': cpx += p[off++]; cpy += p[off++]; cmd = CMD.M; path.addData(cmd, cpx, cpy); subpathX = cpx; subpathY = cpy; cmdStr = 'l'; break; case 'M': cpx = p[off++]; cpy = p[off++]; cmd = CMD.M; path.addData(cmd, cpx, cpy); subpathX = cpx; subpathY = cpy; cmdStr = 'L'; break; case 'h': cpx += p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'H': cpx = p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'v': cpy += p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'V': cpy = p[off++]; cmd = CMD.L; path.addData(cmd, cpx, cpy); break; case 'C': cmd = CMD.C; path.addData( cmd, p[off++], p[off++], p[off++], p[off++], p[off++], p[off++] ); cpx = p[off - 2]; cpy = p[off - 1]; break; case 'c': cmd = CMD.C; path.addData( cmd, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy ); cpx += p[off - 2]; cpy += p[off - 1]; break; case 'S': ctlPtx = cpx; ctlPty = cpy; var len = path.len(); var pathData = path.data; if (prevCmd === CMD.C) { ctlPtx += cpx - pathData[len - 4]; ctlPty += cpy - pathData[len - 3]; } cmd = CMD.C; x1 = p[off++]; y1 = p[off++]; cpx = p[off++]; cpy = p[off++]; path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy); break; case 's': ctlPtx = cpx; ctlPty = cpy; var len = path.len(); var pathData = path.data; if (prevCmd === CMD.C) { ctlPtx += cpx - pathData[len - 4]; ctlPty += cpy - pathData[len - 3]; } cmd = CMD.C; x1 = cpx + p[off++]; y1 = cpy + p[off++]; cpx += p[off++]; cpy += p[off++]; path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy); break; case 'Q': x1 = p[off++]; y1 = p[off++]; cpx = p[off++]; cpy = p[off++]; cmd = CMD.Q; path.addData(cmd, x1, y1, cpx, cpy); break; case 'q': x1 = p[off++] + cpx; y1 = p[off++] + cpy; cpx += p[off++]; cpy += p[off++]; cmd = CMD.Q; path.addData(cmd, x1, y1, cpx, cpy); break; case 'T': ctlPtx = cpx; ctlPty = cpy; var len = path.len(); var pathData = path.data; if (prevCmd === CMD.Q) { ctlPtx += cpx - pathData[len - 4]; ctlPty += cpy - pathData[len - 3]; } cpx = p[off++]; cpy = p[off++]; cmd = CMD.Q; path.addData(cmd, ctlPtx, ctlPty, cpx, cpy); break; case 't': ctlPtx = cpx; ctlPty = cpy; var len = path.len(); var pathData = path.data; if (prevCmd === CMD.Q) { ctlPtx += cpx - pathData[len - 4]; ctlPty += cpy - pathData[len - 3]; } cpx += p[off++]; cpy += p[off++]; cmd = CMD.Q; path.addData(cmd, ctlPtx, ctlPty, cpx, cpy); break; case 'A': rx = p[off++]; ry = p[off++]; psi = p[off++]; fa = p[off++]; fs = p[off++]; x1 = cpx, y1 = cpy; cpx = p[off++]; cpy = p[off++]; cmd = CMD.A; processArc( x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path ); break; case 'a': rx = p[off++]; ry = p[off++]; psi = p[off++]; fa = p[off++]; fs = p[off++]; x1 = cpx, y1 = cpy; cpx += p[off++]; cpy += p[off++]; cmd = CMD.A; processArc( x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path ); break; } } if (cmdStr === 'z' || cmdStr === 'Z') { cmd = CMD.Z; path.addData(cmd); // z may be in the middle of the path. cpx = subpathX; cpy = subpathY; } prevCmd = cmd; } path.toStatic(); return path; }
[ "function", "createPathProxyFromString", "(", "data", ")", "{", "if", "(", "!", "data", ")", "{", "return", "new", "PathProxy", "(", ")", ";", "}", "// var data = data.replace(/-/g, ' -')", "// .replace(/ /g, ' ')", "// .replace(/ /g, ',')", "// .replace(/,,/...
var valueSplitReg = /[\s,]+/;
[ "var", "valueSplitReg", "=", "/", "[", "\\", "s", "]", "+", "/", ";" ]
30321b57cba3149c30eacb0c1e18276f0f001b9f
https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/tool/path.js#L90-L356
train
Create PathProxy from string
[ 30522, 3853, 3443, 15069, 21572, 18037, 19699, 30524, 1043, 1010, 1005, 1005, 1007, 1013, 1013, 1012, 5672, 1006, 1013, 1013, 1043, 1010, 1005, 1010, 1005, 1007, 1013, 1013, 1012, 5672, 1006, 1013, 1010, 1010, 1013, 1043, 1010, 1005, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
getEngineFor
function getEngineFor(inDocument) { if (allowNativeXPath && nativeEngine.setDocument(inDocument).isAvailable()) { return nativeEngine; } var currentEngine = engines[currentEngineName]; if (currentEngine && currentEngine.setDocument(inDocument).isAvailable()) { return currentEngine; } return engines[defaultEngineName].setDocument(inDocument); }
javascript
function getEngineFor(inDocument) { if (allowNativeXPath && nativeEngine.setDocument(inDocument).isAvailable()) { return nativeEngine; } var currentEngine = engines[currentEngineName]; if (currentEngine && currentEngine.setDocument(inDocument).isAvailable()) { return currentEngine; } return engines[defaultEngineName].setDocument(inDocument); }
[ "function", "getEngineFor", "(", "inDocument", ")", "{", "if", "(", "allowNativeXPath", "&&", "nativeEngine", ".", "setDocument", "(", "inDocument", ")", ".", "isAvailable", "(", ")", ")", "{", "return", "nativeEngine", ";", "}", "var", "currentEngine", "=", ...
Returns the most sensible engine given the settings and the document object.
[ "Returns", "the", "most", "sensible", "engine", "given", "the", "settings", "and", "the", "document", "object", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1981-L1995
train
get engine for inDocument
[ 30522, 3853, 2131, 13159, 3170, 29278, 1006, 11424, 24894, 4765, 1007, 1063, 2065, 1006, 3499, 19833, 3512, 2595, 15069, 1004, 1004, 3128, 13159, 3170, 1012, 2275, 3527, 24894, 4765, 1006, 11424, 24894, 4765, 1007, 1012, 18061, 3567, 11733, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
exceljs/exceljs
lib/xlsx/xform/sheet/row-breaks-xform.js
function(xmlStream, model) { if (model && model.length) { xmlStream.openNode(this.tag, this.$); if (this.count) { xmlStream.addAttribute(this.$count, model.length); xmlStream.addAttribute('manualBreakCount', model.length); } var childXform = this.childXform; model.forEach(function(childModel) { childXform.render(xmlStream, childModel); }); xmlStream.closeNode(); } else if (this.empty) { xmlStream.leafNode(this.tag); } }
javascript
function(xmlStream, model) { if (model && model.length) { xmlStream.openNode(this.tag, this.$); if (this.count) { xmlStream.addAttribute(this.$count, model.length); xmlStream.addAttribute('manualBreakCount', model.length); } var childXform = this.childXform; model.forEach(function(childModel) { childXform.render(xmlStream, childModel); }); xmlStream.closeNode(); } else if (this.empty) { xmlStream.leafNode(this.tag); } }
[ "function", "(", "xmlStream", ",", "model", ")", "{", "if", "(", "model", "&&", "model", ".", "length", ")", "{", "xmlStream", ".", "openNode", "(", "this", ".", "tag", ",", "this", ".", "$", ")", ";", "if", "(", "this", ".", "count", ")", "{", ...
get tag() { return 'rowBreaks'; },
[ "get", "tag", "()", "{", "return", "rowBreaks", ";", "}" ]
c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2
https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/xlsx/xform/sheet/row-breaks-xform.js#L17-L34
train
Render the model to the XML stream
[ 30522, 3853, 1006, 20950, 21422, 1010, 2944, 1007, 1063, 2065, 1006, 2944, 1004, 1004, 2944, 1012, 3091, 1007, 1063, 20950, 21422, 1012, 2330, 3630, 3207, 1006, 2023, 1012, 6415, 1010, 2023, 1012, 1002, 1007, 1025, 2065, 1006, 2023, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/util/report-translator.js
normalizeMultiArgReportCall
function normalizeMultiArgReportCall(...args) { // If there is one argument, it is considered to be a new-style call already. if (args.length === 1) { // Shallow clone the object to avoid surprises if reusing the descriptor return Object.assign({}, args[0]); } // If the second argument is a string, the arguments are interpreted as [node, message, data, fix]. if (typeof args[1] === "string") { return { node: args[0], message: args[1], data: args[2], fix: args[3] }; } // Otherwise, the arguments are interpreted as [node, loc, message, data, fix]. return { node: args[0], loc: args[1], message: args[2], data: args[3], fix: args[4] }; }
javascript
function normalizeMultiArgReportCall(...args) { // If there is one argument, it is considered to be a new-style call already. if (args.length === 1) { // Shallow clone the object to avoid surprises if reusing the descriptor return Object.assign({}, args[0]); } // If the second argument is a string, the arguments are interpreted as [node, message, data, fix]. if (typeof args[1] === "string") { return { node: args[0], message: args[1], data: args[2], fix: args[3] }; } // Otherwise, the arguments are interpreted as [node, loc, message, data, fix]. return { node: args[0], loc: args[1], message: args[2], data: args[3], fix: args[4] }; }
[ "function", "normalizeMultiArgReportCall", "(", "...", "args", ")", "{", "// If there is one argument, it is considered to be a new-style call already.", "if", "(", "args", ".", "length", "===", "1", ")", "{", "// Shallow clone the object to avoid surprises if reusing the descripto...
------------------------------------------------------------------------------ Module Definition ------------------------------------------------------------------------------ Translates a multi-argument context.report() call into a single object argument call @param {...*} args A list of arguments passed to `context.report` @returns {MessageDescriptor} A normalized object containing report information
[ "------------------------------------------------------------------------------", "Module", "Definition", "------------------------------------------------------------------------------", "Translates", "a", "multi", "-", "argument", "context", ".", "report", "()", "call", "into", "a", ...
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/report-translator.js#L57-L84
train
Normalize a report call to a specific key
[ 30522, 3853, 3671, 4697, 12274, 7096, 2401, 10623, 2890, 6442, 9289, 2140, 1006, 1012, 1012, 1012, 12098, 5620, 1007, 1063, 1013, 1013, 2065, 2045, 2003, 2028, 6685, 1010, 2009, 2003, 2641, 2000, 2022, 1037, 2047, 1011, 2806, 2655, 2525, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
zeit/pkg
prelude/bootstrap.js
function (orig) { return function () { var args = Array.from(arguments); var promise = createPromise(); orig.apply(undefined, args.concat(function (error, stdout, stderr) { if (error !== null) { error.stdout = stdout; error.stderr = stderr; promiseReject(promise, error); } else { promiseResolve(promise, { stdout: stdout, stderr: stderr }); } })); return promise; }; }
javascript
function (orig) { return function () { var args = Array.from(arguments); var promise = createPromise(); orig.apply(undefined, args.concat(function (error, stdout, stderr) { if (error !== null) { error.stdout = stdout; error.stderr = stderr; promiseReject(promise, error); } else { promiseResolve(promise, { stdout: stdout, stderr: stderr }); } })); return promise; }; }
[ "function", "(", "orig", ")", "{", "return", "function", "(", ")", "{", "var", "args", "=", "Array", ".", "from", "(", "arguments", ")", ";", "var", "promise", "=", "createPromise", "(", ")", ";", "orig", ".", "apply", "(", "undefined", ",", "args", ...
///////////////////////////////////////////////////////////// CHILD_PROCESS /////////////////////////////////////////////// /////////////////////////////////////////////////////////////
[ "/////////////////////////////////////////////////////////////", "CHILD_PROCESS", "///////////////////////////////////////////////", "/////////////////////////////////////////////////////////////" ]
3775ab6decc2f8f013142e1282934c12fbd1881e
https://github.com/zeit/pkg/blob/3775ab6decc2f8f013142e1282934c12fbd1881e/prelude/bootstrap.js#L1493-L1510
train
returns a function that will execute the original function
[ 30522, 3853, 1006, 2030, 8004, 1007, 1063, 2709, 3853, 1006, 1007, 1063, 13075, 12098, 5620, 1027, 9140, 1012, 2013, 1006, 9918, 1007, 1025, 13075, 4872, 1027, 3443, 21572, 28732, 1006, 1007, 1025, 2030, 8004, 1012, 6611, 1006, 6151, 28344,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/models/plugins/pagination.js
formatResponse
function formatResponse(totalItems, options) { var calcPages = Math.ceil(totalItems / options.limit) || 0, pagination = { page: options.page || defaults.page, limit: options.limit, pages: calcPages === 0 ? 1 : calcPages, total: totalItems, next: null, prev: null }; if (pagination.pages > 1) { if (pagination.page === 1) { pagination.next = pagination.page + 1; } else if (pagination.page === pagination.pages) { pagination.prev = pagination.page - 1; } else { pagination.next = pagination.page + 1; pagination.prev = pagination.page - 1; } } return pagination; }
javascript
function formatResponse(totalItems, options) { var calcPages = Math.ceil(totalItems / options.limit) || 0, pagination = { page: options.page || defaults.page, limit: options.limit, pages: calcPages === 0 ? 1 : calcPages, total: totalItems, next: null, prev: null }; if (pagination.pages > 1) { if (pagination.page === 1) { pagination.next = pagination.page + 1; } else if (pagination.page === pagination.pages) { pagination.prev = pagination.page - 1; } else { pagination.next = pagination.page + 1; pagination.prev = pagination.page - 1; } } return pagination; }
[ "function", "formatResponse", "(", "totalItems", ",", "options", ")", "{", "var", "calcPages", "=", "Math", ".", "ceil", "(", "totalItems", "/", "options", ".", "limit", ")", "||", "0", ",", "pagination", "=", "{", "page", ":", "options", ".", "page", ...
### Format Response Takes the no. items returned and original options and calculates all of the pagination meta data @param {Number} totalItems @param {options} options @returns {pagination} pagination metadata
[ "###", "Format", "Response", "Takes", "the", "no", ".", "items", "returned", "and", "original", "options", "and", "calculates", "all", "of", "the", "pagination", "meta", "data" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/plugins/pagination.js#L67-L90
train
Format response for an individual page
[ 30522, 3853, 4289, 6072, 26029, 3366, 1006, 2561, 4221, 5244, 1010, 7047, 1007, 1063, 13075, 10250, 21906, 13923, 1027, 8785, 1012, 8292, 4014, 1006, 2561, 4221, 5244, 1013, 7047, 1012, 5787, 1007, 1064, 1064, 1014, 1010, 6643, 20876, 3508,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TableGrouping.js
function(oTable, oRow) { var oDomRefs = oRow.getDomRefs(true); oDomRefs.row.removeAttr("data-sap-ui-level"); oDomRefs.row.removeData("sap-ui-level"); if (TableGrouping.isGroupMode(oTable)) { oDomRefs.row.removeClass("sapUiTableGroupHeader sapUiAnalyticalTableSum sapUiAnalyticalTableDummy"); TableGrouping.setIndent(oTable, oDomRefs.row, oDomRefs.rowSelector, 0); } var $TreeIcon = null; if (TableGrouping.isTreeMode(oTable)) { $TreeIcon = oDomRefs.row.find(".sapUiTableTreeIcon"); $TreeIcon.removeClass("sapUiTableTreeIconLeaf") .removeClass("sapUiTableTreeIconNodeOpen") .removeClass("sapUiTableTreeIconNodeClosed") .css(this._bRtlMode ? "margin-right" : "margin-left", ""); } oTable._getAccExtension() .updateAriaExpandAndLevelState(oRow, oDomRefs.rowScrollPart, oDomRefs.rowSelector, oDomRefs.rowFixedPart, oDomRefs.rowAction, false, false, -1, $TreeIcon); }
javascript
function(oTable, oRow) { var oDomRefs = oRow.getDomRefs(true); oDomRefs.row.removeAttr("data-sap-ui-level"); oDomRefs.row.removeData("sap-ui-level"); if (TableGrouping.isGroupMode(oTable)) { oDomRefs.row.removeClass("sapUiTableGroupHeader sapUiAnalyticalTableSum sapUiAnalyticalTableDummy"); TableGrouping.setIndent(oTable, oDomRefs.row, oDomRefs.rowSelector, 0); } var $TreeIcon = null; if (TableGrouping.isTreeMode(oTable)) { $TreeIcon = oDomRefs.row.find(".sapUiTableTreeIcon"); $TreeIcon.removeClass("sapUiTableTreeIconLeaf") .removeClass("sapUiTableTreeIconNodeOpen") .removeClass("sapUiTableTreeIconNodeClosed") .css(this._bRtlMode ? "margin-right" : "margin-left", ""); } oTable._getAccExtension() .updateAriaExpandAndLevelState(oRow, oDomRefs.rowScrollPart, oDomRefs.rowSelector, oDomRefs.rowFixedPart, oDomRefs.rowAction, false, false, -1, $TreeIcon); }
[ "function", "(", "oTable", ",", "oRow", ")", "{", "var", "oDomRefs", "=", "oRow", ".", "getDomRefs", "(", "true", ")", ";", "oDomRefs", ".", "row", ".", "removeAttr", "(", "\"data-sap-ui-level\"", ")", ";", "oDomRefs", ".", "row", ".", "removeData", "(",...
Cleanup the dom changes previously done by <code>updateTableRowForGrouping</code>. @param {sap.ui.table.Table} oTable Instance of the table @param {sap.ui.table.Row} oRow Instance of the row
[ "Cleanup", "the", "dom", "changes", "previously", "done", "by", "<code", ">", "updateTableRowForGrouping<", "/", "code", ">", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L422-L445
train
Removes the control and its children
[ 30522, 3853, 1006, 27178, 3085, 1010, 20298, 2860, 1007, 1063, 13075, 1051, 9527, 2890, 10343, 1027, 20298, 2860, 1012, 2131, 9527, 2890, 10343, 1006, 2995, 1007, 1025, 1051, 9527, 2890, 10343, 1012, 5216, 1012, 6366, 19321, 2099, 1006, 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...
jgraph/mxgraph
javascript/mxClient.js
function(evt) { return mxEvent.isRightMouseButton(evt) || (mxClient.IS_MAC && mxEvent.isControlDown(evt) && !mxEvent.isShiftDown(evt) && !mxEvent.isMetaDown(evt) && !mxEvent.isAltDown(evt)); }
javascript
function(evt) { return mxEvent.isRightMouseButton(evt) || (mxClient.IS_MAC && mxEvent.isControlDown(evt) && !mxEvent.isShiftDown(evt) && !mxEvent.isMetaDown(evt) && !mxEvent.isAltDown(evt)); }
[ "function", "(", "evt", ")", "{", "return", "mxEvent", ".", "isRightMouseButton", "(", "evt", ")", "||", "(", "mxClient", ".", "IS_MAC", "&&", "mxEvent", ".", "isControlDown", "(", "evt", ")", "&&", "!", "mxEvent", ".", "isShiftDown", "(", "evt", ")", ...
Function: isPopupTrigger Returns true if the event is a popup trigger. This implementation returns true if the right button or the left button and control was pressed on a Mac.
[ "Function", ":", "isPopupTrigger" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L9935-L9939
train
Returns true if the given event is a right mouse button
[ 30522, 3853, 1006, 23408, 2102, 1007, 1063, 2709, 25630, 18697, 3372, 1012, 2003, 15950, 27711, 15878, 4904, 2669, 1006, 23408, 2102, 1007, 1064, 1064, 1006, 25630, 20464, 11638, 1012, 2003, 1035, 6097, 1004, 1004, 25630, 18697, 3372, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/table/mergeCell.js
_pickContent
function _pickContent(targetRows, startColIndex, endColIndex) { const limitColIndex = endColIndex + 1; const cells = [].concat(...targetRows.map(rowData => rowData.slice(startColIndex, limitColIndex))); const foundCellData = cells.filter(({content}) => content && content !== BASIC_CELL_CONTENT); return foundCellData.length ? foundCellData[0].content : BASIC_CELL_CONTENT; }
javascript
function _pickContent(targetRows, startColIndex, endColIndex) { const limitColIndex = endColIndex + 1; const cells = [].concat(...targetRows.map(rowData => rowData.slice(startColIndex, limitColIndex))); const foundCellData = cells.filter(({content}) => content && content !== BASIC_CELL_CONTENT); return foundCellData.length ? foundCellData[0].content : BASIC_CELL_CONTENT; }
[ "function", "_pickContent", "(", "targetRows", ",", "startColIndex", ",", "endColIndex", ")", "{", "const", "limitColIndex", "=", "endColIndex", "+", "1", ";", "const", "cells", "=", "[", "]", ".", "concat", "(", "...", "targetRows", ".", "map", "(", "rowD...
Pick merger content from selected cells. @param {Array.<Array.<object>>} targetRows - target rows @param {number} startColIndex - start column index @param {number} endColIndex - end column index @returns {string} @private
[ "Pick", "merger", "content", "from", "selected", "cells", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergeCell.js#L64-L70
train
Pick the content from the target rows
[ 30522, 3853, 1035, 4060, 8663, 6528, 2102, 1006, 4539, 10524, 2015, 1010, 2707, 25778, 22254, 10288, 1010, 2203, 25778, 22254, 10288, 1007, 1063, 9530, 3367, 5787, 25778, 22254, 10288, 1027, 2203, 25778, 22254, 10288, 1009, 1015, 1025, 9530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-constant-condition.js
checkConstantConditionLoopInSet
function checkConstantConditionLoopInSet(node) { if (loopsInCurrentScope.has(node)) { loopsInCurrentScope.delete(node); context.report({ node: node.test, messageId: "unexpected" }); } }
javascript
function checkConstantConditionLoopInSet(node) { if (loopsInCurrentScope.has(node)) { loopsInCurrentScope.delete(node); context.report({ node: node.test, messageId: "unexpected" }); } }
[ "function", "checkConstantConditionLoopInSet", "(", "node", ")", "{", "if", "(", "loopsInCurrentScope", ".", "has", "(", "node", ")", ")", "{", "loopsInCurrentScope", ".", "delete", "(", "node", ")", ";", "context", ".", "report", "(", "{", "node", ":", "n...
Reports when the set contains the given constant condition node @param {ASTNode} node The AST node to check. @returns {void} @private
[ "Reports", "when", "the", "set", "contains", "the", "given", "constant", "condition", "node" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-constant-condition.js#L166-L171
train
Check if a constant condition is in the set of loops
[ 30522, 3853, 4638, 8663, 12693, 13535, 15422, 22753, 4135, 7361, 7076, 3388, 1006, 13045, 1007, 1063, 2065, 1006, 15932, 2378, 10841, 14343, 7666, 16186, 1012, 2038, 1006, 13045, 1007, 1007, 1063, 15932, 2378, 10841, 14343, 7666, 16186, 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...