repo
stringclasses
192 values
path
stringlengths
4
115
func_name
stringlengths
0
45
original_string
stringlengths
74
24k
language
stringclasses
1 value
code
stringlengths
74
24k
code_tokens
listlengths
23
4.2k
docstring
stringlengths
2
23.7k
docstring_tokens
listlengths
1
810
sha
stringclasses
192 values
url
stringlengths
90
200
partition
stringclasses
1 value
summary
stringlengths
6
313
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
adobe/brackets
src/command/KeyBindingManager.js
_getBulletList
function _getBulletList(list) { var message = "<ul class='dialog-list'>"; list.forEach(function (info) { message += "<li>" + info + "</li>"; }); message += "</ul>"; return message; }
javascript
function _getBulletList(list) { var message = "<ul class='dialog-list'>"; list.forEach(function (info) { message += "<li>" + info + "</li>"; }); message += "</ul>"; return message; }
[ "function", "_getBulletList", "(", "list", ")", "{", "var", "message", "=", "\"<ul class='dialog-list'>\"", ";", "list", ".", "forEach", "(", "function", "(", "info", ")", "{", "message", "+=", "\"<li>\"", "+", "info", "+", "\"</li>\"", ";", "}", ")", ";",...
@private Creates a bullet list item for any item in the given list. @param {Array.<string>} list An array of strings to be converted into a message string with a bullet list. @return {string} the html text version of the list
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L1084-L1091
train
Get a list of bullet codes
[ 30522, 3853, 1035, 2131, 8569, 22592, 9863, 1006, 2862, 1007, 1063, 13075, 4471, 1027, 1000, 1026, 17359, 2465, 1027, 1005, 13764, 8649, 1011, 2862, 1005, 1028, 1000, 30524, 4471, 1009, 1027, 1000, 1026, 1013, 17359, 1028, 1000, 1025, 2709,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
grpc/grpc-node
packages/grpc-native-core/src/client.js
_read
function _read(size) { /* jshint validthis: true */ if (this.finished) { this.push(null); } else { if (!this.reading) { this.reading = true; var context = { stream: this }; this.call.recvMessageWithContext(context); } } }
javascript
function _read(size) { /* jshint validthis: true */ if (this.finished) { this.push(null); } else { if (!this.reading) { this.reading = true; var context = { stream: this }; this.call.recvMessageWithContext(context); } } }
[ "function", "_read", "(", "size", ")", "{", "/* jshint validthis: true */", "if", "(", "this", ".", "finished", ")", "{", "this", ".", "push", "(", "null", ")", ";", "}", "else", "{", "if", "(", "!", "this", ".", "reading", ")", "{", "this", ".", "...
Read the next object from the stream. @private @param {*} size Ignored because we use objectMode=true
[ "Read", "the", "next", "object", "from", "the", "stream", "." ]
b36b285f4cdb334bbd48f74c12c13bec69961488
https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client.js#L247-L260
train
read the next chunk of data
[ 30522, 3853, 1035, 3191, 1006, 2946, 1007, 1063, 1013, 1008, 1046, 17426, 2102, 9398, 15222, 2015, 1024, 2995, 1008, 1013, 2065, 1006, 2023, 1012, 2736, 1007, 1063, 2023, 1012, 5245, 1006, 19701, 1007, 1025, 1065, 2842, 1063, 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...
SeleniumHQ/selenium
third_party/closure/goog/i18n/dateintervalformat.js
function( pattern, opt_dateIntervalSymbols, opt_dateTimeSymbols) { asserts.assert(goog.isDef(pattern), 'Pattern must be defined.'); asserts.assert( goog.isDef(opt_dateIntervalSymbols) || goog.isDef(dateIntervalSymbols.getDateIntervalSymbols()), 'goog.i18n.DateIntervalSymbols or explicit symbols must be defined'); asserts.assert( goog.isDef(opt_dateTimeSymbols) || goog.isDef(DateTimeSymbols), 'goog.i18n.DateTimeSymbols or explicit symbols must be defined'); /** * DateIntervalSymbols object that contains locale data required by the * formatter. * @private @const {!dateIntervalSymbols.DateIntervalSymbols} */ this.dateIntervalSymbols_ = opt_dateIntervalSymbols || dateIntervalSymbols.getDateIntervalSymbols(); /** * DateTimeSymbols object that contain locale data required by the formatter. * @private @const {!DateTimeSymbolsType} */ this.dateTimeSymbols_ = opt_dateTimeSymbols || DateTimeSymbols; /** * Date interval pattern to use. * @private @const {!dateIntervalSymbols.DateIntervalPatternMap} */ this.intervalPattern_ = this.getIntervalPattern_(pattern); /** * Keys of the available date interval patterns. Used to lookup the key that * contains a specific pattern letter (e.g. for ['Myd', 'hms'], the key that * contains 'y' is 'Myd'). * @private @const {!Array<string>} */ this.intervalPatternKeys_ = object.getKeys(this.intervalPattern_); // Remove the default pattern's key ('_') from intervalPatternKeys_. Is not // necesary when looking up for a key: when no key is found it will always // default to the default pattern. array.remove(this.intervalPatternKeys_, DEFAULT_PATTERN_KEY_); /** * Default fallback pattern to use. * @private @const {string} */ this.fallbackPattern_ = this.dateIntervalSymbols_.FALLBACK || DEFAULT_FALLBACK_PATTERN_; // Determine which date should be used with each part of the interval // pattern. var indexOfFirstDate = this.fallbackPattern_.indexOf(FIRST_DATE_PLACEHOLDER_); var indexOfSecondDate = this.fallbackPattern_.indexOf(SECOND_DATE_PLACEHOLDER_); if (indexOfFirstDate < 0 || indexOfSecondDate < 0) { throw new Error('Malformed fallback interval pattern'); } /** * True if the first date provided should be formatted with the first pattern * of the interval pattern. * @private @const {boolean} */ this.useFirstDateOnFirstPattern_ = indexOfFirstDate <= indexOfSecondDate; /** * Map that stores a Formatter_ object per calendar field. Formatters will be * instanced on demand and stored on this map until required again. * @private @const {!Object<string, !Formatter_>} */ this.formatterMap_ = {}; }
javascript
function( pattern, opt_dateIntervalSymbols, opt_dateTimeSymbols) { asserts.assert(goog.isDef(pattern), 'Pattern must be defined.'); asserts.assert( goog.isDef(opt_dateIntervalSymbols) || goog.isDef(dateIntervalSymbols.getDateIntervalSymbols()), 'goog.i18n.DateIntervalSymbols or explicit symbols must be defined'); asserts.assert( goog.isDef(opt_dateTimeSymbols) || goog.isDef(DateTimeSymbols), 'goog.i18n.DateTimeSymbols or explicit symbols must be defined'); /** * DateIntervalSymbols object that contains locale data required by the * formatter. * @private @const {!dateIntervalSymbols.DateIntervalSymbols} */ this.dateIntervalSymbols_ = opt_dateIntervalSymbols || dateIntervalSymbols.getDateIntervalSymbols(); /** * DateTimeSymbols object that contain locale data required by the formatter. * @private @const {!DateTimeSymbolsType} */ this.dateTimeSymbols_ = opt_dateTimeSymbols || DateTimeSymbols; /** * Date interval pattern to use. * @private @const {!dateIntervalSymbols.DateIntervalPatternMap} */ this.intervalPattern_ = this.getIntervalPattern_(pattern); /** * Keys of the available date interval patterns. Used to lookup the key that * contains a specific pattern letter (e.g. for ['Myd', 'hms'], the key that * contains 'y' is 'Myd'). * @private @const {!Array<string>} */ this.intervalPatternKeys_ = object.getKeys(this.intervalPattern_); // Remove the default pattern's key ('_') from intervalPatternKeys_. Is not // necesary when looking up for a key: when no key is found it will always // default to the default pattern. array.remove(this.intervalPatternKeys_, DEFAULT_PATTERN_KEY_); /** * Default fallback pattern to use. * @private @const {string} */ this.fallbackPattern_ = this.dateIntervalSymbols_.FALLBACK || DEFAULT_FALLBACK_PATTERN_; // Determine which date should be used with each part of the interval // pattern. var indexOfFirstDate = this.fallbackPattern_.indexOf(FIRST_DATE_PLACEHOLDER_); var indexOfSecondDate = this.fallbackPattern_.indexOf(SECOND_DATE_PLACEHOLDER_); if (indexOfFirstDate < 0 || indexOfSecondDate < 0) { throw new Error('Malformed fallback interval pattern'); } /** * True if the first date provided should be formatted with the first pattern * of the interval pattern. * @private @const {boolean} */ this.useFirstDateOnFirstPattern_ = indexOfFirstDate <= indexOfSecondDate; /** * Map that stores a Formatter_ object per calendar field. Formatters will be * instanced on demand and stored on this map until required again. * @private @const {!Object<string, !Formatter_>} */ this.formatterMap_ = {}; }
[ "function", "(", "pattern", ",", "opt_dateIntervalSymbols", ",", "opt_dateTimeSymbols", ")", "{", "asserts", ".", "assert", "(", "goog", ".", "isDef", "(", "pattern", ")", ",", "'Pattern must be defined.'", ")", ";", "asserts", ".", "assert", "(", "goog", ".",...
Constructs a DateIntervalFormat object based on the current locale. @param {number|!dateIntervalSymbols.DateIntervalPatternMap} pattern Pattern specification or pattern object. @param {!dateIntervalSymbols.DateIntervalSymbols=} opt_dateIntervalSymbols Optional DateIntervalSymbols to use for this instance rather than the global symbols. @param {!DateTimeSymbolsType=} opt_dateTimeSymbols Optional DateTimeSymbols to use for this instance rather than the global symbols. @constructor @struct @final
[ "Constructs", "a", "DateIntervalFormat", "object", "based", "on", "the", "current", "locale", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/i18n/dateintervalformat.js#L80-L153
train
A date interval pattern that can be used to format a date.
[ 30522, 3853, 1006, 5418, 1010, 23569, 1035, 3058, 18447, 2121, 10175, 6508, 13344, 4877, 1010, 23569, 1035, 3058, 7292, 6508, 13344, 4877, 1007, 1063, 19514, 1012, 20865, 1006, 27571, 2290, 1012, 2003, 3207, 2546, 1006, 5418, 1007, 1010, 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...
select2/select2
src/js/select2/i18n/hr.js
character
function character (n) { var message = ' ' + n + ' znak'; if (n % 10 < 5 && n % 10 > 0 && (n % 100 < 5 || n % 100 > 19)) { if (n % 10 > 1) { message += 'a'; } } else { message += 'ova'; } return message; }
javascript
function character (n) { var message = ' ' + n + ' znak'; if (n % 10 < 5 && n % 10 > 0 && (n % 100 < 5 || n % 100 > 19)) { if (n % 10 > 1) { message += 'a'; } } else { message += 'ova'; } return message; }
[ "function", "character", "(", "n", ")", "{", "var", "message", "=", "' '", "+", "n", "+", "' znak'", ";", "if", "(", "n", "%", "10", "<", "5", "&&", "n", "%", "10", ">", "0", "&&", "(", "n", "%", "100", "<", "5", "||", "n", "%", "100", ">...
Croatian
[ "Croatian" ]
04fce559673684af8ec2912457a9d6380ea90314
https://github.com/select2/select2/blob/04fce559673684af8ec2912457a9d6380ea90314/src/js/select2/i18n/hr.js#L3-L15
train
character helper function
[ 30522, 3853, 2839, 1006, 1050, 1007, 1063, 13075, 4471, 1027, 1005, 1005, 1009, 1050, 1009, 1005, 1062, 2532, 2243, 1005, 1025, 2065, 1006, 1050, 1003, 2184, 1026, 1019, 1004, 1004, 1050, 1003, 2184, 1028, 1014, 1004, 1004, 1006, 1050, 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.ux3/src/sap/ui/ux3/ExactList.js
function(oList, bArrow){ function getNextOnSameLevel(oLst){ var oParent = oLst.getParent(); var aParentSubLists = oParent.getSubLists(); var idx = oParent.indexOfSubList(oLst) + 1; if (idx < aParentSubLists.length) { return aParentSubLists[idx]; } return null; } function getFirstChild(oLst){ var aSubLists = oLst.getSubLists(); if (aSubLists.length > 0) { return aSubLists[0]; } return null; } function getNext(oLst){ var oNextListRef = getNextOnSameLevel(oLst); if (oNextListRef) { return oNextListRef; } var oParent = oLst.getParent(); if (oParent._iLevel > (bArrow ? 1 : 0)) { return getNext(oParent); } else { return null; } } if (oList._iLevel == 0) { return getFirstChild(oList); } else if (oList._iLevel == 1) { return bArrow ? getFirstChild(oList) : getNextOnSameLevel(oList); } else if (oList._iLevel > 1) { var oNextList = getFirstChild(oList); if (oNextList) { return oNextList; } return getNext(oList); } return null; }
javascript
function(oList, bArrow){ function getNextOnSameLevel(oLst){ var oParent = oLst.getParent(); var aParentSubLists = oParent.getSubLists(); var idx = oParent.indexOfSubList(oLst) + 1; if (idx < aParentSubLists.length) { return aParentSubLists[idx]; } return null; } function getFirstChild(oLst){ var aSubLists = oLst.getSubLists(); if (aSubLists.length > 0) { return aSubLists[0]; } return null; } function getNext(oLst){ var oNextListRef = getNextOnSameLevel(oLst); if (oNextListRef) { return oNextListRef; } var oParent = oLst.getParent(); if (oParent._iLevel > (bArrow ? 1 : 0)) { return getNext(oParent); } else { return null; } } if (oList._iLevel == 0) { return getFirstChild(oList); } else if (oList._iLevel == 1) { return bArrow ? getFirstChild(oList) : getNextOnSameLevel(oList); } else if (oList._iLevel > 1) { var oNextList = getFirstChild(oList); if (oNextList) { return oNextList; } return getNext(oList); } return null; }
[ "function", "(", "oList", ",", "bArrow", ")", "{", "function", "getNextOnSameLevel", "(", "oLst", ")", "{", "var", "oParent", "=", "oLst", ".", "getParent", "(", ")", ";", "var", "aParentSubLists", "=", "oParent", ".", "getSubLists", "(", ")", ";", "var"...
Returns the successor of the given list based on the level and whether TAB or the arrow keys are used
[ "Returns", "the", "successor", "of", "the", "given", "list", "based", "on", "the", "level", "and", "whether", "TAB", "or", "the", "arrow", "keys", "are", "used" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js#L960-L1005
train
Returns the next sibling of the given list
[ 30522, 3853, 1006, 19330, 2923, 1010, 15355, 1007, 1063, 3853, 2131, 2638, 14226, 21559, 12260, 15985, 1006, 19330, 3367, 1007, 1063, 13075, 6728, 12069, 3372, 1027, 19330, 3367, 1012, 2131, 19362, 4765, 1006, 1007, 1025, 13075, 9706, 12069, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/language/HTMLDOMDiff.js
function () { // This check looks a little strange, but it suits what we're trying // to do: as we're walking through the children, a child node that has moved // from one parent to another will be found but would look like some kind // of insert. The check that we're doing here is looking up the current // child's ID in the *old* map and seeing if this child used to have a // different parent. var possiblyMovedElement = oldNodeMap[newChild.tagID]; if (possiblyMovedElement && newParent.tagID !== getParentID(possiblyMovedElement)) { newEdit = { type: "elementMove", tagID: newChild.tagID, parentID: newChild.parent.tagID }; moves.push(newEdit.tagID); newEdits.push(newEdit); // this element in the new tree was a move to this spot, so we can move // on to the next child in the new tree. newIndex++; return true; } return false; }
javascript
function () { // This check looks a little strange, but it suits what we're trying // to do: as we're walking through the children, a child node that has moved // from one parent to another will be found but would look like some kind // of insert. The check that we're doing here is looking up the current // child's ID in the *old* map and seeing if this child used to have a // different parent. var possiblyMovedElement = oldNodeMap[newChild.tagID]; if (possiblyMovedElement && newParent.tagID !== getParentID(possiblyMovedElement)) { newEdit = { type: "elementMove", tagID: newChild.tagID, parentID: newChild.parent.tagID }; moves.push(newEdit.tagID); newEdits.push(newEdit); // this element in the new tree was a move to this spot, so we can move // on to the next child in the new tree. newIndex++; return true; } return false; }
[ "function", "(", ")", "{", "// This check looks a little strange, but it suits what we're trying", "// to do: as we're walking through the children, a child node that has moved", "// from one parent to another will be found but would look like some kind", "// of insert. The check that we're doing here...
Adds an elementMove edit if the parent has changed between the old and new trees. These are fairly infrequent and generally occur if you make a change across tag boundaries. @return {boolean} true if an elementMove was generated
[ "Adds", "an", "elementMove", "edit", "if", "the", "parent", "has", "changed", "between", "the", "old", "and", "new", "trees", ".", "These", "are", "fairly", "infrequent", "and", "generally", "occur", "if", "you", "make", "a", "change", "across", "tag", "bo...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/HTMLDOMDiff.js#L318-L343
train
This function is called when a node is moved to another node. It is called when a node is moved to another node.
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 2023, 4638, 3504, 1037, 2210, 4326, 1010, 2021, 2009, 11072, 2054, 2057, 1005, 2128, 2667, 1013, 1013, 2000, 2079, 1024, 2004, 2057, 1005, 2128, 3788, 2083, 1996, 2336, 1010, 1037, 2775, 13045, 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...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/utils.js
getProperty
function getProperty(url, prefName) { var sbs = Cc["@mozilla.org/intl/stringbundle;1"] .getService(Ci.nsIStringBundleService); var bundle = sbs.createBundle(url); try { return bundle.GetStringFromName(prefName); } catch (ex) { throw new Error(arguments.callee.name + ": Unknown property - " + prefName); } }
javascript
function getProperty(url, prefName) { var sbs = Cc["@mozilla.org/intl/stringbundle;1"] .getService(Ci.nsIStringBundleService); var bundle = sbs.createBundle(url); try { return bundle.GetStringFromName(prefName); } catch (ex) { throw new Error(arguments.callee.name + ": Unknown property - " + prefName); } }
[ "function", "getProperty", "(", "url", ",", "prefName", ")", "{", "var", "sbs", "=", "Cc", "[", "\"@mozilla.org/intl/stringbundle;1\"", "]", ".", "getService", "(", "Ci", ".", "nsIStringBundleService", ")", ";", "var", "bundle", "=", "sbs", ".", "createBundle"...
Returns the value of an individual property. @param {string} url URL of the string bundle. @param {string} prefName The property to get the value of. @return The value of the requested property @type string
[ "Returns", "the", "value", "of", "an", "individual", "property", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/utils.js#L348-L358
train
Get the value of a specific property
[ 30522, 3853, 2131, 21572, 4842, 3723, 1006, 24471, 2140, 1010, 3653, 2546, 18442, 1007, 1063, 13075, 21342, 1027, 10507, 1031, 1000, 1030, 9587, 5831, 4571, 1012, 8917, 1013, 20014, 2140, 1013, 5164, 27265, 2571, 1025, 1015, 1000, 1033, 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...
openlayers/openlayers
examples/shaded-relief.js
shade
function shade(inputs, data) { const elevationImage = inputs[0]; const width = elevationImage.width; const height = elevationImage.height; const elevationData = elevationImage.data; const shadeData = new Uint8ClampedArray(elevationData.length); const dp = data.resolution * 2; const maxX = width - 1; const maxY = height - 1; const pixel = [0, 0, 0, 0]; const twoPi = 2 * Math.PI; const halfPi = Math.PI / 2; const sunEl = Math.PI * data.sunEl / 180; const sunAz = Math.PI * data.sunAz / 180; const cosSunEl = Math.cos(sunEl); const sinSunEl = Math.sin(sunEl); let pixelX, pixelY, x0, x1, y0, y1, offset, z0, z1, dzdx, dzdy, slope, aspect, cosIncidence, scaled; for (pixelY = 0; pixelY <= maxY; ++pixelY) { y0 = pixelY === 0 ? 0 : pixelY - 1; y1 = pixelY === maxY ? maxY : pixelY + 1; for (pixelX = 0; pixelX <= maxX; ++pixelX) { x0 = pixelX === 0 ? 0 : pixelX - 1; x1 = pixelX === maxX ? maxX : pixelX + 1; // determine elevation for (x0, pixelY) offset = (pixelY * width + x0) * 4; pixel[0] = elevationData[offset]; pixel[1] = elevationData[offset + 1]; pixel[2] = elevationData[offset + 2]; pixel[3] = elevationData[offset + 3]; z0 = data.vert * (pixel[0] + pixel[1] * 2 + pixel[2] * 3); // determine elevation for (x1, pixelY) offset = (pixelY * width + x1) * 4; pixel[0] = elevationData[offset]; pixel[1] = elevationData[offset + 1]; pixel[2] = elevationData[offset + 2]; pixel[3] = elevationData[offset + 3]; z1 = data.vert * (pixel[0] + pixel[1] * 2 + pixel[2] * 3); dzdx = (z1 - z0) / dp; // determine elevation for (pixelX, y0) offset = (y0 * width + pixelX) * 4; pixel[0] = elevationData[offset]; pixel[1] = elevationData[offset + 1]; pixel[2] = elevationData[offset + 2]; pixel[3] = elevationData[offset + 3]; z0 = data.vert * (pixel[0] + pixel[1] * 2 + pixel[2] * 3); // determine elevation for (pixelX, y1) offset = (y1 * width + pixelX) * 4; pixel[0] = elevationData[offset]; pixel[1] = elevationData[offset + 1]; pixel[2] = elevationData[offset + 2]; pixel[3] = elevationData[offset + 3]; z1 = data.vert * (pixel[0] + pixel[1] * 2 + pixel[2] * 3); dzdy = (z1 - z0) / dp; slope = Math.atan(Math.sqrt(dzdx * dzdx + dzdy * dzdy)); aspect = Math.atan2(dzdy, -dzdx); if (aspect < 0) { aspect = halfPi - aspect; } else if (aspect > halfPi) { aspect = twoPi - aspect + halfPi; } else { aspect = halfPi - aspect; } cosIncidence = sinSunEl * Math.cos(slope) + cosSunEl * Math.sin(slope) * Math.cos(sunAz - aspect); offset = (pixelY * width + pixelX) * 4; scaled = 255 * cosIncidence; shadeData[offset] = scaled; shadeData[offset + 1] = scaled; shadeData[offset + 2] = scaled; shadeData[offset + 3] = elevationData[offset + 3]; } } return {data: shadeData, width: width, height: height}; }
javascript
function shade(inputs, data) { const elevationImage = inputs[0]; const width = elevationImage.width; const height = elevationImage.height; const elevationData = elevationImage.data; const shadeData = new Uint8ClampedArray(elevationData.length); const dp = data.resolution * 2; const maxX = width - 1; const maxY = height - 1; const pixel = [0, 0, 0, 0]; const twoPi = 2 * Math.PI; const halfPi = Math.PI / 2; const sunEl = Math.PI * data.sunEl / 180; const sunAz = Math.PI * data.sunAz / 180; const cosSunEl = Math.cos(sunEl); const sinSunEl = Math.sin(sunEl); let pixelX, pixelY, x0, x1, y0, y1, offset, z0, z1, dzdx, dzdy, slope, aspect, cosIncidence, scaled; for (pixelY = 0; pixelY <= maxY; ++pixelY) { y0 = pixelY === 0 ? 0 : pixelY - 1; y1 = pixelY === maxY ? maxY : pixelY + 1; for (pixelX = 0; pixelX <= maxX; ++pixelX) { x0 = pixelX === 0 ? 0 : pixelX - 1; x1 = pixelX === maxX ? maxX : pixelX + 1; // determine elevation for (x0, pixelY) offset = (pixelY * width + x0) * 4; pixel[0] = elevationData[offset]; pixel[1] = elevationData[offset + 1]; pixel[2] = elevationData[offset + 2]; pixel[3] = elevationData[offset + 3]; z0 = data.vert * (pixel[0] + pixel[1] * 2 + pixel[2] * 3); // determine elevation for (x1, pixelY) offset = (pixelY * width + x1) * 4; pixel[0] = elevationData[offset]; pixel[1] = elevationData[offset + 1]; pixel[2] = elevationData[offset + 2]; pixel[3] = elevationData[offset + 3]; z1 = data.vert * (pixel[0] + pixel[1] * 2 + pixel[2] * 3); dzdx = (z1 - z0) / dp; // determine elevation for (pixelX, y0) offset = (y0 * width + pixelX) * 4; pixel[0] = elevationData[offset]; pixel[1] = elevationData[offset + 1]; pixel[2] = elevationData[offset + 2]; pixel[3] = elevationData[offset + 3]; z0 = data.vert * (pixel[0] + pixel[1] * 2 + pixel[2] * 3); // determine elevation for (pixelX, y1) offset = (y1 * width + pixelX) * 4; pixel[0] = elevationData[offset]; pixel[1] = elevationData[offset + 1]; pixel[2] = elevationData[offset + 2]; pixel[3] = elevationData[offset + 3]; z1 = data.vert * (pixel[0] + pixel[1] * 2 + pixel[2] * 3); dzdy = (z1 - z0) / dp; slope = Math.atan(Math.sqrt(dzdx * dzdx + dzdy * dzdy)); aspect = Math.atan2(dzdy, -dzdx); if (aspect < 0) { aspect = halfPi - aspect; } else if (aspect > halfPi) { aspect = twoPi - aspect + halfPi; } else { aspect = halfPi - aspect; } cosIncidence = sinSunEl * Math.cos(slope) + cosSunEl * Math.sin(slope) * Math.cos(sunAz - aspect); offset = (pixelY * width + pixelX) * 4; scaled = 255 * cosIncidence; shadeData[offset] = scaled; shadeData[offset + 1] = scaled; shadeData[offset + 2] = scaled; shadeData[offset + 3] = elevationData[offset + 3]; } } return {data: shadeData, width: width, height: height}; }
[ "function", "shade", "(", "inputs", ",", "data", ")", "{", "const", "elevationImage", "=", "inputs", "[", "0", "]", ";", "const", "width", "=", "elevationImage", ".", "width", ";", "const", "height", "=", "elevationImage", ".", "height", ";", "const", "e...
Generates a shaded relief image given elevation data. Uses a 3x3 neighborhood for determining slope and aspect. @param {Array<ImageData>} inputs Array of input images. @param {Object} data Data added in the "beforeoperations" event. @return {ImageData} Output image.
[ "Generates", "a", "shaded", "relief", "image", "given", "elevation", "data", ".", "Uses", "a", "3x3", "neighborhood", "for", "determining", "slope", "and", "aspect", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/shaded-relief.js#L14-L99
train
Compute the shade of the image
[ 30522, 3853, 8703, 1006, 20407, 1010, 2951, 1007, 1063, 9530, 3367, 6678, 9581, 3351, 1027, 20407, 1031, 1014, 1033, 1025, 9530, 3367, 9381, 1027, 6678, 9581, 3351, 1012, 9381, 1025, 9530, 3367, 4578, 1027, 6678, 9581, 3351, 1012, 4578, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function() { // skip loading includes once already loaded if (this._bIncludesLoaded) { return; } var mResources = this.getEntry("/sap.ui5/resources"); if (!mResources) { return; } var sComponentName = this.getComponentName(); // load JS files var aJSResources = mResources["js"]; if (aJSResources) { for (var i = 0; i < aJSResources.length; i++) { var oJSResource = aJSResources[i]; var sFile = oJSResource.uri; if (sFile) { // load javascript file var m = sFile.match(/\.js$/i); if (m) { //var sJsUrl = this.resolveUri(sFile.slice(0, m.index)); var sJsUrl = sComponentName.replace(/\./g, '/') + (sFile.slice(0, 1) === '/' ? '' : '/') + sFile.slice(0, m.index); Log.info("Component \"" + sComponentName + "\" is loading JS: \"" + sJsUrl + "\""); // call internal sap.ui.require variant that accepts a requireJS path and loads the module synchronously sap.ui.requireSync(sJsUrl); } } } } // include CSS files var aCSSResources = mResources["css"]; if (aCSSResources) { for (var j = 0; j < aCSSResources.length; j++) { var oCSSResource = aCSSResources[j]; if (oCSSResource.uri) { var sCssUrl = this.resolveUri(oCSSResource.uri); Log.info("Component \"" + sComponentName + "\" is loading CSS: \"" + sCssUrl + "\""); includeStylesheet(sCssUrl, { id: oCSSResource.id, "data-sap-ui-manifest-uid": this._uid }); } } } this._bIncludesLoaded = true; }
javascript
function() { // skip loading includes once already loaded if (this._bIncludesLoaded) { return; } var mResources = this.getEntry("/sap.ui5/resources"); if (!mResources) { return; } var sComponentName = this.getComponentName(); // load JS files var aJSResources = mResources["js"]; if (aJSResources) { for (var i = 0; i < aJSResources.length; i++) { var oJSResource = aJSResources[i]; var sFile = oJSResource.uri; if (sFile) { // load javascript file var m = sFile.match(/\.js$/i); if (m) { //var sJsUrl = this.resolveUri(sFile.slice(0, m.index)); var sJsUrl = sComponentName.replace(/\./g, '/') + (sFile.slice(0, 1) === '/' ? '' : '/') + sFile.slice(0, m.index); Log.info("Component \"" + sComponentName + "\" is loading JS: \"" + sJsUrl + "\""); // call internal sap.ui.require variant that accepts a requireJS path and loads the module synchronously sap.ui.requireSync(sJsUrl); } } } } // include CSS files var aCSSResources = mResources["css"]; if (aCSSResources) { for (var j = 0; j < aCSSResources.length; j++) { var oCSSResource = aCSSResources[j]; if (oCSSResource.uri) { var sCssUrl = this.resolveUri(oCSSResource.uri); Log.info("Component \"" + sComponentName + "\" is loading CSS: \"" + sCssUrl + "\""); includeStylesheet(sCssUrl, { id: oCSSResource.id, "data-sap-ui-manifest-uid": this._uid }); } } } this._bIncludesLoaded = true; }
[ "function", "(", ")", "{", "// skip loading includes once already loaded", "if", "(", "this", ".", "_bIncludesLoaded", ")", "{", "return", ";", "}", "var", "mResources", "=", "this", ".", "getEntry", "(", "\"/sap.ui5/resources\"", ")", ";", "if", "(", "!", "mR...
Loads the included CSS and JavaScript resources. The resources will be resolved relative to the component location. @private
[ "Loads", "the", "included", "CSS", "and", "JavaScript", "resources", ".", "The", "resources", "will", "be", "resolved", "relative", "to", "the", "component", "location", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L397-L450
train
Loads all includes from the component s resources
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 13558, 10578, 2950, 2320, 2525, 8209, 2065, 1006, 2023, 1012, 1035, 8026, 20464, 22087, 17468, 1007, 1063, 2709, 1025, 1065, 13075, 2720, 2229, 8162, 9623, 1027, 2023, 1012, 2131, 4765, 2854, 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...
adobe/brackets
src/extensions/default/CodeFolding/Prefs.js
inflate
function inflate(folds) { if (!folds) { return; } //transform the folds into objects with from and to properties var ranges = {}, obj; Object.keys(folds).forEach(function (line) { obj = folds[line]; ranges[line] = {from: {line: obj[0][0], ch: obj[0][1]}, to: {line: obj[1][0], ch: obj[1][1]}}; }); return ranges; }
javascript
function inflate(folds) { if (!folds) { return; } //transform the folds into objects with from and to properties var ranges = {}, obj; Object.keys(folds).forEach(function (line) { obj = folds[line]; ranges[line] = {from: {line: obj[0][0], ch: obj[0][1]}, to: {line: obj[1][0], ch: obj[1][1]}}; }); return ranges; }
[ "function", "inflate", "(", "folds", ")", "{", "if", "(", "!", "folds", ")", "{", "return", ";", "}", "//transform the folds into objects with from and to properties", "var", "ranges", "=", "{", "}", ",", "obj", ";", "Object", ".", "keys", "(", "folds", ")",...
Inflates the fold ranges stored as simplified numeric arrays. The inflation converts the data into objects whose keys are line numbers and whose values are objects in the format {from: {line, ch}, to: {line, ch}}. @param {Object} folds the simplified fold ranges @return {Object} the converted fold ranges
[ "Inflates", "the", "fold", "ranges", "stored", "as", "simplified", "numeric", "arrays", ".", "The", "inflation", "converts", "the", "data", "into", "objects", "whose", "keys", "are", "line", "numbers", "and", "whose", "values", "are", "objects", "in", "the", ...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/Prefs.js#L67-L79
train
inflate the folds into a single object with from and to properties
[ 30522, 3853, 1999, 10258, 3686, 1006, 15439, 1007, 1063, 2065, 1006, 999, 15439, 1007, 1063, 2709, 1025, 1065, 1013, 1013, 10938, 1996, 15439, 2046, 5200, 2007, 2013, 1998, 2000, 5144, 13075, 8483, 1027, 1063, 1065, 1010, 27885, 3501, 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/space-unary-ops.js
checkForSpaces
function checkForSpaces(node) { const tokens = node.type === "UpdateExpression" && !node.prefix ? sourceCode.getLastTokens(node, 2) : sourceCode.getFirstTokens(node, 2); const firstToken = tokens[0]; const secondToken = tokens[1]; if ((node.type === "NewExpression" || node.prefix) && firstToken.type === "Keyword") { checkUnaryWordOperatorForSpaces(node, firstToken, secondToken, firstToken.value); return; } const operator = node.prefix ? tokens[0].value : tokens[1].value; if (overrideExistsForOperator(operator)) { if (overrideEnforcesSpaces(operator)) { verifyNonWordsHaveSpaces(node, firstToken, secondToken); } else { verifyNonWordsDontHaveSpaces(node, firstToken, secondToken); } } else if (options.nonwords) { verifyNonWordsHaveSpaces(node, firstToken, secondToken); } else { verifyNonWordsDontHaveSpaces(node, firstToken, secondToken); } }
javascript
function checkForSpaces(node) { const tokens = node.type === "UpdateExpression" && !node.prefix ? sourceCode.getLastTokens(node, 2) : sourceCode.getFirstTokens(node, 2); const firstToken = tokens[0]; const secondToken = tokens[1]; if ((node.type === "NewExpression" || node.prefix) && firstToken.type === "Keyword") { checkUnaryWordOperatorForSpaces(node, firstToken, secondToken, firstToken.value); return; } const operator = node.prefix ? tokens[0].value : tokens[1].value; if (overrideExistsForOperator(operator)) { if (overrideEnforcesSpaces(operator)) { verifyNonWordsHaveSpaces(node, firstToken, secondToken); } else { verifyNonWordsDontHaveSpaces(node, firstToken, secondToken); } } else if (options.nonwords) { verifyNonWordsHaveSpaces(node, firstToken, secondToken); } else { verifyNonWordsDontHaveSpaces(node, firstToken, secondToken); } }
[ "function", "checkForSpaces", "(", "node", ")", "{", "const", "tokens", "=", "node", ".", "type", "===", "\"UpdateExpression\"", "&&", "!", "node", ".", "prefix", "?", "sourceCode", ".", "getLastTokens", "(", "node", ",", "2", ")", ":", "sourceCode", ".", ...
Verifies UnaryExpression, UpdateExpression and NewExpression satisfy spacing requirements @param {ASTnode} node AST node @returns {void}
[ "Verifies", "UnaryExpression", "UpdateExpression", "and", "NewExpression", "satisfy", "spacing", "requirements" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-unary-ops.js#L281-L306
train
Checks if a node has spaces
[ 30522, 3853, 4638, 29278, 23058, 2015, 1006, 13045, 1007, 1063, 9530, 3367, 19204, 2015, 1027, 13045, 1012, 2828, 1027, 1027, 1027, 1000, 10651, 10288, 20110, 3258, 1000, 1004, 1004, 999, 13045, 1012, 17576, 1029, 3120, 16044, 1012, 2131, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
moment/luxon
site/demo/demo.js
demo
function demo(luxon) { var DateTime = luxon.DateTime, Duration = luxon.Duration, Info = luxon.Info, examples = [], run = function(code) { var result; try { // eslint-disable-next-line no-eval result = eval(code); } catch (e) { console.error(e); return "[error]"; } switch (true) { case result.isValid === false: return "Invalid"; case result instanceof DateTime: return "[ DateTime " + result.toISO() + " ]"; case result instanceof Duration: return "[ Duration " + JSON.stringify(result.toObject()) + " ]"; default: return JSON.stringify(result); } }, example = function(code) { examples.push( "<tr class='example'><td class='code'>" + code + "</td><td class='divider'>//=> </td><td class='result'>" + run(code) + "</td></tr>" ); }; example("Info.features()"); example("DateTime.local()"); example("DateTime.local(2017, 5, 15, 17, 36)"); example("DateTime.utc(2017, 5, 15, 17, 36)"); example("DateTime.local().toUTC()"); example("DateTime.utc(2017, 5, 15, 17, 36).toLocal()"); example("DateTime.local().toObject()"); example("DateTime.fromObject({year: 2017, month: 5, day: 15, hour: 17, minute: 36})"); example( "DateTime.fromObject({year: 2017, month: 5, day: 15, hour: 17, minute: 36, zone: 'America/New_York' })" ); example( "DateTime.fromObject({year: 2017, month: 5, day: 15, hour: 17, minute: 36, zone: 'Asia/Singapore' })" ); example("DateTime.local().plus({minutes: 15, seconds: 8})"); example("DateTime.local().plus({days: 6})"); example("DateTime.local().minus({days: 6})"); example("DateTime.local().diff(DateTime.local(1982, 5, 25)).milliseconds"); example("DateTime.local().diff(DateTime.local(1982, 5, 25), 'days').days"); example("DateTime.local().diff(DateTime.local(1982, 5, 25), ['days', 'hours'])"); example("DateTime.local().toLocaleString()"); example("DateTime.local().setLocale('zh').toLocaleString()"); example("DateTime.local().toLocaleString(DateTime.DATE_MED)"); example("DateTime.local().setLocale('zh').toLocaleString(DateTime.DATE_MED)"); example("DateTime.local().setLocale('fr').toLocaleString(DateTime.DATE_FULL)"); example("DateTime.fromISO('2017-05-15')"); example("DateTime.fromISO('2017-05-15T17:36')"); example("DateTime.fromISO('2017-W33-4')"); example("DateTime.fromISO('2017-W33-4T04:45:32.343')"); example("DateTime.fromFormat('12-16-2017', 'MM-dd-yyyy')"); example("DateTime.local().toFormat('MM-dd-yyyy')"); example("DateTime.local().toFormat('MMMM dd, yyyy')"); example("DateTime.local().setLocale('fr').toFormat('MMMM dd, yyyy')"); example("DateTime.fromFormat('May 25, 1982', 'MMMM dd, yyyy')"); example("DateTime.fromFormat('mai 25, 1982', 'MMMM dd, yyyy', { locale: 'fr' })"); example("DateTime.local().plus({ days: 1 }).toRelativeCalendar()"); example("DateTime.local().plus({ days: -1 }).toRelativeCalendar()"); example("DateTime.local().plus({ months: 1 }).toRelativeCalendar()"); example("DateTime.local().setLocale('fr').plus({ days: 1 }).toRelativeCalendar()"); example("DateTime.local().setLocale('fr').plus({ days: -1 }).toRelativeCalendar()"); example("DateTime.local().setLocale('fr').plus({ months: 1 }).toRelativeCalendar()"); var all = "<h1>Some Luxon examples</h1>"; all += "<p>This is not meant to be a comprehensive showcase of Luxon's capabilities, just a quick flavoring.</p>"; all += "<table>"; all += examples.join(""); all += "</table>"; document.body.innerHTML = all; }
javascript
function demo(luxon) { var DateTime = luxon.DateTime, Duration = luxon.Duration, Info = luxon.Info, examples = [], run = function(code) { var result; try { // eslint-disable-next-line no-eval result = eval(code); } catch (e) { console.error(e); return "[error]"; } switch (true) { case result.isValid === false: return "Invalid"; case result instanceof DateTime: return "[ DateTime " + result.toISO() + " ]"; case result instanceof Duration: return "[ Duration " + JSON.stringify(result.toObject()) + " ]"; default: return JSON.stringify(result); } }, example = function(code) { examples.push( "<tr class='example'><td class='code'>" + code + "</td><td class='divider'>//=> </td><td class='result'>" + run(code) + "</td></tr>" ); }; example("Info.features()"); example("DateTime.local()"); example("DateTime.local(2017, 5, 15, 17, 36)"); example("DateTime.utc(2017, 5, 15, 17, 36)"); example("DateTime.local().toUTC()"); example("DateTime.utc(2017, 5, 15, 17, 36).toLocal()"); example("DateTime.local().toObject()"); example("DateTime.fromObject({year: 2017, month: 5, day: 15, hour: 17, minute: 36})"); example( "DateTime.fromObject({year: 2017, month: 5, day: 15, hour: 17, minute: 36, zone: 'America/New_York' })" ); example( "DateTime.fromObject({year: 2017, month: 5, day: 15, hour: 17, minute: 36, zone: 'Asia/Singapore' })" ); example("DateTime.local().plus({minutes: 15, seconds: 8})"); example("DateTime.local().plus({days: 6})"); example("DateTime.local().minus({days: 6})"); example("DateTime.local().diff(DateTime.local(1982, 5, 25)).milliseconds"); example("DateTime.local().diff(DateTime.local(1982, 5, 25), 'days').days"); example("DateTime.local().diff(DateTime.local(1982, 5, 25), ['days', 'hours'])"); example("DateTime.local().toLocaleString()"); example("DateTime.local().setLocale('zh').toLocaleString()"); example("DateTime.local().toLocaleString(DateTime.DATE_MED)"); example("DateTime.local().setLocale('zh').toLocaleString(DateTime.DATE_MED)"); example("DateTime.local().setLocale('fr').toLocaleString(DateTime.DATE_FULL)"); example("DateTime.fromISO('2017-05-15')"); example("DateTime.fromISO('2017-05-15T17:36')"); example("DateTime.fromISO('2017-W33-4')"); example("DateTime.fromISO('2017-W33-4T04:45:32.343')"); example("DateTime.fromFormat('12-16-2017', 'MM-dd-yyyy')"); example("DateTime.local().toFormat('MM-dd-yyyy')"); example("DateTime.local().toFormat('MMMM dd, yyyy')"); example("DateTime.local().setLocale('fr').toFormat('MMMM dd, yyyy')"); example("DateTime.fromFormat('May 25, 1982', 'MMMM dd, yyyy')"); example("DateTime.fromFormat('mai 25, 1982', 'MMMM dd, yyyy', { locale: 'fr' })"); example("DateTime.local().plus({ days: 1 }).toRelativeCalendar()"); example("DateTime.local().plus({ days: -1 }).toRelativeCalendar()"); example("DateTime.local().plus({ months: 1 }).toRelativeCalendar()"); example("DateTime.local().setLocale('fr').plus({ days: 1 }).toRelativeCalendar()"); example("DateTime.local().setLocale('fr').plus({ days: -1 }).toRelativeCalendar()"); example("DateTime.local().setLocale('fr').plus({ months: 1 }).toRelativeCalendar()"); var all = "<h1>Some Luxon examples</h1>"; all += "<p>This is not meant to be a comprehensive showcase of Luxon's capabilities, just a quick flavoring.</p>"; all += "<table>"; all += examples.join(""); all += "</table>"; document.body.innerHTML = all; }
[ "function", "demo", "(", "luxon", ")", "{", "var", "DateTime", "=", "luxon", ".", "DateTime", ",", "Duration", "=", "luxon", ".", "Duration", ",", "Info", "=", "luxon", ".", "Info", ",", "examples", "=", "[", "]", ",", "run", "=", "function", "(", ...
/* eslint-disable no-undef
[ "/", "*", "eslint", "-", "disable", "no", "-", "undef" ]
236f2badea297ee73421aa39a83e06177c1be6d0
https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/site/demo/demo.js#L2-L88
train
This demo is a bit of a hack to make the code more readable
[ 30522, 3853, 9703, 1006, 28359, 2239, 1007, 1063, 13075, 3058, 7292, 1027, 28359, 2239, 1012, 3058, 7292, 1010, 9367, 1027, 28359, 2239, 1012, 9367, 1010, 18558, 1027, 28359, 2239, 1012, 18558, 1010, 4973, 1027, 1031, 1033, 1010, 2448, 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
docs/app/js/demoInclude.js
handleDemoStyles
function handleDemoStyles() { return $q.all(files.css.map(function(file) { return file.contentsPromise; })) .then(function(styles) { styles = styles.join('\n'); // join styles as one string var styleElement = angular.element('<style>' + styles + '</style>'); document.body.appendChild(styleElement[0]); scope.$on('$destroy', function() { styleElement.remove(); }); }); }
javascript
function handleDemoStyles() { return $q.all(files.css.map(function(file) { return file.contentsPromise; })) .then(function(styles) { styles = styles.join('\n'); // join styles as one string var styleElement = angular.element('<style>' + styles + '</style>'); document.body.appendChild(styleElement[0]); scope.$on('$destroy', function() { styleElement.remove(); }); }); }
[ "function", "handleDemoStyles", "(", ")", "{", "return", "$q", ".", "all", "(", "files", ".", "css", ".", "map", "(", "function", "(", "file", ")", "{", "return", "file", ".", "contentsPromise", ";", "}", ")", ")", ".", "then", "(", "function", "(", ...
Fetch the demo styles, and append them to the DOM.
[ "Fetch", "the", "demo", "styles", "and", "append", "them", "to", "the", "DOM", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/app/js/demoInclude.js#L66-L81
train
Handle demo styles
[ 30522, 3853, 8971, 6633, 14122, 26274, 1006, 1007, 1063, 2709, 1002, 1053, 1012, 2035, 1006, 6764, 1012, 20116, 2015, 1012, 4949, 1006, 3853, 1006, 5371, 1007, 1063, 2709, 5371, 1012, 8417, 21572, 28732, 1025, 1065, 1007, 1007, 1012, 2059, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-extra-parens.js
report
function report(node) { const leftParenToken = sourceCode.getTokenBefore(node); const rightParenToken = sourceCode.getTokenAfter(node); if (!isParenthesisedTwice(node)) { if (tokensToIgnore.has(sourceCode.getFirstToken(node))) { return; } if (isIIFE(node) && !isParenthesised(node.callee)) { return; } } context.report({ node, loc: leftParenToken.loc.start, messageId: "unexpected", fix(fixer) { const parenthesizedSource = sourceCode.text.slice(leftParenToken.range[1], rightParenToken.range[0]); return fixer.replaceTextRange([ leftParenToken.range[0], rightParenToken.range[1] ], (requiresLeadingSpace(node) ? " " : "") + parenthesizedSource + (requiresTrailingSpace(node) ? " " : "")); } }); }
javascript
function report(node) { const leftParenToken = sourceCode.getTokenBefore(node); const rightParenToken = sourceCode.getTokenAfter(node); if (!isParenthesisedTwice(node)) { if (tokensToIgnore.has(sourceCode.getFirstToken(node))) { return; } if (isIIFE(node) && !isParenthesised(node.callee)) { return; } } context.report({ node, loc: leftParenToken.loc.start, messageId: "unexpected", fix(fixer) { const parenthesizedSource = sourceCode.text.slice(leftParenToken.range[1], rightParenToken.range[0]); return fixer.replaceTextRange([ leftParenToken.range[0], rightParenToken.range[1] ], (requiresLeadingSpace(node) ? " " : "") + parenthesizedSource + (requiresTrailingSpace(node) ? " " : "")); } }); }
[ "function", "report", "(", "node", ")", "{", "const", "leftParenToken", "=", "sourceCode", ".", "getTokenBefore", "(", "node", ")", ";", "const", "rightParenToken", "=", "sourceCode", ".", "getTokenAfter", "(", "node", ")", ";", "if", "(", "!", "isParenthesi...
Report the node @param {ASTNode} node node to evaluate @returns {void} @private
[ "Report", "the", "node" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-extra-parens.js#L305-L332
train
Reports a given node if it is a parenthesised function.
[ 30522, 3853, 3189, 1006, 13045, 1007, 1063, 9530, 3367, 2187, 19362, 4765, 11045, 2078, 1027, 3120, 16044, 1012, 2131, 18715, 2368, 4783, 29278, 2063, 1006, 13045, 1007, 1025, 9530, 3367, 2157, 19362, 4765, 11045, 2078, 1027, 3120, 16044, 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.documentation/src/sap/ui/documentation/sdk/controller/Sample.controller.js
function (sSampleId, sIframePath) { var aIFramePathParts = sIframePath.split("/"), i; for (i = 0; i < aIFramePathParts.length - 1; i++) { if (aIFramePathParts[i] == "..") { // iframe path has parts pointing one folder up so remove last part of the sSampleId sSampleId = sSampleId.substring(0, sSampleId.lastIndexOf(".")); } else { // append the part of the iframe path to the sample's id sSampleId += "." + aIFramePathParts[i]; } } return sSampleId; }
javascript
function (sSampleId, sIframePath) { var aIFramePathParts = sIframePath.split("/"), i; for (i = 0; i < aIFramePathParts.length - 1; i++) { if (aIFramePathParts[i] == "..") { // iframe path has parts pointing one folder up so remove last part of the sSampleId sSampleId = sSampleId.substring(0, sSampleId.lastIndexOf(".")); } else { // append the part of the iframe path to the sample's id sSampleId += "." + aIFramePathParts[i]; } } return sSampleId; }
[ "function", "(", "sSampleId", ",", "sIframePath", ")", "{", "var", "aIFramePathParts", "=", "sIframePath", ".", "split", "(", "\"/\"", ")", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "aIFramePathParts", ".", "length", "-", "1", ";", "i"...
Extends the sSampleId with the relative path defined in sIframePath and returns the resulting path. @param {string} sSampleId @param {string} sIframe @returns {string} @private
[ "Extends", "the", "sSampleId", "with", "the", "relative", "path", "defined", "in", "sIframePath", "and", "returns", "the", "resulting", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Sample.controller.js#L208-L223
train
Returns the id of the sample based on the path of the iframe
[ 30522, 3853, 1006, 7020, 16613, 23057, 2094, 1010, 9033, 15643, 15069, 1007, 1063, 13075, 9932, 15643, 15069, 26950, 1027, 9033, 15643, 15069, 1012, 3975, 1006, 1000, 1013, 1000, 1007, 1010, 1045, 1025, 2005, 1006, 1045, 1027, 1014, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
function() { if ( list ) { var args = arguments, argIndex = 0, argLength = args.length; for ( ; argIndex < argLength ; argIndex++ ) { for ( var i = 0; i < list.length; i++ ) { if ( args[ argIndex ] === list[ i ] ) { // Handle firingIndex and firingLength if ( firing ) { if ( i <= firingLength ) { firingLength--; if ( i <= firingIndex ) { firingIndex--; } } } // Remove the element list.splice( i--, 1 ); // If we have some unicity property then // we only need to do this once if ( flags.unique ) { break; } } } } } return this; }
javascript
function() { if ( list ) { var args = arguments, argIndex = 0, argLength = args.length; for ( ; argIndex < argLength ; argIndex++ ) { for ( var i = 0; i < list.length; i++ ) { if ( args[ argIndex ] === list[ i ] ) { // Handle firingIndex and firingLength if ( firing ) { if ( i <= firingLength ) { firingLength--; if ( i <= firingIndex ) { firingIndex--; } } } // Remove the element list.splice( i--, 1 ); // If we have some unicity property then // we only need to do this once if ( flags.unique ) { break; } } } } } return this; }
[ "function", "(", ")", "{", "if", "(", "list", ")", "{", "var", "args", "=", "arguments", ",", "argIndex", "=", "0", ",", "argLength", "=", "args", ".", "length", ";", "for", "(", ";", "argIndex", "<", "argLength", ";", "argIndex", "++", ")", "{", ...
Remove a callback from the list
[ "Remove", "a", "callback", "from", "the", "list" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js#L1087-L1116
train
This function is called by the constructor when the list is empty
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 2862, 1007, 1063, 13075, 12098, 5620, 1027, 9918, 1010, 12098, 11528, 3207, 2595, 1027, 1014, 1010, 12098, 9354, 3070, 2705, 1027, 12098, 5620, 1012, 3091, 1025, 2005, 1006, 1025, 12098, 11528, 320...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/block-spacing.js
checkSpacingInsideBraces
function checkSpacingInsideBraces(node) { // Gets braces and the first/last token of content. const openBrace = getOpenBrace(node); const closeBrace = sourceCode.getLastToken(node); const firstToken = sourceCode.getTokenAfter(openBrace, { includeComments: true }); const lastToken = sourceCode.getTokenBefore(closeBrace, { includeComments: true }); // Skip if the node is invalid or empty. if (openBrace.type !== "Punctuator" || openBrace.value !== "{" || closeBrace.type !== "Punctuator" || closeBrace.value !== "}" || firstToken === closeBrace ) { return; } // Skip line comments for option never if (!always && firstToken.type === "Line") { return; } // Check. if (!isValid(openBrace, firstToken)) { context.report({ node, loc: openBrace.loc.start, messageId, data: { location: "after", token: openBrace.value }, fix(fixer) { if (always) { return fixer.insertTextBefore(firstToken, " "); } return fixer.removeRange([openBrace.range[1], firstToken.range[0]]); } }); } if (!isValid(lastToken, closeBrace)) { context.report({ node, loc: closeBrace.loc.start, messageId, data: { location: "before", token: closeBrace.value }, fix(fixer) { if (always) { return fixer.insertTextAfter(lastToken, " "); } return fixer.removeRange([lastToken.range[1], closeBrace.range[0]]); } }); } }
javascript
function checkSpacingInsideBraces(node) { // Gets braces and the first/last token of content. const openBrace = getOpenBrace(node); const closeBrace = sourceCode.getLastToken(node); const firstToken = sourceCode.getTokenAfter(openBrace, { includeComments: true }); const lastToken = sourceCode.getTokenBefore(closeBrace, { includeComments: true }); // Skip if the node is invalid or empty. if (openBrace.type !== "Punctuator" || openBrace.value !== "{" || closeBrace.type !== "Punctuator" || closeBrace.value !== "}" || firstToken === closeBrace ) { return; } // Skip line comments for option never if (!always && firstToken.type === "Line") { return; } // Check. if (!isValid(openBrace, firstToken)) { context.report({ node, loc: openBrace.loc.start, messageId, data: { location: "after", token: openBrace.value }, fix(fixer) { if (always) { return fixer.insertTextBefore(firstToken, " "); } return fixer.removeRange([openBrace.range[1], firstToken.range[0]]); } }); } if (!isValid(lastToken, closeBrace)) { context.report({ node, loc: closeBrace.loc.start, messageId, data: { location: "before", token: closeBrace.value }, fix(fixer) { if (always) { return fixer.insertTextAfter(lastToken, " "); } return fixer.removeRange([lastToken.range[1], closeBrace.range[0]]); } }); } }
[ "function", "checkSpacingInsideBraces", "(", "node", ")", "{", "// Gets braces and the first/last token of content.", "const", "openBrace", "=", "getOpenBrace", "(", "node", ")", ";", "const", "closeBrace", "=", "sourceCode", ".", "getLastToken", "(", "node", ")", ";"...
Reports invalid spacing style inside braces. @param {ASTNode} node - A BlockStatement/SwitchStatement node to get. @returns {void}
[ "Reports", "invalid", "spacing", "style", "inside", "braces", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/block-spacing.js#L80-L140
train
Checks spacing inside braces
[ 30522, 3853, 14148, 19498, 2075, 7076, 5178, 10024, 9623, 1006, 13045, 1007, 1063, 1013, 1013, 4152, 17180, 2015, 1998, 1996, 2034, 1013, 2197, 19204, 1997, 4180, 1012, 9530, 3367, 2330, 10024, 3401, 1027, 2131, 26915, 10024, 3401, 1006, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/type/TimeOfDay.js
getModelFormat
function getModelFormat(oType) { var sPattern = "HH:mm:ss", iPrecision; if (!oType.oModelFormat) { iPrecision = oType.oConstraints && oType.oConstraints.precision; if (iPrecision) { sPattern += "." + "".padEnd(iPrecision, "S"); } oType.oModelFormat = DateFormat.getTimeInstance({pattern : sPattern, strictParsing : true, UTC : true}); } return oType.oModelFormat; }
javascript
function getModelFormat(oType) { var sPattern = "HH:mm:ss", iPrecision; if (!oType.oModelFormat) { iPrecision = oType.oConstraints && oType.oConstraints.precision; if (iPrecision) { sPattern += "." + "".padEnd(iPrecision, "S"); } oType.oModelFormat = DateFormat.getTimeInstance({pattern : sPattern, strictParsing : true, UTC : true}); } return oType.oModelFormat; }
[ "function", "getModelFormat", "(", "oType", ")", "{", "var", "sPattern", "=", "\"HH:mm:ss\"", ",", "iPrecision", ";", "if", "(", "!", "oType", ".", "oModelFormat", ")", "{", "iPrecision", "=", "oType", ".", "oConstraints", "&&", "oType", ".", "oConstraints",...
/* Returns the DateFormat instance for OData values in the model. Creates it lazily. @param {sap.ui.model.odata.type.TimeOfDay} oType The type @returns {sap.ui.core.format.DateFormat} The DateFormat
[ "/", "*", "Returns", "the", "DateFormat", "instance", "for", "OData", "values", "in", "the", "model", ".", "Creates", "it", "lazily", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/TimeOfDay.js#L38-L51
train
Returns the model format for the given type
[ 30522, 3853, 2131, 5302, 9247, 14192, 4017, 1006, 27178, 18863, 1007, 1063, 13075, 14690, 16451, 1027, 1000, 1044, 2232, 1024, 3461, 1024, 7020, 1000, 1010, 12997, 2890, 28472, 1025, 2065, 1006, 999, 27178, 18863, 1012, 18168, 10244, 10270, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/main.js
inlineTimingFunctionEditorProvider
function inlineTimingFunctionEditorProvider(hostEditor, pos) { var context = prepareEditorForProvider(hostEditor, pos), inlineTimingFunctionEditor, result; if (!context.timingFunction) { return context.reason || null; } else { inlineTimingFunctionEditor = new InlineTimingFunctionEditor(context.timingFunction, context.start, context.end); inlineTimingFunctionEditor.load(hostEditor); result = new $.Deferred(); result.resolve(inlineTimingFunctionEditor); return result.promise(); } }
javascript
function inlineTimingFunctionEditorProvider(hostEditor, pos) { var context = prepareEditorForProvider(hostEditor, pos), inlineTimingFunctionEditor, result; if (!context.timingFunction) { return context.reason || null; } else { inlineTimingFunctionEditor = new InlineTimingFunctionEditor(context.timingFunction, context.start, context.end); inlineTimingFunctionEditor.load(hostEditor); result = new $.Deferred(); result.resolve(inlineTimingFunctionEditor); return result.promise(); } }
[ "function", "inlineTimingFunctionEditorProvider", "(", "hostEditor", ",", "pos", ")", "{", "var", "context", "=", "prepareEditorForProvider", "(", "hostEditor", ",", "pos", ")", ",", "inlineTimingFunctionEditor", ",", "result", ";", "if", "(", "!", "context", ".",...
Registered as an inline editor provider: creates an InlineTimingFunctionEditor when the cursor is on a timing function value. @param {!Editor} hostEditor @param {!{line:Number, ch:Number}} pos @return {?$.Promise} synchronously resolved with an InlineWidget, or {string} if timing function with invalid syntax is detected at pos, or null if there's no timing function at pos.
[ "Registered", "as", "an", "inline", "editor", "provider", ":", "creates", "an", "InlineTimingFunctionEditor", "when", "the", "cursor", "is", "on", "a", "timing", "function", "value", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/main.js#L134-L149
train
inlineTimingFunctionEditorProvider - Provider for inlineTimingFunctionEditor
[ 30522, 3853, 23881, 3775, 6562, 11263, 27989, 2098, 15660, 21572, 17258, 2121, 1006, 4354, 15660, 1010, 13433, 2015, 1007, 1063, 13075, 6123, 1027, 7374, 2098, 15660, 29278, 21572, 17258, 2121, 1006, 4354, 15660, 1010, 13433, 2015, 1007, 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/search/FindUtils.js
prioritizeOpenFile
function prioritizeOpenFile(files, firstFile) { var workingSetFiles = MainViewManager.getWorkingSet(MainViewManager.ALL_PANES), workingSetFileFound = {}, fileSetWithoutWorkingSet = [], startingWorkingFileSet = [], propertyName = "", i = 0; firstFile = firstFile || ""; // Create a working set path map which indicates if a file in working set is found in file list for (i = 0; i < workingSetFiles.length; i++) { workingSetFileFound[workingSetFiles[i].fullPath] = false; } // Remove all the working set files from the filtration list fileSetWithoutWorkingSet = files.filter(function (key) { if (workingSetFileFound[key] !== undefined) { workingSetFileFound[key] = true; return false; } return true; }); //push in the first file if (workingSetFileFound[firstFile] === true) { startingWorkingFileSet.push(firstFile); workingSetFileFound[firstFile] = false; } //push in the rest of working set files already present in file list for (propertyName in workingSetFileFound) { if (workingSetFileFound.hasOwnProperty(propertyName) && workingSetFileFound[propertyName]) { startingWorkingFileSet.push(propertyName); } } return startingWorkingFileSet.concat(fileSetWithoutWorkingSet); }
javascript
function prioritizeOpenFile(files, firstFile) { var workingSetFiles = MainViewManager.getWorkingSet(MainViewManager.ALL_PANES), workingSetFileFound = {}, fileSetWithoutWorkingSet = [], startingWorkingFileSet = [], propertyName = "", i = 0; firstFile = firstFile || ""; // Create a working set path map which indicates if a file in working set is found in file list for (i = 0; i < workingSetFiles.length; i++) { workingSetFileFound[workingSetFiles[i].fullPath] = false; } // Remove all the working set files from the filtration list fileSetWithoutWorkingSet = files.filter(function (key) { if (workingSetFileFound[key] !== undefined) { workingSetFileFound[key] = true; return false; } return true; }); //push in the first file if (workingSetFileFound[firstFile] === true) { startingWorkingFileSet.push(firstFile); workingSetFileFound[firstFile] = false; } //push in the rest of working set files already present in file list for (propertyName in workingSetFileFound) { if (workingSetFileFound.hasOwnProperty(propertyName) && workingSetFileFound[propertyName]) { startingWorkingFileSet.push(propertyName); } } return startingWorkingFileSet.concat(fileSetWithoutWorkingSet); }
[ "function", "prioritizeOpenFile", "(", "files", ",", "firstFile", ")", "{", "var", "workingSetFiles", "=", "MainViewManager", ".", "getWorkingSet", "(", "MainViewManager", ".", "ALL_PANES", ")", ",", "workingSetFileFound", "=", "{", "}", ",", "fileSetWithoutWorkingS...
Prioritizes the open file and then the working set files to the starting of the list of files @param {Array.<*>} files An array of file paths or file objects to sort @param {?string} firstFile If specified, the path to the file that should be sorted to the top. @return {Array.<*>}
[ "Prioritizes", "the", "open", "file", "and", "then", "the", "working", "set", "files", "to", "the", "starting", "of", "the", "list", "of", "files" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindUtils.js#L343-L378
train
Prioritize open file
[ 30522, 3853, 3188, 25090, 4371, 26915, 8873, 2571, 1006, 6764, 1010, 2034, 8873, 2571, 1007, 1063, 13075, 24884, 3388, 8873, 4244, 1027, 2364, 8584, 24805, 4590, 1012, 2131, 21398, 13462, 1006, 2364, 8584, 24805, 4590, 1012, 2035, 1035, 609...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.codeeditor/src/sap/ui/codeeditor/js/ace/keybinding-vim.js
isBoundary
function isBoundary(i, dir, any) { if (any) { return isEmpty(i) != isEmpty(i + dir); } return !isEmpty(i) && isEmpty(i + dir); }
javascript
function isBoundary(i, dir, any) { if (any) { return isEmpty(i) != isEmpty(i + dir); } return !isEmpty(i) && isEmpty(i + dir); }
[ "function", "isBoundary", "(", "i", ",", "dir", ",", "any", ")", "{", "if", "(", "any", ")", "{", "return", "isEmpty", "(", "i", ")", "!=", "isEmpty", "(", "i", "+", "dir", ")", ";", "}", "return", "!", "isEmpty", "(", "i", ")", "&&", "isEmpty"...
ace_patch
[ "ace_patch" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.codeeditor/src/sap/ui/codeeditor/js/ace/keybinding-vim.js#L3867-L3870
train
Check if an index is boundary
[ 30522, 3853, 2003, 15494, 5649, 1006, 1045, 1010, 16101, 1010, 2151, 1007, 1063, 2065, 1006, 2151, 1007, 1063, 2709, 2003, 6633, 13876, 2100, 1006, 1045, 1007, 999, 1027, 2003, 6633, 13876, 2100, 1006, 1045, 1009, 16101, 1007, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/components/scene/inspector.js
function (evt) { var shortcutPressed = evt.keyCode === 73 && evt.ctrlKey && evt.altKey; if (!shortcutPressed) { return; } this.openInspector(); }
javascript
function (evt) { var shortcutPressed = evt.keyCode === 73 && evt.ctrlKey && evt.altKey; if (!shortcutPressed) { return; } this.openInspector(); }
[ "function", "(", "evt", ")", "{", "var", "shortcutPressed", "=", "evt", ".", "keyCode", "===", "73", "&&", "evt", ".", "ctrlKey", "&&", "evt", ".", "altKey", ";", "if", "(", "!", "shortcutPressed", ")", "{", "return", ";", "}", "this", ".", "openInsp...
<ctrl> + <alt> + i keyboard shortcut.
[ "<ctrl", ">", "+", "<alt", ">", "+", "i", "keyboard", "shortcut", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/scene/inspector.js#L61-L65
train
The event handler for the keyboard keypress event.
[ 30522, 3853, 1006, 23408, 2102, 1007, 1063, 13075, 2460, 12690, 19811, 1027, 23408, 2102, 1012, 3145, 16044, 1027, 1027, 1027, 6421, 1004, 1004, 23408, 2102, 1012, 14931, 12190, 14839, 1004, 1004, 23408, 2102, 1012, 12456, 14839, 1025, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
snapX
function snapX(x, state) { x += this.graph.panDx; var override = false; if (Math.abs(x - center) < ttX) { dx = x - bounds.getCenterX(); ttX = Math.abs(x - center); override = true; } else if (Math.abs(x - left) < ttX) { dx = x - bounds.x; ttX = Math.abs(x - left); override = true; } else if (Math.abs(x - right) < ttX) { dx = x - bounds.x - bounds.width; ttX = Math.abs(x - right); override = true; } if (override) { stateX = state; valueX = Math.round(x - this.graph.panDx); if (this.guideX == null) { this.guideX = this.createGuideShape(true); // Makes sure to use either VML or SVG shapes in order to implement // event-transparency on the background area of the rectangle since // HTML shapes do not let mouseevents through even when transparent this.guideX.dialect = (this.graph.dialect != mxConstants.DIALECT_SVG) ? mxConstants.DIALECT_VML : mxConstants.DIALECT_SVG; this.guideX.pointerEvents = false; this.guideX.init(this.graph.getView().getOverlayPane()); } } overrideX = overrideX || override; }
javascript
function snapX(x, state) { x += this.graph.panDx; var override = false; if (Math.abs(x - center) < ttX) { dx = x - bounds.getCenterX(); ttX = Math.abs(x - center); override = true; } else if (Math.abs(x - left) < ttX) { dx = x - bounds.x; ttX = Math.abs(x - left); override = true; } else if (Math.abs(x - right) < ttX) { dx = x - bounds.x - bounds.width; ttX = Math.abs(x - right); override = true; } if (override) { stateX = state; valueX = Math.round(x - this.graph.panDx); if (this.guideX == null) { this.guideX = this.createGuideShape(true); // Makes sure to use either VML or SVG shapes in order to implement // event-transparency on the background area of the rectangle since // HTML shapes do not let mouseevents through even when transparent this.guideX.dialect = (this.graph.dialect != mxConstants.DIALECT_SVG) ? mxConstants.DIALECT_VML : mxConstants.DIALECT_SVG; this.guideX.pointerEvents = false; this.guideX.init(this.graph.getView().getOverlayPane()); } } overrideX = overrideX || override; }
[ "function", "snapX", "(", "x", ",", "state", ")", "{", "x", "+=", "this", ".", "graph", ".", "panDx", ";", "var", "override", "=", "false", ";", "if", "(", "Math", ".", "abs", "(", "x", "-", "center", ")", "<", "ttX", ")", "{", "dx", "=", "x"...
Snaps the left, center and right to the given x-coordinate
[ "Snaps", "the", "left", "center", "and", "right", "to", "the", "given", "x", "-", "coordinate" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L21854-L21898
train
Snaps the x - coordinate to the center of the graph
[ 30522, 3853, 10245, 2595, 1006, 1060, 1010, 2110, 1007, 1063, 1060, 1009, 1027, 2023, 1012, 10629, 1012, 6090, 2094, 2595, 1025, 13075, 2058, 15637, 1027, 6270, 1025, 2065, 1006, 8785, 1012, 14689, 1006, 1060, 1011, 2415, 1007, 1026, 23746,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
b64ToUint6
function b64ToUint6 (nChr) { return nChr > 64 && nChr < 91 ? nChr - 65 : nChr > 96 && nChr < 123 ? nChr - 71 : nChr > 47 && nChr < 58 ? nChr + 4 : nChr === 43 ? 62 : nChr === 47 ? 63 : 0; }
javascript
function b64ToUint6 (nChr) { return nChr > 64 && nChr < 91 ? nChr - 65 : nChr > 96 && nChr < 123 ? nChr - 71 : nChr > 47 && nChr < 58 ? nChr + 4 : nChr === 43 ? 62 : nChr === 47 ? 63 : 0; }
[ "function", "b64ToUint6", "(", "nChr", ")", "{", "return", "nChr", ">", "64", "&&", "nChr", "<", "91", "?", "nChr", "-", "65", ":", "nChr", ">", "96", "&&", "nChr", "<", "123", "?", "nChr", "-", "71", ":", "nChr", ">", "47", "&&", "nChr", "<", ...
/*\ |*| |*| Base64 / binary data / UTF-8 strings utilities |*| |*| https://developer.mozilla.org/en-US/docs/Web/JavaScript/Base64_encoding_and_decoding |*| \ /* Array of bytes to base64 string decoding
[ "/", "*", "\\", "|", "*", "|", "|", "*", "|", "Base64", "/", "binary", "data", "/", "UTF", "-", "8", "strings", "utilities", "|", "*", "|", "|", "*", "|", "https", ":", "//", "developer", ".", "mozilla", ".", "org", "/", "en", "-", "US", "/",...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/tracing_examples/string_convert.js#L13-L28
train
Convert a 64 - bit number to an unsigned 6 - bit integer
[ 30522, 3853, 1038, 21084, 24826, 18447, 2575, 1006, 13316, 8093, 1007, 1063, 2709, 13316, 8093, 1028, 4185, 1004, 1004, 13316, 8093, 1026, 6205, 1029, 13316, 8093, 1011, 3515, 1024, 13316, 8093, 1028, 5986, 1004, 1004, 13316, 8093, 1026, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dequelabs/axe-core
lib/core/reporters/helpers/process-aggregate.js
normalizeRelatedNodes
function normalizeRelatedNodes(node, options) { 'use strict'; ['any', 'all', 'none'].forEach(type => { if (!Array.isArray(node[type])) { return; } node[type] .filter(checkRes => Array.isArray(checkRes.relatedNodes)) .forEach(checkRes => { checkRes.relatedNodes = checkRes.relatedNodes.map(relatedNode => { var res = { html: relatedNode.source }; if (options.elementRef && !relatedNode.fromFrame) { res.element = relatedNode.element; } if (options.selectors !== false || relatedNode.fromFrame) { res.target = relatedNode.selector; } if (options.xpath) { res.xpath = relatedNode.xpath; } return res; }); }); }); }
javascript
function normalizeRelatedNodes(node, options) { 'use strict'; ['any', 'all', 'none'].forEach(type => { if (!Array.isArray(node[type])) { return; } node[type] .filter(checkRes => Array.isArray(checkRes.relatedNodes)) .forEach(checkRes => { checkRes.relatedNodes = checkRes.relatedNodes.map(relatedNode => { var res = { html: relatedNode.source }; if (options.elementRef && !relatedNode.fromFrame) { res.element = relatedNode.element; } if (options.selectors !== false || relatedNode.fromFrame) { res.target = relatedNode.selector; } if (options.xpath) { res.xpath = relatedNode.xpath; } return res; }); }); }); }
[ "function", "normalizeRelatedNodes", "(", "node", ",", "options", ")", "{", "'use strict'", ";", "[", "'any'", ",", "'all'", ",", "'none'", "]", ".", "forEach", "(", "type", "=>", "{", "if", "(", "!", "Array", ".", "isArray", "(", "node", "[", "type", ...
/*global helpers
[ "/", "*", "global", "helpers" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/reporters/helpers/process-aggregate.js#L2-L28
train
Normalize related nodes
[ 30522, 3853, 3671, 17629, 10581, 3064, 3630, 6155, 1006, 13045, 1010, 7047, 1007, 1063, 1005, 2224, 9384, 1005, 1025, 1031, 1005, 2151, 1005, 1010, 1005, 2035, 1005, 1010, 1005, 3904, 1005, 1033, 1012, 18921, 6776, 1006, 2828, 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...
firebase/firebase-js-sdk
packages/auth/demo/public/script.js
initApp
function initApp(){ log('Initializing app...'); app = firebase.initializeApp(config); auth = app.auth(); tempApp = firebase.initializeApp({ 'apiKey': config['apiKey'], 'authDomain': config['authDomain'] }, auth['app']['name'] + '-temp'); tempAuth = tempApp.auth(); // Listen to reCAPTCHA config togglers. initRecaptchaToggle(function(size) { clearApplicationVerifier(); recaptchaSize = size; }); // The action code for email verification or password reset // can be passed in the url address as a parameter, and for convenience // this preloads the input field. populateActionCodes(); // Allows to login the user if previously logged in. if (auth.onIdTokenChanged) { auth.onIdTokenChanged(function(user) { refreshUserData(); if (user) { user.getIdTokenResult(false).then( function(idTokenResult) { log(JSON.stringify(idTokenResult)); }, function() { log('No token.'); } ); } else { log('No user logged in.'); } }); } if (auth.onAuthStateChanged) { auth.onAuthStateChanged(function(user) { if (user) { log('user state change detected: ' + user.uid); } else { log('user state change detected: no user'); } // Check Database Auth access. checkDatabaseAuthAccess(); }); } if (tempAuth.onAuthStateChanged) { tempAuth.onAuthStateChanged(function(user) { if (user) { log('user state change on temp Auth detect: ' + JSON.stringify(user)); alertSuccess('user state change on temp Auth detect: ' + user.uid); } }); } // We check for redirect result to refresh user's data. auth.getRedirectResult().then(function(response) { refreshUserData(); logAdditionalUserInfo(response); }, onAuthError); // Bootstrap tooltips. $('[data-toggle="tooltip"]').tooltip(); // Auto submit the choose library type form. $('#library-form').on('change', 'input.library-option', function() { $('#library-form').submit(); }); // To clear the logs in the page. $('.clear-logs').click(clearLogs); // Disables JS forms. $('form.no-submit').on('submit', function() { return false; }); // Keeps track of the current tab opened. $('#tab-menu a').click(function(event) { currentTab = $(event.currentTarget).attr("href"); }); // Toggles user. $('input[name=toggle-user-selection]').change(refreshUserData); // Actions listeners. $('#sign-up-with-email-and-password').click(onSignUp); $('#sign-in-with-email-and-password').click(onSignInWithEmailAndPassword); $('.sign-in-with-custom-token').click(onSignInWithCustomToken); $('#sign-in-anonymously').click(onSignInAnonymously); $('#sign-in-with-generic-idp-credential') .click(onSignInWithGenericIdPCredential); $('#signin-verify-phone-number').click(onSignInVerifyPhoneNumber); $('#signin-confirm-phone-verification') .click(onSignInConfirmPhoneVerification); // On enter click in verification code, complete phone sign-in. This prevents // reCAPTCHA from being re-rendered (default behavior on enter). $('#signin-phone-verification-code').keypress(function(e) { if (e.which == 13) { onSignInConfirmPhoneVerification(); e.preventDefault(); } }); $('#sign-in-with-email-link').click(onSignInWithEmailLink); $('#link-with-email-link').click(onLinkWithEmailLink); $('#reauth-with-email-link').click(onReauthenticateWithEmailLink); $('#change-email').click(onChangeEmail); $('#change-password').click(onChangePassword); $('#update-profile').click(onUpdateProfile); $('#send-sign-in-link-to-email').click(onSendSignInLinkToEmail); $('#send-sign-in-link-to-email-current-url') .click(onSendSignInLinkToEmailCurrentUrl); $('#send-link-email-link').click(onSendLinkEmailLink); $('#send-password-reset-email').click(onSendPasswordResetEmail); $('#verify-password-reset-code').click(onVerifyPasswordResetCode); $('#confirm-password-reset').click(onConfirmPasswordReset); $('#get-provider-data').click(onGetProviderData); $('#link-with-email-and-password').click(onLinkWithEmailAndPassword); $('#link-with-generic-idp-credential').click(onLinkWithGenericIdPCredential); $('#unlink-provider').click(onUnlinkProvider); $('#link-reauth-verify-phone-number').click(onLinkReauthVerifyPhoneNumber); $('#update-confirm-phone-verification') .click(onUpdateConfirmPhoneVerification); $('#link-confirm-phone-verification').click(onLinkConfirmPhoneVerification); $('#reauth-confirm-phone-verification') .click(onReauthConfirmPhoneVerification); // On enter click in verification code, complete phone sign-in. This prevents // reCAPTCHA from being re-rendered (default behavior on enter). $('#link-reauth-phone-verification-code').keypress(function(e) { if (e.which == 13) { // User first option option as default. onUpdateConfirmPhoneVerification(); e.preventDefault(); } }); $('#send-email-verification').click(onSendEmailVerification); $('#confirm-email-verification').click(onApplyActionCode); $('#get-token-result').click(onGetIdTokenResult); $('#refresh-token-result').click(onRefreshTokenResult); $('#get-token').click(onGetIdToken); $('#refresh-token').click(onRefreshToken); $('#get-token-worker').click(onGetCurrentUserDataFromWebWorker); $('#sign-out').click(onSignOut); $('.popup-redirect-provider').click(onPopupRedirectProviderClick); $('#popup-redirect-generic').click(onPopupRedirectGenericProviderClick); $('#popup-redirect-get-redirect-result').click(onGetRedirectResult); $('#popup-redirect-add-custom-parameter') .click(onPopupRedirectAddCustomParam); $('#popup-redirect-saml').click(onPopupRedirectSamlProviderClick); $('#action-code-settings-reset').click(onActionCodeSettingsReset); $('#delete').click(onDelete); $('#set-persistence').click(onSetPersistence); $('#set-language-code').click(onSetLanguageCode); $('#use-device-language').click(onUseDeviceLanguage); $('#fetch-sign-in-methods-for-email').click(onFetchSignInMethodsForEmail); $('#run-web-worker-tests').click(onRunWebWorkTests); $('#run-service-worker-tests').click(onRunServiceWorkTests); $('#copy-active-user').click(onCopyActiveUser); $('#copy-last-user').click(onCopyLastUser); $('#apply-auth-settings-change').click(onApplyAuthSettingsChange); }
javascript
function initApp(){ log('Initializing app...'); app = firebase.initializeApp(config); auth = app.auth(); tempApp = firebase.initializeApp({ 'apiKey': config['apiKey'], 'authDomain': config['authDomain'] }, auth['app']['name'] + '-temp'); tempAuth = tempApp.auth(); // Listen to reCAPTCHA config togglers. initRecaptchaToggle(function(size) { clearApplicationVerifier(); recaptchaSize = size; }); // The action code for email verification or password reset // can be passed in the url address as a parameter, and for convenience // this preloads the input field. populateActionCodes(); // Allows to login the user if previously logged in. if (auth.onIdTokenChanged) { auth.onIdTokenChanged(function(user) { refreshUserData(); if (user) { user.getIdTokenResult(false).then( function(idTokenResult) { log(JSON.stringify(idTokenResult)); }, function() { log('No token.'); } ); } else { log('No user logged in.'); } }); } if (auth.onAuthStateChanged) { auth.onAuthStateChanged(function(user) { if (user) { log('user state change detected: ' + user.uid); } else { log('user state change detected: no user'); } // Check Database Auth access. checkDatabaseAuthAccess(); }); } if (tempAuth.onAuthStateChanged) { tempAuth.onAuthStateChanged(function(user) { if (user) { log('user state change on temp Auth detect: ' + JSON.stringify(user)); alertSuccess('user state change on temp Auth detect: ' + user.uid); } }); } // We check for redirect result to refresh user's data. auth.getRedirectResult().then(function(response) { refreshUserData(); logAdditionalUserInfo(response); }, onAuthError); // Bootstrap tooltips. $('[data-toggle="tooltip"]').tooltip(); // Auto submit the choose library type form. $('#library-form').on('change', 'input.library-option', function() { $('#library-form').submit(); }); // To clear the logs in the page. $('.clear-logs').click(clearLogs); // Disables JS forms. $('form.no-submit').on('submit', function() { return false; }); // Keeps track of the current tab opened. $('#tab-menu a').click(function(event) { currentTab = $(event.currentTarget).attr("href"); }); // Toggles user. $('input[name=toggle-user-selection]').change(refreshUserData); // Actions listeners. $('#sign-up-with-email-and-password').click(onSignUp); $('#sign-in-with-email-and-password').click(onSignInWithEmailAndPassword); $('.sign-in-with-custom-token').click(onSignInWithCustomToken); $('#sign-in-anonymously').click(onSignInAnonymously); $('#sign-in-with-generic-idp-credential') .click(onSignInWithGenericIdPCredential); $('#signin-verify-phone-number').click(onSignInVerifyPhoneNumber); $('#signin-confirm-phone-verification') .click(onSignInConfirmPhoneVerification); // On enter click in verification code, complete phone sign-in. This prevents // reCAPTCHA from being re-rendered (default behavior on enter). $('#signin-phone-verification-code').keypress(function(e) { if (e.which == 13) { onSignInConfirmPhoneVerification(); e.preventDefault(); } }); $('#sign-in-with-email-link').click(onSignInWithEmailLink); $('#link-with-email-link').click(onLinkWithEmailLink); $('#reauth-with-email-link').click(onReauthenticateWithEmailLink); $('#change-email').click(onChangeEmail); $('#change-password').click(onChangePassword); $('#update-profile').click(onUpdateProfile); $('#send-sign-in-link-to-email').click(onSendSignInLinkToEmail); $('#send-sign-in-link-to-email-current-url') .click(onSendSignInLinkToEmailCurrentUrl); $('#send-link-email-link').click(onSendLinkEmailLink); $('#send-password-reset-email').click(onSendPasswordResetEmail); $('#verify-password-reset-code').click(onVerifyPasswordResetCode); $('#confirm-password-reset').click(onConfirmPasswordReset); $('#get-provider-data').click(onGetProviderData); $('#link-with-email-and-password').click(onLinkWithEmailAndPassword); $('#link-with-generic-idp-credential').click(onLinkWithGenericIdPCredential); $('#unlink-provider').click(onUnlinkProvider); $('#link-reauth-verify-phone-number').click(onLinkReauthVerifyPhoneNumber); $('#update-confirm-phone-verification') .click(onUpdateConfirmPhoneVerification); $('#link-confirm-phone-verification').click(onLinkConfirmPhoneVerification); $('#reauth-confirm-phone-verification') .click(onReauthConfirmPhoneVerification); // On enter click in verification code, complete phone sign-in. This prevents // reCAPTCHA from being re-rendered (default behavior on enter). $('#link-reauth-phone-verification-code').keypress(function(e) { if (e.which == 13) { // User first option option as default. onUpdateConfirmPhoneVerification(); e.preventDefault(); } }); $('#send-email-verification').click(onSendEmailVerification); $('#confirm-email-verification').click(onApplyActionCode); $('#get-token-result').click(onGetIdTokenResult); $('#refresh-token-result').click(onRefreshTokenResult); $('#get-token').click(onGetIdToken); $('#refresh-token').click(onRefreshToken); $('#get-token-worker').click(onGetCurrentUserDataFromWebWorker); $('#sign-out').click(onSignOut); $('.popup-redirect-provider').click(onPopupRedirectProviderClick); $('#popup-redirect-generic').click(onPopupRedirectGenericProviderClick); $('#popup-redirect-get-redirect-result').click(onGetRedirectResult); $('#popup-redirect-add-custom-parameter') .click(onPopupRedirectAddCustomParam); $('#popup-redirect-saml').click(onPopupRedirectSamlProviderClick); $('#action-code-settings-reset').click(onActionCodeSettingsReset); $('#delete').click(onDelete); $('#set-persistence').click(onSetPersistence); $('#set-language-code').click(onSetLanguageCode); $('#use-device-language').click(onUseDeviceLanguage); $('#fetch-sign-in-methods-for-email').click(onFetchSignInMethodsForEmail); $('#run-web-worker-tests').click(onRunWebWorkTests); $('#run-service-worker-tests').click(onRunServiceWorkTests); $('#copy-active-user').click(onCopyActiveUser); $('#copy-last-user').click(onCopyLastUser); $('#apply-auth-settings-change').click(onApplyAuthSettingsChange); }
[ "function", "initApp", "(", ")", "{", "log", "(", "'Initializing app...'", ")", ";", "app", "=", "firebase", ".", "initializeApp", "(", "config", ")", ";", "auth", "=", "app", ".", "auth", "(", ")", ";", "tempApp", "=", "firebase", ".", "initializeApp", ...
Initiates the application by setting event listeners on the various buttons.
[ "Initiates", "the", "application", "by", "setting", "event", "listeners", "on", "the", "various", "buttons", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L1314-L1494
train
Initializes the app.
[ 30522, 3853, 1999, 6590, 9397, 1006, 1007, 1063, 8833, 1006, 1005, 3988, 6026, 10439, 1012, 1012, 1012, 1005, 1007, 1025, 10439, 1027, 2543, 15058, 1012, 3988, 4697, 29098, 1006, 9530, 8873, 2290, 1007, 1025, 8740, 2705, 1027, 10439, 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...
wangfupeng1988/wangEditor
src/js/text/index.js
codeHandle
function codeHandle(e) { const $selectionElem = editor.selection.getSelectionContainerElem() if (!$selectionElem) { return } const $parentElem = $selectionElem.parent() const selectionNodeName = $selectionElem.getNodeName() const parentNodeName = $parentElem.getNodeName() if (selectionNodeName !== 'CODE' || parentNodeName !== 'PRE') { // 不符合要求 忽略 return } if (!editor.cmd.queryCommandSupported('insertHTML')) { // 必须原生支持 insertHTML 命令 return } // 处理:光标定位到代码末尾,联系点击两次回车,即跳出代码块 if (editor._willBreakCode === true) { // 此时可以跳出代码块 // 插入 <p> ,并将选取定位到 <p> const $p = $('<p><br></p>') $p.insertAfter($parentElem) editor.selection.createRangeByElem($p, true) editor.selection.restoreSelection() // 修改状态 editor._willBreakCode = false e.preventDefault() return } const _startOffset = editor.selection.getRange().startOffset // 处理:回车时,不能插入 <br> 而是插入 \n ,因为是在 pre 标签里面 editor.cmd.do('insertHTML', '\n') editor.selection.saveRange() if (editor.selection.getRange().startOffset === _startOffset) { // 没起作用,再来一遍 editor.cmd.do('insertHTML', '\n') } const codeLength = $selectionElem.html().length if (editor.selection.getRange().startOffset + 1 === codeLength) { // 说明光标在代码最后的位置,执行了回车操作 // 记录下来,以便下次回车时候跳出 code editor._willBreakCode = true } // 阻止默认行为 e.preventDefault() }
javascript
function codeHandle(e) { const $selectionElem = editor.selection.getSelectionContainerElem() if (!$selectionElem) { return } const $parentElem = $selectionElem.parent() const selectionNodeName = $selectionElem.getNodeName() const parentNodeName = $parentElem.getNodeName() if (selectionNodeName !== 'CODE' || parentNodeName !== 'PRE') { // 不符合要求 忽略 return } if (!editor.cmd.queryCommandSupported('insertHTML')) { // 必须原生支持 insertHTML 命令 return } // 处理:光标定位到代码末尾,联系点击两次回车,即跳出代码块 if (editor._willBreakCode === true) { // 此时可以跳出代码块 // 插入 <p> ,并将选取定位到 <p> const $p = $('<p><br></p>') $p.insertAfter($parentElem) editor.selection.createRangeByElem($p, true) editor.selection.restoreSelection() // 修改状态 editor._willBreakCode = false e.preventDefault() return } const _startOffset = editor.selection.getRange().startOffset // 处理:回车时,不能插入 <br> 而是插入 \n ,因为是在 pre 标签里面 editor.cmd.do('insertHTML', '\n') editor.selection.saveRange() if (editor.selection.getRange().startOffset === _startOffset) { // 没起作用,再来一遍 editor.cmd.do('insertHTML', '\n') } const codeLength = $selectionElem.html().length if (editor.selection.getRange().startOffset + 1 === codeLength) { // 说明光标在代码最后的位置,执行了回车操作 // 记录下来,以便下次回车时候跳出 code editor._willBreakCode = true } // 阻止默认行为 e.preventDefault() }
[ "function", "codeHandle", "(", "e", ")", "{", "const", "$selectionElem", "=", "editor", ".", "selection", ".", "getSelectionContainerElem", "(", ")", "if", "(", "!", "$selectionElem", ")", "{", "return", "}", "const", "$parentElem", "=", "$selectionElem", ".",...
<pre><code></code></pre> 回车时 特殊处理
[ "<pre", ">", "<code", ">", "<", "/", "code", ">", "<", "/", "pre", ">", "回车时", "特殊处理" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/text/index.js#L227-L281
train
Code handle
[ 30522, 3853, 3642, 11774, 2571, 1006, 1041, 1007, 1063, 9530, 3367, 1002, 4989, 12260, 2213, 1027, 3559, 1012, 4989, 1012, 4152, 12260, 7542, 8663, 18249, 7869, 16930, 1006, 1007, 2065, 1006, 999, 1002, 4989, 12260, 2213, 1007, 1063, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/blanket.js
parsePropertyFunction
function parsePropertyFunction(param, first) { var previousStrict, body, startToken; previousStrict = strict; startToken = lookahead; body = parseFunctionSourceElements(); if (first && strict && isRestrictedWord(param[0].name)) { throwErrorTolerant(first, Messages.StrictParamName); } strict = previousStrict; return delegate.markEnd(delegate.createFunctionExpression(null, param, [], body), startToken); }
javascript
function parsePropertyFunction(param, first) { var previousStrict, body, startToken; previousStrict = strict; startToken = lookahead; body = parseFunctionSourceElements(); if (first && strict && isRestrictedWord(param[0].name)) { throwErrorTolerant(first, Messages.StrictParamName); } strict = previousStrict; return delegate.markEnd(delegate.createFunctionExpression(null, param, [], body), startToken); }
[ "function", "parsePropertyFunction", "(", "param", ",", "first", ")", "{", "var", "previousStrict", ",", "body", ",", "startToken", ";", "previousStrict", "=", "strict", ";", "startToken", "=", "lookahead", ";", "body", "=", "parseFunctionSourceElements", "(", "...
11.1.5 Object Initialiser
[ "11", ".", "1", ".", "5", "Object", "Initialiser" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/blanket.js#L2005-L2016
train
ECMA - 262 12. 2. 2 Property Function
[ 30522, 3853, 11968, 3366, 21572, 4842, 3723, 11263, 27989, 1006, 11498, 2213, 1010, 2034, 1007, 1063, 13075, 3025, 3367, 7277, 2102, 1010, 2303, 1010, 2707, 18715, 2368, 1025, 3025, 3367, 7277, 2102, 1027, 9384, 1025, 2707, 18715, 2368, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
chartjs/Chart.js
src/plugins/plugin.legend.js
function(x, y, legendItem) { if (isNaN(boxWidth) || boxWidth <= 0) { return; } // Set the ctx for the box ctx.save(); var lineWidth = valueOrDefault(legendItem.lineWidth, lineDefault.borderWidth); ctx.fillStyle = valueOrDefault(legendItem.fillStyle, defaultColor); ctx.lineCap = valueOrDefault(legendItem.lineCap, lineDefault.borderCapStyle); ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, lineDefault.borderDashOffset); ctx.lineJoin = valueOrDefault(legendItem.lineJoin, lineDefault.borderJoinStyle); ctx.lineWidth = lineWidth; ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor); if (ctx.setLineDash) { // IE 9 and 10 do not support line dash ctx.setLineDash(valueOrDefault(legendItem.lineDash, lineDefault.borderDash)); } if (opts.labels && opts.labels.usePointStyle) { // Recalculate x and y for drawPoint() because its expecting // x and y to be center of figure (instead of top left) var radius = boxWidth * Math.SQRT2 / 2; var centerX = x + boxWidth / 2; var centerY = y + fontSize / 2; // Draw pointStyle as legend symbol helpers.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY); } else { // Draw box as legend symbol if (lineWidth !== 0) { ctx.strokeRect(x, y, boxWidth, fontSize); } ctx.fillRect(x, y, boxWidth, fontSize); } ctx.restore(); }
javascript
function(x, y, legendItem) { if (isNaN(boxWidth) || boxWidth <= 0) { return; } // Set the ctx for the box ctx.save(); var lineWidth = valueOrDefault(legendItem.lineWidth, lineDefault.borderWidth); ctx.fillStyle = valueOrDefault(legendItem.fillStyle, defaultColor); ctx.lineCap = valueOrDefault(legendItem.lineCap, lineDefault.borderCapStyle); ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, lineDefault.borderDashOffset); ctx.lineJoin = valueOrDefault(legendItem.lineJoin, lineDefault.borderJoinStyle); ctx.lineWidth = lineWidth; ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor); if (ctx.setLineDash) { // IE 9 and 10 do not support line dash ctx.setLineDash(valueOrDefault(legendItem.lineDash, lineDefault.borderDash)); } if (opts.labels && opts.labels.usePointStyle) { // Recalculate x and y for drawPoint() because its expecting // x and y to be center of figure (instead of top left) var radius = boxWidth * Math.SQRT2 / 2; var centerX = x + boxWidth / 2; var centerY = y + fontSize / 2; // Draw pointStyle as legend symbol helpers.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY); } else { // Draw box as legend symbol if (lineWidth !== 0) { ctx.strokeRect(x, y, boxWidth, fontSize); } ctx.fillRect(x, y, boxWidth, fontSize); } ctx.restore(); }
[ "function", "(", "x", ",", "y", ",", "legendItem", ")", "{", "if", "(", "isNaN", "(", "boxWidth", ")", "||", "boxWidth", "<=", "0", ")", "{", "return", ";", "}", "// Set the ctx for the box", "ctx", ".", "save", "(", ")", ";", "var", "lineWidth", "="...
current position
[ "current", "position" ]
f093c36574d290330ed623e60fbd070421c730d5
https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/plugins/plugin.legend.js#L359-L398
train
Draws the box
[ 30522, 3853, 1006, 1060, 1010, 1061, 1010, 5722, 4221, 2213, 1007, 1063, 2065, 1006, 3475, 2319, 1006, 3482, 9148, 11927, 2232, 1007, 1064, 1064, 3482, 9148, 11927, 2232, 1026, 1027, 1014, 1007, 1063, 2709, 1025, 1065, 1013, 1013, 2275, 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.layout/src/sap/ui/layout/form/ResponsiveLayout.js
_deletePanel
function _deletePanel( oPanel ) { oPanel.setContent(null); oPanel.setLayout(null); oPanel.setContainer(null); oPanel.destroy(); }
javascript
function _deletePanel( oPanel ) { oPanel.setContent(null); oPanel.setLayout(null); oPanel.setContainer(null); oPanel.destroy(); }
[ "function", "_deletePanel", "(", "oPanel", ")", "{", "oPanel", ".", "setContent", "(", "null", ")", ";", "oPanel", ".", "setLayout", "(", "null", ")", ";", "oPanel", ".", "setContainer", "(", "null", ")", ";", "oPanel", ".", "destroy", "(", ")", ";", ...
/* clear variables before delete it
[ "/", "*", "clear", "variables", "before", "delete", "it" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/ResponsiveLayout.js#L444-L451
train
Delete the Panel
[ 30522, 3853, 1035, 3972, 12870, 9739, 2884, 1006, 6728, 7231, 2140, 1007, 1063, 6728, 7231, 2140, 1012, 2275, 8663, 6528, 2102, 1006, 19701, 1007, 1025, 6728, 7231, 2140, 1012, 2275, 8485, 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...
SheetJS/js-xlsx
xlsx.js
parse_ClrtClient
function parse_ClrtClient(blob) { var ccv = blob.read_shift(2); var o = []; while(ccv-->0) o.push(parse_LongRGB(blob, 8)); return o; }
javascript
function parse_ClrtClient(blob) { var ccv = blob.read_shift(2); var o = []; while(ccv-->0) o.push(parse_LongRGB(blob, 8)); return o; }
[ "function", "parse_ClrtClient", "(", "blob", ")", "{", "var", "ccv", "=", "blob", ".", "read_shift", "(", "2", ")", ";", "var", "o", "=", "[", "]", ";", "while", "(", "ccv", "--", ">", "0", ")", "o", ".", "push", "(", "parse_LongRGB", "(", "blob"...
/* [MS-XLS] 2.4.50 ClrtClient
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "4", ".", "50", "ClrtClient" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6481-L6486
train
ECMA - 262 12. 2. 2 Client
[ 30522, 3853, 11968, 3366, 1035, 18856, 5339, 20464, 11638, 1006, 1038, 4135, 2497, 1007, 1063, 13075, 10507, 2615, 1027, 1038, 4135, 2497, 1012, 3191, 1035, 5670, 1006, 1016, 1007, 1025, 13075, 1051, 1027, 1031, 1033, 1025, 2096, 1006, 1050...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-compiler/transforms/RelayMaskTransform.js
relayMaskTransform
function relayMaskTransform(context: CompilerContext): CompilerContext { return IRTransformer.transform( context, { FragmentSpread: visitFragmentSpread, Fragment: visitFragment, }, () => ({ reachableArguments: [], }), ); }
javascript
function relayMaskTransform(context: CompilerContext): CompilerContext { return IRTransformer.transform( context, { FragmentSpread: visitFragmentSpread, Fragment: visitFragment, }, () => ({ reachableArguments: [], }), ); }
[ "function", "relayMaskTransform", "(", "context", ":", "CompilerContext", ")", ":", "CompilerContext", "{", "return", "IRTransformer", ".", "transform", "(", "context", ",", "{", "FragmentSpread", ":", "visitFragmentSpread", ",", "Fragment", ":", "visitFragment", ",...
A transform that inlines fragment spreads with the @relay(mask: false) directive.
[ "A", "transform", "that", "inlines", "fragment", "spreads", "with", "the" ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/transforms/RelayMaskTransform.js#L40-L51
train
relay mask transform
[ 30522, 3853, 8846, 9335, 25509, 5521, 22747, 2953, 2213, 1006, 6123, 1024, 21624, 8663, 18209, 1007, 1024, 21624, 8663, 18209, 1063, 2709, 20868, 6494, 3619, 14192, 2121, 1012, 10938, 1006, 6123, 1010, 1063, 10341, 28139, 4215, 1024, 3942, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/dataZoom/AxisProxy.js
function (opt) { var dataExtent = this._dataExtent; var axisModel = this.getAxisModel(); var scale = axisModel.axis.scale; var rangePropMode = this._dataZoomModel.getRangePropMode(); var percentExtent = [0, 100]; var percentWindow = []; var valueWindow = []; var hasPropModeValue; each(['start', 'end'], function (prop, idx) { var boundPercent = opt[prop]; var boundValue = opt[prop + 'Value']; // Notice: dataZoom is based either on `percentProp` ('start', 'end') or // on `valueProp` ('startValue', 'endValue'). (They are based on the data extent // but not min/max of axis, which will be calculated by data window then). // The former one is suitable for cases that a dataZoom component controls multiple // axes with different unit or extent, and the latter one is suitable for accurate // zoom by pixel (e.g., in dataZoomSelect). // we use `getRangePropMode()` to mark which prop is used. `rangePropMode` is updated // only when setOption or dispatchAction, otherwise it remains its original value. // (Why not only record `percentProp` and always map to `valueProp`? Because // the map `valueProp` -> `percentProp` -> `valueProp` probably not the original // `valueProp`. consider two axes constrolled by one dataZoom. They have different // data extent. All of values that are overflow the `dataExtent` will be calculated // to percent '100%'). if (rangePropMode[idx] === 'percent') { boundPercent == null && (boundPercent = percentExtent[idx]); // Use scale.parse to math round for category or time axis. boundValue = scale.parse(numberUtil.linearMap( boundPercent, percentExtent, dataExtent )); } else { hasPropModeValue = true; boundValue = boundValue == null ? dataExtent[idx] : scale.parse(boundValue); // Calculating `percent` from `value` may be not accurate, because // This calculation can not be inversed, because all of values that // are overflow the `dataExtent` will be calculated to percent '100%' boundPercent = numberUtil.linearMap( boundValue, dataExtent, percentExtent ); } // valueWindow[idx] = round(boundValue); // percentWindow[idx] = round(boundPercent); valueWindow[idx] = boundValue; percentWindow[idx] = boundPercent; }); asc(valueWindow); asc(percentWindow); // The windows from user calling of `dispatchAction` might be out of the extent, // or do not obey the `min/maxSpan`, `min/maxValueSpan`. But we dont restrict window // by `zoomLock` here, because we see `zoomLock` just as a interaction constraint, // where API is able to initialize/modify the window size even though `zoomLock` // specified. var spans = this._minMaxSpan; hasPropModeValue ? restrictSet(valueWindow, percentWindow, dataExtent, percentExtent, false) : restrictSet(percentWindow, valueWindow, percentExtent, dataExtent, true); function restrictSet(fromWindow, toWindow, fromExtent, toExtent, toValue) { var suffix = toValue ? 'Span' : 'ValueSpan'; sliderMove(0, fromWindow, fromExtent, 'all', spans['min' + suffix], spans['max' + suffix]); for (var i = 0; i < 2; i++) { toWindow[i] = numberUtil.linearMap(fromWindow[i], fromExtent, toExtent, true); toValue && (toWindow[i] = scale.parse(toWindow[i])); } } return { valueWindow: valueWindow, percentWindow: percentWindow }; }
javascript
function (opt) { var dataExtent = this._dataExtent; var axisModel = this.getAxisModel(); var scale = axisModel.axis.scale; var rangePropMode = this._dataZoomModel.getRangePropMode(); var percentExtent = [0, 100]; var percentWindow = []; var valueWindow = []; var hasPropModeValue; each(['start', 'end'], function (prop, idx) { var boundPercent = opt[prop]; var boundValue = opt[prop + 'Value']; // Notice: dataZoom is based either on `percentProp` ('start', 'end') or // on `valueProp` ('startValue', 'endValue'). (They are based on the data extent // but not min/max of axis, which will be calculated by data window then). // The former one is suitable for cases that a dataZoom component controls multiple // axes with different unit or extent, and the latter one is suitable for accurate // zoom by pixel (e.g., in dataZoomSelect). // we use `getRangePropMode()` to mark which prop is used. `rangePropMode` is updated // only when setOption or dispatchAction, otherwise it remains its original value. // (Why not only record `percentProp` and always map to `valueProp`? Because // the map `valueProp` -> `percentProp` -> `valueProp` probably not the original // `valueProp`. consider two axes constrolled by one dataZoom. They have different // data extent. All of values that are overflow the `dataExtent` will be calculated // to percent '100%'). if (rangePropMode[idx] === 'percent') { boundPercent == null && (boundPercent = percentExtent[idx]); // Use scale.parse to math round for category or time axis. boundValue = scale.parse(numberUtil.linearMap( boundPercent, percentExtent, dataExtent )); } else { hasPropModeValue = true; boundValue = boundValue == null ? dataExtent[idx] : scale.parse(boundValue); // Calculating `percent` from `value` may be not accurate, because // This calculation can not be inversed, because all of values that // are overflow the `dataExtent` will be calculated to percent '100%' boundPercent = numberUtil.linearMap( boundValue, dataExtent, percentExtent ); } // valueWindow[idx] = round(boundValue); // percentWindow[idx] = round(boundPercent); valueWindow[idx] = boundValue; percentWindow[idx] = boundPercent; }); asc(valueWindow); asc(percentWindow); // The windows from user calling of `dispatchAction` might be out of the extent, // or do not obey the `min/maxSpan`, `min/maxValueSpan`. But we dont restrict window // by `zoomLock` here, because we see `zoomLock` just as a interaction constraint, // where API is able to initialize/modify the window size even though `zoomLock` // specified. var spans = this._minMaxSpan; hasPropModeValue ? restrictSet(valueWindow, percentWindow, dataExtent, percentExtent, false) : restrictSet(percentWindow, valueWindow, percentExtent, dataExtent, true); function restrictSet(fromWindow, toWindow, fromExtent, toExtent, toValue) { var suffix = toValue ? 'Span' : 'ValueSpan'; sliderMove(0, fromWindow, fromExtent, 'all', spans['min' + suffix], spans['max' + suffix]); for (var i = 0; i < 2; i++) { toWindow[i] = numberUtil.linearMap(fromWindow[i], fromExtent, toExtent, true); toValue && (toWindow[i] = scale.parse(toWindow[i])); } } return { valueWindow: valueWindow, percentWindow: percentWindow }; }
[ "function", "(", "opt", ")", "{", "var", "dataExtent", "=", "this", ".", "_dataExtent", ";", "var", "axisModel", "=", "this", ".", "getAxisModel", "(", ")", ";", "var", "scale", "=", "axisModel", ".", "axis", ".", "scale", ";", "var", "rangePropMode", ...
Only calculate by given range and this._dataExtent, do not change anything. @param {Object} opt @param {number} [opt.start] @param {number} [opt.end] @param {number} [opt.startValue] @param {number} [opt.endValue]
[ "Only", "calculate", "by", "given", "range", "and", "this", ".", "_dataExtent", "do", "not", "change", "anything", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/dataZoom/AxisProxy.js#L192-L270
train
Calculate the data extent for the data zoom.
[ 30522, 3853, 1006, 23569, 1007, 1063, 13075, 2951, 10288, 6528, 2102, 1027, 2023, 1012, 1035, 2951, 10288, 6528, 2102, 1025, 13075, 8123, 5302, 9247, 1027, 2023, 1012, 2131, 8528, 2964, 10244, 2140, 1006, 1007, 1025, 13075, 4094, 1027, 8123...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/angular
aio/scripts/contributors/check-pictures.js
_main
function _main() { const contributors = JSON.parse(readFileSync(CONTRIBUTORS_PATH, 'utf8')); const expectedImages = Object.keys(contributors) .filter(key => !!contributors[key].picture) .map(key => join(IMAGES_DIR, contributors[key].picture)); const missingImages = expectedImages.filter(path => !existsSync(path)); if (missingImages.length > 0) { throw new Error( 'The following pictures are referenced in \'contributors.json\' but do not exist:' + missingImages.map(path => `\n - ${path}`).join('')); } }
javascript
function _main() { const contributors = JSON.parse(readFileSync(CONTRIBUTORS_PATH, 'utf8')); const expectedImages = Object.keys(contributors) .filter(key => !!contributors[key].picture) .map(key => join(IMAGES_DIR, contributors[key].picture)); const missingImages = expectedImages.filter(path => !existsSync(path)); if (missingImages.length > 0) { throw new Error( 'The following pictures are referenced in \'contributors.json\' but do not exist:' + missingImages.map(path => `\n - ${path}`).join('')); } }
[ "function", "_main", "(", ")", "{", "const", "contributors", "=", "JSON", ".", "parse", "(", "readFileSync", "(", "CONTRIBUTORS_PATH", ",", "'utf8'", ")", ")", ";", "const", "expectedImages", "=", "Object", ".", "keys", "(", "contributors", ")", ".", "filt...
Functions - Definitions
[ "Functions", "-", "Definitions" ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/scripts/contributors/check-pictures.js#L16-L28
train
Main entry point
[ 30522, 3853, 1035, 2364, 1006, 1007, 1063, 9530, 3367, 16884, 1027, 1046, 3385, 1012, 11968, 3366, 1006, 3191, 8873, 4244, 6038, 2278, 1006, 16884, 1035, 4130, 1010, 1005, 21183, 2546, 2620, 1005, 1007, 1007, 1025, 9530, 3367, 3517, 9581, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/blanket.js
parseExpression
function parseExpression() { var expr, startToken = lookahead; expr = parseAssignmentExpression(); if (match(',')) { expr = delegate.createSequenceExpression([ expr ]); while (index < length) { if (!match(',')) { break; } lex(); expr.expressions.push(parseAssignmentExpression()); } delegate.markEnd(expr, startToken); } return expr; }
javascript
function parseExpression() { var expr, startToken = lookahead; expr = parseAssignmentExpression(); if (match(',')) { expr = delegate.createSequenceExpression([ expr ]); while (index < length) { if (!match(',')) { break; } lex(); expr.expressions.push(parseAssignmentExpression()); } delegate.markEnd(expr, startToken); } return expr; }
[ "function", "parseExpression", "(", ")", "{", "var", "expr", ",", "startToken", "=", "lookahead", ";", "expr", "=", "parseAssignmentExpression", "(", ")", ";", "if", "(", "match", "(", "','", ")", ")", "{", "expr", "=", "delegate", ".", "createSequenceExpr...
11.14 Comma Operator
[ "11", ".", "14", "Comma", "Operator" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/blanket.js#L2586-L2606
train
ECMA - 262 12. 2 Assignment Expressions
[ 30522, 3853, 11968, 19763, 2595, 20110, 3258, 1006, 1007, 1063, 13075, 4654, 18098, 1010, 2707, 18715, 2368, 1027, 2298, 4430, 13775, 1025, 4654, 18098, 1027, 11968, 17310, 18719, 16206, 3672, 10288, 20110, 3258, 1006, 1007, 1025, 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...
google/closure-library
closure/goog/html/sanitizer/noclobber.js
assertNodeIsElement
function assertNodeIsElement(node) { if (googAsserts.ENABLE_ASSERTS && !isNodeElement(node)) { googAsserts.fail( 'Expected Node of type Element but got Node of type %s', getNodeType(node)); } return /** @type {!Element} */ (node); }
javascript
function assertNodeIsElement(node) { if (googAsserts.ENABLE_ASSERTS && !isNodeElement(node)) { googAsserts.fail( 'Expected Node of type Element but got Node of type %s', getNodeType(node)); } return /** @type {!Element} */ (node); }
[ "function", "assertNodeIsElement", "(", "node", ")", "{", "if", "(", "googAsserts", ".", "ENABLE_ASSERTS", "&&", "!", "isNodeElement", "(", "node", ")", ")", "{", "googAsserts", ".", "fail", "(", "'Expected Node of type Element but got Node of type %s'", ",", "getNo...
Asserts that a Node is an Element, without falling prey to things like <form><input name="nodeType"></form>. @param {!Node} node @return {!Element}
[ "Asserts", "that", "a", "Node", "is", "an", "Element", "without", "falling", "prey", "to", "things", "like", "<form", ">", "<input", "name", "=", "nodeType", ">", "<", "/", "form", ">", "." ]
97390e9ca4483cebb9628e06026139fbb3023d65
https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/html/sanitizer/noclobber.js#L324-L331
train
Assert that a Node is an Element.
[ 30522, 3853, 20865, 3630, 3207, 5562, 16930, 4765, 1006, 13045, 1007, 1063, 2065, 1006, 27571, 12617, 8043, 3215, 1012, 9585, 1035, 19514, 1004, 1004, 999, 3475, 10244, 12260, 3672, 1006, 13045, 1007, 1007, 1063, 27571, 12617, 8043, 3215, 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...
aws/aws-sdk-js
features/extra/helpers.js
function(bucket) { var fs = require('fs'); var path = require('path'); var filePath = path.resolve('integ.buckets.json'); var cache; if (fs.existsSync(filePath)) { try { cache = JSON.parse(fs.readFileSync(filePath)); cache.buckets.push(bucket); fs.writeFileSync(filePath, JSON.stringify(cache)); } catch (fileErr) { throw fileErr; } } else { cache = {}; cache.buckets = [bucket]; fs.writeFileSync(filePath, JSON.stringify(cache)); } }
javascript
function(bucket) { var fs = require('fs'); var path = require('path'); var filePath = path.resolve('integ.buckets.json'); var cache; if (fs.existsSync(filePath)) { try { cache = JSON.parse(fs.readFileSync(filePath)); cache.buckets.push(bucket); fs.writeFileSync(filePath, JSON.stringify(cache)); } catch (fileErr) { throw fileErr; } } else { cache = {}; cache.buckets = [bucket]; fs.writeFileSync(filePath, JSON.stringify(cache)); } }
[ "function", "(", "bucket", ")", "{", "var", "fs", "=", "require", "(", "'fs'", ")", ";", "var", "path", "=", "require", "(", "'path'", ")", ";", "var", "filePath", "=", "path", ".", "resolve", "(", "'integ.buckets.json'", ")", ";", "var", "cache", ";...
Cache bucket names used for cleanup after all features have run.
[ "Cache", "bucket", "names", "used", "for", "cleanup", "after", "all", "features", "have", "run", "." ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/features/extra/helpers.js#L117-L135
train
This function is used to cache an integer bucket
[ 30522, 3853, 1006, 13610, 1007, 1063, 13075, 1042, 2015, 1027, 5478, 1006, 1005, 1042, 2015, 1005, 1007, 1025, 13075, 4130, 1027, 5478, 1006, 1005, 4130, 1005, 1007, 1025, 13075, 5371, 15069, 1027, 4130, 1012, 10663, 1006, 1005, 20014, 1391...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/summary/moveArticleAfter.js
moveArticleAfter
function moveArticleAfter(summary, origin, afterTarget) { // Coerce to level var originLevel = is.string(origin)? origin : origin.getLevel(); var afterTargetLevel = is.string(afterTarget)? afterTarget : afterTarget.getLevel(); var article = summary.getByLevel(originLevel); var targetLevel = increment(afterTargetLevel); if (targetLevel < origin) { // Remove first var removed = removeArticle(summary, originLevel); // Insert then return insertArticle(removed, article, targetLevel); } else { // Insert right after first var inserted = insertArticle(summary, article, targetLevel); // Remove old one return removeArticle(inserted, originLevel); } }
javascript
function moveArticleAfter(summary, origin, afterTarget) { // Coerce to level var originLevel = is.string(origin)? origin : origin.getLevel(); var afterTargetLevel = is.string(afterTarget)? afterTarget : afterTarget.getLevel(); var article = summary.getByLevel(originLevel); var targetLevel = increment(afterTargetLevel); if (targetLevel < origin) { // Remove first var removed = removeArticle(summary, originLevel); // Insert then return insertArticle(removed, article, targetLevel); } else { // Insert right after first var inserted = insertArticle(summary, article, targetLevel); // Remove old one return removeArticle(inserted, originLevel); } }
[ "function", "moveArticleAfter", "(", "summary", ",", "origin", ",", "afterTarget", ")", "{", "// Coerce to level", "var", "originLevel", "=", "is", ".", "string", "(", "origin", ")", "?", "origin", ":", "origin", ".", "getLevel", "(", ")", ";", "var", "aft...
Returns a new summary, with the an article moved after another article. Unlike `moveArticle`, does not ensure that the article will be found at the target's level plus one. @param {Summary} summary @param {String|SummaryArticle} origin @param {String|SummaryArticle} afterTarget @return {Summary}
[ "Returns", "a", "new", "summary", "with", "the", "an", "article", "moved", "after", "another", "article", ".", "Unlike", "moveArticle", "does", "not", "ensure", "that", "the", "article", "will", "be", "found", "at", "the", "target", "s", "level", "plus", "...
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/modifiers/summary/moveArticleAfter.js#L15-L34
train
Moves an article after another article
[ 30522, 3853, 2693, 8445, 25128, 10354, 3334, 1006, 12654, 1010, 4761, 1010, 2044, 7559, 18150, 1007, 1063, 1013, 1013, 24873, 19170, 2000, 2504, 13075, 4761, 20414, 2884, 1027, 2003, 1012, 5164, 1006, 4761, 1007, 1029, 4761, 1024, 4761, 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...
ccxt/ccxt
build/transpile.js
deleteFunction
function deleteFunction (f, from) { const re1 = new RegExp ('def ' + f + '[^\#]+', 'g') const re2 = new RegExp ('[\\s]+' + f + '\\(exchange\\)', 'g') return from.replace (re1, '').replace (re2, '') }
javascript
function deleteFunction (f, from) { const re1 = new RegExp ('def ' + f + '[^\#]+', 'g') const re2 = new RegExp ('[\\s]+' + f + '\\(exchange\\)', 'g') return from.replace (re1, '').replace (re2, '') }
[ "function", "deleteFunction", "(", "f", ",", "from", ")", "{", "const", "re1", "=", "new", "RegExp", "(", "'def '", "+", "f", "+", "'[^\\#]+'", ",", "'g'", ")", "const", "re2", "=", "new", "RegExp", "(", "'[\\\\s]+'", "+", "f", "+", "'\\\\(exchange\\\\...
lines.forEach (line => log (line))
[ "lines", ".", "forEach", "(", "line", "=", ">", "log", "(", "line", "))" ]
8168069b9180a465532905e225586215e115a565
https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/build/transpile.js#L809-L813
train
Delete function from source
[ 30522, 3853, 3972, 12870, 11263, 27989, 1006, 1042, 1010, 2013, 1007, 1063, 9530, 3367, 2128, 2487, 1027, 2047, 19723, 10288, 2361, 1006, 1005, 13366, 1005, 1009, 1042, 1009, 1005, 1031, 1034, 1032, 1001, 1033, 1009, 1005, 1010, 1005, 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...
muaz-khan/RecordRTC
RecordRTC.js
GetRecorderType
function GetRecorderType(mediaStream, config) { var recorder; // StereoAudioRecorder can work with all three: Edge, Firefox and Chrome // todo: detect if it is Edge, then auto use: StereoAudioRecorder if (isChrome || isEdge || isOpera) { // Media Stream Recording API has not been implemented in chrome yet; // That's why using WebAudio API to record stereo audio in WAV format recorder = StereoAudioRecorder; } if (typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype && !isChrome) { recorder = MediaStreamRecorder; } // video recorder (in WebM format) if (config.type === 'video' && (isChrome || isOpera)) { recorder = WhammyRecorder; if (typeof WebAssemblyRecorder !== 'undefined' && typeof ReadableStream !== 'undefined') { recorder = WebAssemblyRecorder; } } // video recorder (in Gif format) if (config.type === 'gif') { recorder = GifRecorder; } // html2canvas recording! if (config.type === 'canvas') { recorder = CanvasRecorder; } if (isMediaRecorderCompatible() && recorder !== CanvasRecorder && recorder !== GifRecorder && typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype) { if (getTracks(mediaStream, 'video').length || getTracks(mediaStream, 'audio').length) { // audio-only recording if (config.type === 'audio') { if (typeof MediaRecorder.isTypeSupported === 'function' && MediaRecorder.isTypeSupported('audio/webm')) { recorder = MediaStreamRecorder; } // else recorder = StereoAudioRecorder; } else { // video or screen tracks if (typeof MediaRecorder.isTypeSupported === 'function' && MediaRecorder.isTypeSupported('video/webm')) { recorder = MediaStreamRecorder; } } } } if (mediaStream instanceof Array && mediaStream.length) { recorder = MultiStreamRecorder; } if (config.recorderType) { recorder = config.recorderType; } if (!config.disableLogs && !!recorder && !!recorder.name) { console.log('Using recorderType:', recorder.name || recorder.constructor.name); } if (!recorder && isSafari) { recorder = MediaStreamRecorder; } return recorder; }
javascript
function GetRecorderType(mediaStream, config) { var recorder; // StereoAudioRecorder can work with all three: Edge, Firefox and Chrome // todo: detect if it is Edge, then auto use: StereoAudioRecorder if (isChrome || isEdge || isOpera) { // Media Stream Recording API has not been implemented in chrome yet; // That's why using WebAudio API to record stereo audio in WAV format recorder = StereoAudioRecorder; } if (typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype && !isChrome) { recorder = MediaStreamRecorder; } // video recorder (in WebM format) if (config.type === 'video' && (isChrome || isOpera)) { recorder = WhammyRecorder; if (typeof WebAssemblyRecorder !== 'undefined' && typeof ReadableStream !== 'undefined') { recorder = WebAssemblyRecorder; } } // video recorder (in Gif format) if (config.type === 'gif') { recorder = GifRecorder; } // html2canvas recording! if (config.type === 'canvas') { recorder = CanvasRecorder; } if (isMediaRecorderCompatible() && recorder !== CanvasRecorder && recorder !== GifRecorder && typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype) { if (getTracks(mediaStream, 'video').length || getTracks(mediaStream, 'audio').length) { // audio-only recording if (config.type === 'audio') { if (typeof MediaRecorder.isTypeSupported === 'function' && MediaRecorder.isTypeSupported('audio/webm')) { recorder = MediaStreamRecorder; } // else recorder = StereoAudioRecorder; } else { // video or screen tracks if (typeof MediaRecorder.isTypeSupported === 'function' && MediaRecorder.isTypeSupported('video/webm')) { recorder = MediaStreamRecorder; } } } } if (mediaStream instanceof Array && mediaStream.length) { recorder = MultiStreamRecorder; } if (config.recorderType) { recorder = config.recorderType; } if (!config.disableLogs && !!recorder && !!recorder.name) { console.log('Using recorderType:', recorder.name || recorder.constructor.name); } if (!recorder && isSafari) { recorder = MediaStreamRecorder; } return recorder; }
[ "function", "GetRecorderType", "(", "mediaStream", ",", "config", ")", "{", "var", "recorder", ";", "// StereoAudioRecorder can work with all three: Edge, Firefox and Chrome", "// todo: detect if it is Edge, then auto use: StereoAudioRecorder", "if", "(", "isChrome", "||", "isEdge"...
__________________ GetRecorderType.js {@link GetRecorderType} is an inner/private helper for {@link RecordRTC}. @summary It returns best recorder-type available for your browser. @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT} @author {@link http://www.MuazKhan.com|Muaz Khan} @typedef GetRecorderType @class @example var RecorderType = GetRecorderType(options); var recorder = new RecorderType(options); @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API. @param {object} config - {type:"video", disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.}
[ "__________________", "GetRecorderType", ".", "js", "{" ]
3c6bad427b9da35c1cf617199ed13dda056c38ba
https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/RecordRTC.js#L989-L1057
train
Get recorder type
[ 30522, 3853, 2131, 2890, 27108, 4063, 13874, 1006, 2865, 21422, 1010, 9530, 8873, 2290, 1007, 1063, 13075, 14520, 1025, 1013, 1013, 12991, 19513, 25346, 8586, 8551, 2121, 2064, 2147, 30524, 2065, 1006, 2003, 20366, 1064, 1064, 2003, 24225, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/util.js
function(containerEl, attributeVal) { var AUTO_FOCUS = this.prefixer('md-autofocus', true); var elToFocus; elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS); if (!elToFocus && attributeVal != AUTO_FOCUS) { // Scan for deprecated attribute elToFocus = scanForFocusable(containerEl, this.prefixer('md-auto-focus', true)); if (!elToFocus) { // Scan for fallback to 'universal' API elToFocus = scanForFocusable(containerEl, AUTO_FOCUS); } } return elToFocus; /** * Can target and nested children for specified Selector (attribute) * whose value may be an expression that evaluates to True/False. */ function scanForFocusable(target, selector) { var elFound, items = target[0].querySelectorAll(selector); // Find the last child element with the focus attribute if (items && items.length){ items.length && angular.forEach(items, function(it) { it = angular.element(it); // Check the element for the md-autofocus class to ensure any associated expression // evaluated to true. var isFocusable = it.hasClass('md-autofocus'); if (isFocusable) elFound = it; }); } return elFound; } }
javascript
function(containerEl, attributeVal) { var AUTO_FOCUS = this.prefixer('md-autofocus', true); var elToFocus; elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS); if (!elToFocus && attributeVal != AUTO_FOCUS) { // Scan for deprecated attribute elToFocus = scanForFocusable(containerEl, this.prefixer('md-auto-focus', true)); if (!elToFocus) { // Scan for fallback to 'universal' API elToFocus = scanForFocusable(containerEl, AUTO_FOCUS); } } return elToFocus; /** * Can target and nested children for specified Selector (attribute) * whose value may be an expression that evaluates to True/False. */ function scanForFocusable(target, selector) { var elFound, items = target[0].querySelectorAll(selector); // Find the last child element with the focus attribute if (items && items.length){ items.length && angular.forEach(items, function(it) { it = angular.element(it); // Check the element for the md-autofocus class to ensure any associated expression // evaluated to true. var isFocusable = it.hasClass('md-autofocus'); if (isFocusable) elFound = it; }); } return elFound; } }
[ "function", "(", "containerEl", ",", "attributeVal", ")", "{", "var", "AUTO_FOCUS", "=", "this", ".", "prefixer", "(", "'md-autofocus'", ",", "true", ")", ";", "var", "elToFocus", ";", "elToFocus", "=", "scanForFocusable", "(", "containerEl", ",", "attributeVa...
Finds the proper focus target by searching the DOM. @param containerEl @param attributeVal @returns {*}
[ "Finds", "the", "proper", "focus", "target", "by", "searching", "the", "DOM", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L176-L214
train
Returns the last child element that has the specified attribute value.
[ 30522, 3853, 1006, 11661, 2884, 1010, 17961, 10175, 1007, 1063, 13075, 8285, 1035, 3579, 1027, 2023, 1012, 17576, 2121, 1006, 1005, 9108, 1011, 8285, 14876, 7874, 1005, 1010, 2995, 1007, 1025, 13075, 3449, 3406, 14876, 7874, 1025, 3449, 340...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-node/src/babel-node.js
getNormalizedV8Flag
function getNormalizedV8Flag(arg) { // v8 uses the "no" prefix to negate boolean flags (e.g. --nolezy), // but they are not listed by v8flags const matches = arg.match(/--(?:no)?(.+)/); if (matches) { return `--${matches[1].replace(/-/g, "_")}`; } return arg; }
javascript
function getNormalizedV8Flag(arg) { // v8 uses the "no" prefix to negate boolean flags (e.g. --nolezy), // but they are not listed by v8flags const matches = arg.match(/--(?:no)?(.+)/); if (matches) { return `--${matches[1].replace(/-/g, "_")}`; } return arg; }
[ "function", "getNormalizedV8Flag", "(", "arg", ")", "{", "// v8 uses the \"no\" prefix to negate boolean flags (e.g. --nolezy),", "// but they are not listed by v8flags", "const", "matches", "=", "arg", ".", "match", "(", "/", "--(?:no)?(.+)", "/", ")", ";", "if", "(", "m...
Replace dashes with underscores in the v8Flag name Also ensure that if the arg contains a value (e.g. --arg=true) that only the flag is returned.
[ "Replace", "dashes", "with", "underscores", "in", "the", "v8Flag", "name", "Also", "ensure", "that", "if", "the", "arg", "contains", "a", "value", "(", "e", ".", "g", ".", "--", "arg", "=", "true", ")", "that", "only", "the", "flag", "is", "returned", ...
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-node/src/babel-node.js#L30-L40
train
Returns the normalized v8 flag
[ 30522, 3853, 2131, 12131, 9067, 3550, 2615, 2620, 10258, 8490, 1006, 12098, 2290, 1007, 1063, 1013, 1013, 15754, 3594, 1996, 1000, 2053, 1000, 17576, 2000, 11265, 5867, 22017, 20898, 9245, 1006, 1041, 1012, 1043, 1012, 1011, 1011, 2053, 280...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
storybooks/storybook
addons/storyshots/storyshots-core/src/frameworks/svelte/renderTree.js
getRenderedTree
function getRenderedTree(story) { const { Component, props } = story.render(); const DefaultCompatComponent = Component.default || Component; // We need to create a target to mount onto. const target = document.createElement('section'); new DefaultCompatComponent({ target, props }); // eslint-disable-line // Classify the target so that it is clear where the markup // originates from, and that it is specific for snapshot tests. target.className = 'storybook-snapshot-container'; return target; }
javascript
function getRenderedTree(story) { const { Component, props } = story.render(); const DefaultCompatComponent = Component.default || Component; // We need to create a target to mount onto. const target = document.createElement('section'); new DefaultCompatComponent({ target, props }); // eslint-disable-line // Classify the target so that it is clear where the markup // originates from, and that it is specific for snapshot tests. target.className = 'storybook-snapshot-container'; return target; }
[ "function", "getRenderedTree", "(", "story", ")", "{", "const", "{", "Component", ",", "props", "}", "=", "story", ".", "render", "(", ")", ";", "const", "DefaultCompatComponent", "=", "Component", ".", "default", "||", "Component", ";", "// We need to create ...
Provides functionality to convert your raw story to the resulting markup. Storybook snapshots need the rendered markup that svelte outputs, but since we only have the story config data ({ Component, data }) in the Svelte stories, we need to mount the component, and then return the resulting HTML. If we don't render to HTML, we will get a snapshot of the raw story i.e. ({ Component, data }).
[ "Provides", "functionality", "to", "convert", "your", "raw", "story", "to", "the", "resulting", "markup", "." ]
9bff9271b7e163fb12b9ee0cf697c56f9d727b7b
https://github.com/storybooks/storybook/blob/9bff9271b7e163fb12b9ee0cf697c56f9d727b7b/addons/storyshots/storyshots-core/src/frameworks/svelte/renderTree.js#L14-L29
train
Returns a rendered tree
[ 30522, 3853, 2131, 7389, 4063, 2098, 13334, 1006, 2466, 1007, 1063, 9530, 3367, 1063, 6922, 1010, 24387, 1065, 1027, 2466, 1012, 17552, 1006, 1007, 1025, 9530, 3367, 12398, 9006, 4502, 13535, 25377, 5643, 3372, 1027, 6922, 1012, 12398, 1064...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/view/MainViewManager.js
_synchronizePaneSize
function _synchronizePaneSize(pane, forceRefresh) { var available; if (_orientation === VERTICAL) { available = _$el.innerWidth(); } else { available = _$el.innerHeight(); } // Update the pane's sizer element if it has one and update the max size Resizer.resyncSizer(pane.$el); pane.$el.data("maxsize", available - MIN_PANE_SIZE); pane.updateLayout(forceRefresh); }
javascript
function _synchronizePaneSize(pane, forceRefresh) { var available; if (_orientation === VERTICAL) { available = _$el.innerWidth(); } else { available = _$el.innerHeight(); } // Update the pane's sizer element if it has one and update the max size Resizer.resyncSizer(pane.$el); pane.$el.data("maxsize", available - MIN_PANE_SIZE); pane.updateLayout(forceRefresh); }
[ "function", "_synchronizePaneSize", "(", "pane", ",", "forceRefresh", ")", "{", "var", "available", ";", "if", "(", "_orientation", "===", "VERTICAL", ")", "{", "available", "=", "_$el", ".", "innerWidth", "(", ")", ";", "}", "else", "{", "available", "=",...
Synchronizes the pane's sizer element, updates the pane's resizer maxsize value and tells the pane to update its layout @param {boolean} forceRefresh - true to force a resize and refresh of the entire view @private
[ "Synchronizes", "the", "pane", "s", "sizer", "element", "updates", "the", "pane", "s", "resizer", "maxsize", "value", "and", "tells", "the", "pane", "to", "update", "its", "layout" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L997-L1010
train
Synchronize the pane s size with the max size
[ 30522, 3853, 1035, 26351, 8093, 10698, 4371, 9739, 2229, 4697, 1006, 6090, 2063, 1010, 2486, 2890, 19699, 9953, 1007, 1063, 13075, 2800, 1025, 2065, 1006, 1035, 10296, 1027, 1027, 1027, 7471, 1007, 1063, 2800, 1027, 1035, 1002, 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...
firebase/firebase-js-sdk
packages/auth/demo/public/script.js
addProviderIcon
function addProviderIcon(providerId) { var pElt = $('<i>').addClass('fa ' + providersIcons[providerId]) .attr('title', providerId) .data({ 'toggle': 'tooltip', 'placement': 'bottom' }); $('.profile-providers').append(pElt); pElt.tooltip(); }
javascript
function addProviderIcon(providerId) { var pElt = $('<i>').addClass('fa ' + providersIcons[providerId]) .attr('title', providerId) .data({ 'toggle': 'tooltip', 'placement': 'bottom' }); $('.profile-providers').append(pElt); pElt.tooltip(); }
[ "function", "addProviderIcon", "(", "providerId", ")", "{", "var", "pElt", "=", "$", "(", "'<i>'", ")", ".", "addClass", "(", "'fa '", "+", "providersIcons", "[", "providerId", "]", ")", ".", "attr", "(", "'title'", ",", "providerId", ")", ".", "data", ...
Add a provider icon to the profile info. @param {string} providerId The providerId of the provider.
[ "Add", "a", "provider", "icon", "to", "the", "profile", "info", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L219-L228
train
Add provider icon
[ 30522, 3853, 5587, 21572, 17258, 22420, 2239, 1006, 10802, 3593, 1007, 1063, 13075, 21877, 7096, 1027, 1002, 1006, 1005, 1026, 1045, 1028, 1005, 1007, 1012, 5587, 26266, 1006, 1005, 6904, 1005, 1009, 11670, 28524, 2015, 1031, 10802, 3593, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
function (iPart, sPath) { var oBaseContext, oBindingOrContext, oModel; if (typeof iPart === "string") { sPath = iPart; iPart = undefined; } getBindingOrContext(); // initialize vBindingOrContext if (Array.isArray(vBindingOrContext)) { if (iPart >= 0 && iPart < vBindingOrContext.length) { oBindingOrContext = vBindingOrContext[iPart]; } else { throw new Error("Invalid index of part: " + iPart); } } else if (iPart !== undefined) { throw new Error("Not the root formatter of a composite binding"); } else if (sPath) { oBindingOrContext = vBindingOrContext; } else { throw new Error("Missing path"); } if (sPath) { oModel = oBindingOrContext.getModel(); if (sPath.charAt(0) !== '/') { // relative path needs a base context oBaseContext = oBindingOrContext instanceof Context ? oBindingOrContext : oModel.createBindingContext(oBindingOrContext.getPath(), oBindingOrContext.getContext()); } oBindingOrContext = oModel.createBindingContext(sPath, oBaseContext); if (!oBindingOrContext) { throw new Error( "Model could not create binding context synchronously: " + oModel); } } return createContextInterface(null, mSettings, undefined, oBindingOrContext); }
javascript
function (iPart, sPath) { var oBaseContext, oBindingOrContext, oModel; if (typeof iPart === "string") { sPath = iPart; iPart = undefined; } getBindingOrContext(); // initialize vBindingOrContext if (Array.isArray(vBindingOrContext)) { if (iPart >= 0 && iPart < vBindingOrContext.length) { oBindingOrContext = vBindingOrContext[iPart]; } else { throw new Error("Invalid index of part: " + iPart); } } else if (iPart !== undefined) { throw new Error("Not the root formatter of a composite binding"); } else if (sPath) { oBindingOrContext = vBindingOrContext; } else { throw new Error("Missing path"); } if (sPath) { oModel = oBindingOrContext.getModel(); if (sPath.charAt(0) !== '/') { // relative path needs a base context oBaseContext = oBindingOrContext instanceof Context ? oBindingOrContext : oModel.createBindingContext(oBindingOrContext.getPath(), oBindingOrContext.getContext()); } oBindingOrContext = oModel.createBindingContext(sPath, oBaseContext); if (!oBindingOrContext) { throw new Error( "Model could not create binding context synchronously: " + oModel); } } return createContextInterface(null, mSettings, undefined, oBindingOrContext); }
[ "function", "(", "iPart", ",", "sPath", ")", "{", "var", "oBaseContext", ",", "oBindingOrContext", ",", "oModel", ";", "if", "(", "typeof", "iPart", "===", "\"string\"", ")", "{", "sPath", "=", "iPart", ";", "iPart", "=", "undefined", ";", "}", "getBindi...
Returns a context interface for the indicated part in case of the root formatter of a composite binding. The new interface provides access to the original settings, but only to the model and path of the indicated part: <pre> this.getInterface(i).getSetting(sName) === this.getSetting(sName); this.getInterface(i).getModel() === this.getModel(i); this.getInterface(i).getPath() === this.getPath(i); </pre> If a path is given, the new interface points to the resolved path as follows: <pre> this.getInterface(i, "foo/bar").getPath() === this.getPath(i) + "/foo/bar"; this.getInterface(i, "/absolute/path").getPath() === "/absolute/path"; </pre> A formatter which is not at the root level of a composite binding can also provide a path, but must not provide an index: <pre> this.getInterface("foo/bar").getPath() === this.getPath() + "/foo/bar"; this.getInterface("/absolute/path").getPath() === "/absolute/path"; </pre> Note that at least one argument must be present. @param {number} [iPart] index of part in case of the root formatter of a composite binding @param {string} [sPath] a path, interpreted relative to <code>this.getPath(iPart)</code> @returns {sap.ui.core.util.XMLPreprocessor.IContext} the context interface related to the indicated part @throws {Error} In case an index is given but the current interface does not belong to the root formatter of a composite binding, or in case the given index is invalid (e.g. missing or out of range), or in case a path is missing because no index is given, or in case a path is given but the model cannot not create a binding context synchronously @public @since 1.31.0
[ "Returns", "a", "context", "interface", "for", "the", "indicated", "part", "in", "case", "of", "the", "root", "formatter", "of", "a", "composite", "binding", ".", "The", "new", "interface", "provides", "access", "to", "the", "original", "settings", "but", "o...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L233-L272
train
Creates a context for a composite binding
[ 30522, 3853, 1006, 24531, 5339, 1010, 14690, 2232, 1007, 1063, 13075, 27885, 11022, 8663, 18209, 1010, 27885, 22254, 2075, 2953, 8663, 18209, 1010, 18168, 10244, 2140, 1025, 2065, 1006, 2828, 11253, 24531, 5339, 1027, 1027, 1027, 1000, 5164, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
catapult-project/catapult
tracing/third_party/oboe/src/lists.js
applyEach
function applyEach(fnList, args) { if( fnList ) { head(fnList).apply(null, args); applyEach(tail(fnList), args); } }
javascript
function applyEach(fnList, args) { if( fnList ) { head(fnList).apply(null, args); applyEach(tail(fnList), args); } }
[ "function", "applyEach", "(", "fnList", ",", "args", ")", "{", "if", "(", "fnList", ")", "{", "head", "(", "fnList", ")", ".", "apply", "(", "null", ",", "args", ")", ";", "applyEach", "(", "tail", "(", "fnList", ")", ",", "args", ")", ";", "}", ...
Call every function in a list of functions with the same arguments This doesn't make any sense if we're doing pure functional because it doesn't return anything. Hence, this is only really useful if the functions being called have side-effects.
[ "Call", "every", "function", "in", "a", "list", "of", "functions", "with", "the", "same", "arguments" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L160-L167
train
Apply each function in the list of functions
[ 30522, 3853, 6611, 5243, 2818, 1006, 1042, 20554, 2923, 1010, 12098, 5620, 1007, 1063, 2065, 1006, 1042, 20554, 2923, 1007, 1063, 2132, 1006, 1042, 20554, 2923, 1007, 1012, 6611, 1006, 19701, 1010, 12098, 5620, 1007, 1025, 6611, 5243, 2818,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-unmodified-loop-condition.js
updateModifiedFlag
function updateModifiedFlag(conditions, modifiers) { for (let i = 0; i < conditions.length; ++i) { const condition = conditions[i]; for (let j = 0; !condition.modified && j < modifiers.length; ++j) { const modifier = modifiers[j]; let funcNode, funcVar; /* * Besides checking for the condition being in the loop, we want to * check the function that this modifier is belonging to is called * in the loop. * FIXME: This should probably be extracted to a function. */ const inLoop = condition.isInLoop(modifier) || Boolean( (funcNode = getEncloseFunctionDeclaration(modifier)) && (funcVar = astUtils.getVariableByName(modifier.from.upper, funcNode.id.name)) && funcVar.references.some(condition.isInLoop) ); condition.modified = inLoop; } } }
javascript
function updateModifiedFlag(conditions, modifiers) { for (let i = 0; i < conditions.length; ++i) { const condition = conditions[i]; for (let j = 0; !condition.modified && j < modifiers.length; ++j) { const modifier = modifiers[j]; let funcNode, funcVar; /* * Besides checking for the condition being in the loop, we want to * check the function that this modifier is belonging to is called * in the loop. * FIXME: This should probably be extracted to a function. */ const inLoop = condition.isInLoop(modifier) || Boolean( (funcNode = getEncloseFunctionDeclaration(modifier)) && (funcVar = astUtils.getVariableByName(modifier.from.upper, funcNode.id.name)) && funcVar.references.some(condition.isInLoop) ); condition.modified = inLoop; } } }
[ "function", "updateModifiedFlag", "(", "conditions", ",", "modifiers", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "conditions", ".", "length", ";", "++", "i", ")", "{", "const", "condition", "=", "conditions", "[", "i", "]", ";", "for...
Updates the "modified" flags of given loop conditions with given modifiers. @param {LoopConditionInfo[]} conditions - The loop conditions to be updated. @param {eslint-scope.Reference[]} modifiers - The references to update. @returns {void}
[ "Updates", "the", "modified", "flags", "of", "given", "loop", "conditions", "with", "given", "modifiers", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-unmodified-loop-condition.js#L136-L160
train
Update modified flag of the conditions
[ 30522, 3853, 10651, 5302, 4305, 10451, 10258, 8490, 1006, 3785, 1010, 16913, 28295, 1007, 1063, 2005, 1006, 2292, 1045, 1027, 1014, 1025, 1045, 1026, 3785, 1012, 3091, 1025, 1009, 1009, 1045, 1007, 1063, 9530, 3367, 4650, 1027, 3785, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/utils/promise.js
map
function map(arr, iter) { if (Immutable.Map.isMap(arr)) { var type = 'Map'; if (Immutable.OrderedMap.isOrderedMap(arr)) { type = 'OrderedMap'; } return mapAsList(arr, function(value, key) { return Q(iter(value, key)) .then(function(result) { return [key, result]; }); }) .then(function(result) { return Immutable[type](result); }); } else { return mapAsList(arr, iter) .then(function(result) { return Immutable.List(result); }); } }
javascript
function map(arr, iter) { if (Immutable.Map.isMap(arr)) { var type = 'Map'; if (Immutable.OrderedMap.isOrderedMap(arr)) { type = 'OrderedMap'; } return mapAsList(arr, function(value, key) { return Q(iter(value, key)) .then(function(result) { return [key, result]; }); }) .then(function(result) { return Immutable[type](result); }); } else { return mapAsList(arr, iter) .then(function(result) { return Immutable.List(result); }); } }
[ "function", "map", "(", "arr", ",", "iter", ")", "{", "if", "(", "Immutable", ".", "Map", ".", "isMap", "(", "arr", ")", ")", "{", "var", "type", "=", "'Map'", ";", "if", "(", "Immutable", ".", "OrderedMap", ".", "isOrderedMap", "(", "arr", ")", ...
Map an array or map @param {Array|List|Map|OrderedMap} arr @param {Function(element, key)} @return {Promise<List|Map|OrderedMap>}
[ "Map", "an", "array", "or", "map" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/promise.js#L100-L122
train
mapAsList - Map - Iterator - Iterator - Function
[ 30522, 3853, 4949, 1006, 12098, 2099, 1010, 2009, 2121, 1007, 1063, 2065, 1006, 10047, 28120, 3085, 1012, 4949, 1012, 2003, 2863, 2361, 1006, 12098, 2099, 1007, 1007, 1063, 13075, 2828, 1027, 1005, 4949, 1005, 1025, 2065, 1006, 10047, 28120...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
bower_components/chart.js/Chart.js
function(){ // First we need the width of the yLabels, assuming the xLabels aren't rotated // To do that we need the base line at the top and base of the chart, assuming there is no x label rotation this.startPoint = (this.display) ? this.fontSize : 0; this.endPoint = (this.display) ? this.height - (this.fontSize * 1.5) - 5 : this.height; // -5 to pad labels // Apply padding settings to the start and end point. this.startPoint += this.padding; this.endPoint -= this.padding; // Cache the starting height, so can determine if we need to recalculate the scale yAxis var cachedHeight = this.endPoint - this.startPoint, cachedYLabelWidth; // Build the current yLabels so we have an idea of what size they'll be to start /* * This sets what is returned from calculateScaleRange as static properties of this class: * this.steps; this.stepValue; this.min; this.max; * */ this.calculateYRange(cachedHeight); // With these properties set we can now build the array of yLabels // and also the width of the largest yLabel this.buildYLabels(); this.calculateXLabelRotation(); while((cachedHeight > this.endPoint - this.startPoint)){ cachedHeight = this.endPoint - this.startPoint; cachedYLabelWidth = this.yLabelWidth; this.calculateYRange(cachedHeight); this.buildYLabels(); // Only go through the xLabel loop again if the yLabel width has changed if (cachedYLabelWidth < this.yLabelWidth){ this.calculateXLabelRotation(); } } }
javascript
function(){ // First we need the width of the yLabels, assuming the xLabels aren't rotated // To do that we need the base line at the top and base of the chart, assuming there is no x label rotation this.startPoint = (this.display) ? this.fontSize : 0; this.endPoint = (this.display) ? this.height - (this.fontSize * 1.5) - 5 : this.height; // -5 to pad labels // Apply padding settings to the start and end point. this.startPoint += this.padding; this.endPoint -= this.padding; // Cache the starting height, so can determine if we need to recalculate the scale yAxis var cachedHeight = this.endPoint - this.startPoint, cachedYLabelWidth; // Build the current yLabels so we have an idea of what size they'll be to start /* * This sets what is returned from calculateScaleRange as static properties of this class: * this.steps; this.stepValue; this.min; this.max; * */ this.calculateYRange(cachedHeight); // With these properties set we can now build the array of yLabels // and also the width of the largest yLabel this.buildYLabels(); this.calculateXLabelRotation(); while((cachedHeight > this.endPoint - this.startPoint)){ cachedHeight = this.endPoint - this.startPoint; cachedYLabelWidth = this.yLabelWidth; this.calculateYRange(cachedHeight); this.buildYLabels(); // Only go through the xLabel loop again if the yLabel width has changed if (cachedYLabelWidth < this.yLabelWidth){ this.calculateXLabelRotation(); } } }
[ "function", "(", ")", "{", "// First we need the width of the yLabels, assuming the xLabels aren't rotated", "// To do that we need the base line at the top and base of the chart, assuming there is no x label rotation", "this", ".", "startPoint", "=", "(", "this", ".", "display", ")", ...
Fitting loop to rotate x Labels and figure out what fits there, and also calculate how many Y steps to use
[ "Fitting", "loop", "to", "rotate", "x", "Labels", "and", "figure", "out", "what", "fits", "there", "and", "also", "calculate", "how", "many", "Y", "steps", "to", "use" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/chart.js/Chart.js#L1482-L1528
train
Calculate the y range of the y labels
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 2034, 2057, 2342, 1996, 9381, 1997, 1996, 1061, 20470, 9050, 1010, 10262, 1996, 28712, 16336, 4877, 4995, 1005, 1056, 20931, 1013, 1013, 2000, 2079, 2008, 2057, 2342, 1996, 2918, 2240, 2012, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
electron/electron
lib/browser/guest-view-manager.js
function (guestInstanceId, contents) { const guest = getGuest(guestInstanceId) if (!guest) { throw new Error(`Invalid guestInstanceId: ${guestInstanceId}`) } if (guest.hostWebContents !== contents) { throw new Error(`Access denied to guestInstanceId: ${guestInstanceId}`) } return guest }
javascript
function (guestInstanceId, contents) { const guest = getGuest(guestInstanceId) if (!guest) { throw new Error(`Invalid guestInstanceId: ${guestInstanceId}`) } if (guest.hostWebContents !== contents) { throw new Error(`Access denied to guestInstanceId: ${guestInstanceId}`) } return guest }
[ "function", "(", "guestInstanceId", ",", "contents", ")", "{", "const", "guest", "=", "getGuest", "(", "guestInstanceId", ")", "if", "(", "!", "guest", ")", "{", "throw", "new", "Error", "(", "`", "${", "guestInstanceId", "}", "`", ")", "}", "if", "(",...
Returns WebContents from its guest id hosted in given webContents.
[ "Returns", "WebContents", "from", "its", "guest", "id", "hosted", "in", "given", "webContents", "." ]
6e29611788277729647acf465f10db1ea6f15788
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L395-L404
train
Returns the guest id that has the given contents
[ 30522, 3853, 1006, 4113, 7076, 26897, 3593, 1010, 8417, 1007, 1063, 9530, 3367, 4113, 1027, 2131, 22967, 2102, 1006, 4113, 7076, 26897, 3593, 1007, 2065, 1006, 999, 4113, 1007, 1063, 5466, 2047, 7561, 1006, 1036, 19528, 4113, 7076, 26897, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-lone-blocks.js
isLoneBlock
function isLoneBlock(node) { return node.parent.type === "BlockStatement" || node.parent.type === "Program" || // Don't report blocks in switch cases if the block is the only statement of the case. node.parent.type === "SwitchCase" && !(node.parent.consequent[0] === node && node.parent.consequent.length === 1); }
javascript
function isLoneBlock(node) { return node.parent.type === "BlockStatement" || node.parent.type === "Program" || // Don't report blocks in switch cases if the block is the only statement of the case. node.parent.type === "SwitchCase" && !(node.parent.consequent[0] === node && node.parent.consequent.length === 1); }
[ "function", "isLoneBlock", "(", "node", ")", "{", "return", "node", ".", "parent", ".", "type", "===", "\"BlockStatement\"", "||", "node", ".", "parent", ".", "type", "===", "\"Program\"", "||", "// Don't report blocks in switch cases if the block is the only statement ...
Checks for any ocurrence of a BlockStatement in a place where lists of statements can appear @param {ASTNode} node The node to check @returns {boolean} True if the node is a lone block.
[ "Checks", "for", "any", "ocurrence", "of", "a", "BlockStatement", "in", "a", "place", "where", "lists", "of", "statements", "can", "appear" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-lone-blocks.js#L48-L54
train
Check if the node is a single block
[ 30522, 3853, 2003, 27165, 23467, 1006, 13045, 1007, 1063, 2709, 13045, 1012, 6687, 1012, 2828, 1027, 1027, 1027, 1000, 5991, 12259, 3672, 1000, 1064, 1064, 13045, 1012, 6687, 1012, 2828, 1027, 1027, 1027, 1000, 2565, 1000, 1064, 1064, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/parse/parseLanguages.js
parseLanguages
function parseLanguages(book) { var logger = book.getLogger(); return parseStructureFile(book, 'langs') .spread(function(file, result) { if (!file) { return book; } var languages = Languages.createFromList(file, result); logger.debug.ln('languages index file found at', file.getPath()); logger.info.ln('parsing multilingual book, with', languages.getList().size, 'languages'); return book.set('languages', languages); }); }
javascript
function parseLanguages(book) { var logger = book.getLogger(); return parseStructureFile(book, 'langs') .spread(function(file, result) { if (!file) { return book; } var languages = Languages.createFromList(file, result); logger.debug.ln('languages index file found at', file.getPath()); logger.info.ln('parsing multilingual book, with', languages.getList().size, 'languages'); return book.set('languages', languages); }); }
[ "function", "parseLanguages", "(", "book", ")", "{", "var", "logger", "=", "book", ".", "getLogger", "(", ")", ";", "return", "parseStructureFile", "(", "book", ",", "'langs'", ")", ".", "spread", "(", "function", "(", "file", ",", "result", ")", "{", ...
Parse languages list from book @param {Book} book @return {Promise<Book>}
[ "Parse", "languages", "list", "from", "book" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/parse/parseLanguages.js#L10-L26
train
Parse multilingual book
[ 30522, 3853, 11968, 11246, 5654, 6692, 8449, 1006, 2338, 1007, 1063, 13075, 8833, 4590, 1027, 2338, 1012, 2131, 21197, 4590, 1006, 1007, 1025, 2709, 11968, 8583, 18300, 5397, 8873, 2571, 1006, 2338, 1010, 1005, 11374, 2015, 1005, 1007, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js
fakeEvent
function fakeEvent(sEventName, oTarget, oParams) { var oEvent = jQuery.Event({type : sEventName}); if ( oTarget != null ) { oEvent.target = oTarget; } if (oParams) { for (var x in oParams) { // propagate property to event oEvent[x] = oParams[x]; if ( x === 'originalEvent' ) { // if 'originalEvent' has been changed, fix it fixOriginalEvent(oEvent[x]); } else { // otherwise propagate property to 'originalEvent' as well oEvent.originalEvent[x] = oParams[x]; } } } return oEvent; }
javascript
function fakeEvent(sEventName, oTarget, oParams) { var oEvent = jQuery.Event({type : sEventName}); if ( oTarget != null ) { oEvent.target = oTarget; } if (oParams) { for (var x in oParams) { // propagate property to event oEvent[x] = oParams[x]; if ( x === 'originalEvent' ) { // if 'originalEvent' has been changed, fix it fixOriginalEvent(oEvent[x]); } else { // otherwise propagate property to 'originalEvent' as well oEvent.originalEvent[x] = oParams[x]; } } } return oEvent; }
[ "function", "fakeEvent", "(", "sEventName", ",", "oTarget", ",", "oParams", ")", "{", "var", "oEvent", "=", "jQuery", ".", "Event", "(", "{", "type", ":", "sEventName", "}", ")", ";", "if", "(", "oTarget", "!=", "null", ")", "{", "oEvent", ".", "targ...
/* Creates a fake event of type jQuery.Event, according to current UI5 practices; it will always contain a pseudo browser event (property <code>originalEvent</code>). Please note that the <code>originalEvent</code> could be created as a native browser event (class <code>Event</code>) as some existing test cases specify a <code>target</code> property which is readonly in the <code>Event</code> class. Any given <code>oParams</code> are added to the new <code>jQuery.Event</code> as well as to its <code>originalEvent</code> object. To be compatible with older versions, this function does not propagate properties to <code>originalEvent</code> when they are given before an eventual <code>originalEvent</code> property in <code>oParams</code>. @param {string} sEventName mandatory name (type) of the newly created event @param {DOMElement} [oTarget] optional target of the event @param {object} [oParams] optional map of properties to be added to the event
[ "/", "*", "Creates", "a", "fake", "event", "of", "type", "jQuery", ".", "Event", "according", "to", "current", "UI5", "practices", ";", "it", "will", "always", "contain", "a", "pseudo", "browser", "event", "(", "property", "<code", ">", "originalEvent<", "...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L259-L283
train
fakeEvent - creates a fake event
[ 30522, 3853, 8275, 18697, 3372, 1006, 2698, 2102, 18442, 1010, 27178, 2906, 18150, 1010, 6728, 5400, 5244, 1007, 1063, 13075, 1051, 18697, 3372, 1027, 1046, 4226, 2854, 1012, 2724, 1006, 1063, 2828, 1024, 2698, 2102, 18442, 1065, 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
src/ol/format/MVT.js
layerPBFReader
function layerPBFReader(tag, layer, pbf) { if (tag === 15) { layer.version = pbf.readVarint(); } else if (tag === 1) { layer.name = pbf.readString(); } else if (tag === 5) { layer.extent = pbf.readVarint(); } else if (tag === 2) { layer.features.push(pbf.pos); } else if (tag === 3) { layer.keys.push(pbf.readString()); } else if (tag === 4) { let value = null; const end = pbf.readVarint() + pbf.pos; while (pbf.pos < end) { tag = pbf.readVarint() >> 3; value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null; } layer.values.push(value); } }
javascript
function layerPBFReader(tag, layer, pbf) { if (tag === 15) { layer.version = pbf.readVarint(); } else if (tag === 1) { layer.name = pbf.readString(); } else if (tag === 5) { layer.extent = pbf.readVarint(); } else if (tag === 2) { layer.features.push(pbf.pos); } else if (tag === 3) { layer.keys.push(pbf.readString()); } else if (tag === 4) { let value = null; const end = pbf.readVarint() + pbf.pos; while (pbf.pos < end) { tag = pbf.readVarint() >> 3; value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null; } layer.values.push(value); } }
[ "function", "layerPBFReader", "(", "tag", ",", "layer", ",", "pbf", ")", "{", "if", "(", "tag", "===", "15", ")", "{", "layer", ".", "version", "=", "pbf", ".", "readVarint", "(", ")", ";", "}", "else", "if", "(", "tag", "===", "1", ")", "{", "...
Reader callback for parsing layer. @param {number} tag The tag. @param {Object} layer The layer object. @param {PBF} pbf The PBF.
[ "Reader", "callback", "for", "parsing", "layer", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/MVT.js#L312-L338
train
Read a layer from a PBF stream.
[ 30522, 3853, 6741, 2361, 29292, 16416, 4063, 1006, 6415, 1010, 6741, 1010, 1052, 29292, 1007, 1063, 2065, 1006, 6415, 1027, 1027, 1027, 2321, 1007, 1063, 6741, 1012, 2544, 1027, 1052, 29292, 1012, 3191, 10755, 18447, 1006, 1007, 1025, 1065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/wysiwygCommands/tableAddCol.js
addColToCellAfter
function addColToCellAfter($cell, numberOfCols = 1) { const index = $cell.index(); let cellToAdd; $cell.parents('table').find('tr').each((n, tr) => { const isTBody = domUtils.getNodeName(tr.parentNode) === 'TBODY'; const isMSIE = util.browser.msie; const cell = tr.children[index]; for (let i = 0; i < numberOfCols; i += 1) { if (isTBody) { cellToAdd = document.createElement('td'); } else { cellToAdd = document.createElement('th'); } if (!isMSIE) { cellToAdd.appendChild(document.createElement('br')); } $(cellToAdd).insertAfter(cell); } }); }
javascript
function addColToCellAfter($cell, numberOfCols = 1) { const index = $cell.index(); let cellToAdd; $cell.parents('table').find('tr').each((n, tr) => { const isTBody = domUtils.getNodeName(tr.parentNode) === 'TBODY'; const isMSIE = util.browser.msie; const cell = tr.children[index]; for (let i = 0; i < numberOfCols; i += 1) { if (isTBody) { cellToAdd = document.createElement('td'); } else { cellToAdd = document.createElement('th'); } if (!isMSIE) { cellToAdd.appendChild(document.createElement('br')); } $(cellToAdd).insertAfter(cell); } }); }
[ "function", "addColToCellAfter", "(", "$cell", ",", "numberOfCols", "=", "1", ")", "{", "const", "index", "=", "$cell", ".", "index", "(", ")", ";", "let", "cellToAdd", ";", "$cell", ".", "parents", "(", "'table'", ")", ".", "find", "(", "'tr'", ")", ...
Add column to after the current cell @param {jQuery} $cell - jQuery wrapped table cell @param {number} [numberOfCols=1] - number of cols @ignore
[ "Add", "column", "to", "after", "the", "current", "cell" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAddCol.js#L86-L106
train
Add column to next cell
[ 30522, 3853, 5587, 25778, 3406, 29109, 2721, 6199, 2121, 1006, 1002, 3526, 1010, 2193, 11253, 25778, 2015, 1027, 1015, 1007, 1063, 9530, 3367, 5950, 1027, 1002, 3526, 1012, 5950, 1006, 1007, 1025, 2292, 3526, 3406, 4215, 2094, 1025, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/js/mui.locker.js
function() { var self = this; //self.pointLocationArr = []; if (self.cxt) { self.cxt.clearRect(0, 0, self.CW, self.CH); self.draw(self.cxt, self.pointLocationArr, [], { X: 0, Y: 0 }); } }
javascript
function() { var self = this; //self.pointLocationArr = []; if (self.cxt) { self.cxt.clearRect(0, 0, self.CW, self.CH); self.draw(self.cxt, self.pointLocationArr, [], { X: 0, Y: 0 }); } }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "//self.pointLocationArr = [];", "if", "(", "self", ".", "cxt", ")", "{", "self", ".", "cxt", ".", "clearRect", "(", "0", ",", "0", ",", "self", ".", "CW", ",", "self", ".", "CH", ")", "...
清除图形
[ "清除图形" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/js/mui.locker.js#L249-L259
train
Draws the region region
[ 30522, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 1013, 1013, 2969, 1012, 2391, 4135, 10719, 2906, 2099, 1027, 1031, 1033, 1025, 2065, 1006, 2969, 1012, 1039, 18413, 1007, 1063, 2969, 1012, 1039, 18413, 1012, 3154, 2890, 6593, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/vue-devtools
src/backend/index.js
flush
function flush () { let start functionalIds.clear() captureIds.clear() if (process.env.NODE_ENV !== 'production') { captureCount = 0 start = isBrowser ? window.performance.now() : 0 } const payload = stringify({ inspectedInstance: getInstanceDetails(currentInspectedId), instances: findQualifiedChildrenFromList(rootInstances) }) if (process.env.NODE_ENV !== 'production') { console.log(`[flush] serialized ${captureCount} instances${isBrowser ? `, took ${window.performance.now() - start}ms.` : ''}.`) } bridge.send('flush', payload) }
javascript
function flush () { let start functionalIds.clear() captureIds.clear() if (process.env.NODE_ENV !== 'production') { captureCount = 0 start = isBrowser ? window.performance.now() : 0 } const payload = stringify({ inspectedInstance: getInstanceDetails(currentInspectedId), instances: findQualifiedChildrenFromList(rootInstances) }) if (process.env.NODE_ENV !== 'production') { console.log(`[flush] serialized ${captureCount} instances${isBrowser ? `, took ${window.performance.now() - start}ms.` : ''}.`) } bridge.send('flush', payload) }
[ "function", "flush", "(", ")", "{", "let", "start", "functionalIds", ".", "clear", "(", ")", "captureIds", ".", "clear", "(", ")", "if", "(", "process", ".", "env", ".", "NODE_ENV", "!==", "'production'", ")", "{", "captureCount", "=", "0", "start", "=...
Called on every Vue.js batcher flush cycle. Capture current component tree structure and the state of the current inspected instance (if present) and send it to the devtools.
[ "Called", "on", "every", "Vue", ".", "js", "batcher", "flush", "cycle", ".", "Capture", "current", "component", "tree", "structure", "and", "the", "state", "of", "the", "current", "inspected", "instance", "(", "if", "present", ")", "and", "send", "it", "to...
4de4b86388453cd07f0c1bf967d43a4dd4b011c9
https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/index.js#L275-L291
train
Flush the current inspected instance
[ 30522, 3853, 13862, 1006, 1007, 1063, 2292, 2707, 8360, 9821, 1012, 3154, 1006, 1007, 5425, 9821, 1012, 3154, 1006, 1007, 2065, 1006, 2832, 1012, 4372, 2615, 1012, 13045, 1035, 4372, 2615, 999, 1027, 1027, 1005, 2537, 1005, 1007, 1063, 54...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/BezierCurveEditor.js
handlePointMove
function handlePointMove(e, x, y) { var self = e.target, bezierEditor = self.bezierEditor; // Helper function to redraw curve function mouseMoveRedraw() { if (!bezierEditor.dragElement) { animationRequest = null; return; } // Update code bezierEditor._commitTimingFunction(); bezierEditor._updateCanvas(); animationRequest = window.requestAnimationFrame(mouseMoveRedraw); } // This is a dragging state, but left button is no longer down, so mouse // exited element, was released, and re-entered element. Treat like a drop. if (bezierEditor.dragElement && (e.which !== 1)) { bezierEditor.dragElement = null; bezierEditor._commitTimingFunction(); bezierEditor._updateCanvas(); bezierEditor = null; return; } // Constrain time (x-axis) to 0 to 1 range. Progression (y-axis) is // theoretically not constrained, although canvas to drawing curve is // arbitrarily constrained to -0.5 to 1.5 range. x = Math.min(Math.max(0, x), WIDTH_MAIN); if (bezierEditor.dragElement) { $(bezierEditor.dragElement).css({ left: x + "px", top: y + "px" }); } // update coords bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas .offsetsToCoordinates(bezierEditor.P1) .concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2)); if (!animationRequest) { animationRequest = window.requestAnimationFrame(mouseMoveRedraw); } }
javascript
function handlePointMove(e, x, y) { var self = e.target, bezierEditor = self.bezierEditor; // Helper function to redraw curve function mouseMoveRedraw() { if (!bezierEditor.dragElement) { animationRequest = null; return; } // Update code bezierEditor._commitTimingFunction(); bezierEditor._updateCanvas(); animationRequest = window.requestAnimationFrame(mouseMoveRedraw); } // This is a dragging state, but left button is no longer down, so mouse // exited element, was released, and re-entered element. Treat like a drop. if (bezierEditor.dragElement && (e.which !== 1)) { bezierEditor.dragElement = null; bezierEditor._commitTimingFunction(); bezierEditor._updateCanvas(); bezierEditor = null; return; } // Constrain time (x-axis) to 0 to 1 range. Progression (y-axis) is // theoretically not constrained, although canvas to drawing curve is // arbitrarily constrained to -0.5 to 1.5 range. x = Math.min(Math.max(0, x), WIDTH_MAIN); if (bezierEditor.dragElement) { $(bezierEditor.dragElement).css({ left: x + "px", top: y + "px" }); } // update coords bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas .offsetsToCoordinates(bezierEditor.P1) .concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2)); if (!animationRequest) { animationRequest = window.requestAnimationFrame(mouseMoveRedraw); } }
[ "function", "handlePointMove", "(", "e", ",", "x", ",", "y", ")", "{", "var", "self", "=", "e", ".", "target", ",", "bezierEditor", "=", "self", ".", "bezierEditor", ";", "// Helper function to redraw curve", "function", "mouseMoveRedraw", "(", ")", "{", "if...
Helper function for handling point move @param {Event} e Mouse move event @param {number} x New horizontal position @param {number} y New vertical position
[ "Helper", "function", "for", "handling", "point", "move" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js#L286-L334
train
Handle mouse move event
[ 30522, 3853, 5047, 8400, 5302, 3726, 1006, 1041, 1010, 1060, 1010, 1061, 1007, 1063, 13075, 2969, 1027, 1041, 1012, 4539, 1010, 2022, 21548, 2098, 15660, 30524, 21548, 2098, 15660, 1012, 8011, 12260, 3672, 1007, 1063, 7284, 2890, 15500, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wuchangming/spy-debugger
buildin_modules/weinre/web/modjewel.js
require_reset
function require_reset() { ModuleStore = {} ModulePreloadStore = {} MainModule = create_module(null) var require = get_require(MainModule) var define = require_define define("modjewel", modjewel_module) global.modjewel = require("modjewel") global.modjewel.require = require global.modjewel.define = define global.modjewel.define.amd = {implementation: PROGRAM, version: VERSION} }
javascript
function require_reset() { ModuleStore = {} ModulePreloadStore = {} MainModule = create_module(null) var require = get_require(MainModule) var define = require_define define("modjewel", modjewel_module) global.modjewel = require("modjewel") global.modjewel.require = require global.modjewel.define = define global.modjewel.define.amd = {implementation: PROGRAM, version: VERSION} }
[ "function", "require_reset", "(", ")", "{", "ModuleStore", "=", "{", "}", "ModulePreloadStore", "=", "{", "}", "MainModule", "=", "create_module", "(", "null", ")", "var", "require", "=", "get_require", "(", "MainModule", ")", "var", "define", "=", "require_...
---------------------------------------------------------------------------- reset the stores ----------------------------------------------------------------------------
[ "----------------------------------------------------------------------------", "reset", "the", "stores", "----------------------------------------------------------------------------" ]
55c1dda0dff0c44920673711656ddfd7ff03c307
https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/modjewel.js#L168-L182
train
Reset the module
[ 30522, 3853, 5478, 1035, 25141, 1006, 1007, 1063, 14184, 19277, 1027, 1063, 1065, 11336, 28139, 11066, 23809, 2063, 1027, 1063, 1065, 2364, 5302, 8566, 2571, 1027, 3443, 1035, 11336, 1006, 19701, 1007, 13075, 5478, 1027, 2131, 1035, 5478, 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...
wangfupeng1988/wangEditor
src/js/command/index.js
function (name, value) { const editor = this.editor // 使用 styleWithCSS if (!editor._useStyleWithCSS) { document.execCommand('styleWithCSS', null, true) editor._useStyleWithCSS = true } // 如果无选区,忽略 if (!editor.selection.getRange()) { return } // 恢复选取 editor.selection.restoreSelection() // 执行 const _name = '_' + name if (this[_name]) { // 有自定义事件 this[_name](value) } else { // 默认 command this._execCommand(name, value) } // 修改菜单状态 editor.menus.changeActive() // 最后,恢复选取保证光标在原来的位置闪烁 editor.selection.saveRange() editor.selection.restoreSelection() // 触发 onchange editor.change && editor.change() }
javascript
function (name, value) { const editor = this.editor // 使用 styleWithCSS if (!editor._useStyleWithCSS) { document.execCommand('styleWithCSS', null, true) editor._useStyleWithCSS = true } // 如果无选区,忽略 if (!editor.selection.getRange()) { return } // 恢复选取 editor.selection.restoreSelection() // 执行 const _name = '_' + name if (this[_name]) { // 有自定义事件 this[_name](value) } else { // 默认 command this._execCommand(name, value) } // 修改菜单状态 editor.menus.changeActive() // 最后,恢复选取保证光标在原来的位置闪烁 editor.selection.saveRange() editor.selection.restoreSelection() // 触发 onchange editor.change && editor.change() }
[ "function", "(", "name", ",", "value", ")", "{", "const", "editor", "=", "this", ".", "editor", "// 使用 styleWithCSS", "if", "(", "!", "editor", ".", "_useStyleWithCSS", ")", "{", "document", ".", "execCommand", "(", "'styleWithCSS'", ",", "null", ",", "tru...
执行命令
[ "执行命令" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/command/index.js#L18-L54
train
Execute a command
[ 30522, 3853, 1006, 2171, 1010, 3643, 1007, 1063, 9530, 3367, 3559, 1027, 2023, 1012, 3559, 1013, 1013, 100, 100, 2806, 24415, 6169, 2015, 2065, 1006, 999, 3559, 1012, 1035, 3594, 27983, 24415, 6169, 2015, 1007, 1063, 6254, 1012, 4654, 858...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
babel/babel
packages/babel-plugin-transform-block-scoping/src/index.js
isInLoop
function isInLoop(path) { const loopOrFunctionParent = path.find( path => path.isLoop() || path.isFunction(), ); return loopOrFunctionParent && loopOrFunctionParent.isLoop(); }
javascript
function isInLoop(path) { const loopOrFunctionParent = path.find( path => path.isLoop() || path.isFunction(), ); return loopOrFunctionParent && loopOrFunctionParent.isLoop(); }
[ "function", "isInLoop", "(", "path", ")", "{", "const", "loopOrFunctionParent", "=", "path", ".", "find", "(", "path", "=>", "path", ".", "isLoop", "(", ")", "||", "path", ".", "isFunction", "(", ")", ",", ")", ";", "return", "loopOrFunctionParent", "&&"...
If there is a loop ancestor closer than the closest function, we consider ourselves to be in a loop.
[ "If", "there", "is", "a", "loop", "ancestor", "closer", "than", "the", "closest", "function", "we", "consider", "ourselves", "to", "be", "in", "a", "loop", "." ]
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-plugin-transform-block-scoping/src/index.js#L123-L129
train
Check if path is a loop or function
[ 30522, 3853, 2003, 2378, 4135, 7361, 1006, 4130, 1007, 1063, 9530, 3367, 7077, 16347, 4609, 7542, 19362, 4765, 1027, 4130, 1012, 2424, 1006, 4130, 1027, 1028, 4130, 1012, 2003, 4135, 7361, 1006, 1007, 1064, 1064, 4130, 1012, 2003, 11263, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kriasoft/react-starter-kit
tools/runServer.js
runServer
function runServer() { return new Promise(resolve => { function onStdOut(data) { const time = new Date().toTimeString(); const match = data.toString('utf8').match(RUNNING_REGEXP); process.stdout.write(time.replace(/.*(\d{2}:\d{2}:\d{2}).*/, '[$1] ')); process.stdout.write(data); if (match) { server.host = match[1]; server.stdout.removeListener('data', onStdOut); server.stdout.on('data', x => process.stdout.write(x)); pending = false; resolve(server); } } if (server) { server.kill('SIGTERM'); } server = cp.spawn('node', [serverPath], { env: Object.assign({ NODE_ENV: 'development' }, process.env), silent: false, }); if (pending) { server.once('exit', (code, signal) => { if (pending) { throw new Error( `Server terminated unexpectedly with code: ${code} signal: ${signal}`, ); } }); } server.stdout.on('data', onStdOut); server.stderr.on('data', x => process.stderr.write(x)); return server; }); }
javascript
function runServer() { return new Promise(resolve => { function onStdOut(data) { const time = new Date().toTimeString(); const match = data.toString('utf8').match(RUNNING_REGEXP); process.stdout.write(time.replace(/.*(\d{2}:\d{2}:\d{2}).*/, '[$1] ')); process.stdout.write(data); if (match) { server.host = match[1]; server.stdout.removeListener('data', onStdOut); server.stdout.on('data', x => process.stdout.write(x)); pending = false; resolve(server); } } if (server) { server.kill('SIGTERM'); } server = cp.spawn('node', [serverPath], { env: Object.assign({ NODE_ENV: 'development' }, process.env), silent: false, }); if (pending) { server.once('exit', (code, signal) => { if (pending) { throw new Error( `Server terminated unexpectedly with code: ${code} signal: ${signal}`, ); } }); } server.stdout.on('data', onStdOut); server.stderr.on('data', x => process.stderr.write(x)); return server; }); }
[ "function", "runServer", "(", ")", "{", "return", "new", "Promise", "(", "resolve", "=>", "{", "function", "onStdOut", "(", "data", ")", "{", "const", "time", "=", "new", "Date", "(", ")", ".", "toTimeString", "(", ")", ";", "const", "match", "=", "d...
Launch or restart the Node.js server
[ "Launch", "or", "restart", "the", "Node", ".", "js", "server" ]
8d6c018f3198dec2a580ecafb011a32f06e38dbf
https://github.com/kriasoft/react-starter-kit/blob/8d6c018f3198dec2a580ecafb011a32f06e38dbf/tools/runServer.js#L26-L68
train
Run the server
[ 30522, 3853, 3216, 2121, 6299, 1006, 1007, 1063, 2709, 2047, 4872, 1006, 10663, 1027, 1028, 1063, 3853, 2006, 3367, 26797, 2102, 1006, 2951, 1007, 1063, 9530, 3367, 2051, 1027, 2047, 3058, 1006, 1007, 1012, 2000, 7292, 3367, 4892, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
Makefile.js
loadPerformance
function loadPerformance() { echo(""); echo("Loading:"); const results = []; for (let cnt = 0; cnt < 5; cnt++) { const loadPerfData = loadPerf({ checkDependencies: false }); echo(` Load performance Run #${cnt + 1}: %dms`, loadPerfData.loadTime); results.push(loadPerfData.loadTime); } results.sort((a, b) => a - b); const median = results[~~(results.length / 2)]; echo(""); echo(" Load Performance median: %dms", median); echo(""); }
javascript
function loadPerformance() { echo(""); echo("Loading:"); const results = []; for (let cnt = 0; cnt < 5; cnt++) { const loadPerfData = loadPerf({ checkDependencies: false }); echo(` Load performance Run #${cnt + 1}: %dms`, loadPerfData.loadTime); results.push(loadPerfData.loadTime); } results.sort((a, b) => a - b); const median = results[~~(results.length / 2)]; echo(""); echo(" Load Performance median: %dms", median); echo(""); }
[ "function", "loadPerformance", "(", ")", "{", "echo", "(", "\"\"", ")", ";", "echo", "(", "\"Loading:\"", ")", ";", "const", "results", "=", "[", "]", ";", "for", "(", "let", "cnt", "=", "0", ";", "cnt", "<", "5", ";", "cnt", "++", ")", "{", "c...
Run the load performance for eslint @returns {void} @private
[ "Run", "the", "load", "performance", "for", "eslint" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/Makefile.js#L1036-L1057
train
Load performance for the
[ 30522, 3853, 7170, 4842, 14192, 6651, 1006, 1007, 1063, 9052, 1006, 1000, 1000, 1007, 1025, 9052, 1006, 1000, 10578, 1024, 1000, 1007, 1025, 9530, 3367, 3463, 1027, 1031, 1033, 1025, 2005, 1006, 2292, 27166, 2102, 1027, 1014, 1025, 27166, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
parse_kwargs
function parse_kwargs(kwargs) { var args = new Object(); var pairs = kwargs.split(/,/); for (var i = 0; i < pairs.length;) { if (i > 0 && pairs[i].indexOf('=') == -1) { // the value string contained a comma. Glue the parts back together. pairs[i-1] += ',' + pairs.splice(i, 1)[0]; } else { ++i; } } for (var i = 0; i < pairs.length; ++i) { var splits = pairs[i].split(/=/); if (splits.length == 1) { continue; } var key = splits.shift(); var value = splits.join('='); args[key.trim()] = value.trim(); } return args; }
javascript
function parse_kwargs(kwargs) { var args = new Object(); var pairs = kwargs.split(/,/); for (var i = 0; i < pairs.length;) { if (i > 0 && pairs[i].indexOf('=') == -1) { // the value string contained a comma. Glue the parts back together. pairs[i-1] += ',' + pairs.splice(i, 1)[0]; } else { ++i; } } for (var i = 0; i < pairs.length; ++i) { var splits = pairs[i].split(/=/); if (splits.length == 1) { continue; } var key = splits.shift(); var value = splits.join('='); args[key.trim()] = value.trim(); } return args; }
[ "function", "parse_kwargs", "(", "kwargs", ")", "{", "var", "args", "=", "new", "Object", "(", ")", ";", "var", "pairs", "=", "kwargs", ".", "split", "(", "/", ",", "/", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "pairs", ".", ...
Parses a python-style keyword arguments string and returns the pairs in a new object. @param kwargs a string representing a set of keyword arguments. It should look like <tt>keyword1=value1, keyword2=value2, ...</tt> @return an object mapping strings to strings
[ "Parses", "a", "python", "-", "style", "keyword", "arguments", "string", "and", "returns", "the", "pairs", "in", "a", "new", "object", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2482-L2505
train
Parse kwargs into a object
[ 30522, 3853, 11968, 3366, 1035, 6448, 2906, 5620, 1006, 6448, 2906, 5620, 1007, 1063, 13075, 12098, 5620, 1027, 2047, 4874, 1006, 1007, 1025, 13075, 7689, 1027, 6448, 2906, 5620, 1012, 3975, 1006, 1013, 1010, 1013, 1007, 1025, 2005, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (oChange, aActiveContexts) { var sChangeContext = oChange.context || ""; if (!sChangeContext) { // change is free of context (always applied) return true; } return aActiveContexts && aActiveContexts.indexOf(sChangeContext) !== -1; }
javascript
function (oChange, aActiveContexts) { var sChangeContext = oChange.context || ""; if (!sChangeContext) { // change is free of context (always applied) return true; } return aActiveContexts && aActiveContexts.indexOf(sChangeContext) !== -1; }
[ "function", "(", "oChange", ",", "aActiveContexts", ")", "{", "var", "sChangeContext", "=", "oChange", ".", "context", "||", "\"\"", ";", "if", "(", "!", "sChangeContext", ")", "{", "// change is free of context (always applied)", "return", "true", ";", "}", "re...
Helper to check if a passed change is free of contexts or in a matching context. @param {sap.ui.fl.Change} oChange - change object which has to be filtered @param {sap.ui.fl.Context[]} aActiveContexts - active runtime or designtime context @returns {boolean} is change context free or has a valid context
[ "Helper", "to", "check", "if", "a", "passed", "change", "is", "free", "of", "contexts", "or", "in", "a", "matching", "context", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L41-L50
train
Returns true if the change is free of context
[ 30522, 3853, 1006, 28166, 22043, 1010, 9779, 15277, 8663, 18209, 2015, 1007, 1063, 13075, 8040, 18003, 8586, 30524, 2467, 4162, 1007, 2709, 2995, 1025, 1065, 2709, 9779, 15277, 8663, 18209, 2015, 1004, 1004, 9779, 15277, 8663, 18209, 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...
uber/deck.gl
modules/core/bundle/deckgl.js
getViewState
function getViewState(props) { if (!props.viewState && 'latitude' in props && 'longitude' in props && 'zoom' in props) { const {latitude, longitude, zoom, pitch = 0, bearing = 0} = props; return {latitude, longitude, zoom, pitch, bearing}; } return props.viewState; }
javascript
function getViewState(props) { if (!props.viewState && 'latitude' in props && 'longitude' in props && 'zoom' in props) { const {latitude, longitude, zoom, pitch = 0, bearing = 0} = props; return {latitude, longitude, zoom, pitch, bearing}; } return props.viewState; }
[ "function", "getViewState", "(", "props", ")", "{", "if", "(", "!", "props", ".", "viewState", "&&", "'latitude'", "in", "props", "&&", "'longitude'", "in", "props", "&&", "'zoom'", "in", "props", ")", "{", "const", "{", "latitude", ",", "longitude", ","...
Supports old "geospatial view state as separate props" style TODO - this should either be moved into the core or deprecated
[ "Supports", "old", "geospatial", "view", "state", "as", "separate", "props", "style", "TODO", "-", "this", "should", "either", "be", "moved", "into", "the", "core", "or", "deprecated" ]
a2010448b7f268bbd03617b812334c68a6b9e5b2
https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/core/bundle/deckgl.js#L17-L23
train
Get the viewState from the given props
[ 30522, 3853, 2131, 8584, 9153, 2618, 1006, 24387, 1007, 1063, 2065, 1006, 999, 24387, 1012, 5328, 12259, 1004, 1004, 1005, 15250, 1005, 1999, 24387, 1004, 1004, 1005, 20413, 1005, 1999, 24387, 1004, 1004, 1005, 24095, 1005, 1999, 24387, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function(sStyle, sPattern) { check(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full"); this._set("dateFormats-" + sStyle, sPattern); return this; }
javascript
function(sStyle, sPattern) { check(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full"); this._set("dateFormats-" + sStyle, sPattern); return this; }
[ "function", "(", "sStyle", ",", "sPattern", ")", "{", "check", "(", "sStyle", "==", "\"short\"", "||", "sStyle", "==", "\"medium\"", "||", "sStyle", "==", "\"long\"", "||", "sStyle", "==", "\"full\"", ",", "\"sStyle must be short, medium, long or full\"", ")", "...
Defines the preferred format pattern for the given date format style. Calling this method with a null or undefined pattern removes a previously set pattern. If a pattern is defined, it will be preferred over patterns derived from the current locale. See class {@link sap.ui.core.format.DateFormat} for details about the pattern syntax. After changing the date pattern, the framework tries to update localization specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage} for details and restrictions. @param {string} sStyle must be one of short, medium, long or full. @param {string} sPattern the format pattern to be used in LDML syntax. @return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining @public
[ "Defines", "the", "preferred", "format", "pattern", "for", "the", "given", "date", "format", "style", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1846-L1850
train
Sets the date format pattern for the specified date format style.
[ 30522, 3853, 1006, 7020, 27983, 1010, 14690, 16451, 1007, 1063, 4638, 1006, 7020, 27983, 1027, 1027, 1000, 2460, 1000, 1064, 1064, 7020, 27983, 1027, 1027, 1000, 5396, 1000, 1064, 1064, 7020, 27983, 1027, 30524, 2440, 1000, 1010, 1000, 7020...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/CodeHintManager.js
registerHintProvider
function registerHintProvider(providerInfo, languageIds, priority) { var providerObj = { provider: providerInfo, priority: priority || 0 }; if (languageIds.indexOf("all") !== -1) { // Ignore anything else in languageIds and just register for every language. This includes // the special "all" language since its key is in the hintProviders map from the beginning. var languageId; for (languageId in hintProviders) { if (hintProviders.hasOwnProperty(languageId)) { hintProviders[languageId].push(providerObj); hintProviders[languageId].sort(_providerSort); } } } else { languageIds.forEach(function (languageId) { if (!hintProviders[languageId]) { // Initialize provider list with any existing all-language providers hintProviders[languageId] = Array.prototype.concat(hintProviders.all); } hintProviders[languageId].push(providerObj); hintProviders[languageId].sort(_providerSort); }); } }
javascript
function registerHintProvider(providerInfo, languageIds, priority) { var providerObj = { provider: providerInfo, priority: priority || 0 }; if (languageIds.indexOf("all") !== -1) { // Ignore anything else in languageIds and just register for every language. This includes // the special "all" language since its key is in the hintProviders map from the beginning. var languageId; for (languageId in hintProviders) { if (hintProviders.hasOwnProperty(languageId)) { hintProviders[languageId].push(providerObj); hintProviders[languageId].sort(_providerSort); } } } else { languageIds.forEach(function (languageId) { if (!hintProviders[languageId]) { // Initialize provider list with any existing all-language providers hintProviders[languageId] = Array.prototype.concat(hintProviders.all); } hintProviders[languageId].push(providerObj); hintProviders[languageId].sort(_providerSort); }); } }
[ "function", "registerHintProvider", "(", "providerInfo", ",", "languageIds", ",", "priority", ")", "{", "var", "providerObj", "=", "{", "provider", ":", "providerInfo", ",", "priority", ":", "priority", "||", "0", "}", ";", "if", "(", "languageIds", ".", "in...
The method by which a CodeHintProvider registers its willingness to providing hints for editors in a given language. @param {!CodeHintProvider} provider The hint provider to be registered, described below. @param {!Array.<string>} languageIds The set of language ids for which the provider is capable of providing hints. If the special language id name "all" is included then the provider may be called for any language. @param {?number} priority Used to break ties among hint providers for a particular language. Providers with a higher number will be asked for hints before those with a lower priority value. Defaults to zero.
[ "The", "method", "by", "which", "a", "CodeHintProvider", "registers", "its", "willingness", "to", "providing", "hints", "for", "editors", "in", "a", "given", "language", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/CodeHintManager.js#L290-L314
train
Register a hint provider
[ 30522, 3853, 4236, 10606, 25856, 12298, 18688, 1006, 10802, 2378, 14876, 1010, 2653, 9821, 1010, 9470, 1007, 1063, 13075, 10802, 16429, 3501, 1027, 1063, 10802, 1024, 10802, 2378, 14876, 1010, 9470, 1024, 9470, 1064, 1064, 1014, 1065, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/MultiBrowserImpl/language/HTMLSimpleDOM.js
getTextNodeID
function getTextNodeID(textNode) { var childIndex = textNode.parent.children.indexOf(textNode); if (childIndex === 0) { return textNode.parent.tagID + ".0"; } return textNode.parent.children[childIndex - 1].tagID + "t"; }
javascript
function getTextNodeID(textNode) { var childIndex = textNode.parent.children.indexOf(textNode); if (childIndex === 0) { return textNode.parent.tagID + ".0"; } return textNode.parent.children[childIndex - 1].tagID + "t"; }
[ "function", "getTextNodeID", "(", "textNode", ")", "{", "var", "childIndex", "=", "textNode", ".", "parent", ".", "children", ".", "indexOf", "(", "textNode", ")", ";", "if", "(", "childIndex", "===", "0", ")", "{", "return", "textNode", ".", "parent", "...
@private Generates a synthetic ID for text nodes. These IDs are only used for convenience when reading a SimpleDOM that is dumped to the console. @param {Object} textNode new node for which we are generating an ID @return {string} ID for the node
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/language/HTMLSimpleDOM.js#L198-L204
train
Get the ID of the text node
[ 30522, 3853, 2131, 18209, 3630, 3207, 3593, 1006, 3793, 3630, 30524, 1009, 1000, 1012, 1014, 1000, 1025, 1065, 2709, 3793, 3630, 3207, 1012, 6687, 1012, 2336, 1031, 2775, 22254, 10288, 1011, 1015, 1033, 1012, 6415, 3593, 1009, 1000, 1056, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
js/mui.class.scroll.slider.js
function(x, y) { this._super(x, y); var progressBar = this.progressBar; if (progressBar) { this.progressBarStyle.webkitTransform = this._getTranslateStr((-x * (this.progressBarWidth / this.wrapperWidth)), 0); } }
javascript
function(x, y) { this._super(x, y); var progressBar = this.progressBar; if (progressBar) { this.progressBarStyle.webkitTransform = this._getTranslateStr((-x * (this.progressBarWidth / this.wrapperWidth)), 0); } }
[ "function", "(", "x", ",", "y", ")", "{", "this", ".", "_super", "(", "x", ",", "y", ")", ";", "var", "progressBar", "=", "this", ".", "progressBar", ";", "if", "(", "progressBar", ")", "{", "this", ".", "progressBarStyle", ".", "webkitTransform", "=...
API
[ "API" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/js/mui.class.scroll.slider.js#L312-L318
train
Set the transform to the given x y position
[ 30522, 3853, 1006, 1060, 1010, 1061, 1007, 1063, 2023, 1012, 1035, 3565, 1006, 1060, 1010, 1061, 1007, 1025, 13075, 5082, 8237, 1027, 2023, 1012, 5082, 8237, 1025, 2065, 1006, 5082, 8237, 1007, 1063, 2023, 1012, 5082, 8237, 21756, 2571, 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.commons/src/sap/ui/commons/RoadMapRenderer.js
function(sId, bOpen, fComplete){ var jRef = jQueryById(sId); if (!jQuery.fx.off && !bSkipAnim) { //Animation only if turned on globally and if should not be skipped jRef.width(bOpen ? "0px" : oRoadMap.iStepWidth); var oLabel = jQueryById(sId + "-label"); oLabel.addClass("sapUiRoadMapHidden"); if (bOpen) { jRef.toggleClass("sapUiRoadMapHidden"); } jRef.animate({width: bOpen ? oRoadMap.iStepWidth : "0px"}, "fast", function(){ if (!bOpen) { jRef.toggleClass("sapUiRoadMapHidden"); } jRef.width(""); oLabel.removeClass("sapUiRoadMapHidden"); if (fComplete) { fComplete(); } }); } else { jRef.toggleClass("sapUiRoadMapHidden"); if (fComplete) { fComplete(); } } }
javascript
function(sId, bOpen, fComplete){ var jRef = jQueryById(sId); if (!jQuery.fx.off && !bSkipAnim) { //Animation only if turned on globally and if should not be skipped jRef.width(bOpen ? "0px" : oRoadMap.iStepWidth); var oLabel = jQueryById(sId + "-label"); oLabel.addClass("sapUiRoadMapHidden"); if (bOpen) { jRef.toggleClass("sapUiRoadMapHidden"); } jRef.animate({width: bOpen ? oRoadMap.iStepWidth : "0px"}, "fast", function(){ if (!bOpen) { jRef.toggleClass("sapUiRoadMapHidden"); } jRef.width(""); oLabel.removeClass("sapUiRoadMapHidden"); if (fComplete) { fComplete(); } }); } else { jRef.toggleClass("sapUiRoadMapHidden"); if (fComplete) { fComplete(); } } }
[ "function", "(", "sId", ",", "bOpen", ",", "fComplete", ")", "{", "var", "jRef", "=", "jQueryById", "(", "sId", ")", ";", "if", "(", "!", "jQuery", ".", "fx", ".", "off", "&&", "!", "bSkipAnim", ")", "{", "//Animation only if turned on globally and if shou...
Animation function to hide / show a step (depending on the current expand state)
[ "Animation", "function", "to", "hide", "/", "show", "a", "step", "(", "depending", "on", "the", "current", "expand", "state", ")" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js#L152-L177
train
Sets the width of the item in the pane
[ 30522, 3853, 1006, 15765, 1010, 29432, 2368, 1010, 4429, 25377, 25890, 1007, 1063, 13075, 3781, 12879, 1027, 1046, 4226, 2854, 3762, 3593, 1006, 15765, 1007, 1025, 2065, 1006, 999, 1046, 4226, 2854, 1012, 23292, 1012, 2125, 1004, 1004, 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...
eslint/eslint
lib/rules/dot-notation.js
checkComputedProperty
function checkComputedProperty(node, value) { if ( validIdentifier.test(value) && (allowKeywords || keywords.indexOf(String(value)) === -1) && !(allowPattern && allowPattern.test(value)) ) { const formattedValue = node.property.type === "Literal" ? JSON.stringify(value) : `\`${value}\``; context.report({ node: node.property, messageId: "useDot", data: { key: formattedValue }, fix(fixer) { const leftBracket = sourceCode.getTokenAfter(node.object, astUtils.isOpeningBracketToken); const rightBracket = sourceCode.getLastToken(node); if (sourceCode.getFirstTokenBetween(leftBracket, rightBracket, { includeComments: true, filter: astUtils.isCommentToken })) { // Don't perform any fixes if there are comments inside the brackets. return null; } const tokenAfterProperty = sourceCode.getTokenAfter(rightBracket); const needsSpaceAfterProperty = tokenAfterProperty && rightBracket.range[1] === tokenAfterProperty.range[0] && !astUtils.canTokensBeAdjacent(String(value), tokenAfterProperty); const textBeforeDot = astUtils.isDecimalInteger(node.object) ? " " : ""; const textAfterProperty = needsSpaceAfterProperty ? " " : ""; return fixer.replaceTextRange( [leftBracket.range[0], rightBracket.range[1]], `${textBeforeDot}.${value}${textAfterProperty}` ); } }); } }
javascript
function checkComputedProperty(node, value) { if ( validIdentifier.test(value) && (allowKeywords || keywords.indexOf(String(value)) === -1) && !(allowPattern && allowPattern.test(value)) ) { const formattedValue = node.property.type === "Literal" ? JSON.stringify(value) : `\`${value}\``; context.report({ node: node.property, messageId: "useDot", data: { key: formattedValue }, fix(fixer) { const leftBracket = sourceCode.getTokenAfter(node.object, astUtils.isOpeningBracketToken); const rightBracket = sourceCode.getLastToken(node); if (sourceCode.getFirstTokenBetween(leftBracket, rightBracket, { includeComments: true, filter: astUtils.isCommentToken })) { // Don't perform any fixes if there are comments inside the brackets. return null; } const tokenAfterProperty = sourceCode.getTokenAfter(rightBracket); const needsSpaceAfterProperty = tokenAfterProperty && rightBracket.range[1] === tokenAfterProperty.range[0] && !astUtils.canTokensBeAdjacent(String(value), tokenAfterProperty); const textBeforeDot = astUtils.isDecimalInteger(node.object) ? " " : ""; const textAfterProperty = needsSpaceAfterProperty ? " " : ""; return fixer.replaceTextRange( [leftBracket.range[0], rightBracket.range[1]], `${textBeforeDot}.${value}${textAfterProperty}` ); } }); } }
[ "function", "checkComputedProperty", "(", "node", ",", "value", ")", "{", "if", "(", "validIdentifier", ".", "test", "(", "value", ")", "&&", "(", "allowKeywords", "||", "keywords", ".", "indexOf", "(", "String", "(", "value", ")", ")", "===", "-", "1", ...
Check if the property is valid dot notation @param {ASTNode} node The dot notation node @param {string} value Value which is to be checked @returns {void}
[ "Check", "if", "the", "property", "is", "valid", "dot", "notation" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/dot-notation.js#L73-L112
train
Checks if a computed property is valid
[ 30522, 3853, 4638, 9006, 29462, 21572, 4842, 3723, 1006, 13045, 1010, 3643, 1007, 1063, 2065, 1006, 9398, 5178, 16778, 8873, 2121, 1012, 3231, 1006, 3643, 1007, 1004, 1004, 1006, 3499, 14839, 22104, 1064, 1064, 3145, 22104, 1012, 5950, 1125...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ApiMaster.controller.js
function () { var oComponent = this.getOwnerComponent(); // Routing this._oRouter = this.getRouter(); this._oRouter.getRoute("api").attachPatternMatched(this._onMatched, this); this._oRouter.getRoute("apiId").attachPatternMatched(this._onTopicMatched, this); this._oRouter.getRoute("deprecated").attachPatternMatched(this._onTopicMatched, this); this._oRouter.getRoute("experimental").attachPatternMatched(this._onTopicMatched, this); this._oRouter.getRoute("since").attachPatternMatched(this._onTopicMatched, this); // Create the model this._oTreeModel = new JSONModel(); this._oTreeModel.setSizeLimit(10000); this.setModel(this._oTreeModel, "treeData"); // By default we don't show deprecated symbols in the tree this._bIncludeDeprecated = false; // Cache references this._oTree = this.byId("tree"); // Load model data this._oDataLoadedPromise = oComponent.loadVersionInfo() .then(function () { // Cache allowed members this._aAllowedMembers = oComponent.aAllowedMembers; }.bind(this)) .then(APIInfo.getIndexJsonPromise) .then(this._bindTreeModel.bind(this)) .then(function () { // Apply default filters this.buildAndApplyFilters(); // Init tree util this._initTreeUtil("name", "nodes"); }.bind(this)); }
javascript
function () { var oComponent = this.getOwnerComponent(); // Routing this._oRouter = this.getRouter(); this._oRouter.getRoute("api").attachPatternMatched(this._onMatched, this); this._oRouter.getRoute("apiId").attachPatternMatched(this._onTopicMatched, this); this._oRouter.getRoute("deprecated").attachPatternMatched(this._onTopicMatched, this); this._oRouter.getRoute("experimental").attachPatternMatched(this._onTopicMatched, this); this._oRouter.getRoute("since").attachPatternMatched(this._onTopicMatched, this); // Create the model this._oTreeModel = new JSONModel(); this._oTreeModel.setSizeLimit(10000); this.setModel(this._oTreeModel, "treeData"); // By default we don't show deprecated symbols in the tree this._bIncludeDeprecated = false; // Cache references this._oTree = this.byId("tree"); // Load model data this._oDataLoadedPromise = oComponent.loadVersionInfo() .then(function () { // Cache allowed members this._aAllowedMembers = oComponent.aAllowedMembers; }.bind(this)) .then(APIInfo.getIndexJsonPromise) .then(this._bindTreeModel.bind(this)) .then(function () { // Apply default filters this.buildAndApplyFilters(); // Init tree util this._initTreeUtil("name", "nodes"); }.bind(this)); }
[ "function", "(", ")", "{", "var", "oComponent", "=", "this", ".", "getOwnerComponent", "(", ")", ";", "// Routing", "this", ".", "_oRouter", "=", "this", ".", "getRouter", "(", ")", ";", "this", ".", "_oRouter", ".", "getRoute", "(", "\"api\"", ")", "....
Called when the master list controller is instantiated. It sets up the event handling for the master/detail communication and other lifecycle tasks. @public
[ "Called", "when", "the", "master", "list", "controller", "is", "instantiated", ".", "It", "sets", "up", "the", "event", "handling", "for", "the", "master", "/", "detail", "communication", "and", "other", "lifecycle", "tasks", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiMaster.controller.js#L36-L73
train
Initializes the tree model
[ 30522, 3853, 1006, 1007, 1063, 13075, 1051, 9006, 29513, 3372, 1027, 2023, 1012, 2131, 12384, 2121, 9006, 29513, 3372, 1006, 1007, 1025, 1013, 1013, 16972, 2023, 1012, 1035, 20298, 19901, 1027, 2023, 1012, 2131, 22494, 3334, 1006, 1007, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/services/interimElement/interimElement.js
InterimElement
function InterimElement(options) { var self, element, showAction = $q.when(true); options = configureScopeAndTransitions(options); return self = { options : options, deferred: $q.defer(), show : createAndTransitionIn, remove : transitionOutAndRemove }; /** * Compile, link, and show this interim element * Use optional autoHided and transition-in effects */ function createAndTransitionIn() { return $q(function(resolve, reject) { // Trigger onCompiling callback before the compilation starts. // This is useful, when modifying options, which can be influenced by developers. options.onCompiling && options.onCompiling(options); compileElement(options) .then(function(compiledData) { element = linkElement(compiledData, options); // Expose the cleanup function from the compiler. options.cleanupElement = compiledData.cleanup; showAction = showElement(element, options, compiledData.controller) .then(resolve, rejectAll); }).catch(rejectAll); function rejectAll(fault) { // Force the '$md<xxx>.show()' promise to reject self.deferred.reject(fault); // Continue rejection propagation reject(fault); } }); } /** * After the show process has finished/rejected: * - announce 'removing', * - perform the transition-out, and * - perform optional clean up scope. */ function transitionOutAndRemove(response, isCancelled, opts) { // abort if the show() and compile failed if (!element) return $q.when(false); options = angular.extend(options || {}, opts || {}); options.cancelAutoHide && options.cancelAutoHide(); options.element.triggerHandler('$mdInterimElementRemove'); if (options.$destroy === true) { return hideElement(options.element, options).then(function(){ (isCancelled && rejectAll(response)) || resolveAll(response); }); } else { $q.when(showAction).finally(function() { hideElement(options.element, options).then(function() { isCancelled ? rejectAll(response) : resolveAll(response); }, rejectAll); }); return self.deferred.promise; } /** * The `show()` returns a promise that will be resolved when the interim * element is hidden or cancelled... */ function resolveAll(response) { self.deferred.resolve(response); } /** * Force the '$md<xxx>.show()' promise to reject */ function rejectAll(fault) { self.deferred.reject(fault); } } /** * Prepare optional isolated scope and prepare $animate with default enter and leave * transitions for the new element instance. */ function configureScopeAndTransitions(options) { options = options || { }; if (options.template) { options.template = $mdUtil.processTemplate(options.template); } return angular.extend({ preserveScope: false, cancelAutoHide : angular.noop, scope: options.scope || $rootScope.$new(options.isolateScope), /** * Default usage to enable $animate to transition-in; can be easily overridden via 'options' */ onShow: function transitionIn(scope, element, options) { return $animate.enter(element, options.parent); }, /** * Default usage to enable $animate to transition-out; can be easily overridden via 'options' */ onRemove: function transitionOut(scope, element) { // Element could be undefined if a new element is shown before // the old one finishes compiling. return element && $animate.leave(element) || $q.when(); } }, options); } /** * Compile an element with a templateUrl, controller, and locals */ function compileElement(options) { var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null; return compiled || $q(function (resolve) { resolve({ locals: {}, link: function () { return options.element; } }); }); } /** * Link an element with compiled configuration */ function linkElement(compileData, options){ angular.extend(compileData.locals, options); var element = compileData.link(options.scope); // Search for parent at insertion time, if not specified options.element = element; options.parent = findParent(element, options); if (options.themable) $mdTheming(element); return element; } /** * Search for parent at insertion time, if not specified */ function findParent(element, options) { var parent = options.parent; // Search for parent at insertion time, if not specified if (angular.isFunction(parent)) { parent = parent(options.scope, element, options); } else if (angular.isString(parent)) { parent = angular.element($document[0].querySelector(parent)); } else { parent = angular.element(parent); } // If parent querySelector/getter function fails, or it's just null, // find a default. if (!(parent || {}).length) { var el; if ($rootElement[0] && $rootElement[0].querySelector) { el = $rootElement[0].querySelector(':not(svg) > body'); } if (!el) el = $rootElement[0]; if (el.nodeName == '#comment') { el = $document[0].body; } return angular.element(el); } return parent; } /** * If auto-hide is enabled, start timer and prepare cancel function */ function startAutoHide() { var autoHideTimer, cancelAutoHide = angular.noop; if (options.hideDelay) { autoHideTimer = $timeout(service.hide, options.hideDelay) ; cancelAutoHide = function() { $timeout.cancel(autoHideTimer); }; } // Cache for subsequent use options.cancelAutoHide = function() { cancelAutoHide(); options.cancelAutoHide = undefined; }; } /** * Show the element ( with transitions), notify complete and start * optional auto-Hide */ function showElement(element, options, controller) { // Trigger onShowing callback before the `show()` starts var notifyShowing = options.onShowing || angular.noop; // Trigger onComplete callback when the `show()` finishes var notifyComplete = options.onComplete || angular.noop; // Necessary for consistency between AngularJS 1.5 and 1.6. try { notifyShowing(options.scope, element, options, controller); } catch (e) { return $q.reject(e); } return $q(function (resolve, reject) { try { // Start transitionIn $q.when(options.onShow(options.scope, element, options, controller)) .then(function () { notifyComplete(options.scope, element, options); startAutoHide(); resolve(element); }, reject); } catch (e) { reject(e.message); } }); } function hideElement(element, options) { var announceRemoving = options.onRemoving || angular.noop; return $q(function (resolve, reject) { try { // Start transitionIn var action = $q.when(options.onRemove(options.scope, element, options) || true); // Trigger callback *before* the remove operation starts announceRemoving(element, action); if (options.$destroy) { // For $destroy, onRemove should be synchronous resolve(element); if (!options.preserveScope && options.scope) { // scope destroy should still be be done after the current digest is done action.then(function() { options.scope.$destroy(); }); } } else { // Wait until transition-out is done action.then(function () { if (!options.preserveScope && options.scope) { options.scope.$destroy(); } resolve(element); }, reject); } } catch (e) { reject(e.message); } }); } }
javascript
function InterimElement(options) { var self, element, showAction = $q.when(true); options = configureScopeAndTransitions(options); return self = { options : options, deferred: $q.defer(), show : createAndTransitionIn, remove : transitionOutAndRemove }; /** * Compile, link, and show this interim element * Use optional autoHided and transition-in effects */ function createAndTransitionIn() { return $q(function(resolve, reject) { // Trigger onCompiling callback before the compilation starts. // This is useful, when modifying options, which can be influenced by developers. options.onCompiling && options.onCompiling(options); compileElement(options) .then(function(compiledData) { element = linkElement(compiledData, options); // Expose the cleanup function from the compiler. options.cleanupElement = compiledData.cleanup; showAction = showElement(element, options, compiledData.controller) .then(resolve, rejectAll); }).catch(rejectAll); function rejectAll(fault) { // Force the '$md<xxx>.show()' promise to reject self.deferred.reject(fault); // Continue rejection propagation reject(fault); } }); } /** * After the show process has finished/rejected: * - announce 'removing', * - perform the transition-out, and * - perform optional clean up scope. */ function transitionOutAndRemove(response, isCancelled, opts) { // abort if the show() and compile failed if (!element) return $q.when(false); options = angular.extend(options || {}, opts || {}); options.cancelAutoHide && options.cancelAutoHide(); options.element.triggerHandler('$mdInterimElementRemove'); if (options.$destroy === true) { return hideElement(options.element, options).then(function(){ (isCancelled && rejectAll(response)) || resolveAll(response); }); } else { $q.when(showAction).finally(function() { hideElement(options.element, options).then(function() { isCancelled ? rejectAll(response) : resolveAll(response); }, rejectAll); }); return self.deferred.promise; } /** * The `show()` returns a promise that will be resolved when the interim * element is hidden or cancelled... */ function resolveAll(response) { self.deferred.resolve(response); } /** * Force the '$md<xxx>.show()' promise to reject */ function rejectAll(fault) { self.deferred.reject(fault); } } /** * Prepare optional isolated scope and prepare $animate with default enter and leave * transitions for the new element instance. */ function configureScopeAndTransitions(options) { options = options || { }; if (options.template) { options.template = $mdUtil.processTemplate(options.template); } return angular.extend({ preserveScope: false, cancelAutoHide : angular.noop, scope: options.scope || $rootScope.$new(options.isolateScope), /** * Default usage to enable $animate to transition-in; can be easily overridden via 'options' */ onShow: function transitionIn(scope, element, options) { return $animate.enter(element, options.parent); }, /** * Default usage to enable $animate to transition-out; can be easily overridden via 'options' */ onRemove: function transitionOut(scope, element) { // Element could be undefined if a new element is shown before // the old one finishes compiling. return element && $animate.leave(element) || $q.when(); } }, options); } /** * Compile an element with a templateUrl, controller, and locals */ function compileElement(options) { var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null; return compiled || $q(function (resolve) { resolve({ locals: {}, link: function () { return options.element; } }); }); } /** * Link an element with compiled configuration */ function linkElement(compileData, options){ angular.extend(compileData.locals, options); var element = compileData.link(options.scope); // Search for parent at insertion time, if not specified options.element = element; options.parent = findParent(element, options); if (options.themable) $mdTheming(element); return element; } /** * Search for parent at insertion time, if not specified */ function findParent(element, options) { var parent = options.parent; // Search for parent at insertion time, if not specified if (angular.isFunction(parent)) { parent = parent(options.scope, element, options); } else if (angular.isString(parent)) { parent = angular.element($document[0].querySelector(parent)); } else { parent = angular.element(parent); } // If parent querySelector/getter function fails, or it's just null, // find a default. if (!(parent || {}).length) { var el; if ($rootElement[0] && $rootElement[0].querySelector) { el = $rootElement[0].querySelector(':not(svg) > body'); } if (!el) el = $rootElement[0]; if (el.nodeName == '#comment') { el = $document[0].body; } return angular.element(el); } return parent; } /** * If auto-hide is enabled, start timer and prepare cancel function */ function startAutoHide() { var autoHideTimer, cancelAutoHide = angular.noop; if (options.hideDelay) { autoHideTimer = $timeout(service.hide, options.hideDelay) ; cancelAutoHide = function() { $timeout.cancel(autoHideTimer); }; } // Cache for subsequent use options.cancelAutoHide = function() { cancelAutoHide(); options.cancelAutoHide = undefined; }; } /** * Show the element ( with transitions), notify complete and start * optional auto-Hide */ function showElement(element, options, controller) { // Trigger onShowing callback before the `show()` starts var notifyShowing = options.onShowing || angular.noop; // Trigger onComplete callback when the `show()` finishes var notifyComplete = options.onComplete || angular.noop; // Necessary for consistency between AngularJS 1.5 and 1.6. try { notifyShowing(options.scope, element, options, controller); } catch (e) { return $q.reject(e); } return $q(function (resolve, reject) { try { // Start transitionIn $q.when(options.onShow(options.scope, element, options, controller)) .then(function () { notifyComplete(options.scope, element, options); startAutoHide(); resolve(element); }, reject); } catch (e) { reject(e.message); } }); } function hideElement(element, options) { var announceRemoving = options.onRemoving || angular.noop; return $q(function (resolve, reject) { try { // Start transitionIn var action = $q.when(options.onRemove(options.scope, element, options) || true); // Trigger callback *before* the remove operation starts announceRemoving(element, action); if (options.$destroy) { // For $destroy, onRemove should be synchronous resolve(element); if (!options.preserveScope && options.scope) { // scope destroy should still be be done after the current digest is done action.then(function() { options.scope.$destroy(); }); } } else { // Wait until transition-out is done action.then(function () { if (!options.preserveScope && options.scope) { options.scope.$destroy(); } resolve(element); }, reject); } } catch (e) { reject(e.message); } }); } }
[ "function", "InterimElement", "(", "options", ")", "{", "var", "self", ",", "element", ",", "showAction", "=", "$q", ".", "when", "(", "true", ")", ";", "options", "=", "configureScopeAndTransitions", "(", "options", ")", ";", "return", "self", "=", "{", ...
/* Internal Interim Element Object Used internally to manage the DOM element and related data
[ "/", "*", "Internal", "Interim", "Element", "Object", "Used", "internally", "to", "manage", "the", "DOM", "element", "and", "related", "data" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L476-L756
train
InterimElement constructor.
[ 30522, 3853, 9455, 12260, 3672, 1006, 7047, 1007, 1063, 13075, 2969, 1010, 5783, 1010, 2265, 18908, 3258, 1027, 1002, 1053, 1012, 2043, 1006, 2995, 1007, 1025, 7047, 1027, 9530, 8873, 27390, 2229, 16186, 5685, 6494, 3619, 22753, 2015, 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...
dequelabs/axe-core
lib/core/utils/respondable.js
parseMessage
function parseMessage(dataString) { /*eslint no-empty: 0*/ var data; if (typeof dataString !== 'string') { return; } try { data = JSON.parse(dataString); } catch (ex) {} if (!verify(data)) { return; } if (typeof data.error === 'object') { data.error = buildErrorObject(data.error); } else { data.error = undefined; } return data; }
javascript
function parseMessage(dataString) { /*eslint no-empty: 0*/ var data; if (typeof dataString !== 'string') { return; } try { data = JSON.parse(dataString); } catch (ex) {} if (!verify(data)) { return; } if (typeof data.error === 'object') { data.error = buildErrorObject(data.error); } else { data.error = undefined; } return data; }
[ "function", "parseMessage", "(", "dataString", ")", "{", "/*eslint no-empty: 0*/", "var", "data", ";", "if", "(", "typeof", "dataString", "!==", "'string'", ")", "{", "return", ";", "}", "try", "{", "data", "=", "JSON", ".", "parse", "(", "dataString", ")"...
Parse the received message for processing @param {string} dataString Message received @return {object} Object to be used for pub/sub
[ "Parse", "the", "received", "message", "for", "processing" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/respondable.js#L182-L203
train
Parse a message
[ 30522, 3853, 11968, 3366, 7834, 3736, 3351, 1006, 2951, 3367, 4892, 1007, 1063, 1013, 1008, 9686, 4115, 2102, 2053, 1011, 4064, 1024, 1014, 1008, 1013, 13075, 2951, 1025, 2065, 1006, 2828, 11253, 2951, 3367, 4892, 999, 1027, 1027, 1005, 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...
fex-team/webuploader
dist/webuploader.withoutimage.js
function( file ) { file = file.id ? file : this.request( 'get-file', file ); // 如果正在上传。 file.blocks && $.each( file.blocks, function( _, v ) { var _tr = v.transport; if ( _tr ) { _tr.abort(); _tr.destroy(); delete v.transport; } }); file.setStatus( Status.CANCELLED ); this.owner.trigger( 'fileDequeued', file ); }
javascript
function( file ) { file = file.id ? file : this.request( 'get-file', file ); // 如果正在上传。 file.blocks && $.each( file.blocks, function( _, v ) { var _tr = v.transport; if ( _tr ) { _tr.abort(); _tr.destroy(); delete v.transport; } }); file.setStatus( Status.CANCELLED ); this.owner.trigger( 'fileDequeued', file ); }
[ "function", "(", "file", ")", "{", "file", "=", "file", ".", "id", "?", "file", ":", "this", ".", "request", "(", "'get-file'", ",", "file", ")", ";", "// 如果正在上传。", "file", ".", "blocks", "&&", "$", ".", "each", "(", "file", ".", "blocks", ",", "...
@method cancelFile @grammar cancelFile( file ) => undefined @grammar cancelFile( id ) => undefined @param {File|id} file File对象或这File对象的id @description 标记文件状态为已取消, 同时将中断文件传输。 @for Uploader @example $li.on('click', '.remove-this', function() { uploader.cancelFile( file ); })
[ "@method", "cancelFile", "@grammar", "cancelFile", "(", "file", ")", "=", ">", "undefined", "@grammar", "cancelFile", "(", "id", ")", "=", ">", "undefined", "@param", "{", "File|id", "}", "file", "File对象或这File对象的id", "@description", "标记文件状态为已取消", "同时将中断文件传输。", "...
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L3218-L3234
train
Dequeue a file
[ 30522, 3853, 1006, 5371, 1007, 1063, 5371, 1027, 5371, 1012, 8909, 1029, 5371, 1024, 2023, 1012, 5227, 1006, 1005, 2131, 1011, 5371, 1005, 1010, 5371, 1007, 1025, 1013, 1013, 100, 100, 1888, 100, 1742, 100, 1636, 5371, 1012, 5991, 1004, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
PrismJS/prism
scripts/utopia.js
function(o) { document.body.setAttribute('data-loading', ''); var xhr = new XMLHttpRequest(), method = o.method || 'GET', data = o.data || ''; xhr.open(method, o.url + (method === 'GET' && data? '?' + data : ''), true); o.headers = o.headers || {}; if(method !== 'GET' && !o.headers['Content-type'] && !o.headers['Content-Type']) { xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); } for (var header in o.headers) { xhr.setRequestHeader(header, o.headers[header]); } xhr.onreadystatechange = function(){ if(xhr.readyState === 4) { document.body.removeAttribute('data-loading'); o.callback(xhr); } }; xhr.send(method === 'GET'? null : data); return xhr; }
javascript
function(o) { document.body.setAttribute('data-loading', ''); var xhr = new XMLHttpRequest(), method = o.method || 'GET', data = o.data || ''; xhr.open(method, o.url + (method === 'GET' && data? '?' + data : ''), true); o.headers = o.headers || {}; if(method !== 'GET' && !o.headers['Content-type'] && !o.headers['Content-Type']) { xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); } for (var header in o.headers) { xhr.setRequestHeader(header, o.headers[header]); } xhr.onreadystatechange = function(){ if(xhr.readyState === 4) { document.body.removeAttribute('data-loading'); o.callback(xhr); } }; xhr.send(method === 'GET'? null : data); return xhr; }
[ "function", "(", "o", ")", "{", "document", ".", "body", ".", "setAttribute", "(", "'data-loading'", ",", "''", ")", ";", "var", "xhr", "=", "new", "XMLHttpRequest", "(", ")", ",", "method", "=", "o", ".", "method", "||", "'GET'", ",", "data", "=", ...
Helper for XHR requests
[ "Helper", "for", "XHR", "requests" ]
acceb3b56f0e8362a7ef274dbd85b17611df2ec4
https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/scripts/utopia.js#L367-L398
train
This function is called by the xhr module to send the request
[ 30522, 3853, 1006, 1051, 1007, 1063, 6254, 1012, 2303, 30524, 2047, 20950, 11039, 25856, 2890, 15500, 1006, 1007, 1010, 4118, 1027, 1051, 1012, 4118, 1064, 1064, 1005, 2131, 1005, 1010, 2951, 1027, 1051, 1012, 2951, 1064, 1064, 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...
eslint/eslint
lib/rules/lines-around-comment.js
getCommentLineNums
function getCommentLineNums(comments) { const lines = []; comments.forEach(token => { const start = token.loc.start.line; const end = token.loc.end.line; lines.push(start, end); }); return lines; }
javascript
function getCommentLineNums(comments) { const lines = []; comments.forEach(token => { const start = token.loc.start.line; const end = token.loc.end.line; lines.push(start, end); }); return lines; }
[ "function", "getCommentLineNums", "(", "comments", ")", "{", "const", "lines", "=", "[", "]", ";", "comments", ".", "forEach", "(", "token", "=>", "{", "const", "start", "=", "token", ".", "loc", ".", "start", ".", "line", ";", "const", "end", "=", "...
Return an array with with any line numbers that contain comments. @param {Array} comments An array of comment tokens. @returns {Array} An array of line numbers.
[ "Return", "an", "array", "with", "with", "any", "line", "numbers", "that", "contain", "comments", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/lines-around-comment.js#L37-L47
train
Get line numbers of comments
[ 30522, 3853, 2131, 9006, 3672, 4179, 19172, 2015, 1006, 7928, 1007, 1063, 9530, 3367, 3210, 1027, 1031, 1033, 1025, 7928, 1012, 18921, 6776, 1006, 19204, 1027, 1028, 1063, 9530, 3367, 2707, 1027, 19204, 1012, 8840, 2278, 1012, 2707, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js
extractMilliseconds
function extractMilliseconds(vValue) { if (typeof vValue === "string" && rTime.test(vValue)) { vValue = parseInt(RegExp.$1) * 3600000 + parseInt(RegExp.$2) * 60000 + parseInt(RegExp.$3) * 1000; } if (vValue instanceof Date) { return vValue.getTime(); } if (vValue && vValue.__edmType === "Edm.Time") { return vValue.ms; } return vValue; }
javascript
function extractMilliseconds(vValue) { if (typeof vValue === "string" && rTime.test(vValue)) { vValue = parseInt(RegExp.$1) * 3600000 + parseInt(RegExp.$2) * 60000 + parseInt(RegExp.$3) * 1000; } if (vValue instanceof Date) { return vValue.getTime(); } if (vValue && vValue.__edmType === "Edm.Time") { return vValue.ms; } return vValue; }
[ "function", "extractMilliseconds", "(", "vValue", ")", "{", "if", "(", "typeof", "vValue", "===", "\"string\"", "&&", "rTime", ".", "test", "(", "vValue", ")", ")", "{", "vValue", "=", "parseInt", "(", "RegExp", ".", "$1", ")", "*", "3600000", "+", "pa...
Extracts the milliseconds if the value is a date/time instance or formatted string. @param {any} vValue the value (may be <code>undefined</code> or <code>null</code>) @returns {any} the number of milliseconds or the value itself
[ "Extracts", "the", "milliseconds", "if", "the", "value", "is", "a", "date", "/", "time", "instance", "or", "formatted", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js#L632-L645
train
Extract the milliseconds from a value
[ 30522, 3853, 14817, 19912, 5562, 8663, 5104, 1006, 1058, 10175, 5657, 1007, 1063, 2065, 1006, 2828, 11253, 1058, 10175, 5657, 1027, 1027, 1027, 1000, 5164, 1000, 1004, 1004, 19387, 14428, 30524, 1006, 19723, 10288, 2361, 1012, 1002, 1015, 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...
GoogleChrome/workbox
packages/workbox-build/src/entry-points/inject-manifest.js
injectManifest
async function injectManifest(config) { // This check needs to be done before validation, since the deprecated options // will be renamed. const deprecationWarnings = checkForDeprecatedOptions(config); const options = validate(config, injectManifestSchema); if (path.normalize(config.swSrc) === path.normalize(config.swDest)) { throw new Error(errors['same-src-and-dest']); } const globalRegexp = new RegExp(options.injectionPointRegexp, 'g'); const {count, size, manifestEntries, warnings} = await getFileManifestEntries(options); let swFileContents; try { swFileContents = await fse.readFile(config.swSrc, 'utf8'); } catch (error) { throw new Error(`${errors['invalid-sw-src']} ${error.message}`); } const injectionResults = swFileContents.match(globalRegexp); assert(injectionResults, errors['injection-point-not-found'] + // Customize the error message when this happens: // - If the default RegExp is used, then include the expected string that // matches as a hint to the developer. // - If a custom RegExp is used, then just include the raw RegExp. (options.injectionPointRegexp === defaults.injectionPointRegexp ? 'workbox.precaching.precacheAndRoute([])' : options.injectionPointRegexp)); assert(injectionResults.length === 1, errors['multiple-injection-points'] + ` ${options.injectionPointRegexp}`); const entriesString = JSON.stringify(manifestEntries, null, 2); swFileContents = swFileContents.replace(globalRegexp, `$1${entriesString}$2`); try { await fse.mkdirp(path.dirname(options.swDest)); } catch (error) { throw new Error(errors['unable-to-make-injection-directory'] + ` '${error.message}'`); } await fse.writeFile(config.swDest, swFileContents); // Add in any deprecation warnings. warnings.push(...deprecationWarnings); return {count, size, warnings}; }
javascript
async function injectManifest(config) { // This check needs to be done before validation, since the deprecated options // will be renamed. const deprecationWarnings = checkForDeprecatedOptions(config); const options = validate(config, injectManifestSchema); if (path.normalize(config.swSrc) === path.normalize(config.swDest)) { throw new Error(errors['same-src-and-dest']); } const globalRegexp = new RegExp(options.injectionPointRegexp, 'g'); const {count, size, manifestEntries, warnings} = await getFileManifestEntries(options); let swFileContents; try { swFileContents = await fse.readFile(config.swSrc, 'utf8'); } catch (error) { throw new Error(`${errors['invalid-sw-src']} ${error.message}`); } const injectionResults = swFileContents.match(globalRegexp); assert(injectionResults, errors['injection-point-not-found'] + // Customize the error message when this happens: // - If the default RegExp is used, then include the expected string that // matches as a hint to the developer. // - If a custom RegExp is used, then just include the raw RegExp. (options.injectionPointRegexp === defaults.injectionPointRegexp ? 'workbox.precaching.precacheAndRoute([])' : options.injectionPointRegexp)); assert(injectionResults.length === 1, errors['multiple-injection-points'] + ` ${options.injectionPointRegexp}`); const entriesString = JSON.stringify(manifestEntries, null, 2); swFileContents = swFileContents.replace(globalRegexp, `$1${entriesString}$2`); try { await fse.mkdirp(path.dirname(options.swDest)); } catch (error) { throw new Error(errors['unable-to-make-injection-directory'] + ` '${error.message}'`); } await fse.writeFile(config.swDest, swFileContents); // Add in any deprecation warnings. warnings.push(...deprecationWarnings); return {count, size, warnings}; }
[ "async", "function", "injectManifest", "(", "config", ")", "{", "// This check needs to be done before validation, since the deprecated options", "// will be renamed.", "const", "deprecationWarnings", "=", "checkForDeprecatedOptions", "(", "config", ")", ";", "const", "options", ...
This method creates a list of URLs to precache, referred to as a "precache manifest", based on the options you provide. The manifest is injected into the `swSrc` file, and the regular expression `injectionPointRegexp` determines where in the file the manifest should go. The final service worker file, with the manifest injected, is written to disk at `swDest`. @param {Object} config Please refer to the [configuration guide](https://developers.google.com/web/tools/workbox/modules/workbox-build#full_injectmanifest_config). @return {Promise<{count: number, size: number, warnings: Array<string>}>} A promise that resolves once the service worker file has been written to `swDest`. The `size` property contains the aggregate size of all the precached entries, in bytes, and the `count` property contains the total number of precached entries. Any non-fatal warning messages will be returned via `warnings`. @memberof module:workbox-build
[ "This", "method", "creates", "a", "list", "of", "URLs", "to", "precache", "referred", "to", "as", "a", "precache", "manifest", "based", "on", "the", "options", "you", "provide", "." ]
8379c51b6deaf52faed5879206fe84579cae41f0
https://github.com/GoogleChrome/workbox/blob/8379c51b6deaf52faed5879206fe84579cae41f0/packages/workbox-build/src/entry-points/inject-manifest.js#L42-L92
train
Injects the manifest into the specified destination directory.
[ 30522, 2004, 6038, 2278, 3853, 1999, 20614, 20799, 14081, 1006, 9530, 8873, 2290, 1007, 1063, 1013, 1013, 2023, 4638, 3791, 2000, 2022, 2589, 2077, 27354, 1010, 2144, 1996, 2139, 28139, 12921, 7047, 1013, 1013, 2097, 2022, 4096, 1012, 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...
reasonml/reason-react
migrate/from015To020.js
migrate
function migrate(files) { files.forEach((file) => { let content; try { content = fs.readFileSync(file, {encoding: 'utf-8'}); } catch (e) { console.error(`\u{1b}[31mProblem reading ${file}: ${e.message}\u{1b}[39m`); process.exit(1); } const newContent = transform(content); if (newContent !== content) { console.log('Found a file that has things to migrate: ' + file); fs.writeFileSync(file, newContent, {encoding: 'utf-8'}); } }); }
javascript
function migrate(files) { files.forEach((file) => { let content; try { content = fs.readFileSync(file, {encoding: 'utf-8'}); } catch (e) { console.error(`\u{1b}[31mProblem reading ${file}: ${e.message}\u{1b}[39m`); process.exit(1); } const newContent = transform(content); if (newContent !== content) { console.log('Found a file that has things to migrate: ' + file); fs.writeFileSync(file, newContent, {encoding: 'utf-8'}); } }); }
[ "function", "migrate", "(", "files", ")", "{", "files", ".", "forEach", "(", "(", "file", ")", "=>", "{", "let", "content", ";", "try", "{", "content", "=", "fs", ".", "readFileSync", "(", "file", ",", "{", "encoding", ":", "'utf-8'", "}", ")", ";"...
entry point
[ "entry", "point" ]
17e4568aaa5a6d03e3f3381a60c2073dc7ac50e2
https://github.com/reasonml/reason-react/blob/17e4568aaa5a6d03e3f3381a60c2073dc7ac50e2/migrate/from015To020.js#L56-L71
train
Migrate the files that have things to be migrated
[ 30522, 3853, 22806, 1006, 6764, 1007, 1063, 6764, 1012, 18921, 6776, 1006, 1006, 5371, 1007, 1027, 1028, 1063, 2292, 4180, 1025, 3046, 1063, 4180, 1027, 1042, 2015, 1012, 3191, 8873, 4244, 6038, 2278, 1006, 5371, 1010, 1063, 17181, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function () { var that = this; return Promise.resolve().then(function () { safeClearInstance(that); sap.ui.getCore().getConfiguration().setUI5CacheOn(false); }); }
javascript
function () { var that = this; return Promise.resolve().then(function () { safeClearInstance(that); sap.ui.getCore().getConfiguration().setUI5CacheOn(false); }); }
[ "function", "(", ")", "{", "var", "that", "=", "this", ";", "return", "Promise", ".", "resolve", "(", ")", ".", "then", "(", "function", "(", ")", "{", "safeClearInstance", "(", "that", ")", ";", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "...
Shuts-down the Cache Manager (all next calls to it will return an immediately resolved dummy promise with value of <undefined>) Usages are meant for testing purposes. Make sure you switch it on so the rest still can use it. @see sap.ui.core.cache.CacheManager._switchOn @returns {*} @protected
[ "Shuts", "-", "down", "the", "Cache", "Manager", "(", "all", "next", "calls", "to", "it", "will", "return", "an", "immediately", "resolved", "dummy", "promise", "with", "value", "of", "<undefined", ">", ")", "Usages", "are", "meant", "for", "testing", "pur...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L246-L252
train
Clear all the cache instances
[ 30522, 3853, 1006, 1007, 1063, 13075, 2008, 1027, 2023, 1025, 2709, 4872, 1012, 10663, 1006, 1007, 1012, 2059, 1006, 3853, 1006, 1007, 1063, 3647, 14321, 8486, 23808, 6651, 1006, 2008, 1007, 1025, 20066, 1012, 21318, 1012, 2131, 17345, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(aEventListenerTargets, oTable, mOptions) { var fnOnMouseWheelEventHandler = ScrollingHelper.onMouseWheelScrolling.bind(oTable, mOptions); for (var i = 0; i < aEventListenerTargets.length; i++) { aEventListenerTargets[i].addEventListener("wheel", fnOnMouseWheelEventHandler); } return {wheel: fnOnMouseWheelEventHandler}; }
javascript
function(aEventListenerTargets, oTable, mOptions) { var fnOnMouseWheelEventHandler = ScrollingHelper.onMouseWheelScrolling.bind(oTable, mOptions); for (var i = 0; i < aEventListenerTargets.length; i++) { aEventListenerTargets[i].addEventListener("wheel", fnOnMouseWheelEventHandler); } return {wheel: fnOnMouseWheelEventHandler}; }
[ "function", "(", "aEventListenerTargets", ",", "oTable", ",", "mOptions", ")", "{", "var", "fnOnMouseWheelEventHandler", "=", "ScrollingHelper", ".", "onMouseWheelScrolling", ".", "bind", "(", "oTable", ",", "mOptions", ")", ";", "for", "(", "var", "i", "=", "...
Adds mouse wheel event listeners to HTMLElements. @param {HTMLElement[]} aEventListenerTargets The elements to add listeners to. @param {sap.ui.table.Table} oTable The table instance to be set as the context of the listeners. @param {TableScrollExtension.EventListenerOptions} mOptions The options. @returns {{wheel: Function}} A key value map containing the event names as keys and listener functions as values.
[ "Adds", "mouse", "wheel", "event", "listeners", "to", "HTMLElements", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L1079-L1087
train
Adds a wheel event listener to the given event targets.
[ 30522, 3853, 1006, 29347, 15338, 9863, 24454, 7559, 18150, 2015, 1010, 27178, 3085, 1010, 9587, 16790, 2015, 1007, 1063, 13075, 1042, 8540, 27711, 7974, 21030, 20414, 4765, 11774, 3917, 1027, 28903, 16001, 4842, 1012, 2006, 27711, 7974, 21030...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
lovell/sharp
lib/resize.js
resize
function resize (width, height, options) { if (is.defined(width)) { if (is.object(width) && !is.defined(options)) { options = width; } else if (is.integer(width) && width > 0) { this.options.width = width; } else { throw is.invalidParameterError('width', 'positive integer', width); } } else { this.options.width = -1; } if (is.defined(height)) { if (is.integer(height) && height > 0) { this.options.height = height; } else { throw is.invalidParameterError('height', 'positive integer', height); } } else { this.options.height = -1; } if (is.object(options)) { // Width if (is.integer(options.width) && options.width > 0) { this.options.width = options.width; } // Height if (is.integer(options.height) && options.height > 0) { this.options.height = options.height; } // Fit if (is.defined(options.fit)) { const canvas = mapFitToCanvas[options.fit]; if (is.string(canvas)) { this.options.canvas = canvas; } else { throw is.invalidParameterError('fit', 'valid fit', options.fit); } } // Position if (is.defined(options.position)) { const pos = is.integer(options.position) ? options.position : strategy[options.position] || position[options.position] || gravity[options.position]; if (is.integer(pos) && (is.inRange(pos, 0, 8) || is.inRange(pos, 16, 17))) { this.options.position = pos; } else { throw is.invalidParameterError('position', 'valid position/gravity/strategy', options.position); } } // Background if (is.defined(options.background)) { this._setColourOption('resizeBackground', options.background); } // Kernel if (is.defined(options.kernel)) { if (is.string(kernel[options.kernel])) { this.options.kernel = kernel[options.kernel]; } else { throw is.invalidParameterError('kernel', 'valid kernel name', options.kernel); } } // Without enlargement if (is.defined(options.withoutEnlargement)) { this._setBooleanOption('withoutEnlargement', options.withoutEnlargement); } // Shrink on load if (is.defined(options.fastShrinkOnLoad)) { this._setBooleanOption('fastShrinkOnLoad', options.fastShrinkOnLoad); } } return this; }
javascript
function resize (width, height, options) { if (is.defined(width)) { if (is.object(width) && !is.defined(options)) { options = width; } else if (is.integer(width) && width > 0) { this.options.width = width; } else { throw is.invalidParameterError('width', 'positive integer', width); } } else { this.options.width = -1; } if (is.defined(height)) { if (is.integer(height) && height > 0) { this.options.height = height; } else { throw is.invalidParameterError('height', 'positive integer', height); } } else { this.options.height = -1; } if (is.object(options)) { // Width if (is.integer(options.width) && options.width > 0) { this.options.width = options.width; } // Height if (is.integer(options.height) && options.height > 0) { this.options.height = options.height; } // Fit if (is.defined(options.fit)) { const canvas = mapFitToCanvas[options.fit]; if (is.string(canvas)) { this.options.canvas = canvas; } else { throw is.invalidParameterError('fit', 'valid fit', options.fit); } } // Position if (is.defined(options.position)) { const pos = is.integer(options.position) ? options.position : strategy[options.position] || position[options.position] || gravity[options.position]; if (is.integer(pos) && (is.inRange(pos, 0, 8) || is.inRange(pos, 16, 17))) { this.options.position = pos; } else { throw is.invalidParameterError('position', 'valid position/gravity/strategy', options.position); } } // Background if (is.defined(options.background)) { this._setColourOption('resizeBackground', options.background); } // Kernel if (is.defined(options.kernel)) { if (is.string(kernel[options.kernel])) { this.options.kernel = kernel[options.kernel]; } else { throw is.invalidParameterError('kernel', 'valid kernel name', options.kernel); } } // Without enlargement if (is.defined(options.withoutEnlargement)) { this._setBooleanOption('withoutEnlargement', options.withoutEnlargement); } // Shrink on load if (is.defined(options.fastShrinkOnLoad)) { this._setBooleanOption('fastShrinkOnLoad', options.fastShrinkOnLoad); } } return this; }
[ "function", "resize", "(", "width", ",", "height", ",", "options", ")", "{", "if", "(", "is", ".", "defined", "(", "width", ")", ")", "{", "if", "(", "is", ".", "object", "(", "width", ")", "&&", "!", "is", ".", "defined", "(", "options", ")", ...
Resize image to `width`, `height` or `width x height`. When both a `width` and `height` are provided, the possible methods by which the image should **fit** these are: - `cover`: Crop to cover both provided dimensions (the default). - `contain`: Embed within both provided dimensions. - `fill`: Ignore the aspect ratio of the input and stretch to both provided dimensions. - `inside`: Preserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to both those specified. - `outside`: Preserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to both those specified. Some of these values are based on the [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property. When using a `fit` of `cover` or `contain`, the default **position** is `centre`. Other options are: - `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`. - `sharp.gravity`: `north`, `northeast`, `east`, `southeast`, `south`, `southwest`, `west`, `northwest`, `center` or `centre`. - `sharp.strategy`: `cover` only, dynamically crop using either the `entropy` or `attention` strategy. Some of these values are based on the [object-position](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) CSS property. The experimental strategy-based approach resizes so one dimension is at its target length then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy. - `entropy`: focus on the region with the highest [Shannon entropy](https://en.wikipedia.org/wiki/Entropy_%28information_theory%29). - `attention`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones. Possible interpolation kernels are: - `nearest`: Use [nearest neighbour interpolation](http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation). - `cubic`: Use a [Catmull-Rom spline](https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline). - `mitchell`: Use a [Mitchell-Netravali spline](https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf). - `lanczos2`: Use a [Lanczos kernel](https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel) with `a=2`. - `lanczos3`: Use a Lanczos kernel with `a=3` (the default). @example sharp(input) .resize({ width: 100 }) .toBuffer() .then(data => { // 100 pixels wide, auto-scaled height }); @example sharp(input) .resize({ height: 100 }) .toBuffer() .then(data => { // 100 pixels high, auto-scaled width }); @example sharp(input) .resize(200, 300, { kernel: sharp.kernel.nearest, fit: 'contain', position: 'right top', background: { r: 255, g: 255, b: 255, alpha: 0.5 } }) .toFile('output.png') .then(() => { // output.png is a 200 pixels wide and 300 pixels high image // containing a nearest-neighbour scaled version // contained within the north-east corner of a semi-transparent white canvas }); @example const transformer = sharp() .resize({ width: 200, height: 200, fit: sharp.fit.cover, position: sharp.strategy.entropy }); // Read image data from readableStream // Write 200px square auto-cropped image data to writableStream readableStream .pipe(transformer) .pipe(writableStream); @example sharp(input) .resize(200, 200, { fit: sharp.fit.inside, withoutEnlargement: true }) .toFormat('jpeg') .toBuffer() .then(function(outputBuffer) { // outputBuffer contains JPEG image data // no wider and no higher than 200 pixels // and no larger than the input image }); @param {Number} [width] - pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height. @param {Number} [height] - pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width. @param {Object} [options] @param {String} [options.width] - alternative means of specifying `width`. If both are present this take priority. @param {String} [options.height] - alternative means of specifying `height`. If both are present this take priority. @param {String} [options.fit='cover'] - how the image should be resized to fit both provided dimensions, one of `cover`, `contain`, `fill`, `inside` or `outside`. @param {String} [options.position='centre'] - position, gravity or strategy to use when `fit` is `cover` or `contain`. @param {String|Object} [options.background={r: 0, g: 0, b: 0, alpha: 1}] - background colour when using a `fit` of `contain`, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black without transparency. @param {String} [options.kernel='lanczos3'] - the kernel to use for image reduction. @param {Boolean} [options.withoutEnlargement=false] - do not enlarge if the width *or* height are already less than the specified dimensions, equivalent to GraphicsMagick's `>` geometry option. @param {Boolean} [options.fastShrinkOnLoad=true] - take greater advantage of the JPEG and WebP shrink-on-load feature, which can lead to a slight moiré pattern on some images. @returns {Sharp} @throws {Error} Invalid parameters
[ "Resize", "image", "to", "width", "height", "or", "width", "x", "height", "." ]
05d76eeadfe54713606a615185b2da047923406b
https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/resize.js#L190-L262
train
Resize the image to the specified size
[ 30522, 3853, 24501, 4697, 1006, 9381, 1010, 4578, 1010, 7047, 1007, 1063, 2065, 1006, 2003, 1012, 4225, 1006, 9381, 1007, 1007, 1063, 2065, 1006, 2003, 1012, 4874, 1006, 9381, 1007, 1004, 1004, 999, 2003, 1012, 4225, 1006, 7047, 1007, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
checkSwitch
function checkSwitch(k, trueFnName, falseFnName) { var obj_k = obj[k]; if (obj_k != null && obj_k !== p[k]) { if (obj_k) { ele[trueFnName](); } else { ele[falseFnName](); } } }
javascript
function checkSwitch(k, trueFnName, falseFnName) { var obj_k = obj[k]; if (obj_k != null && obj_k !== p[k]) { if (obj_k) { ele[trueFnName](); } else { ele[falseFnName](); } } }
[ "function", "checkSwitch", "(", "k", ",", "trueFnName", ",", "falseFnName", ")", "{", "var", "obj_k", "=", "obj", "[", "k", "]", ";", "if", "(", "obj_k", "!=", "null", "&&", "obj_k", "!==", "p", "[", "k", "]", ")", "{", "if", "(", "obj_k", ")", ...
ignore group -- immutable
[ "ignore", "group", "--", "immutable" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L12030-L12040
train
check if the switch is a true or false
[ 30522, 3853, 14148, 9148, 10649, 1006, 1047, 1010, 2995, 2546, 9516, 4168, 1010, 6270, 2546, 9516, 4168, 1007, 1063, 13075, 27885, 3501, 1035, 1047, 1027, 27885, 3501, 1031, 1047, 1033, 1025, 2065, 1006, 27885, 3501, 1035, 1047, 999, 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...
GeekyAnts/vue-native-core
dist/vue.runtime.common.js
updateAttrs
function updateAttrs (oldVnode, vnode) { if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) { return } var key, cur, old; var elm = vnode.elm; var oldAttrs = oldVnode.data.attrs || {}; var attrs = vnode.data.attrs || {}; // clone observed objects, as the user probably wants to mutate it if (isDef(attrs.__ob__)) { attrs = vnode.data.attrs = extend({}, attrs); } for (key in attrs) { cur = attrs[key]; old = oldAttrs[key]; if (old !== cur) { setAttr(elm, key, cur); } } // #4391: in IE9, setting type can reset value for input[type=radio] /* istanbul ignore if */ if (isIE9 && attrs.value !== oldAttrs.value) { setAttr(elm, 'value', attrs.value); } for (key in oldAttrs) { if (isUndef(attrs[key])) { if (isXlink(key)) { elm.removeAttributeNS(xlinkNS, getXlinkProp(key)); } else if (!isEnumeratedAttr(key)) { elm.removeAttribute(key); } } } }
javascript
function updateAttrs (oldVnode, vnode) { if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) { return } var key, cur, old; var elm = vnode.elm; var oldAttrs = oldVnode.data.attrs || {}; var attrs = vnode.data.attrs || {}; // clone observed objects, as the user probably wants to mutate it if (isDef(attrs.__ob__)) { attrs = vnode.data.attrs = extend({}, attrs); } for (key in attrs) { cur = attrs[key]; old = oldAttrs[key]; if (old !== cur) { setAttr(elm, key, cur); } } // #4391: in IE9, setting type can reset value for input[type=radio] /* istanbul ignore if */ if (isIE9 && attrs.value !== oldAttrs.value) { setAttr(elm, 'value', attrs.value); } for (key in oldAttrs) { if (isUndef(attrs[key])) { if (isXlink(key)) { elm.removeAttributeNS(xlinkNS, getXlinkProp(key)); } else if (!isEnumeratedAttr(key)) { elm.removeAttribute(key); } } } }
[ "function", "updateAttrs", "(", "oldVnode", ",", "vnode", ")", "{", "if", "(", "isUndef", "(", "oldVnode", ".", "data", ".", "attrs", ")", "&&", "isUndef", "(", "vnode", ".", "data", ".", "attrs", ")", ")", "{", "return", "}", "var", "key", ",", "c...
/*
[ "/", "*" ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L5017-L5051
train
Updates attributes of a node
[ 30522, 3853, 10651, 19321, 2869, 1006, 2214, 16022, 10244, 1010, 1058, 3630, 3207, 1007, 1063, 2065, 1006, 2003, 8630, 12879, 1006, 2214, 16022, 10244, 1012, 2951, 1012, 2012, 16344, 2015, 1007, 1004, 1004, 2003, 8630, 12879, 1006, 1058, 36...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
zloirock/core-js
packages/core-js/internals/collection-weak.js
has
function has(key) { var state = getInternalState(this); if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).has(key); return data && $has(data, state.id); }
javascript
function has(key) { var state = getInternalState(this); if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).has(key); return data && $has(data, state.id); }
[ "function", "has", "(", "key", ")", "{", "var", "state", "=", "getInternalState", "(", "this", ")", ";", "if", "(", "!", "isObject", "(", "key", ")", ")", "return", "false", ";", "var", "data", "=", "getWeakData", "(", "key", ")", ";", "if", "(", ...
23.3.3.4 WeakMap.prototype.has(key) 23.4.3.4 WeakSet.prototype.has(value)
[ "23", ".", "3", ".", "3", ".", "4", "WeakMap", ".", "prototype", ".", "has", "(", "key", ")", "23", ".", "4", ".", "3", ".", "4", "WeakSet", ".", "prototype", ".", "has", "(", "value", ")" ]
fe7c8511a6d27d03a9b8e075b3351416aae95c58
https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/internals/collection-weak.js#L88-L94
train
Check if the key exists in the cache
[ 30522, 3853, 2038, 1006, 3145, 1007, 1063, 13075, 2110, 1027, 2131, 18447, 11795, 9777, 12259, 1006, 2023, 1007, 1025, 2065, 1006, 999, 11163, 2497, 20614, 1006, 3145, 1007, 1007, 2709, 6270, 1025, 13075, 2951, 1027, 2131, 8545, 4817, 2850,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.rta/src/sap/ui/rta/util/BindingsExtractor.js
getBindingsFromProperties
function getBindingsFromProperties(oElement, oParentDefaultModel) { var aPropertiesKeys = Object.keys(oElement.getMetadata().getAllProperties()); return aPropertiesKeys // filter properties which are not bound .filter(oElement.getBinding.bind(oElement)) .reduce(function (aBindings, sPropertyName) { return aBindings.concat( flattenBindings( oElement.getBinding(sPropertyName), oParentDefaultModel ) ); }, []); }
javascript
function getBindingsFromProperties(oElement, oParentDefaultModel) { var aPropertiesKeys = Object.keys(oElement.getMetadata().getAllProperties()); return aPropertiesKeys // filter properties which are not bound .filter(oElement.getBinding.bind(oElement)) .reduce(function (aBindings, sPropertyName) { return aBindings.concat( flattenBindings( oElement.getBinding(sPropertyName), oParentDefaultModel ) ); }, []); }
[ "function", "getBindingsFromProperties", "(", "oElement", ",", "oParentDefaultModel", ")", "{", "var", "aPropertiesKeys", "=", "Object", ".", "keys", "(", "oElement", ".", "getMetadata", "(", ")", ".", "getAllProperties", "(", ")", ")", ";", "return", "aProperti...
Retrieving all bindings from all available properties for a specified element @param {sap.ui.core.Control} oElement - element to get bindings from @param {sap.ui.model.Model} oParentDefaultModel - parent model to filter irrelevant bindings @return {Array} - returns found bindings @private
[ "Retrieving", "all", "bindings", "from", "all", "available", "properties", "for", "a", "specified", "element" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/util/BindingsExtractor.js#L196-L210
train
get bindings from all properties of the given element
[ 30522, 3853, 2131, 8428, 4667, 22747, 21716, 21572, 4842, 7368, 1006, 1051, 12260, 3672, 1010, 6728, 12069, 3372, 3207, 7011, 11314, 5302, 9247, 1007, 1063, 13075, 19804, 25918, 7368, 14839, 2015, 1027, 4874, 1012, 6309, 1006, 1051, 12260, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
badges/shields
services/opencollective/opencollective-base.js
buildMembersArraySchema
function buildMembersArraySchema({ userType, tierRequired }) { const keys = { MemberId: Joi.number().required(), type: userType || Joi.string().required(), role: Joi.string().required(), } if (tierRequired) keys.tier = Joi.string().required() return Joi.array().items(Joi.object().keys(keys)) }
javascript
function buildMembersArraySchema({ userType, tierRequired }) { const keys = { MemberId: Joi.number().required(), type: userType || Joi.string().required(), role: Joi.string().required(), } if (tierRequired) keys.tier = Joi.string().required() return Joi.array().items(Joi.object().keys(keys)) }
[ "function", "buildMembersArraySchema", "(", "{", "userType", ",", "tierRequired", "}", ")", "{", "const", "keys", "=", "{", "MemberId", ":", "Joi", ".", "number", "(", ")", ".", "required", "(", ")", ",", "type", ":", "userType", "||", "Joi", ".", "str...
https://developer.opencollective.com/#/api/collectives?id=get-members
[ "https", ":", "//", "developer", ".", "opencollective", ".", "com", "/", "#", "/", "api", "/", "collectives?id", "=", "get", "-", "members" ]
283601423f3d1a19aae83bf62032d40683948636
https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/services/opencollective/opencollective-base.js#L14-L22
train
Build a schema for the members array
[ 30522, 3853, 3857, 4168, 21784, 10286, 9447, 22842, 2863, 1006, 1063, 5310, 13874, 1010, 7563, 2890, 15549, 5596, 1065, 1007, 1063, 9530, 3367, 6309, 1027, 1063, 2266, 3593, 1024, 8183, 2072, 1012, 2193, 1006, 1007, 1012, 3223, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/xpath/dom.js
domTraverseElements
function domTraverseElements(node, opt_pre, opt_post) { var ret; if (opt_pre) { ret = opt_pre.call(null, node); if (typeof ret == 'boolean' && !ret) { return false; } } for (var c = node.firstChild; c; c = c.nextSibling) { if (c.nodeType == DOM_ELEMENT_NODE) { ret = arguments.callee.call(this, c, opt_pre, opt_post); if (typeof ret == 'boolean' && !ret) { return false; } } } if (opt_post) { ret = opt_post.call(null, node); if (typeof ret == 'boolean' && !ret) { return false; } } }
javascript
function domTraverseElements(node, opt_pre, opt_post) { var ret; if (opt_pre) { ret = opt_pre.call(null, node); if (typeof ret == 'boolean' && !ret) { return false; } } for (var c = node.firstChild; c; c = c.nextSibling) { if (c.nodeType == DOM_ELEMENT_NODE) { ret = arguments.callee.call(this, c, opt_pre, opt_post); if (typeof ret == 'boolean' && !ret) { return false; } } } if (opt_post) { ret = opt_post.call(null, node); if (typeof ret == 'boolean' && !ret) { return false; } } }
[ "function", "domTraverseElements", "(", "node", ",", "opt_pre", ",", "opt_post", ")", "{", "var", "ret", ";", "if", "(", "opt_pre", ")", "{", "ret", "=", "opt_pre", ".", "call", "(", "null", ",", "node", ")", ";", "if", "(", "typeof", "ret", "==", ...
Traverses the element nodes in the DOM section underneath the given node and invokes the given callbacks as methods on every element node encountered. Function opt_pre is invoked before a node's children are traversed; opt_post is invoked after they are traversed. Traversal will not be continued if a callback function returns boolean false. NOTE(mesch): copied from <//google3/maps/webmaps/javascript/dom.js>.
[ "Traverses", "the", "element", "nodes", "in", "the", "DOM", "section", "underneath", "the", "given", "node", "and", "invokes", "the", "given", "callbacks", "as", "methods", "on", "every", "element", "node", "encountered", ".", "Function", "opt_pre", "is", "inv...
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/dom.js#L234-L258
train
Traverse all elements of a node
[ 30522, 3853, 14383, 6494, 16070, 12260, 8163, 1006, 13045, 1010, 23569, 1035, 3653, 1010, 23569, 1035, 2695, 1007, 1063, 13075, 2128, 2102, 1025, 2065, 1006, 23569, 1035, 3653, 1007, 1063, 2128, 2102, 1027, 23569, 1035, 3653, 1012, 2655, 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/dom/jquery/Selectors.js
visible
function visible( element ) { // check if one of the parents (until it's position parent) is invisible // prevent that elements in static area are always checked as invisible // list all items until the offsetParent item (with jQuery >1.6 you can use parentsUntil) var oOffsetParent = jQuery(element).offsetParent(); var bOffsetParentFound = false; var $refs = jQuery(element).parents().filter(function() { if (this === oOffsetParent) { bOffsetParentFound = true; } return bOffsetParentFound; }); // check for at least one item to be visible return !jQuery(element).add($refs).filter(function() { return jQuery.css( this, "visibility" ) === "hidden" || jQuery.expr.filters.hidden( this ); }).length; }
javascript
function visible( element ) { // check if one of the parents (until it's position parent) is invisible // prevent that elements in static area are always checked as invisible // list all items until the offsetParent item (with jQuery >1.6 you can use parentsUntil) var oOffsetParent = jQuery(element).offsetParent(); var bOffsetParentFound = false; var $refs = jQuery(element).parents().filter(function() { if (this === oOffsetParent) { bOffsetParentFound = true; } return bOffsetParentFound; }); // check for at least one item to be visible return !jQuery(element).add($refs).filter(function() { return jQuery.css( this, "visibility" ) === "hidden" || jQuery.expr.filters.hidden( this ); }).length; }
[ "function", "visible", "(", "element", ")", "{", "// check if one of the parents (until it's position parent) is invisible", "// prevent that elements in static area are always checked as invisible", "// list all items until the offsetParent item (with jQuery >1.6 you can use parentsUntil)", "var"...
/*! The following functions are taken from jQuery UI 1.8.17 but modified Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) Dual licensed under the MIT or GPL Version 2 licenses. http://jquery.org/license http://docs.jquery.com/UI
[ "/", "*", "!", "The", "following", "functions", "are", "taken", "from", "jQuery", "UI", "1", ".", "8", ".", "17", "but", "modified" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/jquery/Selectors.js#L39-L57
train
Checks if an element is visible
[ 30522, 3853, 5710, 1006, 5783, 1007, 1063, 1013, 1013, 4638, 2065, 2028, 1997, 1996, 3008, 1006, 2127, 2009, 1005, 1055, 2597, 6687, 1007, 2003, 8841, 1013, 1013, 4652, 2008, 3787, 1999, 10763, 2181, 2024, 2467, 7039, 2004, 8841, 1013, 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...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/modal-dialog.js
modalDialog_waitForDialog
function modalDialog_waitForDialog(aTimeout) { var timeout = aTimeout || TIMEOUT_MODAL_DIALOG; if (!this._observer) { return; } try { mozmill.utils.waitFor(function () { return this.finished; }, "Modal dialog has been found and processed", timeout, undefined, this); // Forward the raised exception so we can detect failures in modal dialogs if (this._observer.exception) { throw this._observer.exception; } } finally { this.stop(); } }
javascript
function modalDialog_waitForDialog(aTimeout) { var timeout = aTimeout || TIMEOUT_MODAL_DIALOG; if (!this._observer) { return; } try { mozmill.utils.waitFor(function () { return this.finished; }, "Modal dialog has been found and processed", timeout, undefined, this); // Forward the raised exception so we can detect failures in modal dialogs if (this._observer.exception) { throw this._observer.exception; } } finally { this.stop(); } }
[ "function", "modalDialog_waitForDialog", "(", "aTimeout", ")", "{", "var", "timeout", "=", "aTimeout", "||", "TIMEOUT_MODAL_DIALOG", ";", "if", "(", "!", "this", ".", "_observer", ")", "{", "return", ";", "}", "try", "{", "mozmill", ".", "utils", ".", "wai...
Wait until the modal dialog has been processed. @param {Number} aTimeout (optional - default 5s) Duration to wait
[ "Wait", "until", "the", "modal", "dialog", "has", "been", "processed", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/modal-dialog.js#L205-L225
train
Wait for a modal dialog to be processed
[ 30522, 3853, 16913, 24657, 23067, 2290, 1035, 3524, 3877, 4818, 8649, 1006, 2012, 14428, 5833, 1007, 1063, 13075, 2051, 5833, 1027, 2012, 14428, 5833, 1064, 1064, 2051, 5833, 1035, 16913, 2389, 1035, 13764, 8649, 1025, 2065, 1006, 999, 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...
laurent22/joplin
Clipper/joplin-webclipper/content_scripts/Readability.js
function(articleContent) { var baseURI = this._doc.baseURI; var documentURI = this._doc.documentURI; function toAbsoluteURI(uri) { // Leave hash links alone if the base URI matches the document URI: if (baseURI == documentURI && uri.charAt(0) == "#") { return uri; } // Otherwise, resolve against base URI: try { return new URL(uri, baseURI).href; } catch (ex) { // Something went wrong, just return the original: } return uri; } var links = articleContent.getElementsByTagName("a"); this._forEachNode(links, function(link) { var href = link.getAttribute("href"); if (href) { // Replace links with javascript: URIs with text content, since // they won't work after scripts have been removed from the page. if (href.indexOf("javascript:") === 0) { var text = this._doc.createTextNode(link.textContent); link.parentNode.replaceChild(text, link); } else { link.setAttribute("href", toAbsoluteURI(href)); } } }); var imgs = articleContent.getElementsByTagName("img"); this._forEachNode(imgs, function(img) { var src = img.getAttribute("src"); if (src) { img.setAttribute("src", toAbsoluteURI(src)); } }); }
javascript
function(articleContent) { var baseURI = this._doc.baseURI; var documentURI = this._doc.documentURI; function toAbsoluteURI(uri) { // Leave hash links alone if the base URI matches the document URI: if (baseURI == documentURI && uri.charAt(0) == "#") { return uri; } // Otherwise, resolve against base URI: try { return new URL(uri, baseURI).href; } catch (ex) { // Something went wrong, just return the original: } return uri; } var links = articleContent.getElementsByTagName("a"); this._forEachNode(links, function(link) { var href = link.getAttribute("href"); if (href) { // Replace links with javascript: URIs with text content, since // they won't work after scripts have been removed from the page. if (href.indexOf("javascript:") === 0) { var text = this._doc.createTextNode(link.textContent); link.parentNode.replaceChild(text, link); } else { link.setAttribute("href", toAbsoluteURI(href)); } } }); var imgs = articleContent.getElementsByTagName("img"); this._forEachNode(imgs, function(img) { var src = img.getAttribute("src"); if (src) { img.setAttribute("src", toAbsoluteURI(src)); } }); }
[ "function", "(", "articleContent", ")", "{", "var", "baseURI", "=", "this", ".", "_doc", ".", "baseURI", ";", "var", "documentURI", "=", "this", ".", "_doc", ".", "documentURI", ";", "function", "toAbsoluteURI", "(", "uri", ")", "{", "// Leave hash links alo...
Converts each <a> and <img> uri in the given element to an absolute URI, ignoring #ref URIs. @param Element @return void
[ "Converts", "each", "<a", ">", "and", "<img", ">", "uri", "in", "the", "given", "element", "to", "an", "absolute", "URI", "ignoring", "#ref", "URIs", "." ]
beb428b246cecba4630a3ca57b472f43c0933a43
https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L306-L345
train
This function is called by the articleParser when the article is parsed.
[ 30522, 3853, 1006, 3720, 8663, 6528, 2102, 1007, 1063, 13075, 2918, 9496, 1027, 2023, 1012, 1035, 9986, 30524, 1027, 2023, 1012, 1035, 9986, 1012, 6254, 9496, 1025, 3853, 2000, 7875, 19454, 10421, 9496, 1006, 24471, 2072, 1007, 1063, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/api/v0.1/users.js
doQuery
function doQuery(options) { return models.User.changePassword( options.data.password[0], _.omit(options, ['data']) ).then(() => { return Promise.resolve({ password: [{message: common.i18n.t('notices.api.users.pwdChangedSuccessfully')}] }); }); }
javascript
function doQuery(options) { return models.User.changePassword( options.data.password[0], _.omit(options, ['data']) ).then(() => { return Promise.resolve({ password: [{message: common.i18n.t('notices.api.users.pwdChangedSuccessfully')}] }); }); }
[ "function", "doQuery", "(", "options", ")", "{", "return", "models", ".", "User", ".", "changePassword", "(", "options", ".", "data", ".", "password", "[", "0", "]", ",", "_", ".", "omit", "(", "options", ",", "[", "'data'", "]", ")", ")", ".", "th...
### Model Query Make the call to the Model layer @param {Object} options @returns {Object} options
[ "###", "Model", "Query", "Make", "the", "call", "to", "the", "Model", "layer" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/users.js#L278-L287
train
Query the database to change the password of a user
[ 30522, 3853, 2079, 4226, 2854, 1006, 7047, 1007, 1063, 2709, 4275, 1012, 5310, 1012, 2689, 15194, 18351, 1006, 7047, 1012, 2951, 1012, 20786, 1031, 1014, 1033, 1010, 1035, 1012, 18168, 4183, 1006, 7047, 1010, 1031, 1005, 2951, 1005, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nosir/cleave.js
src/Cleave.js
function (element, opts) { var owner = this; var hasMultipleElements = false; if (typeof element === 'string') { owner.element = document.querySelector(element); hasMultipleElements = document.querySelectorAll(element).length > 1; } else { if (typeof element.length !== 'undefined' && element.length > 0) { owner.element = element[0]; hasMultipleElements = element.length > 1; } else { owner.element = element; } } if (!owner.element) { throw new Error('[cleave.js] Please check the element'); } if (hasMultipleElements) { try { // eslint-disable-next-line console.warn('[cleave.js] Multiple input fields matched, cleave.js will only take the first one.'); } catch (e) { // Old IE } } opts.initValue = owner.element.value; owner.properties = Cleave.DefaultProperties.assign({}, opts); owner.init(); }
javascript
function (element, opts) { var owner = this; var hasMultipleElements = false; if (typeof element === 'string') { owner.element = document.querySelector(element); hasMultipleElements = document.querySelectorAll(element).length > 1; } else { if (typeof element.length !== 'undefined' && element.length > 0) { owner.element = element[0]; hasMultipleElements = element.length > 1; } else { owner.element = element; } } if (!owner.element) { throw new Error('[cleave.js] Please check the element'); } if (hasMultipleElements) { try { // eslint-disable-next-line console.warn('[cleave.js] Multiple input fields matched, cleave.js will only take the first one.'); } catch (e) { // Old IE } } opts.initValue = owner.element.value; owner.properties = Cleave.DefaultProperties.assign({}, opts); owner.init(); }
[ "function", "(", "element", ",", "opts", ")", "{", "var", "owner", "=", "this", ";", "var", "hasMultipleElements", "=", "false", ";", "if", "(", "typeof", "element", "===", "'string'", ")", "{", "owner", ".", "element", "=", "document", ".", "querySelect...
Construct a new Cleave instance by passing the configuration object @param {String | HTMLElement} element @param {Object} opts
[ "Construct", "a", "new", "Cleave", "instance", "by", "passing", "the", "configuration", "object" ]
fc1bcca55589e0e95465f39b4dc22c25634e7cf5
https://github.com/nosir/cleave.js/blob/fc1bcca55589e0e95465f39b4dc22c25634e7cf5/src/Cleave.js#L9-L43
train
Initialize the object
[ 30522, 3853, 1006, 5783, 1010, 23569, 2015, 1007, 1063, 13075, 3954, 1027, 2023, 1025, 13075, 2038, 12274, 7096, 11514, 10559, 16930, 11187, 30524, 1006, 5783, 1007, 1012, 3091, 1028, 1015, 1025, 1065, 2842, 1063, 2065, 1006, 2828, 11253, 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...
thomaspark/bootswatch
docs/_vendor/popper.js/dist/popper.js
getSupportedPropertyName
function getSupportedPropertyName(property) { const prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; const upperProp = property.charAt(0).toUpperCase() + property.slice(1); for (let i = 0; i < prefixes.length; i++) { const prefix = prefixes[i]; const toCheck = prefix ? `${prefix}${upperProp}` : property; if (typeof document.body.style[toCheck] !== 'undefined') { return toCheck; } } return null; }
javascript
function getSupportedPropertyName(property) { const prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; const upperProp = property.charAt(0).toUpperCase() + property.slice(1); for (let i = 0; i < prefixes.length; i++) { const prefix = prefixes[i]; const toCheck = prefix ? `${prefix}${upperProp}` : property; if (typeof document.body.style[toCheck] !== 'undefined') { return toCheck; } } return null; }
[ "function", "getSupportedPropertyName", "(", "property", ")", "{", "const", "prefixes", "=", "[", "false", ",", "'ms'", ",", "'Webkit'", ",", "'Moz'", ",", "'O'", "]", ";", "const", "upperProp", "=", "property", ".", "charAt", "(", "0", ")", ".", "toUppe...
Get the prefixed supported property name @method @memberof Popper.Utils @argument {String} property (camelCase) @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
[ "Get", "the", "prefixed", "supported", "property", "name" ]
a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd
https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/_vendor/popper.js/dist/popper.js#L881-L893
train
Get the supported CSS property name
[ 30522, 3853, 4152, 6279, 6442, 2098, 21572, 4842, 25680, 14074, 1006, 3200, 1007, 1063, 9530, 3367, 17576, 2229, 1027, 1031, 6270, 1010, 1005, 5796, 1005, 1010, 1005, 4773, 23615, 1005, 1010, 1005, 9587, 2480, 1005, 1010, 1005, 1051, 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...
jgraph/mxgraph
javascript/mxClient.js
function (bounds, vertex, next, orthogonal) { var x = bounds.x; var y = bounds.y; var w = bounds.width; var h = bounds.height; var cx = bounds.getCenterX(); var cy = bounds.getCenterY(); var px = next.x; var py = next.y; var dx = px - cx; var dy = py - cy; var alpha = -Math.atan2(dy, dx); var pi = Math.PI; var pi2 = Math.PI / 2; var result = new mxPoint(cx, cy); var direction = (vertex != null) ? mxUtils.getValue( vertex.style, mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST) : mxConstants.DIRECTION_EAST; var vertical = direction == mxConstants.DIRECTION_NORTH || direction == mxConstants.DIRECTION_SOUTH; var a = new mxPoint(); var b = new mxPoint(); //Only consider corrects quadrants for the orthogonal case. if ((px < x) && (py < y) || (px < x) && (py > y + h) || (px > x + w) && (py < y) || (px > x + w) && (py > y + h)) { orthogonal = false; } if (orthogonal) { if (vertical) { //Special cases where intersects with hexagon corners if (px == cx) { if (py <= y) { return new mxPoint(cx, y); } else if (py >= y + h) { return new mxPoint(cx, y + h); } } else if (px < x) { if (py == y + h / 4) { return new mxPoint(x, y + h / 4); } else if (py == y + 3 * h / 4) { return new mxPoint(x, y + 3 * h / 4); } } else if (px > x + w) { if (py == y + h / 4) { return new mxPoint(x + w, y + h / 4); } else if (py == y + 3 * h / 4) { return new mxPoint(x + w, y + 3 * h / 4); } } else if (px == x) { if (py < cy) { return new mxPoint(x, y + h / 4); } else if (py > cy) { return new mxPoint(x, y + 3 * h / 4); } } else if (px == x + w) { if (py < cy) { return new mxPoint(x + w, y + h / 4); } else if (py > cy) { return new mxPoint(x + w, y + 3 * h / 4); } } if (py == y) { return new mxPoint(cx, y); } else if (py == y + h) { return new mxPoint(cx, y + h); } if (px < cx) { if ((py > y + h / 4) && (py < y + 3 * h / 4)) { a = new mxPoint(x, y); b = new mxPoint(x, y + h); } else if (py < y + h / 4) { a = new mxPoint(x - Math.floor(0.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x + w, y - Math.floor(0.25 * h)); } else if (py > y + 3 * h / 4) { a = new mxPoint(x - Math.floor(0.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x + w, y + Math.floor(1.25 * h)); } } else if (px > cx) { if ((py > y + h / 4) && (py < y + 3 * h / 4)) { a = new mxPoint(x + w, y); b = new mxPoint(x + w, y + h); } else if (py < y + h / 4) { a = new mxPoint(x, y - Math.floor(0.25 * h)); b = new mxPoint(x + Math.floor(1.5 * w), y + Math.floor(0.5 * h)); } else if (py > y + 3 * h / 4) { a = new mxPoint(x + Math.floor(1.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x, y + Math.floor(1.25 * h)); } } } else { //Special cases where intersects with hexagon corners if (py == cy) { if (px <= x) { return new mxPoint(x, y + h / 2); } else if (px >= x + w) { return new mxPoint(x + w, y + h / 2); } } else if (py < y) { if (px == x + w / 4) { return new mxPoint(x + w / 4, y); } else if (px == x + 3 * w / 4) { return new mxPoint(x + 3 * w / 4, y); } } else if (py > y + h) { if (px == x + w / 4) { return new mxPoint(x + w / 4, y + h); } else if (px == x + 3 * w / 4) { return new mxPoint(x + 3 * w / 4, y + h); } } else if (py == y) { if (px < cx) { return new mxPoint(x + w / 4, y); } else if (px > cx) { return new mxPoint(x + 3 * w / 4, y); } } else if (py == y + h) { if (px < cx) { return new mxPoint(x + w / 4, y + h); } else if (py > cy) { return new mxPoint(x + 3 * w / 4, y + h); } } if (px == x) { return new mxPoint(x, cy); } else if (px == x + w) { return new mxPoint(x + w, cy); } if (py < cy) { if ((px > x + w / 4) && (px < x + 3 * w / 4)) { a = new mxPoint(x, y); b = new mxPoint(x + w, y); } else if (px < x + w / 4) { a = new mxPoint(x - Math.floor(0.25 * w), y + h); b = new mxPoint(x + Math.floor(0.5 * w), y - Math.floor(0.5 * h)); } else if (px > x + 3 * w / 4) { a = new mxPoint(x + Math.floor(0.5 * w), y - Math.floor(0.5 * h)); b = new mxPoint(x + Math.floor(1.25 * w), y + h); } } else if (py > cy) { if ((px > x + w / 4) && (px < x + 3 * w / 4)) { a = new mxPoint(x, y + h); b = new mxPoint(x + w, y + h); } else if (px < x + w / 4) { a = new mxPoint(x - Math.floor(0.25 * w), y); b = new mxPoint(x + Math.floor(0.5 * w), y + Math.floor(1.5 * h)); } else if (px > x + 3 * w / 4) { a = new mxPoint(x + Math.floor(0.5 * w), y + Math.floor(1.5 * h)); b = new mxPoint(x + Math.floor(1.25 * w), y); } } } var tx = cx; var ty = cy; if (px >= x && px <= x + w) { tx = px; if (py < cy) { ty = y + h; } else { ty = y; } } else if (py >= y && py <= y + h) { ty = py; if (px < cx) { tx = x + w; } else { tx = x; } } result = mxUtils.intersection(tx, ty, next.x, next.y, a.x, a.y, b.x, b.y); } else { if (vertical) { var beta = Math.atan2(h / 4, w / 2); //Special cases where intersects with hexagon corners if (alpha == beta) { return new mxPoint(x + w, y + Math.floor(0.25 * h)); } else if (alpha == pi2) { return new mxPoint(x + Math.floor(0.5 * w), y); } else if (alpha == (pi - beta)) { return new mxPoint(x, y + Math.floor(0.25 * h)); } else if (alpha == -beta) { return new mxPoint(x + w, y + Math.floor(0.75 * h)); } else if (alpha == (-pi2)) { return new mxPoint(x + Math.floor(0.5 * w), y + h); } else if (alpha == (-pi + beta)) { return new mxPoint(x, y + Math.floor(0.75 * h)); } if ((alpha < beta) && (alpha > -beta)) { a = new mxPoint(x + w, y); b = new mxPoint(x + w, y + h); } else if ((alpha > beta) && (alpha < pi2)) { a = new mxPoint(x, y - Math.floor(0.25 * h)); b = new mxPoint(x + Math.floor(1.5 * w), y + Math.floor(0.5 * h)); } else if ((alpha > pi2) && (alpha < (pi - beta))) { a = new mxPoint(x - Math.floor(0.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x + w, y - Math.floor(0.25 * h)); } else if (((alpha > (pi - beta)) && (alpha <= pi)) || ((alpha < (-pi + beta)) && (alpha >= -pi))) { a = new mxPoint(x, y); b = new mxPoint(x, y + h); } else if ((alpha < -beta) && (alpha > -pi2)) { a = new mxPoint(x + Math.floor(1.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x, y + Math.floor(1.25 * h)); } else if ((alpha < -pi2) && (alpha > (-pi + beta))) { a = new mxPoint(x - Math.floor(0.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x + w, y + Math.floor(1.25 * h)); } } else { var beta = Math.atan2(h / 2, w / 4); //Special cases where intersects with hexagon corners if (alpha == beta) { return new mxPoint(x + Math.floor(0.75 * w), y); } else if (alpha == (pi - beta)) { return new mxPoint(x + Math.floor(0.25 * w), y); } else if ((alpha == pi) || (alpha == -pi)) { return new mxPoint(x, y + Math.floor(0.5 * h)); } else if (alpha == 0) { return new mxPoint(x + w, y + Math.floor(0.5 * h)); } else if (alpha == -beta) { return new mxPoint(x + Math.floor(0.75 * w), y + h); } else if (alpha == (-pi + beta)) { return new mxPoint(x + Math.floor(0.25 * w), y + h); } if ((alpha > 0) && (alpha < beta)) { a = new mxPoint(x + Math.floor(0.5 * w), y - Math.floor(0.5 * h)); b = new mxPoint(x + Math.floor(1.25 * w), y + h); } else if ((alpha > beta) && (alpha < (pi - beta))) { a = new mxPoint(x, y); b = new mxPoint(x + w, y); } else if ((alpha > (pi - beta)) && (alpha < pi)) { a = new mxPoint(x - Math.floor(0.25 * w), y + h); b = new mxPoint(x + Math.floor(0.5 * w), y - Math.floor(0.5 * h)); } else if ((alpha < 0) && (alpha > -beta)) { a = new mxPoint(x + Math.floor(0.5 * w), y + Math.floor(1.5 * h)); b = new mxPoint(x + Math.floor(1.25 * w), y); } else if ((alpha < -beta) && (alpha > (-pi + beta))) { a = new mxPoint(x, y + h); b = new mxPoint(x + w, y + h); } else if ((alpha < (-pi + beta)) && (alpha > -pi)) { a = new mxPoint(x - Math.floor(0.25 * w), y); b = new mxPoint(x + Math.floor(0.5 * w), y + Math.floor(1.5 * h)); } } result = mxUtils.intersection(cx, cy, next.x, next.y, a.x, a.y, b.x, b.y); } if (result == null) { return new mxPoint(cx, cy); } return result; }
javascript
function (bounds, vertex, next, orthogonal) { var x = bounds.x; var y = bounds.y; var w = bounds.width; var h = bounds.height; var cx = bounds.getCenterX(); var cy = bounds.getCenterY(); var px = next.x; var py = next.y; var dx = px - cx; var dy = py - cy; var alpha = -Math.atan2(dy, dx); var pi = Math.PI; var pi2 = Math.PI / 2; var result = new mxPoint(cx, cy); var direction = (vertex != null) ? mxUtils.getValue( vertex.style, mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST) : mxConstants.DIRECTION_EAST; var vertical = direction == mxConstants.DIRECTION_NORTH || direction == mxConstants.DIRECTION_SOUTH; var a = new mxPoint(); var b = new mxPoint(); //Only consider corrects quadrants for the orthogonal case. if ((px < x) && (py < y) || (px < x) && (py > y + h) || (px > x + w) && (py < y) || (px > x + w) && (py > y + h)) { orthogonal = false; } if (orthogonal) { if (vertical) { //Special cases where intersects with hexagon corners if (px == cx) { if (py <= y) { return new mxPoint(cx, y); } else if (py >= y + h) { return new mxPoint(cx, y + h); } } else if (px < x) { if (py == y + h / 4) { return new mxPoint(x, y + h / 4); } else if (py == y + 3 * h / 4) { return new mxPoint(x, y + 3 * h / 4); } } else if (px > x + w) { if (py == y + h / 4) { return new mxPoint(x + w, y + h / 4); } else if (py == y + 3 * h / 4) { return new mxPoint(x + w, y + 3 * h / 4); } } else if (px == x) { if (py < cy) { return new mxPoint(x, y + h / 4); } else if (py > cy) { return new mxPoint(x, y + 3 * h / 4); } } else if (px == x + w) { if (py < cy) { return new mxPoint(x + w, y + h / 4); } else if (py > cy) { return new mxPoint(x + w, y + 3 * h / 4); } } if (py == y) { return new mxPoint(cx, y); } else if (py == y + h) { return new mxPoint(cx, y + h); } if (px < cx) { if ((py > y + h / 4) && (py < y + 3 * h / 4)) { a = new mxPoint(x, y); b = new mxPoint(x, y + h); } else if (py < y + h / 4) { a = new mxPoint(x - Math.floor(0.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x + w, y - Math.floor(0.25 * h)); } else if (py > y + 3 * h / 4) { a = new mxPoint(x - Math.floor(0.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x + w, y + Math.floor(1.25 * h)); } } else if (px > cx) { if ((py > y + h / 4) && (py < y + 3 * h / 4)) { a = new mxPoint(x + w, y); b = new mxPoint(x + w, y + h); } else if (py < y + h / 4) { a = new mxPoint(x, y - Math.floor(0.25 * h)); b = new mxPoint(x + Math.floor(1.5 * w), y + Math.floor(0.5 * h)); } else if (py > y + 3 * h / 4) { a = new mxPoint(x + Math.floor(1.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x, y + Math.floor(1.25 * h)); } } } else { //Special cases where intersects with hexagon corners if (py == cy) { if (px <= x) { return new mxPoint(x, y + h / 2); } else if (px >= x + w) { return new mxPoint(x + w, y + h / 2); } } else if (py < y) { if (px == x + w / 4) { return new mxPoint(x + w / 4, y); } else if (px == x + 3 * w / 4) { return new mxPoint(x + 3 * w / 4, y); } } else if (py > y + h) { if (px == x + w / 4) { return new mxPoint(x + w / 4, y + h); } else if (px == x + 3 * w / 4) { return new mxPoint(x + 3 * w / 4, y + h); } } else if (py == y) { if (px < cx) { return new mxPoint(x + w / 4, y); } else if (px > cx) { return new mxPoint(x + 3 * w / 4, y); } } else if (py == y + h) { if (px < cx) { return new mxPoint(x + w / 4, y + h); } else if (py > cy) { return new mxPoint(x + 3 * w / 4, y + h); } } if (px == x) { return new mxPoint(x, cy); } else if (px == x + w) { return new mxPoint(x + w, cy); } if (py < cy) { if ((px > x + w / 4) && (px < x + 3 * w / 4)) { a = new mxPoint(x, y); b = new mxPoint(x + w, y); } else if (px < x + w / 4) { a = new mxPoint(x - Math.floor(0.25 * w), y + h); b = new mxPoint(x + Math.floor(0.5 * w), y - Math.floor(0.5 * h)); } else if (px > x + 3 * w / 4) { a = new mxPoint(x + Math.floor(0.5 * w), y - Math.floor(0.5 * h)); b = new mxPoint(x + Math.floor(1.25 * w), y + h); } } else if (py > cy) { if ((px > x + w / 4) && (px < x + 3 * w / 4)) { a = new mxPoint(x, y + h); b = new mxPoint(x + w, y + h); } else if (px < x + w / 4) { a = new mxPoint(x - Math.floor(0.25 * w), y); b = new mxPoint(x + Math.floor(0.5 * w), y + Math.floor(1.5 * h)); } else if (px > x + 3 * w / 4) { a = new mxPoint(x + Math.floor(0.5 * w), y + Math.floor(1.5 * h)); b = new mxPoint(x + Math.floor(1.25 * w), y); } } } var tx = cx; var ty = cy; if (px >= x && px <= x + w) { tx = px; if (py < cy) { ty = y + h; } else { ty = y; } } else if (py >= y && py <= y + h) { ty = py; if (px < cx) { tx = x + w; } else { tx = x; } } result = mxUtils.intersection(tx, ty, next.x, next.y, a.x, a.y, b.x, b.y); } else { if (vertical) { var beta = Math.atan2(h / 4, w / 2); //Special cases where intersects with hexagon corners if (alpha == beta) { return new mxPoint(x + w, y + Math.floor(0.25 * h)); } else if (alpha == pi2) { return new mxPoint(x + Math.floor(0.5 * w), y); } else if (alpha == (pi - beta)) { return new mxPoint(x, y + Math.floor(0.25 * h)); } else if (alpha == -beta) { return new mxPoint(x + w, y + Math.floor(0.75 * h)); } else if (alpha == (-pi2)) { return new mxPoint(x + Math.floor(0.5 * w), y + h); } else if (alpha == (-pi + beta)) { return new mxPoint(x, y + Math.floor(0.75 * h)); } if ((alpha < beta) && (alpha > -beta)) { a = new mxPoint(x + w, y); b = new mxPoint(x + w, y + h); } else if ((alpha > beta) && (alpha < pi2)) { a = new mxPoint(x, y - Math.floor(0.25 * h)); b = new mxPoint(x + Math.floor(1.5 * w), y + Math.floor(0.5 * h)); } else if ((alpha > pi2) && (alpha < (pi - beta))) { a = new mxPoint(x - Math.floor(0.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x + w, y - Math.floor(0.25 * h)); } else if (((alpha > (pi - beta)) && (alpha <= pi)) || ((alpha < (-pi + beta)) && (alpha >= -pi))) { a = new mxPoint(x, y); b = new mxPoint(x, y + h); } else if ((alpha < -beta) && (alpha > -pi2)) { a = new mxPoint(x + Math.floor(1.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x, y + Math.floor(1.25 * h)); } else if ((alpha < -pi2) && (alpha > (-pi + beta))) { a = new mxPoint(x - Math.floor(0.5 * w), y + Math.floor(0.5 * h)); b = new mxPoint(x + w, y + Math.floor(1.25 * h)); } } else { var beta = Math.atan2(h / 2, w / 4); //Special cases where intersects with hexagon corners if (alpha == beta) { return new mxPoint(x + Math.floor(0.75 * w), y); } else if (alpha == (pi - beta)) { return new mxPoint(x + Math.floor(0.25 * w), y); } else if ((alpha == pi) || (alpha == -pi)) { return new mxPoint(x, y + Math.floor(0.5 * h)); } else if (alpha == 0) { return new mxPoint(x + w, y + Math.floor(0.5 * h)); } else if (alpha == -beta) { return new mxPoint(x + Math.floor(0.75 * w), y + h); } else if (alpha == (-pi + beta)) { return new mxPoint(x + Math.floor(0.25 * w), y + h); } if ((alpha > 0) && (alpha < beta)) { a = new mxPoint(x + Math.floor(0.5 * w), y - Math.floor(0.5 * h)); b = new mxPoint(x + Math.floor(1.25 * w), y + h); } else if ((alpha > beta) && (alpha < (pi - beta))) { a = new mxPoint(x, y); b = new mxPoint(x + w, y); } else if ((alpha > (pi - beta)) && (alpha < pi)) { a = new mxPoint(x - Math.floor(0.25 * w), y + h); b = new mxPoint(x + Math.floor(0.5 * w), y - Math.floor(0.5 * h)); } else if ((alpha < 0) && (alpha > -beta)) { a = new mxPoint(x + Math.floor(0.5 * w), y + Math.floor(1.5 * h)); b = new mxPoint(x + Math.floor(1.25 * w), y); } else if ((alpha < -beta) && (alpha > (-pi + beta))) { a = new mxPoint(x, y + h); b = new mxPoint(x + w, y + h); } else if ((alpha < (-pi + beta)) && (alpha > -pi)) { a = new mxPoint(x - Math.floor(0.25 * w), y); b = new mxPoint(x + Math.floor(0.5 * w), y + Math.floor(1.5 * h)); } } result = mxUtils.intersection(cx, cy, next.x, next.y, a.x, a.y, b.x, b.y); } if (result == null) { return new mxPoint(cx, cy); } return result; }
[ "function", "(", "bounds", ",", "vertex", ",", "next", ",", "orthogonal", ")", "{", "var", "x", "=", "bounds", ".", "x", ";", "var", "y", "=", "bounds", ".", "y", ";", "var", "w", "=", "bounds", ".", "width", ";", "var", "h", "=", "bounds", "."...
Function: HexagonPerimeter Describes a hexagon perimeter. See <RectanglePerimeter> for a description of the parameters.
[ "Function", ":", "HexagonPerimeter" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L43859-L44288
train
Returns the next point in the bounds
[ 30522, 3853, 1006, 19202, 1010, 19449, 1010, 2279, 1010, 28721, 1007, 1063, 13075, 1060, 1027, 19202, 1012, 1060, 1025, 13075, 1061, 1027, 19202, 1012, 1061, 1025, 13075, 1059, 1027, 19202, 1012, 9381, 1025, 13075, 1044, 1027, 19202, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oManifest) { if (oManifest) { if (oManifest.getEntry("sap.ui5")) { if (oManifest.getEntry("sap.ui5").appVariantId) { return oManifest.getEntry("sap.ui5").appVariantId; } if (oManifest.getEntry("sap.ui5").componentName) { var sComponentName = oManifest.getEntry("sap.ui5").componentName; if (sComponentName.length > 0 && sComponentName.indexOf(".Component") < 0) { sComponentName += ".Component"; } return sComponentName; } } if (oManifest.getEntry("sap.app") && oManifest.getEntry("sap.app").id) { var sAppId = oManifest.getEntry("sap.app").id; if (sAppId === Utils.APP_ID_AT_DESIGN_TIME && oManifest.getComponentName) { sAppId = oManifest.getComponentName(); } if (sAppId.length > 0 && sAppId.indexOf(".Component") < 0) { sAppId += ".Component"; } return sAppId; } } this.log.warning("No Manifest received."); return ""; }
javascript
function (oManifest) { if (oManifest) { if (oManifest.getEntry("sap.ui5")) { if (oManifest.getEntry("sap.ui5").appVariantId) { return oManifest.getEntry("sap.ui5").appVariantId; } if (oManifest.getEntry("sap.ui5").componentName) { var sComponentName = oManifest.getEntry("sap.ui5").componentName; if (sComponentName.length > 0 && sComponentName.indexOf(".Component") < 0) { sComponentName += ".Component"; } return sComponentName; } } if (oManifest.getEntry("sap.app") && oManifest.getEntry("sap.app").id) { var sAppId = oManifest.getEntry("sap.app").id; if (sAppId === Utils.APP_ID_AT_DESIGN_TIME && oManifest.getComponentName) { sAppId = oManifest.getComponentName(); } if (sAppId.length > 0 && sAppId.indexOf(".Component") < 0) { sAppId += ".Component"; } return sAppId; } } this.log.warning("No Manifest received."); return ""; }
[ "function", "(", "oManifest", ")", "{", "if", "(", "oManifest", ")", "{", "if", "(", "oManifest", ".", "getEntry", "(", "\"sap.ui5\"", ")", ")", "{", "if", "(", "oManifest", ".", "getEntry", "(", "\"sap.ui5\"", ")", ".", "appVariantId", ")", "{", "retu...
Returns the reference of a component, according to the following logic: First appVariantId, if not, componentName + ".Component", if not appId + ".Component" (unless they already have ".Component" at the end). @param {object} oManifest - Manifest of the component @returns {string} flex reference @public
[ "Returns", "the", "reference", "of", "a", "component", "according", "to", "the", "following", "logic", ":", "First", "appVariantId", "if", "not", "componentName", "+", ".", "Component", "if", "not", "appId", "+", ".", "Component", "(", "unless", "they", "alr...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1116-L1143
train
Returns the component name of the component
[ 30522, 3853, 1006, 16640, 29323, 3367, 1007, 1063, 2065, 1006, 16640, 30524, 1000, 1007, 1007, 1063, 2065, 1006, 16640, 29323, 3367, 1012, 2131, 4765, 2854, 1006, 1000, 20066, 1012, 21318, 2629, 1000, 1007, 1012, 10439, 10755, 2937, 3775, 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...
spencermountain/compromise
src/world/index.js
function() { this.words = {}; this.tags = tags; this.regex = []; this.patterns = {}; this.conjugations = {}; this.plurals = {}; //denormalized data for faster-lookups this.cache = { firstWords: {}, toInfinitive: {}, toSingular: {} }; }
javascript
function() { this.words = {}; this.tags = tags; this.regex = []; this.patterns = {}; this.conjugations = {}; this.plurals = {}; //denormalized data for faster-lookups this.cache = { firstWords: {}, toInfinitive: {}, toSingular: {} }; }
[ "function", "(", ")", "{", "this", ".", "words", "=", "{", "}", ";", "this", ".", "tags", "=", "tags", ";", "this", ".", "regex", "=", "[", "]", ";", "this", ".", "patterns", "=", "{", "}", ";", "this", ".", "conjugations", "=", "{", "}", ";"...
class World
[ "class", "World" ]
526b1cab28a45ccbb430fbf2824db420acd587cf
https://github.com/spencermountain/compromise/blob/526b1cab28a45ccbb430fbf2824db420acd587cf/src/world/index.js#L26-L39
train
A cache of the words and tags
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 2616, 1027, 1063, 1065, 1025, 2023, 1012, 22073, 1027, 22073, 1025, 2023, 1012, 19723, 10288, 1027, 1031, 1033, 1025, 2023, 1012, 7060, 1027, 1063, 1065, 1025, 2023, 1012, 9530, 9103, 12540, 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...