repo
stringclasses
195 values
path
stringlengths
4
99
func_name
stringlengths
0
41
original_string
stringlengths
72
56.1k
language
stringclasses
1 value
code
stringlengths
72
56.1k
code_tokens
listlengths
25
8.12k
docstring
stringlengths
2
12.5k
docstring_tokens
listlengths
1
449
sha
stringclasses
197 values
url
stringlengths
88
186
partition
stringclasses
1 value
summary
stringlengths
8
338
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
vuejs/vuex
dist/vuex.esm.js
applyMixin
function applyMixin (Vue) { var version = Number(Vue.version.split('.')[0]); if (version >= 2) { Vue.mixin({ beforeCreate: vuexInit }); } else { // override init and inject vuex init procedure // for 1.x backwards compatibility. var _init = Vue.prototype._init; Vue.prototype._init = function (options) { if ( options === void 0 ) options = {}; options.init = options.init ? [vuexInit].concat(options.init) : vuexInit; _init.call(this, options); }; } /** * Vuex init hook, injected into each instances init hooks list. */ function vuexInit () { var options = this.$options; // store injection if (options.store) { this.$store = typeof options.store === 'function' ? options.store() : options.store; } else if (options.parent && options.parent.$store) { this.$store = options.parent.$store; } } }
javascript
function applyMixin (Vue) { var version = Number(Vue.version.split('.')[0]); if (version >= 2) { Vue.mixin({ beforeCreate: vuexInit }); } else { // override init and inject vuex init procedure // for 1.x backwards compatibility. var _init = Vue.prototype._init; Vue.prototype._init = function (options) { if ( options === void 0 ) options = {}; options.init = options.init ? [vuexInit].concat(options.init) : vuexInit; _init.call(this, options); }; } /** * Vuex init hook, injected into each instances init hooks list. */ function vuexInit () { var options = this.$options; // store injection if (options.store) { this.$store = typeof options.store === 'function' ? options.store() : options.store; } else if (options.parent && options.parent.$store) { this.$store = options.parent.$store; } } }
[ "function", "applyMixin", "(", "Vue", ")", "{", "var", "version", "=", "Number", "(", "Vue", ".", "version", ".", "split", "(", "'.'", ")", "[", "0", "]", ")", ";", "if", "(", "version", ">=", "2", ")", "{", "Vue", ".", "mixin", "(", "{", "befo...
vuex v3.1.0 (c) 2019 Evan You @license MIT
[ "vuex", "v3", ".", "1", ".", "0", "(", "c", ")", "2019", "Evan", "You" ]
d7c7f9844831f98c5c9aaca213746c4ccc5d6929
https://github.com/vuejs/vuex/blob/d7c7f9844831f98c5c9aaca213746c4ccc5d6929/dist/vuex.esm.js#L6-L40
train
Vue mixin for vuex
[ 30522, 3853, 6611, 4328, 20303, 1006, 24728, 2063, 1007, 1063, 13075, 2544, 1027, 2193, 1006, 24728, 2063, 1012, 2544, 1012, 3975, 1006, 1005, 1012, 1005, 1007, 1031, 1014, 1033, 1007, 1025, 2065, 1006, 2544, 1028, 1027, 1016, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/capitalized-comments.js
isCommentValid
function isCommentValid(comment, options) { // 1. Check for default ignore pattern. if (DEFAULT_IGNORE_PATTERN.test(comment.value)) { return true; } // 2. Check for custom ignore pattern. const commentWithoutAsterisks = comment.value .replace(/\*/gu, ""); if (options.ignorePatternRegExp && options.ignorePatternRegExp.test(commentWithoutAsterisks)) { return true; } // 3. Check for inline comments. if (options.ignoreInlineComments && isInlineComment(comment)) { return true; } // 4. Is this a consecutive comment (and are we tolerating those)? if (options.ignoreConsecutiveComments && isConsecutiveComment(comment)) { return true; } // 5. Does the comment start with a possible URL? if (MAYBE_URL.test(commentWithoutAsterisks)) { return true; } // 6. Is the initial word character a letter? const commentWordCharsOnly = commentWithoutAsterisks .replace(WHITESPACE, ""); if (commentWordCharsOnly.length === 0) { return true; } const firstWordChar = commentWordCharsOnly[0]; if (!LETTER_PATTERN.test(firstWordChar)) { return true; } // 7. Check the case of the initial word character. const isUppercase = firstWordChar !== firstWordChar.toLocaleLowerCase(), isLowercase = firstWordChar !== firstWordChar.toLocaleUpperCase(); if (capitalize === "always" && isLowercase) { return false; } if (capitalize === "never" && isUppercase) { return false; } return true; }
javascript
function isCommentValid(comment, options) { // 1. Check for default ignore pattern. if (DEFAULT_IGNORE_PATTERN.test(comment.value)) { return true; } // 2. Check for custom ignore pattern. const commentWithoutAsterisks = comment.value .replace(/\*/gu, ""); if (options.ignorePatternRegExp && options.ignorePatternRegExp.test(commentWithoutAsterisks)) { return true; } // 3. Check for inline comments. if (options.ignoreInlineComments && isInlineComment(comment)) { return true; } // 4. Is this a consecutive comment (and are we tolerating those)? if (options.ignoreConsecutiveComments && isConsecutiveComment(comment)) { return true; } // 5. Does the comment start with a possible URL? if (MAYBE_URL.test(commentWithoutAsterisks)) { return true; } // 6. Is the initial word character a letter? const commentWordCharsOnly = commentWithoutAsterisks .replace(WHITESPACE, ""); if (commentWordCharsOnly.length === 0) { return true; } const firstWordChar = commentWordCharsOnly[0]; if (!LETTER_PATTERN.test(firstWordChar)) { return true; } // 7. Check the case of the initial word character. const isUppercase = firstWordChar !== firstWordChar.toLocaleLowerCase(), isLowercase = firstWordChar !== firstWordChar.toLocaleUpperCase(); if (capitalize === "always" && isLowercase) { return false; } if (capitalize === "never" && isUppercase) { return false; } return true; }
[ "function", "isCommentValid", "(", "comment", ",", "options", ")", "{", "// 1. Check for default ignore pattern.", "if", "(", "DEFAULT_IGNORE_PATTERN", ".", "test", "(", "comment", ".", "value", ")", ")", "{", "return", "true", ";", "}", "// 2. Check for custom igno...
Check a comment to determine if it is valid for this rule. @param {ASTNode} comment The comment node to process. @param {Object} options The options for checking this comment. @returns {boolean} True if the comment is valid, false otherwise.
[ "Check", "a", "comment", "to", "determine", "if", "it", "is", "valid", "for", "this", "rule", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/capitalized-comments.js#L204-L260
train
Check if a comment is valid
[ 30522, 3853, 2003, 9006, 3672, 10175, 3593, 1006, 7615, 1010, 7047, 1007, 1063, 1013, 1013, 1015, 1012, 4638, 2005, 12398, 8568, 5418, 1012, 2065, 1006, 12398, 1035, 8568, 1035, 5418, 1012, 3231, 1006, 7615, 1012, 3643, 1007, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/chart/custom.js
mergeChildren
function mergeChildren(el, dataIndex, elOption, animatableModel, data) { var newChildren = elOption.children; var newLen = newChildren ? newChildren.length : 0; var mergeChildren = elOption.$mergeChildren; // `diffChildrenByName` has been deprecated. var byName = mergeChildren === 'byName' || elOption.diffChildrenByName; var notMerge = mergeChildren === false; // For better performance on roam update, only enter if necessary. if (!newLen && !byName && !notMerge) { return; } if (byName) { diffGroupChildren({ oldChildren: el.children() || [], newChildren: newChildren || [], dataIndex: dataIndex, animatableModel: animatableModel, group: el, data: data }); return; } notMerge && el.removeAll(); // Mapping children of a group simply by index, which // might be better performance. var index = 0; for (; index < newLen; index++) { newChildren[index] && doCreateOrUpdate( el.childAt(index), dataIndex, newChildren[index], animatableModel, el, data ); } if (__DEV__) { zrUtil.assert( !notMerge || el.childCount() === index, 'MUST NOT contain empty item in children array when `group.$mergeChildren` is `false`.' ); } }
javascript
function mergeChildren(el, dataIndex, elOption, animatableModel, data) { var newChildren = elOption.children; var newLen = newChildren ? newChildren.length : 0; var mergeChildren = elOption.$mergeChildren; // `diffChildrenByName` has been deprecated. var byName = mergeChildren === 'byName' || elOption.diffChildrenByName; var notMerge = mergeChildren === false; // For better performance on roam update, only enter if necessary. if (!newLen && !byName && !notMerge) { return; } if (byName) { diffGroupChildren({ oldChildren: el.children() || [], newChildren: newChildren || [], dataIndex: dataIndex, animatableModel: animatableModel, group: el, data: data }); return; } notMerge && el.removeAll(); // Mapping children of a group simply by index, which // might be better performance. var index = 0; for (; index < newLen; index++) { newChildren[index] && doCreateOrUpdate( el.childAt(index), dataIndex, newChildren[index], animatableModel, el, data ); } if (__DEV__) { zrUtil.assert( !notMerge || el.childCount() === index, 'MUST NOT contain empty item in children array when `group.$mergeChildren` is `false`.' ); } }
[ "function", "mergeChildren", "(", "el", ",", "dataIndex", ",", "elOption", ",", "animatableModel", ",", "data", ")", "{", "var", "newChildren", "=", "elOption", ".", "children", ";", "var", "newLen", "=", "newChildren", "?", "newChildren", ".", "length", ":"...
Usage: (1) By default, `elOption.$mergeChildren` is `'byIndex'`, which indicates that the existing children will not be removed, and enables the feature that update some of the props of some of the children simply by construct the returned children of `renderItem` like: `var children = group.children = []; children[3] = {opacity: 0.5};` (2) If `elOption.$mergeChildren` is `'byName'`, add/update/remove children by child.name. But that might be lower performance. (3) If `elOption.$mergeChildren` is `false`, the existing children will be replaced totally. (4) If `!elOption.children`, following the "merge" principle, nothing will happen. For implementation simpleness, do not provide a direct way to remove sinlge child (otherwise the total indicies of the children array have to be modified). User can remove a single child by set its `ignore` as `true` or replace it by another element, where its `$merge` can be set as `true` if necessary.
[ "Usage", ":", "(", "1", ")", "By", "default", "elOption", ".", "$mergeChildren", "is", "byIndex", "which", "indicates", "that", "the", "existing", "children", "will", "not", "be", "removed", "and", "enables", "the", "feature", "that", "update", "some", "of",...
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/custom.js#L640-L686
train
Merge children of an element into another element.
[ 30522, 3853, 13590, 19339, 7389, 1006, 3449, 1010, 2951, 22254, 10288, 1010, 3449, 7361, 3508, 1010, 2019, 9581, 10880, 5302, 9247, 1010, 2951, 1007, 1063, 13075, 2047, 19339, 7389, 1027, 3449, 7361, 3508, 1012, 2336, 1025, 13075, 2047, 777...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/node/FindInFilesDomain.js
getAllResults
function getAllResults() { var send_object = { "results": {}, "numMatches": 0, "foundMaximum": foundMaximum, "exceedsMaximum": exceedsMaximum }; if (!savedSearchObject) { return send_object; } savedSearchObject.startFileIndex = 0; savedSearchObject.getAllResults = true; return doSearch(savedSearchObject); }
javascript
function getAllResults() { var send_object = { "results": {}, "numMatches": 0, "foundMaximum": foundMaximum, "exceedsMaximum": exceedsMaximum }; if (!savedSearchObject) { return send_object; } savedSearchObject.startFileIndex = 0; savedSearchObject.getAllResults = true; return doSearch(savedSearchObject); }
[ "function", "getAllResults", "(", ")", "{", "var", "send_object", "=", "{", "\"results\"", ":", "{", "}", ",", "\"numMatches\"", ":", "0", ",", "\"foundMaximum\"", ":", "foundMaximum", ",", "\"exceedsMaximum\"", ":", "exceedsMaximum", "}", ";", "if", "(", "!...
Gets all the results for the saved search query if present or empty search results @return {Object} The results object
[ "Gets", "all", "the", "results", "for", "the", "saved", "search", "query", "if", "present", "or", "empty", "search", "results" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/node/FindInFilesDomain.js#L544-L557
train
Get all the results
[ 30522, 3853, 2131, 8095, 6072, 11314, 2015, 1006, 1007, 1063, 13075, 4604, 1035, 4874, 1027, 1063, 1000, 3463, 1000, 1024, 1063, 1065, 1010, 1000, 16371, 14760, 10649, 2229, 1000, 1024, 1014, 1010, 1000, 2179, 17848, 28591, 1000, 1024, 2179...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/firebaseui-web
javascript/widgets/handler/emailnotreceived.js
function() { firebaseui.auth.widget.handler.common.sendEmailLinkForSignIn( app, component, email, onCancelClick, function(error) { // The email provided could be an invalid one or some other error // could occur. var errorMessage = firebaseui.auth.widget.handler.common.getErrorMessage(error); component.showInfoBar(errorMessage); }, opt_pendingCredential); }
javascript
function() { firebaseui.auth.widget.handler.common.sendEmailLinkForSignIn( app, component, email, onCancelClick, function(error) { // The email provided could be an invalid one or some other error // could occur. var errorMessage = firebaseui.auth.widget.handler.common.getErrorMessage(error); component.showInfoBar(errorMessage); }, opt_pendingCredential); }
[ "function", "(", ")", "{", "firebaseui", ".", "auth", ".", "widget", ".", "handler", ".", "common", ".", "sendEmailLinkForSignIn", "(", "app", ",", "component", ",", "email", ",", "onCancelClick", ",", "function", "(", "error", ")", "{", "// The email provid...
On resend link click.
[ "On", "resend", "link", "click", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/javascript/widgets/handler/emailnotreceived.js#L44-L58
train
Send an email link for sign in.
[ 30522, 3853, 1006, 1007, 1063, 2543, 15058, 10179, 1012, 8740, 2705, 1012, 15536, 24291, 1012, 28213, 1012, 2691, 1012, 4604, 14545, 8591, 19839, 29278, 5332, 29076, 2078, 1006, 10439, 1010, 6922, 1010, 10373, 1010, 2006, 9336, 29109, 20464, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
heyui/heyui
src/plugins/popper/index.js
update
function update() { // if popper is destroyed, don't perform any further update if (this.state.isDestroyed) { return; } var data = { instance: this, styles: {}, arrowStyles: {}, attributes: {}, flipped: false, offsets: {} }; // compute reference element offsets data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); // compute auto placement, store placement inside the data object, // modifiers will be able to edit `placement` if needed // and refer to originalPlacement to know the original value data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); // store the computed placement inside `originalPlacement` data.originalPlacement = data.placement; data.positionFixed = this.options.positionFixed; // compute the popper offsets data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; // run the modifiers data = runModifiers(this.modifiers, data); // the first `update` will call `onCreate` callback // the other ones will call `onUpdate` callback if (!this.state.isCreated) { this.state.isCreated = true; this.options.onCreate(data); } else { this.options.onUpdate(data); } }
javascript
function update() { // if popper is destroyed, don't perform any further update if (this.state.isDestroyed) { return; } var data = { instance: this, styles: {}, arrowStyles: {}, attributes: {}, flipped: false, offsets: {} }; // compute reference element offsets data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); // compute auto placement, store placement inside the data object, // modifiers will be able to edit `placement` if needed // and refer to originalPlacement to know the original value data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); // store the computed placement inside `originalPlacement` data.originalPlacement = data.placement; data.positionFixed = this.options.positionFixed; // compute the popper offsets data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; // run the modifiers data = runModifiers(this.modifiers, data); // the first `update` will call `onCreate` callback // the other ones will call `onUpdate` callback if (!this.state.isCreated) { this.state.isCreated = true; this.options.onCreate(data); } else { this.options.onUpdate(data); } }
[ "function", "update", "(", ")", "{", "// if popper is destroyed, don't perform any further update", "if", "(", "this", ".", "state", ".", "isDestroyed", ")", "{", "return", ";", "}", "var", "data", "=", "{", "instance", ":", "this", ",", "styles", ":", "{", ...
Updates the position of the popper, computing the new offsets and applying the new style.<br /> Prefer `scheduleUpdate` over `update` because of performance reasons. @method @memberof Popper
[ "Updates", "the", "position", "of", "the", "popper", "computing", "the", "new", "offsets", "and", "applying", "the", "new", "style", ".", "<br", "/", ">", "Prefer", "scheduleUpdate", "over", "update", "because", "of", "performance", "reasons", "." ]
d5405d27d994151b676eb91c12b389316d7f6679
https://github.com/heyui/heyui/blob/d5405d27d994151b676eb91c12b389316d7f6679/src/plugins/popper/index.js#L951-L994
train
update the layout
[ 30522, 3853, 10651, 1006, 1007, 1063, 1013, 1013, 2065, 3769, 4842, 2003, 3908, 1010, 2123, 1005, 1056, 4685, 2151, 2582, 10651, 2065, 1006, 2023, 1012, 2110, 1012, 2003, 6155, 13181, 20821, 1007, 1063, 2709, 1025, 1065, 13075, 2951, 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...
GitbookIO/gitbook
lib/utils/images.js
convertInlinePNG
function convertInlinePNG(source, dest) { if (!/^data\:image\/png/.test(source)) return Promise.reject(new Error('Source is not a PNG data-uri')); var base64data = source.split('data:image/png;base64,')[1]; var buf = new Buffer(base64data, 'base64'); return fs.writeFile(dest, buf) .then(function() { if (fs.existsSync(dest)) return; throw new Error('Error converting '+source+' into '+dest); }); }
javascript
function convertInlinePNG(source, dest) { if (!/^data\:image\/png/.test(source)) return Promise.reject(new Error('Source is not a PNG data-uri')); var base64data = source.split('data:image/png;base64,')[1]; var buf = new Buffer(base64data, 'base64'); return fs.writeFile(dest, buf) .then(function() { if (fs.existsSync(dest)) return; throw new Error('Error converting '+source+' into '+dest); }); }
[ "function", "convertInlinePNG", "(", "source", ",", "dest", ")", "{", "if", "(", "!", "/", "^data\\:image\\/png", "/", ".", "test", "(", "source", ")", ")", "return", "Promise", ".", "reject", "(", "new", "Error", "(", "'Source is not a PNG data-uri'", ")", ...
Converts a inline data: to png file
[ "Converts", "a", "inline", "data", ":", "to", "png", "file" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/images.js#L42-L54
train
Convert an inline PNG to a PNG file
[ 30522, 3853, 10463, 2378, 4179, 2361, 3070, 1006, 3120, 1010, 4078, 2102, 1007, 1063, 2065, 1006, 999, 1013, 1034, 2951, 1032, 1024, 3746, 1032, 1013, 1052, 3070, 1013, 1012, 3231, 1006, 3120, 1007, 1007, 2709, 4872, 1012, 15454, 1006, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/command/Menus.js
registerContextMenu
function registerContextMenu(id) { if (!id) { console.error("call to registerContextMenu() is missing required parameters"); return null; } // Guard against duplicate menu ids if (contextMenuMap[id]) { console.log("Context Menu added with same name and id of existing Context Menu: " + id); return null; } var cmenu = new ContextMenu(id); contextMenuMap[id] = cmenu; return cmenu; }
javascript
function registerContextMenu(id) { if (!id) { console.error("call to registerContextMenu() is missing required parameters"); return null; } // Guard against duplicate menu ids if (contextMenuMap[id]) { console.log("Context Menu added with same name and id of existing Context Menu: " + id); return null; } var cmenu = new ContextMenu(id); contextMenuMap[id] = cmenu; return cmenu; }
[ "function", "registerContextMenu", "(", "id", ")", "{", "if", "(", "!", "id", ")", "{", "console", ".", "error", "(", "\"call to registerContextMenu() is missing required parameters\"", ")", ";", "return", "null", ";", "}", "// Guard against duplicate menu ids", "if",...
Registers new context menu with Brackets. Extensions should generally use the predefined context menus built into Brackets. Use this API to add a new context menu to UI that is specific to an extension. After registering a new context menu clients should: - use addMenuItem() to add items to the context menu - call open() to show the context menu. For example: $("#my_ID").contextmenu(function (e) { if (e.which === 3) { my_cmenu.open(e); } }); To make menu items be contextual to things like selection, listen for the "beforeContextMenuOpen" to make changes to Command objects before the context menu is shown. MenuItems are views of Commands, which control a MenuItem's name, enabled state, and checked state. @param {string} id - unique identifier for context menu. Core context menus in Brackets use a simple title as an id. Extensions should use the following format: "author.myextension.mycontextmenu name" @return {?ContextMenu} the newly created context menu
[ "Registers", "new", "context", "menu", "with", "Brackets", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/Menus.js#L1371-L1386
train
Register Context Menu
[ 30522, 3853, 4236, 8663, 18209, 3549, 2226, 1006, 8909, 1007, 1063, 2065, 1006, 999, 8909, 1007, 1063, 10122, 1012, 7561, 1006, 1000, 2655, 2000, 4236, 8663, 18209, 30524, 3549, 12248, 2361, 1031, 8909, 1033, 1007, 1063, 10122, 1012, 8833, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
MithrilJS/mithril.js
mithril.js
setAttrs
function setAttrs(vnode3, attrs2, ns) { for (var key in attrs2) { setAttr(vnode3, key, null, attrs2[key], ns) } }
javascript
function setAttrs(vnode3, attrs2, ns) { for (var key in attrs2) { setAttr(vnode3, key, null, attrs2[key], ns) } }
[ "function", "setAttrs", "(", "vnode3", ",", "attrs2", ",", "ns", ")", "{", "for", "(", "var", "key", "in", "attrs2", ")", "{", "setAttr", "(", "vnode3", ",", "key", ",", "null", ",", "attrs2", "[", "key", "]", ",", "ns", ")", "}", "}" ]
attrs2
[ "attrs2" ]
6d36fe09d129928c6b460720e08d9ed321fcd62b
https://github.com/MithrilJS/mithril.js/blob/6d36fe09d129928c6b460720e08d9ed321fcd62b/mithril.js#L1101-L1105
train
set attrs on vnode3
[ 30522, 3853, 2275, 19321, 2869, 1006, 1058, 3630, 3207, 2509, 1010, 2012, 16344, 2015, 2475, 1010, 24978, 1007, 1063, 2005, 1006, 13075, 3145, 1999, 2012, 16344, 2015, 2475, 1007, 1063, 2275, 19321, 2099, 1006, 1058, 3630, 3207, 2509, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
normalizeSpaces
function normalizeSpaces(text) { // IE has already done this conversion, so doing it again will remove multiple nbsp if (browserVersion.isIE) { return text; } // Replace multiple spaces with a single space // TODO - this shouldn't occur inside PRE elements text = text.replace(/\ +/g, " "); // Replace &nbsp; with a space var nbspPattern = new RegExp(String.fromCharCode(160), "g"); if (browserVersion.isSafari) { return replaceAll(text, String.fromCharCode(160), " "); } else { return text.replace(nbspPattern, " "); } }
javascript
function normalizeSpaces(text) { // IE has already done this conversion, so doing it again will remove multiple nbsp if (browserVersion.isIE) { return text; } // Replace multiple spaces with a single space // TODO - this shouldn't occur inside PRE elements text = text.replace(/\ +/g, " "); // Replace &nbsp; with a space var nbspPattern = new RegExp(String.fromCharCode(160), "g"); if (browserVersion.isSafari) { return replaceAll(text, String.fromCharCode(160), " "); } else { return text.replace(nbspPattern, " "); } }
[ "function", "normalizeSpaces", "(", "text", ")", "{", "// IE has already done this conversion, so doing it again will remove multiple nbsp", "if", "(", "browserVersion", ".", "isIE", ")", "{", "return", "text", ";", "}", "// Replace multiple spaces with a single space", "// TOD...
Replace multiple sequential spaces with a single space, and then convert &nbsp; to space.
[ "Replace", "multiple", "sequential", "spaces", "with", "a", "single", "space", "and", "then", "convert", "&nbsp", ";", "to", "space", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L221-L240
train
Normalize spaces in text
[ 30522, 3853, 3671, 10057, 15327, 2015, 1006, 3793, 1007, 1063, 1013, 1013, 29464, 2038, 2525, 2589, 2023, 7584, 1010, 2061, 2725, 2009, 2153, 2097, 6366, 3674, 1050, 5910, 2361, 2065, 1006, 16602, 27774, 1012, 2003, 2666, 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...
eslint/eslint
lib/rules/no-dupe-class-members.js
getState
function getState(name, isStatic) { const stateMap = stack[stack.length - 1]; const key = `$${name}`; // to avoid "__proto__". if (!stateMap[key]) { stateMap[key] = { nonStatic: { init: false, get: false, set: false }, static: { init: false, get: false, set: false } }; } return stateMap[key][isStatic ? "static" : "nonStatic"]; }
javascript
function getState(name, isStatic) { const stateMap = stack[stack.length - 1]; const key = `$${name}`; // to avoid "__proto__". if (!stateMap[key]) { stateMap[key] = { nonStatic: { init: false, get: false, set: false }, static: { init: false, get: false, set: false } }; } return stateMap[key][isStatic ? "static" : "nonStatic"]; }
[ "function", "getState", "(", "name", ",", "isStatic", ")", "{", "const", "stateMap", "=", "stack", "[", "stack", ".", "length", "-", "1", "]", ";", "const", "key", "=", "`", "${", "name", "}", "`", ";", "// to avoid \"__proto__\".", "if", "(", "!", "...
Gets state of a given member name. @param {string} name - A name of a member. @param {boolean} isStatic - A flag which specifies that is a static member. @returns {Object} A state of a given member name. - retv.init {boolean} A flag which shows the name is declared as normal member. - retv.get {boolean} A flag which shows the name is declared as getter. - retv.set {boolean} A flag which shows the name is declared as setter.
[ "Gets", "state", "of", "a", "given", "member", "name", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-dupe-class-members.js#L42-L54
train
get state of a specific state
[ 30522, 3853, 4152, 12259, 1006, 2171, 1010, 26354, 29336, 2594, 1007, 1063, 9530, 3367, 2110, 2863, 2361, 1027, 9991, 1031, 9991, 1012, 3091, 1011, 1015, 1033, 1025, 9530, 3367, 3145, 1027, 1036, 1002, 1002, 1063, 2171, 1065, 1036, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/LiveEditorOutput.js
addOnErrorHook
function addOnErrorHook () { window.addEventListener("error", function(error) { error.preventDefault(); var oErrorOutput = document.createElement("span"); oErrorOutput.innerText = error.message; // use save API oErrorOutput.style.cssText = "position:absolute; top:1rem; left:1rem"; if (!document.body) { document.write("<span></span>"); // add content via document.write to ensure document.body is created; } document.body.appendChild(oErrorOutput); }); }
javascript
function addOnErrorHook () { window.addEventListener("error", function(error) { error.preventDefault(); var oErrorOutput = document.createElement("span"); oErrorOutput.innerText = error.message; // use save API oErrorOutput.style.cssText = "position:absolute; top:1rem; left:1rem"; if (!document.body) { document.write("<span></span>"); // add content via document.write to ensure document.body is created; } document.body.appendChild(oErrorOutput); }); }
[ "function", "addOnErrorHook", "(", ")", "{", "window", ".", "addEventListener", "(", "\"error\"", ",", "function", "(", "error", ")", "{", "error", ".", "preventDefault", "(", ")", ";", "var", "oErrorOutput", "=", "document", ".", "createElement", "(", "\"sp...
Listen for errors and display them in the DOM, so that the user does not need to open the console
[ "Listen", "for", "errors", "and", "display", "them", "in", "the", "DOM", "so", "that", "the", "user", "does", "not", "need", "to", "open", "the", "console" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/LiveEditorOutput.js#L51-L63
train
Add an error handler to the error output element
[ 30522, 3853, 5587, 5643, 18933, 25032, 14659, 1006, 1007, 1063, 3332, 1012, 5587, 18697, 3372, 9863, 24454, 1006, 30524, 13075, 1051, 2121, 29165, 5833, 18780, 1027, 6254, 1012, 3443, 12260, 3672, 1006, 1000, 8487, 1000, 1007, 1025, 1051, 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...
openlayers/openlayers
tasks/generate-info.js
parseOutput
function parseOutput(output) { if (!output) { throw new Error('Expected JSON output'); } let info; try { info = JSON.parse(String(output)); } catch (err) { throw new Error('Failed to parse output as JSON: ' + output); } if (!Array.isArray(info.symbols)) { throw new Error('Expected symbols array: ' + output); } if (!Array.isArray(info.defines)) { throw new Error('Expected defines array: ' + output); } return info; }
javascript
function parseOutput(output) { if (!output) { throw new Error('Expected JSON output'); } let info; try { info = JSON.parse(String(output)); } catch (err) { throw new Error('Failed to parse output as JSON: ' + output); } if (!Array.isArray(info.symbols)) { throw new Error('Expected symbols array: ' + output); } if (!Array.isArray(info.defines)) { throw new Error('Expected defines array: ' + output); } return info; }
[ "function", "parseOutput", "(", "output", ")", "{", "if", "(", "!", "output", ")", "{", "throw", "new", "Error", "(", "'Expected JSON output'", ")", ";", "}", "let", "info", ";", "try", "{", "info", "=", "JSON", ".", "parse", "(", "String", "(", "out...
Parse the JSDoc output. @param {string} output JSDoc output @return {Object} Symbol and define info.
[ "Parse", "the", "JSDoc", "output", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/tasks/generate-info.js#L84-L103
train
Parse the output as JSON
[ 30522, 3853, 11968, 3366, 5833, 18780, 1006, 6434, 1007, 1063, 2065, 1006, 999, 6434, 1007, 1063, 5466, 2047, 7561, 1006, 1005, 30524, 3046, 1063, 18558, 1027, 1046, 3385, 1012, 11968, 3366, 1006, 5164, 1006, 6434, 1007, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v2/ODataListBinding.js
normalizeFilterValues
function normalizeFilterValues(sType, oFilter) { switch (sType) { case "Edm.Decimal": case "Edm.Int64": if (typeof oFilter.oValue1 == "number") { oFilter.oValue1 = oFilter.oValue1.toString(); } if (typeof oFilter.oValue2 == "number") { oFilter.oValue2 = oFilter.oValue2.toString(); } break; case "Edm.Byte": case "Edm.Int16": case "Edm.Int32": case "Edm.SByte": if (typeof oFilter.oValue1 == "string") { oFilter.oValue1 = parseInt(oFilter.oValue1); } if (typeof oFilter.oValue2 == "string") { oFilter.oValue2 = parseInt(oFilter.oValue2); } break; case "Edm.Float": case "Edm.Single": case "Edm.Double": if (typeof oFilter.oValue1 == "string") { oFilter.oValue1 = parseFloat(oFilter.oValue1); } if (typeof oFilter.oValue2 == "string") { oFilter.oValue2 = parseFloat(oFilter.oValue2); } break; default: // Nothing to do } }
javascript
function normalizeFilterValues(sType, oFilter) { switch (sType) { case "Edm.Decimal": case "Edm.Int64": if (typeof oFilter.oValue1 == "number") { oFilter.oValue1 = oFilter.oValue1.toString(); } if (typeof oFilter.oValue2 == "number") { oFilter.oValue2 = oFilter.oValue2.toString(); } break; case "Edm.Byte": case "Edm.Int16": case "Edm.Int32": case "Edm.SByte": if (typeof oFilter.oValue1 == "string") { oFilter.oValue1 = parseInt(oFilter.oValue1); } if (typeof oFilter.oValue2 == "string") { oFilter.oValue2 = parseInt(oFilter.oValue2); } break; case "Edm.Float": case "Edm.Single": case "Edm.Double": if (typeof oFilter.oValue1 == "string") { oFilter.oValue1 = parseFloat(oFilter.oValue1); } if (typeof oFilter.oValue2 == "string") { oFilter.oValue2 = parseFloat(oFilter.oValue2); } break; default: // Nothing to do } }
[ "function", "normalizeFilterValues", "(", "sType", ",", "oFilter", ")", "{", "switch", "(", "sType", ")", "{", "case", "\"Edm.Decimal\"", ":", "case", "\"Edm.Int64\"", ":", "if", "(", "typeof", "oFilter", ".", "oValue1", "==", "\"number\"", ")", "{", "oFilte...
Does normalize the filter values according to the given Edm type. This is necessary for comparators to work as expected, even if the wrong JavaScript type is passed to the filter (string vs number) @private
[ "Does", "normalize", "the", "filter", "values", "according", "to", "the", "given", "Edm", "type", ".", "This", "is", "necessary", "for", "comparators", "to", "work", "as", "expected", "even", "if", "the", "wrong", "JavaScript", "type", "is", "passed", "to", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v2/ODataListBinding.js#L1289-L1324
train
Normalizes the values of the filter according to the given type.
[ 30522, 3853, 3671, 4697, 8873, 21928, 10175, 15808, 1006, 2358, 18863, 1010, 1997, 4014, 3334, 1007, 1063, 6942, 1006, 2358, 18863, 1007, 1063, 2553, 1000, 3968, 2213, 1012, 26066, 1000, 1024, 2553, 1000, 3968, 2213, 1012, 20014, 21084, 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...
adobe/brackets
src/utils/NativeApp.js
openLiveBrowser
function openLiveBrowser(url, enableRemoteDebugging) { var result = new $.Deferred(); brackets.app.openLiveBrowser(url, !!enableRemoteDebugging, function onRun(err, pid) { if (!err) { // Undefined ids never get removed from list, so don't push them on if (pid !== undefined) { liveBrowserOpenedPIDs.push(pid); } result.resolve(pid); } else { result.reject(_browserErrToFileError(err)); } }); return result.promise(); }
javascript
function openLiveBrowser(url, enableRemoteDebugging) { var result = new $.Deferred(); brackets.app.openLiveBrowser(url, !!enableRemoteDebugging, function onRun(err, pid) { if (!err) { // Undefined ids never get removed from list, so don't push them on if (pid !== undefined) { liveBrowserOpenedPIDs.push(pid); } result.resolve(pid); } else { result.reject(_browserErrToFileError(err)); } }); return result.promise(); }
[ "function", "openLiveBrowser", "(", "url", ",", "enableRemoteDebugging", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ";", "brackets", ".", "app", ".", "openLiveBrowser", "(", "url", ",", "!", "!", "enableRemoteDebugging", ",", "f...
openLiveBrowser Open the given URL in the user's system browser, optionally enabling debugging. @param {string} url The URL to open. @param {boolean=} enableRemoteDebugging Whether to turn on remote debugging. Default false. @return {$.Promise}
[ "openLiveBrowser", "Open", "the", "given", "URL", "in", "the", "user", "s", "system", "browser", "optionally", "enabling", "debugging", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/NativeApp.js#L51-L67
train
Open Live Browser
[ 30522, 3853, 2330, 3669, 3726, 12618, 9333, 2121, 1006, 24471, 2140, 1010, 9585, 28578, 27428, 15878, 15916, 4726, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 19719, 1012, 10439, 1012, 2330, 3669, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/core/core.tooltip.js
function(elements, eventPosition) { var x = eventPosition.x; var y = eventPosition.y; var minDistance = Number.POSITIVE_INFINITY; var i, len, nearestElement; for (i = 0, len = elements.length; i < len; ++i) { var el = elements[i]; if (el && el.hasValue()) { var center = el.getCenterPoint(); var d = helpers.distanceBetweenPoints(eventPosition, center); if (d < minDistance) { minDistance = d; nearestElement = el; } } } if (nearestElement) { var tp = nearestElement.tooltipPosition(); x = tp.x; y = tp.y; } return { x: x, y: y }; }
javascript
function(elements, eventPosition) { var x = eventPosition.x; var y = eventPosition.y; var minDistance = Number.POSITIVE_INFINITY; var i, len, nearestElement; for (i = 0, len = elements.length; i < len; ++i) { var el = elements[i]; if (el && el.hasValue()) { var center = el.getCenterPoint(); var d = helpers.distanceBetweenPoints(eventPosition, center); if (d < minDistance) { minDistance = d; nearestElement = el; } } } if (nearestElement) { var tp = nearestElement.tooltipPosition(); x = tp.x; y = tp.y; } return { x: x, y: y }; }
[ "function", "(", "elements", ",", "eventPosition", ")", "{", "var", "x", "=", "eventPosition", ".", "x", ";", "var", "y", "=", "eventPosition", ".", "y", ";", "var", "minDistance", "=", "Number", ".", "POSITIVE_INFINITY", ";", "var", "i", ",", "len", "...
Gets the tooltip position nearest of the item nearest to the event position @function Chart.Tooltip.positioners.nearest @param elements {Chart.Element[]} the tooltip elements @param eventPosition {object} the position of the event in canvas coordinates @returns {object} the tooltip position
[ "Gets", "the", "tooltip", "position", "nearest", "of", "the", "item", "nearest", "to", "the", "event", "position" ]
f093c36574d290330ed623e60fbd070421c730d5
https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.tooltip.js#L145-L174
train
Returns the tooltip position of the nearest element to the given event position
[ 30522, 3853, 1006, 3787, 1010, 2724, 26994, 1007, 1063, 13075, 1060, 1027, 2724, 26994, 1012, 1060, 1025, 13075, 1061, 1027, 2724, 26994, 1012, 1061, 1025, 13075, 2568, 23137, 3401, 1027, 2193, 1012, 3893, 1035, 15579, 1025, 13075, 1045, 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...
caolan/async
lib/eachLimit.js
eachLimit
function eachLimit(coll, limit, iteratee, callback) { return eachOfLimit(limit)(coll, withoutIndex(wrapAsync(iteratee)), callback); }
javascript
function eachLimit(coll, limit, iteratee, callback) { return eachOfLimit(limit)(coll, withoutIndex(wrapAsync(iteratee)), callback); }
[ "function", "eachLimit", "(", "coll", ",", "limit", ",", "iteratee", ",", "callback", ")", "{", "return", "eachOfLimit", "(", "limit", ")", "(", "coll", ",", "withoutIndex", "(", "wrapAsync", "(", "iteratee", ")", ")", ",", "callback", ")", ";", "}" ]
The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. @name eachLimit @static @memberOf module:Collections @method @see [async.each]{@link module:Collections.each} @alias forEachLimit @category Collection @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. @param {number} limit - The maximum number of async operations at a time. @param {AsyncFunction} iteratee - An async function to apply to each item in `coll`. The array index is not passed to the iteratee. If you need the index, use `eachOfLimit`. Invoked with (item, callback). @param {Function} [callback] - A callback which is called when all `iteratee` functions have finished, or an error occurs. Invoked with (err). @returns {Promise} a promise, if a callback is omitted
[ "The", "same", "as", "[", "each", "]", "{", "@link", "module", ":", "Collections", ".", "each", "}", "but", "runs", "a", "maximum", "of", "limit", "async", "operations", "at", "a", "time", "." ]
4330d536c106592139fa82062494c9dba0da1fdb
https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/eachLimit.js#L27-L29
train
Iterates over a collection and returns an array of items.
[ 30522, 3853, 2169, 17960, 4183, 1006, 8902, 2140, 1010, 5787, 1010, 2009, 22139, 2063, 1010, 2655, 5963, 1007, 1063, 2709, 2169, 11253, 17960, 4183, 1006, 5787, 1007, 1006, 8902, 2140, 1010, 2302, 22254, 10288, 1006, 10236, 3022, 6038, 2278...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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( block ) { var idx = $.inArray( block, this.pool ); this.pool.splice( idx, 1 ); block.file.remaning--; this.remaning--; }
javascript
function( block ) { var idx = $.inArray( block, this.pool ); this.pool.splice( idx, 1 ); block.file.remaning--; this.remaning--; }
[ "function", "(", "block", ")", "{", "var", "idx", "=", "$", ".", "inArray", "(", "block", ",", "this", ".", "pool", ")", ";", "this", ".", "pool", ".", "splice", "(", "idx", ",", "1", ")", ";", "block", ".", "file", ".", "remaning", "--", ";", ...
让出位置了,可以让其他分片开始上传
[ "让出位置了,可以让其他分片开始上传" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L3443-L3449
train
Removes a block from the cache
[ 30522, 3853, 1006, 3796, 1007, 1063, 13075, 8909, 2595, 1027, 1002, 1012, 27118, 11335, 2100, 1006, 3796, 1010, 2023, 1012, 4770, 1007, 1025, 2023, 1012, 4770, 1012, 11867, 13231, 1006, 8909, 2595, 1010, 1015, 1007, 1025, 3796, 1012, 5371, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/service.js
makeUnauthenticatedRequest
function makeUnauthenticatedRequest(operation, params, callback) { if (typeof params === 'function') { callback = params; params = {}; } var request = this.makeRequest(operation, params).toUnauthenticated(); return callback ? request.send(callback) : request; }
javascript
function makeUnauthenticatedRequest(operation, params, callback) { if (typeof params === 'function') { callback = params; params = {}; } var request = this.makeRequest(operation, params).toUnauthenticated(); return callback ? request.send(callback) : request; }
[ "function", "makeUnauthenticatedRequest", "(", "operation", ",", "params", ",", "callback", ")", "{", "if", "(", "typeof", "params", "===", "'function'", ")", "{", "callback", "=", "params", ";", "params", "=", "{", "}", ";", "}", "var", "request", "=", ...
Calls an operation on a service with the given input parameters, without any authentication data. This method is useful for "public" API operations. @param operation [String] the name of the operation to call on the service. @param params [map] a map of input options for the operation @callback callback function(err, data) If a callback is supplied, it is called when a response is returned from the service. @param err [Error] the error object returned from the request. Set to `null` if the request is successful. @param data [Object] the de-serialized data returned from the request. Set to `null` if a request error occurs.
[ "Calls", "an", "operation", "on", "a", "service", "with", "the", "given", "input", "parameters", "without", "any", "authentication", "data", ".", "This", "method", "is", "useful", "for", "public", "API", "operations", "." ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/service.js#L223-L231
train
Make an unauthenticated request
[ 30522, 3853, 2191, 9521, 14317, 4765, 17872, 2890, 15500, 1006, 3169, 1010, 11498, 5244, 1010, 2655, 5963, 1007, 1063, 2065, 1006, 2828, 11253, 11498, 5244, 1027, 1027, 1027, 1005, 3853, 1005, 1007, 1063, 2655, 5963, 1027, 11498, 5244, 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...
laurent22/joplin
ReactNativeClient/lib/MdToHtml/rules/katex.js
isValidDelim
function isValidDelim(state, pos) { var prevChar, nextChar, max = state.posMax, can_open = true, can_close = true; prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1; nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1; // Check non-whitespace conditions for opening and closing, and // check that closing delimeter isn't followed by a number if (prevChar === 0x20/* " " */ || prevChar === 0x09/* \t */ || (nextChar >= 0x30/* "0" */ && nextChar <= 0x39/* "9" */)) { can_close = false; } if (nextChar === 0x20/* " " */ || nextChar === 0x09/* \t */) { can_open = false; } return { can_open: can_open, can_close: can_close }; }
javascript
function isValidDelim(state, pos) { var prevChar, nextChar, max = state.posMax, can_open = true, can_close = true; prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1; nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1; // Check non-whitespace conditions for opening and closing, and // check that closing delimeter isn't followed by a number if (prevChar === 0x20/* " " */ || prevChar === 0x09/* \t */ || (nextChar >= 0x30/* "0" */ && nextChar <= 0x39/* "9" */)) { can_close = false; } if (nextChar === 0x20/* " " */ || nextChar === 0x09/* \t */) { can_open = false; } return { can_open: can_open, can_close: can_close }; }
[ "function", "isValidDelim", "(", "state", ",", "pos", ")", "{", "var", "prevChar", ",", "nextChar", ",", "max", "=", "state", ".", "posMax", ",", "can_open", "=", "true", ",", "can_close", "=", "true", ";", "prevChar", "=", "pos", ">", "0", "?", "sta...
Test if potential opening or closing delimieter Assumes that there is a "$" at state.src[pos]
[ "Test", "if", "potential", "opening", "or", "closing", "delimieter", "Assumes", "that", "there", "is", "a", "$", "at", "state", ".", "src", "[", "pos", "]" ]
beb428b246cecba4630a3ca57b472f43c0933a43
https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/ReactNativeClient/lib/MdToHtml/rules/katex.js#L28-L51
train
Check if a delimiter is valid
[ 30522, 3853, 2003, 10175, 3593, 9247, 5714, 1006, 2110, 1010, 13433, 2015, 1007, 1063, 13075, 3653, 25465, 8167, 1010, 2279, 7507, 2099, 1010, 4098, 1027, 2110, 1012, 13433, 26212, 2595, 1010, 2064, 1035, 2330, 1027, 2995, 1010, 2064, 1035,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(node, linefeed) { var xml = ''; if (window.XMLSerializer != null) { var xmlSerializer = new XMLSerializer(); xml = xmlSerializer.serializeToString(node); } else if (node.xml != null) { xml = node.xml.replace(/\r\n\t[\t]*/g, ''). replace(/>\r\n/g, '>'). replace(/\r\n/g, '\n'); } // Replaces linefeeds with HTML Entities. linefeed = linefeed || '&#xa;'; xml = xml.replace(/\n/g, linefeed); return xml; }
javascript
function(node, linefeed) { var xml = ''; if (window.XMLSerializer != null) { var xmlSerializer = new XMLSerializer(); xml = xmlSerializer.serializeToString(node); } else if (node.xml != null) { xml = node.xml.replace(/\r\n\t[\t]*/g, ''). replace(/>\r\n/g, '>'). replace(/\r\n/g, '\n'); } // Replaces linefeeds with HTML Entities. linefeed = linefeed || '&#xa;'; xml = xml.replace(/\n/g, linefeed); return xml; }
[ "function", "(", "node", ",", "linefeed", ")", "{", "var", "xml", "=", "''", ";", "if", "(", "window", ".", "XMLSerializer", "!=", "null", ")", "{", "var", "xmlSerializer", "=", "new", "XMLSerializer", "(", ")", ";", "xml", "=", "xmlSerializer", ".", ...
Function: getXml Returns the XML content of the specified node. For Internet Explorer, all \r\n\t[\t]* are removed from the XML string and the remaining \r\n are replaced by \n. All \n are then replaced with linefeed, or &#xa; if no linefeed is defined. Parameters: node - DOM node to return the XML for. linefeed - Optional string that linefeeds are converted into. Default is &#xa;
[ "Function", ":", "getXml" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L2974-L2995
train
Returns the XML representation of the node.
[ 30522, 3853, 1006, 13045, 1010, 2240, 7959, 2098, 1007, 1063, 13075, 20950, 1027, 1005, 1005, 1025, 2065, 1006, 3332, 1012, 20950, 8043, 4818, 17629, 999, 1027, 19701, 1007, 1063, 13075, 20950, 8043, 4818, 17629, 1027, 2047, 30524, 1025, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/document/DocumentCommandHandlers.js
_doRevert
function _doRevert(doc, suppressError) { var result = new $.Deferred(); FileUtils.readAsText(doc.file) .done(function (text, readTimestamp) { doc.refreshText(text, readTimestamp); result.resolve(); }) .fail(function (error) { if (suppressError) { result.resolve(); } else { showFileOpenError(error, doc.file.fullPath) .done(function () { result.reject(error); }); } }); return result.promise(); }
javascript
function _doRevert(doc, suppressError) { var result = new $.Deferred(); FileUtils.readAsText(doc.file) .done(function (text, readTimestamp) { doc.refreshText(text, readTimestamp); result.resolve(); }) .fail(function (error) { if (suppressError) { result.resolve(); } else { showFileOpenError(error, doc.file.fullPath) .done(function () { result.reject(error); }); } }); return result.promise(); }
[ "function", "_doRevert", "(", "doc", ",", "suppressError", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ";", "FileUtils", ".", "readAsText", "(", "doc", ".", "file", ")", ".", "done", "(", "function", "(", "text", ",", "read...
Reverts the Document to the current contents of its file on disk. Discards any unsaved changes in the Document. @private @param {Document} doc @param {boolean=} suppressError If true, then a failure to read the file will be ignored and the resulting promise will be resolved rather than rejected. @return {$.Promise} a Promise that's resolved when done, or (if suppressError is false) rejected with a FileSystemError if the file cannot be read (after showing an error dialog to the user).
[ "Reverts", "the", "Document", "to", "the", "current", "contents", "of", "its", "file", "on", "disk", ".", "Discards", "any", "unsaved", "changes", "in", "the", "Document", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L849-L869
train
Revert the file
[ 30522, 3853, 1035, 2079, 2890, 16874, 1006, 9986, 1010, 16081, 2121, 29165, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 5371, 21823, 4877, 1012, 3191, 14083, 10288, 2102, 1006, 9986, 1012, 5371, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/JSLint/main.js
_getIndentSize
function _getIndentSize(fullPath) { return Editor.getUseTabChar(fullPath) ? Editor.getTabSize(fullPath) : Editor.getSpaceUnits(fullPath); }
javascript
function _getIndentSize(fullPath) { return Editor.getUseTabChar(fullPath) ? Editor.getTabSize(fullPath) : Editor.getSpaceUnits(fullPath); }
[ "function", "_getIndentSize", "(", "fullPath", ")", "{", "return", "Editor", ".", "getUseTabChar", "(", "fullPath", ")", "?", "Editor", ".", "getTabSize", "(", "fullPath", ")", ":", "Editor", ".", "getSpaceUnits", "(", "fullPath", ")", ";", "}" ]
gets indentation size depending whether the tabs or spaces are used
[ "gets", "indentation", "size", "depending", "whether", "the", "tabs", "or", "spaces", "are", "used" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JSLint/main.js#L210-L212
train
Get indent size of file
[ 30522, 3853, 1035, 2131, 22254, 11187, 4697, 1006, 2440, 15069, 1007, 1063, 2709, 3559, 1012, 2131, 8557, 2696, 9818, 8167, 1006, 2440, 15069, 1007, 1029, 3559, 1012, 2131, 2696, 5910, 4697, 1006, 2440, 15069, 1007, 30524, 19496, 3215, 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...
jgraph/mxgraph
javascript/mxClient.js
function(str, chars) { chars = chars || "\\s"; return (str != null) ? str.replace(new RegExp("^[" + chars + "]+", "g"), "") : null; }
javascript
function(str, chars) { chars = chars || "\\s"; return (str != null) ? str.replace(new RegExp("^[" + chars + "]+", "g"), "") : null; }
[ "function", "(", "str", ",", "chars", ")", "{", "chars", "=", "chars", "||", "\"\\\\s\"", ";", "return", "(", "str", "!=", "null", ")", "?", "str", ".", "replace", "(", "new", "RegExp", "(", "\"^[\"", "+", "chars", "+", "\"]+\"", ",", "\"g\"", ")",...
Function: ltrim Strips all whitespaces from the beginning of the string. Without the second parameter, this will trim these characters: - " " (ASCII 32 (0x20)), an ordinary space - "\t" (ASCII 9 (0x09)), a tab - "\n" (ASCII 10 (0x0A)), a new line (line feed) - "\r" (ASCII 13 (0x0D)), a carriage return - "\0" (ASCII 0 (0x00)), the NUL-byte - "\x0B" (ASCII 11 (0x0B)), a vertical tab
[ "Function", ":", "ltrim" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L4912-L4917
train
Removes all occurrences of a character in a string
[ 30522, 3853, 1006, 2358, 2099, 1010, 25869, 2015, 1007, 1063, 25869, 2015, 1027, 25869, 2015, 1064, 1064, 1000, 1032, 1032, 1055, 1000, 1025, 2709, 1006, 2358, 2099, 999, 1027, 19701, 1007, 1029, 2358, 2099, 1012, 5672, 1006, 2047, 19723, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/support/techinfo/TechnicalInfo.js
function () { var oModel = this._oDialog.getModel("view"), sSelectedLocation = oModel.getProperty("/SelectedLocation"), oControl; if (sSelectedLocation === "custom") { oControl = this._getControl("customBootstrapURL",this._SUPPORT_ASSISTANT_POPOVER_ID); var sValue = oControl.getValue(); try { this._validateValue(sValue); } catch (oException) { this._showError(oControl, oException.message); if (this._sErrorMessage) { this._sErrorMessage = null; } return; } } else { oControl = this._getControl("standardBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID); } if (this._sErrorMessage) { this._showError(oControl, this._sErrorMessage); this._sErrorMessage = null; } }
javascript
function () { var oModel = this._oDialog.getModel("view"), sSelectedLocation = oModel.getProperty("/SelectedLocation"), oControl; if (sSelectedLocation === "custom") { oControl = this._getControl("customBootstrapURL",this._SUPPORT_ASSISTANT_POPOVER_ID); var sValue = oControl.getValue(); try { this._validateValue(sValue); } catch (oException) { this._showError(oControl, oException.message); if (this._sErrorMessage) { this._sErrorMessage = null; } return; } } else { oControl = this._getControl("standardBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID); } if (this._sErrorMessage) { this._showError(oControl, this._sErrorMessage); this._sErrorMessage = null; } }
[ "function", "(", ")", "{", "var", "oModel", "=", "this", ".", "_oDialog", ".", "getModel", "(", "\"view\"", ")", ",", "sSelectedLocation", "=", "oModel", ".", "getProperty", "(", "\"/SelectedLocation\"", ")", ",", "oControl", ";", "if", "(", "sSelectedLocati...
Handler for onAfterOpen event from popover @private
[ "Handler", "for", "onAfterOpen", "event", "from", "popover" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L795-L820
train
Validates the value of the selected location
[ 30522, 3853, 1006, 1007, 1063, 13075, 18168, 10244, 2140, 1027, 2023, 1012, 1035, 21045, 23067, 2290, 1012, 2131, 5302, 9247, 1006, 1000, 3193, 1000, 1007, 1010, 7020, 12260, 10985, 4135, 10719, 1027, 18168, 10244, 2140, 1012, 2131, 21572, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/support/apps/contentbrowser/controller/ContentDetails.controller.js
function () { this._initAndBindSelectedContentModel(); var oRouter = sap.ui.core.UIComponent.getRouterFor(this); oRouter.getRoute("ContentDetails").attachMatched(this._onRouteMatched, this); oRouter.getRoute("ContentDetailsFlip").attachMatched(this._onRouteMatched, this); }
javascript
function () { this._initAndBindSelectedContentModel(); var oRouter = sap.ui.core.UIComponent.getRouterFor(this); oRouter.getRoute("ContentDetails").attachMatched(this._onRouteMatched, this); oRouter.getRoute("ContentDetailsFlip").attachMatched(this._onRouteMatched, this); }
[ "function", "(", ")", "{", "this", ".", "_initAndBindSelectedContentModel", "(", ")", ";", "var", "oRouter", "=", "sap", ".", "ui", ".", "core", ".", "UIComponent", ".", "getRouterFor", "(", "this", ")", ";", "oRouter", ".", "getRoute", "(", "\"ContentDeta...
Initialize function; Handles data binding and route matching. @public
[ "Initialize", "function", ";", "Handles", "data", "binding", "and", "route", "matching", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js#L41-L46
train
Initializes the selected content model and binds the matched event to the selected content model.
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1035, 1999, 25451, 18939, 22254, 11246, 22471, 2098, 8663, 6528, 21246, 10244, 2140, 1006, 1007, 1025, 13075, 20298, 19901, 1027, 20066, 1012, 21318, 1012, 4563, 1012, 21318, 9006, 29513, 3372, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/angular
tools/gulp-tasks/cldr/extract.js
removeDuplicates
function removeDuplicates(data) { const dedup = [data[0]]; for(let i = 1; i < data.length; i++) { if (stringify(data[i]) !== stringify(data[i - 1])) { dedup.push(data[i]); } else { dedup.push(undefined); } } return dedup; }
javascript
function removeDuplicates(data) { const dedup = [data[0]]; for(let i = 1; i < data.length; i++) { if (stringify(data[i]) !== stringify(data[i - 1])) { dedup.push(data[i]); } else { dedup.push(undefined); } } return dedup; }
[ "function", "removeDuplicates", "(", "data", ")", "{", "const", "dedup", "=", "[", "data", "[", "0", "]", "]", ";", "for", "(", "let", "i", "=", "1", ";", "i", "<", "data", ".", "length", ";", "i", "++", ")", "{", "if", "(", "stringify", "(", ...
To create smaller locale files, we remove duplicated data. To be make this work we need to store similar data in arrays, if some value in an array is undefined, we can take the previous defined value instead, because it means that it has been deduplicated. e.g.: [x, y, undefined, z, undefined, undefined] The first undefined is equivalent to y, the second and third are equivalent to z Note that the first value in an array is always defined. Also since we need to know which data is assumed similar, it is important that we store those similar data in arrays to mark the delimitation between values that have different meanings (e.g. months and days). For further size improvements, "undefined" values will be replaced by a constant in the arrays as the last step of the file generation (in generateLocale and generateLocaleExtra). e.g.: [x, y, undefined, z, undefined, undefined] will be [x, y, u, z, u, u]
[ "To", "create", "smaller", "locale", "files", "we", "remove", "duplicated", "data", ".", "To", "be", "make", "this", "work", "we", "need", "to", "store", "similar", "data", "in", "arrays", "if", "some", "value", "in", "an", "array", "is", "undefined", "w...
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L560-L570
train
Remove duplicates from the array
[ 30522, 3853, 3718, 6279, 19341, 4570, 1006, 2951, 1007, 1063, 9530, 3367, 2139, 8566, 2361, 1027, 1031, 2951, 1031, 1014, 1033, 1033, 1025, 2005, 1006, 2292, 1045, 1027, 1015, 1025, 1045, 1026, 2951, 1012, 3091, 1025, 1045, 1009, 1009, 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...
SheetJS/js-xlsx
xlsx.js
parse_PtgExp
function parse_PtgExp(blob, length, opts) { blob.l++; if(opts && opts.biff == 12) return [blob.read_shift(4, 'i'), 0]; var row = blob.read_shift(2); var col = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); return [row, col]; }
javascript
function parse_PtgExp(blob, length, opts) { blob.l++; if(opts && opts.biff == 12) return [blob.read_shift(4, 'i'), 0]; var row = blob.read_shift(2); var col = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); return [row, col]; }
[ "function", "parse_PtgExp", "(", "blob", ",", "length", ",", "opts", ")", "{", "blob", ".", "l", "++", ";", "if", "(", "opts", "&&", "opts", ".", "biff", "==", "12", ")", "return", "[", "blob", ".", "read_shift", "(", "4", ",", "'i'", ")", ",", ...
/* [MS-XLS] 2.5.198.58 ; [MS-XLSB] 2.5.97.40
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "5", ".", "198", ".", "58", ";", "[", "MS", "-", "XLSB", "]", "2", ".", "5", ".", "97", ".", "40" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L10474-L10480
train
Parse a PTG expression
[ 30522, 3853, 11968, 3366, 1035, 13866, 3351, 2595, 2361, 1006, 1038, 4135, 2497, 1010, 3091, 1010, 23569, 2015, 1007, 1063, 1038, 4135, 2497, 1012, 1048, 1009, 1009, 1025, 2065, 1006, 23569, 2015, 1004, 1004, 23569, 2015, 1012, 12170, 4246,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/less.js
function () { var k; k = $re(/^[_A-Za-z-][_A-Za-z0-9-]*/); if (k) { var color = tree.Color.fromKeyword(k); if (color) { return color; } return new(tree.Keyword)(k); } }
javascript
function () { var k; k = $re(/^[_A-Za-z-][_A-Za-z0-9-]*/); if (k) { var color = tree.Color.fromKeyword(k); if (color) { return color; } return new(tree.Keyword)(k); } }
[ "function", "(", ")", "{", "var", "k", ";", "k", "=", "$re", "(", "/", "^[_A-Za-z-][_A-Za-z0-9-]*", "/", ")", ";", "if", "(", "k", ")", "{", "var", "color", "=", "tree", ".", "Color", ".", "fromKeyword", "(", "k", ")", ";", "if", "(", "color", ...
A catch-all word, such as: black border-collapse
[ "A", "catch", "-", "all", "word", "such", "as", ":", "black", "border", "-", "collapse" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L831-L842
train
Returns the next keyword in the list
[ 30522, 3853, 1006, 1007, 1063, 13075, 1047, 1025, 1047, 1027, 1002, 2128, 1006, 1013, 1034, 1031, 1035, 1037, 1011, 23564, 1011, 1062, 1011, 1033, 1031, 1035, 1037, 1011, 23564, 1011, 1062, 2692, 1011, 1023, 1011, 1033, 1008, 1013, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
lib/jsdoc/ui5/template/publish.js
makeExample
function makeExample(example) { var result = { caption: null, example: example }, match = /^\s*<caption>([\s\S]+?)<\/caption>(?:[ \t]*[\n\r]*)([\s\S]+)$/i.exec(example); if ( match ) { result.caption = match[1]; result.example = match[2]; } return result; }
javascript
function makeExample(example) { var result = { caption: null, example: example }, match = /^\s*<caption>([\s\S]+?)<\/caption>(?:[ \t]*[\n\r]*)([\s\S]+)$/i.exec(example); if ( match ) { result.caption = match[1]; result.example = match[2]; } return result; }
[ "function", "makeExample", "(", "example", ")", "{", "var", "result", "=", "{", "caption", ":", "null", ",", "example", ":", "example", "}", ",", "match", "=", "/", "^\\s*<caption>([\\s\\S]+?)<\\/caption>(?:[ \\t]*[\\n\\r]*)([\\s\\S]+)$", "/", "i", ".", "exec", ...
Example
[ "Example" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L4111-L4124
train
Creates an example object from a string
[ 30522, 3853, 2191, 10288, 16613, 2571, 1006, 2742, 1007, 1063, 13075, 2765, 1027, 1063, 14408, 3258, 1024, 19701, 1010, 2742, 1024, 2742, 1065, 1010, 2674, 1027, 1013, 1034, 1032, 1055, 1008, 1026, 14408, 3258, 1028, 1006, 1031, 1032, 1055,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
airbnb/enzyme
packages/enzyme/src/ShallowWrapper.js
getContextFromWrappingComponent
function getContextFromWrappingComponent(wrapper, adapter) { const rootFinder = deepRender(wrapper, wrapper[ROOT_FINDER], adapter); if (!rootFinder) { throw new Error('`wrappingComponent` must render its children!'); } return { legacyContext: rootFinder[OPTIONS].context, providerValues: rootFinder[PROVIDER_VALUES], }; }
javascript
function getContextFromWrappingComponent(wrapper, adapter) { const rootFinder = deepRender(wrapper, wrapper[ROOT_FINDER], adapter); if (!rootFinder) { throw new Error('`wrappingComponent` must render its children!'); } return { legacyContext: rootFinder[OPTIONS].context, providerValues: rootFinder[PROVIDER_VALUES], }; }
[ "function", "getContextFromWrappingComponent", "(", "wrapper", ",", "adapter", ")", "{", "const", "rootFinder", "=", "deepRender", "(", "wrapper", ",", "wrapper", "[", "ROOT_FINDER", "]", ",", "adapter", ")", ";", "if", "(", "!", "rootFinder", ")", "{", "thr...
Deep-renders the `wrappingComponent` and returns the context that should be accessible to the primary wrapper. @param {WrappingComponentWrapper} wrapper The `WrappingComponentWrapper` for a `wrappingComponent` @param {Adapter} adapter An Enzyme adapter @returns {object} An object containing an object of legacy context values and a Map of `createContext()` Provider values.
[ "Deep", "-", "renders", "the", "wrappingComponent", "and", "returns", "the", "context", "that", "should", "be", "accessible", "to", "the", "primary", "wrapper", "." ]
cd430eae95eba151f17e970ee77c18f09476de0e
https://github.com/airbnb/enzyme/blob/cd430eae95eba151f17e970ee77c18f09476de0e/packages/enzyme/src/ShallowWrapper.js#L320-L329
train
Get the context from a wrapping component
[ 30522, 3853, 2131, 8663, 18209, 19699, 5358, 13088, 29098, 2075, 9006, 29513, 3372, 1006, 10236, 4842, 1010, 15581, 2121, 1007, 1063, 9530, 3367, 7117, 23695, 1027, 2784, 7389, 4063, 1006, 10236, 4842, 1010, 10236, 4842, 1031, 7117, 1035, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.m/src/sap/m/TabStripRenderer.js
getTabStripItemAccAttributes
function getTabStripItemAccAttributes(oItem, oTabStrip, oSelectedItem) { var aItems = oTabStrip.getItems(), iIndex = aItems.indexOf(oItem), oTabStripParent = oTabStrip.getParent(), mAccAttributes = { role: "tab"}, sDescribedBy = InvisibleText.getStaticId("sap.m", "TABSTRIP_ITEM_CLOSABLE") + " "; sDescribedBy += InvisibleText.getStaticId("sap.m", oItem.getModified() ? "TABSTRIP_ITEM_MODIFIED" : "TABSTRIP_ITEM_NOT_MODIFIED"); mAccAttributes["describedby"] = sDescribedBy; mAccAttributes["posinset"] = iIndex + 1; mAccAttributes["setsize"] = aItems.length; mAccAttributes["labelledby"] = getTabTextDomId(oItem) + "-addText " + getTabTextDomId(oItem) + "-text"; if (oTabStripParent && oTabStripParent.getRenderer && oTabStripParent.getRenderer().getContentDomId) { mAccAttributes["controls"] = oTabStripParent.getRenderer().getContentDomId(oTabStripParent); } if (oSelectedItem && oSelectedItem.getId() === oItem.getId()) { mAccAttributes["selected"] = "true"; } else { mAccAttributes["selected"] = "false"; } return mAccAttributes; }
javascript
function getTabStripItemAccAttributes(oItem, oTabStrip, oSelectedItem) { var aItems = oTabStrip.getItems(), iIndex = aItems.indexOf(oItem), oTabStripParent = oTabStrip.getParent(), mAccAttributes = { role: "tab"}, sDescribedBy = InvisibleText.getStaticId("sap.m", "TABSTRIP_ITEM_CLOSABLE") + " "; sDescribedBy += InvisibleText.getStaticId("sap.m", oItem.getModified() ? "TABSTRIP_ITEM_MODIFIED" : "TABSTRIP_ITEM_NOT_MODIFIED"); mAccAttributes["describedby"] = sDescribedBy; mAccAttributes["posinset"] = iIndex + 1; mAccAttributes["setsize"] = aItems.length; mAccAttributes["labelledby"] = getTabTextDomId(oItem) + "-addText " + getTabTextDomId(oItem) + "-text"; if (oTabStripParent && oTabStripParent.getRenderer && oTabStripParent.getRenderer().getContentDomId) { mAccAttributes["controls"] = oTabStripParent.getRenderer().getContentDomId(oTabStripParent); } if (oSelectedItem && oSelectedItem.getId() === oItem.getId()) { mAccAttributes["selected"] = "true"; } else { mAccAttributes["selected"] = "false"; } return mAccAttributes; }
[ "function", "getTabStripItemAccAttributes", "(", "oItem", ",", "oTabStrip", ",", "oSelectedItem", ")", "{", "var", "aItems", "=", "oTabStrip", ".", "getItems", "(", ")", ",", "iIndex", "=", "aItems", ".", "indexOf", "(", "oItem", ")", ",", "oTabStripParent", ...
Returns the accessibility attributes for a given <code>TabStripItem</code>. @param {sap.m.TabStripItem} oItem The <code>TabStripItem</code> to prepare accessibility attributes for @param {sap.ui.core.Control} oTabStripParent The <code>TabStrip</code> parent control @param {sap.m.TabStripItem} oSelectedItem The <code>TabStripItem</code> that is currently selected @returns {Object} The accessibility attributes for given <code>TabStripItem</code> @private
[ "Returns", "the", "accessibility", "attributes", "for", "a", "given", "<code", ">", "TabStripItem<", "/", "code", ">", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TabStripRenderer.js#L264-L286
train
Returns an object with attributes to be added to the given tabStrip
[ 30522, 3853, 2131, 2696, 5910, 24901, 4221, 22911, 11266, 18886, 8569, 4570, 1006, 1051, 4221, 2213, 1010, 27178, 7875, 3367, 29443, 1010, 9808, 12260, 10985, 4221, 2213, 1007, 1063, 13075, 9932, 18532, 2015, 1027, 27178, 7875, 3367, 29443, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/jszip.js
function(reader, from, length, compression, uncompressedSize) { return function() { var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); var uncompressedFileData = compression.uncompress(compressedFileData); if (uncompressedFileData.length !== uncompressedSize) { throw new Error("Bug : uncompressed data size mismatch"); } return uncompressedFileData; }; }
javascript
function(reader, from, length, compression, uncompressedSize) { return function() { var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); var uncompressedFileData = compression.uncompress(compressedFileData); if (uncompressedFileData.length !== uncompressedSize) { throw new Error("Bug : uncompressed data size mismatch"); } return uncompressedFileData; }; }
[ "function", "(", "reader", ",", "from", ",", "length", ",", "compression", ",", "uncompressedSize", ")", "{", "return", "function", "(", ")", "{", "var", "compressedFileData", "=", "utils", ".", "transformTo", "(", "compression", ".", "uncompressInputType", ",...
Prepare the function used to generate the uncompressed content from this ZipFile. @param {DataReader} reader the reader to use. @param {number} from the offset from where we should read the data. @param {number} length the length of the data to read. @param {JSZip.compression} compression the compression used on this file. @param {number} uncompressedSize the uncompressed size to expect. @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class).
[ "Prepare", "the", "function", "used", "to", "generate", "the", "uncompressed", "content", "from", "this", "ZipFile", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1942-L1954
train
uncompress the file
[ 30522, 3853, 1006, 8068, 1010, 2013, 1010, 3091, 1010, 13379, 1010, 4895, 9006, 19811, 5332, 4371, 1007, 1063, 2709, 3853, 1006, 1007, 1063, 13075, 16620, 8873, 3709, 6790, 1027, 21183, 12146, 1012, 10938, 3406, 1006, 13379, 1012, 4895, 900...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/prefer-arrow-callback.js
checkMetaProperty
function checkMetaProperty(node, metaName, propertyName) { return node.meta.name === metaName && node.property.name === propertyName; }
javascript
function checkMetaProperty(node, metaName, propertyName) { return node.meta.name === metaName && node.property.name === propertyName; }
[ "function", "checkMetaProperty", "(", "node", ",", "metaName", ",", "propertyName", ")", "{", "return", "node", ".", "meta", ".", "name", "===", "metaName", "&&", "node", ".", "property", ".", "name", "===", "propertyName", ";", "}" ]
Checks whether or not a given MetaProperty node equals to a given value. @param {ASTNode} node - A MetaProperty node to check. @param {string} metaName - The name of `MetaProperty.meta`. @param {string} propertyName - The name of `MetaProperty.property`. @returns {boolean} `true` if the node is the specific value.
[ "Checks", "whether", "or", "not", "a", "given", "MetaProperty", "node", "equals", "to", "a", "given", "value", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-arrow-callback.js#L28-L30
train
Check if a node is a meta property
[ 30522, 3853, 4638, 11368, 9331, 18981, 15010, 1006, 13045, 1010, 18804, 18442, 1010, 3200, 18442, 1007, 1063, 2709, 13045, 1012, 18804, 1012, 2171, 1027, 1027, 1027, 18804, 18442, 1004, 1004, 13045, 1012, 3200, 1012, 2171, 1027, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wix/Detox
website/gatherDocs.js
checkOutTag
function checkOutTag(repo, tag) { return git.Reference.dwim(repo, 'refs/tags/' + tag) .then(function(ref) { return ref.peel(git.Object.TYPE.COMMIT); }) .then(function(ref) { return repo.getCommit(ref); }) .then(function(commit) { return git.Checkout.tree(repo, commit, { checkoutStrategy: git.Checkout.STRATEGY.FORCE }).then(function() { return repo.setHeadDetached(commit, repo.defaultSignature, 'Checkout: HEAD ' + commit.id()); }); }); }
javascript
function checkOutTag(repo, tag) { return git.Reference.dwim(repo, 'refs/tags/' + tag) .then(function(ref) { return ref.peel(git.Object.TYPE.COMMIT); }) .then(function(ref) { return repo.getCommit(ref); }) .then(function(commit) { return git.Checkout.tree(repo, commit, { checkoutStrategy: git.Checkout.STRATEGY.FORCE }).then(function() { return repo.setHeadDetached(commit, repo.defaultSignature, 'Checkout: HEAD ' + commit.id()); }); }); }
[ "function", "checkOutTag", "(", "repo", ",", "tag", ")", "{", "return", "git", ".", "Reference", ".", "dwim", "(", "repo", ",", "'refs/tags/'", "+", "tag", ")", ".", "then", "(", "function", "(", "ref", ")", "{", "return", "ref", ".", "peel", "(", ...
https://stackoverflow.com/a/46140283/1559386
[ "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "46140283", "/", "1559386" ]
0ed5e8c7ba279a3a409130b4d4bad3f9a9c2f1f9
https://github.com/wix/Detox/blob/0ed5e8c7ba279a3a409130b4d4bad3f9a9c2f1f9/website/gatherDocs.js#L36-L51
train
Check out a commit tag
[ 30522, 3853, 4638, 5833, 15900, 1006, 16360, 2080, 1010, 6415, 1007, 1063, 2709, 21025, 2102, 1012, 4431, 1012, 1040, 9148, 2213, 1006, 16360, 2080, 1010, 1005, 25416, 2015, 1013, 22073, 1013, 1005, 1009, 6415, 1007, 1012, 2059, 1006, 3853,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/removePart.js
removePart
function removePart(summary, index) { var parts = summary.getParts().remove(index); return indexLevels(summary.set('parts', parts)); }
javascript
function removePart(summary, index) { var parts = summary.getParts().remove(index); return indexLevels(summary.set('parts', parts)); }
[ "function", "removePart", "(", "summary", ",", "index", ")", "{", "var", "parts", "=", "summary", ".", "getParts", "(", ")", ".", "remove", "(", "index", ")", ";", "return", "indexLevels", "(", "summary", ".", "set", "(", "'parts'", ",", "parts", ")", ...
Remove a part at given index @param {Summary} summary @param {Number|} index @return {Summary}
[ "Remove", "a", "part", "at", "given", "index" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/modifiers/summary/removePart.js#L10-L13
train
Remove a part from a summary
[ 30522, 3853, 6366, 19362, 2102, 1006, 12654, 1010, 5950, 1007, 1063, 13075, 3033, 1027, 12654, 1012, 2131, 26950, 1006, 1007, 1012, 6366, 1006, 5950, 1007, 1025, 2709, 5950, 20414, 9050, 1006, 12654, 1012, 2275, 1006, 1005, 3033, 1005, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/lib/scriptaculous/dragdrop.js
function(element, options) { return Element.findChildren( element, options.only, options.tree ? true : false, options.tag); }
javascript
function(element, options) { return Element.findChildren( element, options.only, options.tree ? true : false, options.tag); }
[ "function", "(", "element", ",", "options", ")", "{", "return", "Element", ".", "findChildren", "(", "element", ",", "options", ".", "only", ",", "options", ".", "tree", "?", "true", ":", "false", ",", "options", ".", "tag", ")", ";", "}" ]
return all suitable-for-sortable elements in a guaranteed order
[ "return", "all", "suitable", "-", "for", "-", "sortable", "elements", "in", "a", "guaranteed", "order" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/lib/scriptaculous/dragdrop.js#L665-L668
train
Find the children of an element
[ 30522, 3853, 1006, 5783, 1010, 7047, 1007, 1063, 2709, 5783, 1012, 2424, 19339, 7389, 1006, 5783, 1010, 7047, 1012, 2069, 1010, 7047, 1012, 3392, 1029, 2995, 1024, 6270, 1010, 7047, 1012, 6415, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/project/FileTreeViewModel.js
_isFilePathVisible
function _isFilePathVisible(treeData, path) { if (path === null) { return null; } else if (path === "") { return true; } var parts = path.split("/"), part = parts.shift(), result = [], node; while (part) { if (treeData === null) { return false; } node = treeData.get(part); if (node === undefined) { return null; } result.push(part); part = parts.shift(); if (part) { if (!node.get("open")) { return false; } treeData = node.get("children"); if (treeData) { result.push("children"); } } } return true; }
javascript
function _isFilePathVisible(treeData, path) { if (path === null) { return null; } else if (path === "") { return true; } var parts = path.split("/"), part = parts.shift(), result = [], node; while (part) { if (treeData === null) { return false; } node = treeData.get(part); if (node === undefined) { return null; } result.push(part); part = parts.shift(); if (part) { if (!node.get("open")) { return false; } treeData = node.get("children"); if (treeData) { result.push("children"); } } } return true; }
[ "function", "_isFilePathVisible", "(", "treeData", ",", "path", ")", "{", "if", "(", "path", "===", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "path", "===", "\"\"", ")", "{", "return", "true", ";", "}", "var", "parts", "=", "...
@private See `FileTreeViewModel.isFilePathVisible`
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeViewModel.js#L223-L257
train
Check if a file path is visible in the tree
[ 30522, 3853, 1035, 2003, 8873, 2571, 15069, 11365, 7028, 1006, 3392, 2850, 2696, 1010, 4130, 1007, 1063, 2065, 1006, 4130, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 19701, 1025, 1065, 2842, 2065, 1006, 4130, 1027, 1027, 1027, 1000, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/LiveDevelopment.js
_onConnect
function _onConnect(event) { // When the browser navigates away from the primary live document Inspector.Page.on("frameNavigated.livedev", _onFrameNavigated); // When the Inspector WebSocket disconnects unexpectedely Inspector.on("disconnect.livedev", _onDisconnect); _waitForInterstitialPageLoad() .fail(function () { close(); Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_ERROR, Strings.LIVE_DEVELOPMENT_ERROR_TITLE, _makeTroubleshootingMessage(Strings.LIVE_DEV_LOADING_ERROR_MESSAGE) ); }) .done(_onInterstitialPageLoad); }
javascript
function _onConnect(event) { // When the browser navigates away from the primary live document Inspector.Page.on("frameNavigated.livedev", _onFrameNavigated); // When the Inspector WebSocket disconnects unexpectedely Inspector.on("disconnect.livedev", _onDisconnect); _waitForInterstitialPageLoad() .fail(function () { close(); Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_ERROR, Strings.LIVE_DEVELOPMENT_ERROR_TITLE, _makeTroubleshootingMessage(Strings.LIVE_DEV_LOADING_ERROR_MESSAGE) ); }) .done(_onInterstitialPageLoad); }
[ "function", "_onConnect", "(", "event", ")", "{", "// When the browser navigates away from the primary live document", "Inspector", ".", "Page", ".", "on", "(", "\"frameNavigated.livedev\"", ",", "_onFrameNavigated", ")", ";", "// When the Inspector WebSocket disconnects unexpect...
Triggered by Inspector.connect
[ "Triggered", "by", "Inspector", ".", "connect" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopment.js#L1101-L1119
train
Called when the Inspector WebSocket connection is made
[ 30522, 3853, 1035, 2006, 8663, 2638, 6593, 1006, 2724, 1007, 1063, 1013, 1013, 2043, 1996, 16602, 22149, 2015, 2185, 2013, 1996, 3078, 2444, 6254, 7742, 1012, 3931, 1012, 2006, 1006, 1000, 4853, 2532, 5737, 11644, 1012, 2973, 6777, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Dogfalo/materialize
extras/noUiSlider/nouislider.js
checkHandlePosition
function checkHandlePosition ( reference, handleNumber, to, lookBackward, lookForward ) { // For sliders with multiple handles, limit movement to the other handle. // Apply the margin option by adding it to the handle positions. if ( scope_Handles.length > 1 ) { if ( lookBackward && handleNumber > 0 ) { to = Math.max(to, reference[handleNumber - 1] + options.margin); } if ( lookForward && handleNumber < scope_Handles.length - 1 ) { to = Math.min(to, reference[handleNumber + 1] - options.margin); } } // The limit option has the opposite effect, limiting handles to a // maximum distance from another. Limit must be > 0, as otherwise // handles would be unmoveable. if ( scope_Handles.length > 1 && options.limit ) { if ( lookBackward && handleNumber > 0 ) { to = Math.min(to, reference[handleNumber - 1] + options.limit); } if ( lookForward && handleNumber < scope_Handles.length - 1 ) { to = Math.max(to, reference[handleNumber + 1] - options.limit); } } // The padding option keeps the handles a certain distance from the // edges of the slider. Padding must be > 0. if ( options.padding ) { if ( handleNumber === 0 ) { to = Math.max(to, options.padding); } if ( handleNumber === scope_Handles.length - 1 ) { to = Math.min(to, 100 - options.padding); } } to = scope_Spectrum.getStep(to); // Limit percentage to the 0 - 100 range to = limit(to); // Return false if handle can't move if ( to === reference[handleNumber] ) { return false; } return to; }
javascript
function checkHandlePosition ( reference, handleNumber, to, lookBackward, lookForward ) { // For sliders with multiple handles, limit movement to the other handle. // Apply the margin option by adding it to the handle positions. if ( scope_Handles.length > 1 ) { if ( lookBackward && handleNumber > 0 ) { to = Math.max(to, reference[handleNumber - 1] + options.margin); } if ( lookForward && handleNumber < scope_Handles.length - 1 ) { to = Math.min(to, reference[handleNumber + 1] - options.margin); } } // The limit option has the opposite effect, limiting handles to a // maximum distance from another. Limit must be > 0, as otherwise // handles would be unmoveable. if ( scope_Handles.length > 1 && options.limit ) { if ( lookBackward && handleNumber > 0 ) { to = Math.min(to, reference[handleNumber - 1] + options.limit); } if ( lookForward && handleNumber < scope_Handles.length - 1 ) { to = Math.max(to, reference[handleNumber + 1] - options.limit); } } // The padding option keeps the handles a certain distance from the // edges of the slider. Padding must be > 0. if ( options.padding ) { if ( handleNumber === 0 ) { to = Math.max(to, options.padding); } if ( handleNumber === scope_Handles.length - 1 ) { to = Math.min(to, 100 - options.padding); } } to = scope_Spectrum.getStep(to); // Limit percentage to the 0 - 100 range to = limit(to); // Return false if handle can't move if ( to === reference[handleNumber] ) { return false; } return to; }
[ "function", "checkHandlePosition", "(", "reference", ",", "handleNumber", ",", "to", ",", "lookBackward", ",", "lookForward", ")", "{", "// For sliders with multiple handles, limit movement to the other handle.", "// Apply the margin option by adding it to the handle positions.", "if...
Split out the handle positioning logic so the Move event can use it, too
[ "Split", "out", "the", "handle", "positioning", "logic", "so", "the", "Move", "event", "can", "use", "it", "too" ]
1122efadad8f1433d404696f7613e3cc13fb83a4
https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L1719-L1772
train
Check handle position
[ 30522, 3853, 4638, 11774, 2571, 26994, 1006, 4431, 1010, 5047, 19172, 5677, 1010, 2000, 1010, 2298, 5963, 7652, 1010, 2298, 29278, 7652, 1007, 1063, 1013, 1013, 2005, 7358, 2869, 2007, 3674, 16024, 1010, 5787, 2929, 2000, 1996, 2060, 5047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-useless-constructor.js
isValidRestSpreadPair
function isValidRestSpreadPair(ctorParam, superArg) { return ( ctorParam.type === "RestElement" && superArg.type === "SpreadElement" && isValidIdentifierPair(ctorParam.argument, superArg.argument) ); }
javascript
function isValidRestSpreadPair(ctorParam, superArg) { return ( ctorParam.type === "RestElement" && superArg.type === "SpreadElement" && isValidIdentifierPair(ctorParam.argument, superArg.argument) ); }
[ "function", "isValidRestSpreadPair", "(", "ctorParam", ",", "superArg", ")", "{", "return", "(", "ctorParam", ".", "type", "===", "\"RestElement\"", "&&", "superArg", ".", "type", "===", "\"SpreadElement\"", "&&", "isValidIdentifierPair", "(", "ctorParam", ".", "a...
Checks whether given 2 nodes are a rest/spread pair which has the same values. @param {ASTNode} ctorParam - A node to check. @param {ASTNode} superArg - A node to check. @returns {boolean} `true` if the nodes are a rest/spread pair which has the same values.
[ "Checks", "whether", "given", "2", "nodes", "are", "a", "rest", "/", "spread", "pair", "which", "has", "the", "same", "values", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-constructor.js#L77-L83
train
Checks if the two parameters are valid
[ 30522, 3853, 2003, 10175, 3593, 28533, 13102, 16416, 18927, 11215, 1006, 14931, 2953, 28689, 2213, 1010, 3565, 2906, 2290, 1007, 1063, 2709, 1006, 14931, 2953, 28689, 2213, 1012, 2828, 1027, 1027, 1027, 1000, 2717, 12260, 3672, 1000, 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...
eslint/eslint
lib/rules/no-extra-semi.js
checkForPartOfClassBody
function checkForPartOfClassBody(firstToken) { for (let token = firstToken; token.type === "Punctuator" && !astUtils.isClosingBraceToken(token); token = sourceCode.getTokenAfter(token) ) { if (astUtils.isSemicolonToken(token)) { report(token); } } }
javascript
function checkForPartOfClassBody(firstToken) { for (let token = firstToken; token.type === "Punctuator" && !astUtils.isClosingBraceToken(token); token = sourceCode.getTokenAfter(token) ) { if (astUtils.isSemicolonToken(token)) { report(token); } } }
[ "function", "checkForPartOfClassBody", "(", "firstToken", ")", "{", "for", "(", "let", "token", "=", "firstToken", ";", "token", ".", "type", "===", "\"Punctuator\"", "&&", "!", "astUtils", ".", "isClosingBraceToken", "(", "token", ")", ";", "token", "=", "s...
Checks for a part of a class body. This checks tokens from a specified token to a next MethodDefinition or the end of class body. @param {Token} firstToken - The first token to check. @returns {void}
[ "Checks", "for", "a", "part", "of", "a", "class", "body", ".", "This", "checks", "tokens", "from", "a", "specified", "token", "to", "a", "next", "MethodDefinition", "or", "the", "end", "of", "class", "body", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-extra-semi.js#L71-L80
train
Check if the first token is part of class body
[ 30522, 3853, 4638, 29278, 19362, 3406, 11329, 27102, 23684, 1006, 2034, 18715, 2368, 1007, 1063, 2005, 1006, 2292, 19204, 1027, 2034, 18715, 2368, 1025, 19204, 1012, 2828, 1027, 1027, 1027, 1000, 26136, 6593, 6692, 4263, 1000, 1004, 1004, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/table/mergedTableRemoveRow.js
_updateMergeStartIndex
function _updateMergeStartIndex(tableData, startRowIndex, endRowIndex) { tableData.slice(endRowIndex + 1).forEach(row => { row.forEach(cell => { if (util.isExisty(cell.rowMergeWith) && cell.rowMergeWith >= startRowIndex) { cell.rowMergeWith = endRowIndex + 1; } }); }); }
javascript
function _updateMergeStartIndex(tableData, startRowIndex, endRowIndex) { tableData.slice(endRowIndex + 1).forEach(row => { row.forEach(cell => { if (util.isExisty(cell.rowMergeWith) && cell.rowMergeWith >= startRowIndex) { cell.rowMergeWith = endRowIndex + 1; } }); }); }
[ "function", "_updateMergeStartIndex", "(", "tableData", ",", "startRowIndex", ",", "endRowIndex", ")", "{", "tableData", ".", "slice", "(", "endRowIndex", "+", "1", ")", ".", "forEach", "(", "row", "=>", "{", "row", ".", "forEach", "(", "cell", "=>", "{", ...
Update row merge start index to merged cell. @param {Array.<Array.<object>>} tableData - table data @param {number} startRowIndex - start row index @param {number} endRowIndex - end row index @private
[ "Update", "row", "merge", "start", "index", "to", "merged", "cell", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableRemoveRow.js#L93-L101
train
Update merge start index
[ 30522, 3853, 1035, 10651, 5017, 8449, 7559, 7629, 3207, 2595, 1006, 2795, 2850, 2696, 1010, 2707, 10524, 22254, 10288, 1010, 2203, 10524, 22254, 10288, 1007, 1063, 2795, 2850, 2696, 1012, 14704, 1006, 2203, 10524, 22254, 10288, 1009, 1015, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/gridList/grid-list.js
getTileStyle
function getTileStyle(position, spans, colCount, rowCount, gutter, rowMode, rowHeight) { // TODO(shyndman): There are style caching opportunities here. // Percent of the available horizontal space that one column takes up. var hShare = (1 / colCount) * 100; // Fraction of the gutter size that each column takes up. var hGutterShare = (colCount - 1) / colCount; // Base horizontal size of a column. var hUnit = UNIT({share: hShare, gutterShare: hGutterShare, gutter: gutter}); // The width and horizontal position of each tile is always calculated the same way, but the // height and vertical position depends on the rowMode. var ltr = document.dir != 'rtl' && document.body.dir != 'rtl'; var style = ltr ? { left: POSITION({ unit: hUnit, offset: position.col, gutter: gutter }), width: DIMENSION({ unit: hUnit, span: spans.col, gutter: gutter }), // resets paddingTop: '', marginTop: '', top: '', height: '' } : { right: POSITION({ unit: hUnit, offset: position.col, gutter: gutter }), width: DIMENSION({ unit: hUnit, span: spans.col, gutter: gutter }), // resets paddingTop: '', marginTop: '', top: '', height: '' }; switch (rowMode) { case 'fixed': // In fixed mode, simply use the given rowHeight. style.top = POSITION({ unit: rowHeight, offset: position.row, gutter: gutter }); style.height = DIMENSION({ unit: rowHeight, span: spans.row, gutter: gutter }); break; case 'ratio': // Percent of the available vertical space that one row takes up. Here, rowHeight holds // the ratio value. For example, if the width:height ratio is 4:3, rowHeight = 1.333. var vShare = hShare / rowHeight; // Base veritcal size of a row. var vUnit = UNIT({ share: vShare, gutterShare: hGutterShare, gutter: gutter }); // padidngTop and marginTop are used to maintain the given aspect ratio, as // a percentage-based value for these properties is applied to the *width* of the // containing block. See http://www.w3.org/TR/CSS2/box.html#margin-properties style.paddingTop = DIMENSION({ unit: vUnit, span: spans.row, gutter: gutter}); style.marginTop = POSITION({ unit: vUnit, offset: position.row, gutter: gutter }); break; case 'fit': // Fraction of the gutter size that each column takes up. var vGutterShare = (rowCount - 1) / rowCount; // Percent of the available vertical space that one row takes up. vShare = (1 / rowCount) * 100; // Base vertical size of a row. vUnit = UNIT({share: vShare, gutterShare: vGutterShare, gutter: gutter}); style.top = POSITION({unit: vUnit, offset: position.row, gutter: gutter}); style.height = DIMENSION({unit: vUnit, span: spans.row, gutter: gutter}); break; } return style; }
javascript
function getTileStyle(position, spans, colCount, rowCount, gutter, rowMode, rowHeight) { // TODO(shyndman): There are style caching opportunities here. // Percent of the available horizontal space that one column takes up. var hShare = (1 / colCount) * 100; // Fraction of the gutter size that each column takes up. var hGutterShare = (colCount - 1) / colCount; // Base horizontal size of a column. var hUnit = UNIT({share: hShare, gutterShare: hGutterShare, gutter: gutter}); // The width and horizontal position of each tile is always calculated the same way, but the // height and vertical position depends on the rowMode. var ltr = document.dir != 'rtl' && document.body.dir != 'rtl'; var style = ltr ? { left: POSITION({ unit: hUnit, offset: position.col, gutter: gutter }), width: DIMENSION({ unit: hUnit, span: spans.col, gutter: gutter }), // resets paddingTop: '', marginTop: '', top: '', height: '' } : { right: POSITION({ unit: hUnit, offset: position.col, gutter: gutter }), width: DIMENSION({ unit: hUnit, span: spans.col, gutter: gutter }), // resets paddingTop: '', marginTop: '', top: '', height: '' }; switch (rowMode) { case 'fixed': // In fixed mode, simply use the given rowHeight. style.top = POSITION({ unit: rowHeight, offset: position.row, gutter: gutter }); style.height = DIMENSION({ unit: rowHeight, span: spans.row, gutter: gutter }); break; case 'ratio': // Percent of the available vertical space that one row takes up. Here, rowHeight holds // the ratio value. For example, if the width:height ratio is 4:3, rowHeight = 1.333. var vShare = hShare / rowHeight; // Base veritcal size of a row. var vUnit = UNIT({ share: vShare, gutterShare: hGutterShare, gutter: gutter }); // padidngTop and marginTop are used to maintain the given aspect ratio, as // a percentage-based value for these properties is applied to the *width* of the // containing block. See http://www.w3.org/TR/CSS2/box.html#margin-properties style.paddingTop = DIMENSION({ unit: vUnit, span: spans.row, gutter: gutter}); style.marginTop = POSITION({ unit: vUnit, offset: position.row, gutter: gutter }); break; case 'fit': // Fraction of the gutter size that each column takes up. var vGutterShare = (rowCount - 1) / rowCount; // Percent of the available vertical space that one row takes up. vShare = (1 / rowCount) * 100; // Base vertical size of a row. vUnit = UNIT({share: vShare, gutterShare: vGutterShare, gutter: gutter}); style.top = POSITION({unit: vUnit, offset: position.row, gutter: gutter}); style.height = DIMENSION({unit: vUnit, span: spans.row, gutter: gutter}); break; } return style; }
[ "function", "getTileStyle", "(", "position", ",", "spans", ",", "colCount", ",", "rowCount", ",", "gutter", ",", "rowMode", ",", "rowHeight", ")", "{", "// TODO(shyndman): There are style caching opportunities here.", "// Percent of the available horizontal space that one colum...
Gets the styles applied to a tile element described by the given parameters. @param {{row: number, col: number}} position The row and column indices of the tile. @param {{row: number, col: number}} spans The rowSpan and colSpan of the tile. @param {number} colCount The number of columns. @param {number} rowCount The number of rows. @param {string} gutter The amount of space between tiles. This will be something like '5px' or '2em'. @param {string} rowMode The row height mode. Can be one of: 'fixed': all rows have a fixed size, given by rowHeight, 'ratio': row height defined as a ratio to width, or 'fit': fit to the grid-list element height, divinding evenly among rows. @param {string|number} rowHeight The height of a row. This is only used for 'fixed' mode and for 'ratio' mode. For 'ratio' mode, this is the *ratio* of width-to-height (e.g., 0.75). @returns {Object} Map of CSS properties to be applied to the style element. Will define values for top, left, width, height, marginTop, and paddingTop.
[ "Gets", "the", "styles", "applied", "to", "a", "tile", "element", "described", "by", "the", "given", "parameters", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L259-L330
train
Returns the tile style for a given position and spans.
[ 30522, 3853, 2131, 15286, 21756, 2571, 1006, 2597, 1010, 14798, 1010, 8902, 3597, 16671, 1010, 5216, 3597, 16671, 1010, 9535, 3334, 1010, 5216, 5302, 3207, 1010, 5216, 26036, 13900, 1007, 1063, 1013, 1013, 28681, 2080, 1006, 11004, 4859, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/tools/examples/run-example-e2e.js
reportStatus
function reportStatus(status, outputFile) { let log = ['']; log.push('Suites ignored due to legacy guides:'); IGNORED_EXAMPLES.filter(example => !fixmeIvyExamples.find(ex => ex.startsWith(example))) .forEach(function(val) { log.push(' ' + val); }); if (argv.ivy) { log.push(''); log.push('Suites ignored due to breakage with Ivy:'); fixmeIvyExamples.forEach(function(val) { log.push(' ' + val); }); } log.push(''); log.push('Suites passed:'); status.passed.forEach(function(val) { log.push(' ' + val); }); if (status.failed.length == 0) { log.push('All tests passed'); } else { log.push('Suites failed:'); status.failed.forEach(function(val) { log.push(' ' + val); }); } log.push('\nElapsed time: ' + status.elapsedTime + ' seconds'); log = log.join('\n'); console.log(log); fs.appendFileSync(outputFile, log); }
javascript
function reportStatus(status, outputFile) { let log = ['']; log.push('Suites ignored due to legacy guides:'); IGNORED_EXAMPLES.filter(example => !fixmeIvyExamples.find(ex => ex.startsWith(example))) .forEach(function(val) { log.push(' ' + val); }); if (argv.ivy) { log.push(''); log.push('Suites ignored due to breakage with Ivy:'); fixmeIvyExamples.forEach(function(val) { log.push(' ' + val); }); } log.push(''); log.push('Suites passed:'); status.passed.forEach(function(val) { log.push(' ' + val); }); if (status.failed.length == 0) { log.push('All tests passed'); } else { log.push('Suites failed:'); status.failed.forEach(function(val) { log.push(' ' + val); }); } log.push('\nElapsed time: ' + status.elapsedTime + ' seconds'); log = log.join('\n'); console.log(log); fs.appendFileSync(outputFile, log); }
[ "function", "reportStatus", "(", "status", ",", "outputFile", ")", "{", "let", "log", "=", "[", "''", "]", ";", "log", ".", "push", "(", "'Suites ignored due to legacy guides:'", ")", ";", "IGNORED_EXAMPLES", ".", "filter", "(", "example", "=>", "!", "fixmeI...
Report final status.
[ "Report", "final", "status", "." ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/run-example-e2e.js#L283-L310
train
Reports the status of a suite
[ 30522, 3853, 4311, 29336, 2271, 1006, 3570, 1010, 6434, 8873, 2571, 1007, 1063, 2292, 8833, 1027, 1031, 1005, 1005, 1033, 1025, 8833, 1012, 5245, 1006, 1005, 19796, 6439, 2349, 2000, 8027, 12468, 1024, 1005, 1007, 1025, 6439, 1035, 4973, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/func-name-matching.js
report
function report(node, name, funcName, isProp) { let messageId; if (nameMatches === "always" && isProp) { messageId = "matchProperty"; } else if (nameMatches === "always") { messageId = "matchVariable"; } else if (isProp) { messageId = "notMatchProperty"; } else { messageId = "notMatchVariable"; } context.report({ node, messageId, data: { name, funcName } }); }
javascript
function report(node, name, funcName, isProp) { let messageId; if (nameMatches === "always" && isProp) { messageId = "matchProperty"; } else if (nameMatches === "always") { messageId = "matchVariable"; } else if (isProp) { messageId = "notMatchProperty"; } else { messageId = "notMatchVariable"; } context.report({ node, messageId, data: { name, funcName } }); }
[ "function", "report", "(", "node", ",", "name", ",", "funcName", ",", "isProp", ")", "{", "let", "messageId", ";", "if", "(", "nameMatches", "===", "\"always\"", "&&", "isProp", ")", "{", "messageId", "=", "\"matchProperty\"", ";", "}", "else", "if", "("...
Reports @param {ASTNode} node The node to report @param {string} name The variable or property name @param {string} funcName The function name @param {boolean} isProp True if the reported node is a property assignment @returns {void}
[ "Reports" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/func-name-matching.js#L143-L163
train
Report a node to the log
[ 30522, 3853, 3189, 1006, 13045, 1010, 2171, 1010, 4569, 2278, 18442, 1010, 2003, 21572, 2361, 1007, 1063, 2292, 4471, 3593, 1025, 2065, 1006, 2171, 18900, 8376, 1027, 1027, 1027, 1000, 2467, 1000, 1004, 1004, 2003, 21572, 2361, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
NetEase/pomelo
lib/common/service/channelService.js
function(uid, sid, groups) { if(!sid) { logger.warn('ignore uid %j for sid not specified.', uid); return false; } var group = groups[sid]; if(!group) { group = []; groups[sid] = group; } group.push(uid); return true; }
javascript
function(uid, sid, groups) { if(!sid) { logger.warn('ignore uid %j for sid not specified.', uid); return false; } var group = groups[sid]; if(!group) { group = []; groups[sid] = group; } group.push(uid); return true; }
[ "function", "(", "uid", ",", "sid", ",", "groups", ")", "{", "if", "(", "!", "sid", ")", "{", "logger", ".", "warn", "(", "'ignore uid %j for sid not specified.'", ",", "uid", ")", ";", "return", "false", ";", "}", "var", "group", "=", "groups", "[", ...
add uid and sid into group. ignore any uid that uid not specified. @param uid user id @param sid server id @param groups {Object} grouped uids, , key: sid, value: [uid]
[ "add", "uid", "and", "sid", "into", "group", ".", "ignore", "any", "uid", "that", "uid", "not", "specified", "." ]
defcf019631ed399cc4dad932d3b028a04a039a4
https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/common/service/channelService.js#L340-L354
train
add uid to group
[ 30522, 3853, 1006, 21318, 2094, 1010, 15765, 1010, 2967, 1007, 1063, 2065, 1006, 999, 15765, 1007, 1063, 8833, 4590, 1012, 11582, 1006, 1005, 8568, 21318, 2094, 1003, 1046, 2005, 15765, 2025, 9675, 1012, 1005, 1010, 21318, 2094, 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...
googleapis/google-api-nodejs-client
samples/drive/quickstart.js
listFiles
function listFiles(auth) { const service = google.drive('v3'); service.files.list( { auth: auth, pageSize: 10, fields: 'nextPageToken, files(id, name)', }, (err, res) => { if (err) { console.error('The API returned an error.'); throw err; } const files = res.data.files; if (files.length === 0) { console.log('No files found.'); } else { console.log('Files:'); for (const file of files) { console.log(`${file.name} (${file.id})`); } } } ); }
javascript
function listFiles(auth) { const service = google.drive('v3'); service.files.list( { auth: auth, pageSize: 10, fields: 'nextPageToken, files(id, name)', }, (err, res) => { if (err) { console.error('The API returned an error.'); throw err; } const files = res.data.files; if (files.length === 0) { console.log('No files found.'); } else { console.log('Files:'); for (const file of files) { console.log(`${file.name} (${file.id})`); } } } ); }
[ "function", "listFiles", "(", "auth", ")", "{", "const", "service", "=", "google", ".", "drive", "(", "'v3'", ")", ";", "service", ".", "files", ".", "list", "(", "{", "auth", ":", "auth", ",", "pageSize", ":", "10", ",", "fields", ":", "'nextPageTok...
Lists the names and IDs of up to 10 files. @param {google.auth.OAuth2} auth An authorized OAuth2 client.
[ "Lists", "the", "names", "and", "IDs", "of", "up", "to", "10", "files", "." ]
e6e632a29d0b246d058e3067de3a5c3827e2b54e
https://github.com/googleapis/google-api-nodejs-client/blob/e6e632a29d0b246d058e3067de3a5c3827e2b54e/samples/drive/quickstart.js#L66-L90
train
List all files in the specified drive
[ 30522, 3853, 2862, 8873, 4244, 1006, 8740, 2705, 1007, 1063, 9530, 3367, 2326, 1027, 8224, 1012, 3298, 1006, 1005, 1058, 2509, 1005, 1007, 1025, 2326, 1012, 6764, 1012, 2862, 1006, 1063, 8740, 2705, 1024, 8740, 2705, 1010, 5530, 4697, 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...
lovell/sharp
lib/channel.js
extractChannel
function extractChannel (channel) { if (channel === 'red') { channel = 0; } else if (channel === 'green') { channel = 1; } else if (channel === 'blue') { channel = 2; } if (is.integer(channel) && is.inRange(channel, 0, 4)) { this.options.extractChannel = channel; } else { throw new Error('Cannot extract invalid channel ' + channel); } return this; }
javascript
function extractChannel (channel) { if (channel === 'red') { channel = 0; } else if (channel === 'green') { channel = 1; } else if (channel === 'blue') { channel = 2; } if (is.integer(channel) && is.inRange(channel, 0, 4)) { this.options.extractChannel = channel; } else { throw new Error('Cannot extract invalid channel ' + channel); } return this; }
[ "function", "extractChannel", "(", "channel", ")", "{", "if", "(", "channel", "===", "'red'", ")", "{", "channel", "=", "0", ";", "}", "else", "if", "(", "channel", "===", "'green'", ")", "{", "channel", "=", "1", ";", "}", "else", "if", "(", "chan...
Extract a single channel from a multi-channel image. @example sharp(input) .extractChannel('green') .toFile('input_green.jpg', function(err, info) { // info.channels === 1 // input_green.jpg contains the green channel of the input image }); @param {Number|String} channel - zero-indexed band number to extract, or `red`, `green` or `blue` as alternative to `0`, `1` or `2` respectively. @returns {Sharp} @throws {Error} Invalid channel
[ "Extract", "a", "single", "channel", "from", "a", "multi", "-", "channel", "image", "." ]
05d76eeadfe54713606a615185b2da047923406b
https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/channel.js#L64-L78
train
Extract a channel from a node
[ 30522, 3853, 14817, 26058, 1006, 3149, 1007, 1063, 2065, 1006, 3149, 1027, 1027, 1027, 1005, 2417, 1005, 1007, 1063, 3149, 1027, 1014, 1025, 1065, 2842, 2065, 1006, 3149, 1027, 1027, 1027, 1005, 2665, 1005, 1007, 1063, 3149, 30524, 1018, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
moleculerjs/moleculer
src/middlewares/circuit-breaker.js
failure
function failure(item, err, ctx) { item.count++; item.failures++; checkThreshold(item, ctx); }
javascript
function failure(item, err, ctx) { item.count++; item.failures++; checkThreshold(item, ctx); }
[ "function", "failure", "(", "item", ",", "err", ",", "ctx", ")", "{", "item", ".", "count", "++", ";", "item", ".", "failures", "++", ";", "checkThreshold", "(", "item", ",", "ctx", ")", ";", "}" ]
Increment failure counter @param {Object} item @param {Error} err @param {Context} ctx
[ "Increment", "failure", "counter" ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/circuit-breaker.js#L80-L85
train
Helper function for reporting failure of a query.
[ 30522, 3853, 4945, 1006, 8875, 1010, 9413, 2099, 1010, 14931, 2595, 1007, 1063, 8875, 1012, 4175, 1009, 1009, 1025, 8875, 1012, 15428, 1009, 1009, 1025, 4638, 2705, 21898, 11614, 1006, 8875, 1010, 14931, 2595, 1007, 1025, 1065, 102, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
checkEnums
function checkEnums() { for (var _i = 0; _i < type.enums.length; _i++) { var en = type.enums[_i]; if (en === value) { return { name: name, value: value, strValue: '' + value, bypass: propIsBypass }; } } return null; }
javascript
function checkEnums() { for (var _i = 0; _i < type.enums.length; _i++) { var en = type.enums[_i]; if (en === value) { return { name: name, value: value, strValue: '' + value, bypass: propIsBypass }; } } return null; }
[ "function", "checkEnums", "(", ")", "{", "for", "(", "var", "_i", "=", "0", ";", "_i", "<", "type", ".", "enums", ".", "length", ";", "_i", "++", ")", "{", "var", "en", "=", "type", ".", "enums", "[", "_i", "]", ";", "if", "(", "en", "===", ...
several types also allow enums
[ "several", "types", "also", "allow", "enums" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L16587-L16602
train
Check if the value is in the enumeration list
[ 30522, 3853, 4638, 2368, 18163, 1006, 1007, 1063, 2005, 1006, 13075, 1035, 1045, 1027, 1014, 1025, 1035, 1045, 1026, 2828, 1012, 4372, 18163, 1012, 3091, 1025, 1035, 1045, 1009, 1009, 1007, 1063, 13075, 4372, 1027, 2828, 1012, 4372, 18163, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/main.js
_loadStyles
function _loadStyles() { var lessText = require("text!LiveDevelopment/main.less"); less.render(lessText, function onParse(err, tree) { console.assert(!err, err); ExtensionUtils.addEmbeddedStyleSheet(tree.css); }); }
javascript
function _loadStyles() { var lessText = require("text!LiveDevelopment/main.less"); less.render(lessText, function onParse(err, tree) { console.assert(!err, err); ExtensionUtils.addEmbeddedStyleSheet(tree.css); }); }
[ "function", "_loadStyles", "(", ")", "{", "var", "lessText", "=", "require", "(", "\"text!LiveDevelopment/main.less\"", ")", ";", "less", ".", "render", "(", "lessText", ",", "function", "onParse", "(", "err", ",", "tree", ")", "{", "console", ".", "assert",...
Load Live Development LESS Style
[ "Load", "Live", "Development", "LESS", "Style" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/main.js#L137-L144
train
Load the styles from the main. less file
[ 30522, 3853, 1035, 15665, 27983, 2015, 1006, 1007, 1063, 13075, 2625, 18209, 1027, 5478, 1006, 1000, 3793, 999, 2973, 18697, 4135, 24073, 1013, 2364, 1012, 2625, 1000, 1007, 1025, 2625, 1012, 17552, 1006, 2625, 18209, 1010, 3853, 2006, 1936...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/linter.js
createDisableDirectives
function createDisableDirectives(type, loc, value) { const ruleIds = Object.keys(commentParser.parseListConfig(value)); const directiveRules = ruleIds.length ? ruleIds : [null]; return directiveRules.map(ruleId => ({ type, line: loc.line, column: loc.column + 1, ruleId })); }
javascript
function createDisableDirectives(type, loc, value) { const ruleIds = Object.keys(commentParser.parseListConfig(value)); const directiveRules = ruleIds.length ? ruleIds : [null]; return directiveRules.map(ruleId => ({ type, line: loc.line, column: loc.column + 1, ruleId })); }
[ "function", "createDisableDirectives", "(", "type", ",", "loc", ",", "value", ")", "{", "const", "ruleIds", "=", "Object", ".", "keys", "(", "commentParser", ".", "parseListConfig", "(", "value", ")", ")", ";", "const", "directiveRules", "=", "ruleIds", ".",...
Creates a collection of disable directives from a comment @param {("disable"|"enable"|"disable-line"|"disable-next-line")} type The type of directive comment @param {{line: number, column: number}} loc The 0-based location of the comment token @param {string} value The value after the directive in the comment comment specified no specific rules, so it applies to all rules (e.g. `eslint-disable`) @returns {DisableDirective[]} Directives from the comment
[ "Creates", "a", "collection", "of", "disable", "directives", "from", "a", "comment" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/linter.js#L148-L153
train
Create disable directives
[ 30522, 3853, 2580, 14268, 23242, 7442, 15277, 2015, 1006, 2828, 1010, 8840, 2278, 1010, 3643, 1007, 1063, 9530, 3367, 3627, 9821, 1027, 4874, 1012, 6309, 1006, 7615, 19362, 8043, 1012, 11968, 11246, 2923, 8663, 8873, 2290, 1006, 3643, 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...
jgraph/mxgraph
javascript/mxClient.js
mxDivResizer
function mxDivResizer(div, container) { if (div.nodeName.toLowerCase() == 'div') { if (container == null) { container = window; } this.div = div; var style = mxUtils.getCurrentStyle(div); if (style != null) { this.resizeWidth = style.width == 'auto'; this.resizeHeight = style.height == 'auto'; } mxEvent.addListener(container, 'resize', mxUtils.bind(this, function(evt) { if (!this.handlingResize) { this.handlingResize = true; this.resize(); this.handlingResize = false; } }) ); this.resize(); } }
javascript
function mxDivResizer(div, container) { if (div.nodeName.toLowerCase() == 'div') { if (container == null) { container = window; } this.div = div; var style = mxUtils.getCurrentStyle(div); if (style != null) { this.resizeWidth = style.width == 'auto'; this.resizeHeight = style.height == 'auto'; } mxEvent.addListener(container, 'resize', mxUtils.bind(this, function(evt) { if (!this.handlingResize) { this.handlingResize = true; this.resize(); this.handlingResize = false; } }) ); this.resize(); } }
[ "function", "mxDivResizer", "(", "div", ",", "container", ")", "{", "if", "(", "div", ".", "nodeName", ".", "toLowerCase", "(", ")", "==", "'div'", ")", "{", "if", "(", "container", "==", "null", ")", "{", "container", "=", "window", ";", "}", "this"...
Copyright (c) 2006-2015, JGraph Ltd Copyright (c) 2006-2015, Gaudenz Alder Class: mxDivResizer Maintains the size of a div element in Internet Explorer. This is a workaround for the right and bottom style being ignored in IE. If you need a div to cover the scrollwidth and -height of a document, then you can use this class as follows: (code) var resizer = new mxDivResizer(background); resizer.getDocumentHeight = function() { return document.body.scrollHeight; } resizer.getDocumentWidth = function() { return document.body.scrollWidth; } resizer.resize(); (end) Constructor: mxDivResizer Constructs an object that maintains the size of a div element when the window is being resized. This is only required for Internet Explorer as it ignores the respective stylesheet information for DIV elements. Parameters: div - Reference to the DOM node whose size should be maintained. container - Optional Container that contains the div. Default is the window.
[ "Copyright", "(", "c", ")", "2006", "-", "2015", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2015", "Gaudenz", "Alder", "Class", ":", "mxDivResizer" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L12882-L12914
train
Resizes the given div
[ 30522, 3853, 25630, 4305, 24790, 17629, 1006, 4487, 2615, 1010, 11661, 1007, 1063, 2065, 1006, 4487, 2615, 1012, 13045, 18442, 1012, 2000, 27663, 18992, 3366, 1006, 1007, 1027, 1027, 1005, 4487, 2615, 1005, 1007, 1063, 2065, 1006, 11661, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensibility/Package.js
githubURLFilter
function githubURLFilter(urlInfo) { if (urlInfo.parsed.hostname === "github.com" || urlInfo.parsed.hostname === "www.github.com") { // Is it a URL to the root of a repo? (/user/repo) var match = /^\/[^\/?]+\/([^\/?]+)(\/?)$/.exec(urlInfo.parsed.pathname); if (match) { if (!match[2]) { urlInfo.url += "/"; } urlInfo.url += "archive/master.zip"; urlInfo.filenameHint = match[1] + ".zip"; } else { // Is it a URL directly to the repo's 'master.zip'? (/user/repo/archive/master.zip) match = /^\/[^\/?]+\/([^\/?]+)\/archive\/master.zip$/.exec(urlInfo.parsed.pathname); if (match) { urlInfo.filenameHint = match[1] + ".zip"; } } } }
javascript
function githubURLFilter(urlInfo) { if (urlInfo.parsed.hostname === "github.com" || urlInfo.parsed.hostname === "www.github.com") { // Is it a URL to the root of a repo? (/user/repo) var match = /^\/[^\/?]+\/([^\/?]+)(\/?)$/.exec(urlInfo.parsed.pathname); if (match) { if (!match[2]) { urlInfo.url += "/"; } urlInfo.url += "archive/master.zip"; urlInfo.filenameHint = match[1] + ".zip"; } else { // Is it a URL directly to the repo's 'master.zip'? (/user/repo/archive/master.zip) match = /^\/[^\/?]+\/([^\/?]+)\/archive\/master.zip$/.exec(urlInfo.parsed.pathname); if (match) { urlInfo.filenameHint = match[1] + ".zip"; } } } }
[ "function", "githubURLFilter", "(", "urlInfo", ")", "{", "if", "(", "urlInfo", ".", "parsed", ".", "hostname", "===", "\"github.com\"", "||", "urlInfo", ".", "parsed", ".", "hostname", "===", "\"www.github.com\"", ")", "{", "// Is it a URL to the root of a repo? (/u...
Special case handling to make the common case of downloading from GitHub easier; modifies 'urlInfo' as needed. Converts a bare GitHub repo URL to the corresponding master ZIP URL; or if given a direct master ZIP URL already, sets a nicer download filename (both cases use the repo name). @param {{url:string, parsed:Array.<string>, filenameHint:string}} urlInfo
[ "Special", "case", "handling", "to", "make", "the", "common", "case", "of", "downloading", "from", "GitHub", "easier", ";", "modifies", "urlInfo", "as", "needed", ".", "Converts", "a", "bare", "GitHub", "repo", "URL", "to", "the", "corresponding", "master", ...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/Package.js#L209-L228
train
Filter out the github URL
[ 30522, 3853, 21025, 2705, 12083, 3126, 10270, 4014, 3334, 1006, 24471, 4115, 14876, 1007, 1063, 2065, 1006, 24471, 30524, 1012, 4012, 1000, 1007, 1063, 1013, 1013, 2003, 2009, 1037, 24471, 2140, 2000, 1996, 7117, 1997, 1037, 16360, 2080, 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...
nodejs/node-gyp
lib/install.js
cb
function cb (err) { if (cb.done) return cb.done = true if (err) { log.warn('install', 'got an error, rolling back install') // roll-back the install if anything went wrong gyp.commands.remove([ release.versionDir ], function () { callback(err) }) } else { callback(null, release.version) } }
javascript
function cb (err) { if (cb.done) return cb.done = true if (err) { log.warn('install', 'got an error, rolling back install') // roll-back the install if anything went wrong gyp.commands.remove([ release.versionDir ], function () { callback(err) }) } else { callback(null, release.version) } }
[ "function", "cb", "(", "err", ")", "{", "if", "(", "cb", ".", "done", ")", "return", "cb", ".", "done", "=", "true", "if", "(", "err", ")", "{", "log", ".", "warn", "(", "'install'", ",", "'got an error, rolling back install'", ")", "// roll-back the ins...
ensure no double-callbacks happen
[ "ensure", "no", "double", "-", "callbacks", "happen" ]
721eb691cf15556cc2700eda0558d5bad5f84232
https://github.com/nodejs/node-gyp/blob/721eb691cf15556cc2700eda0558d5bad5f84232/lib/install.js#L29-L41
train
check if we have an error
[ 30522, 3853, 17324, 1006, 9413, 2099, 1007, 1063, 2065, 1006, 17324, 1012, 2589, 1007, 2709, 17324, 1012, 2589, 1027, 2995, 2065, 1006, 9413, 2099, 1007, 1063, 8833, 1012, 11582, 1006, 1005, 16500, 1005, 1010, 1005, 2288, 2019, 7561, 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...
ColorlibHQ/AdminLTE
plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
isHostMethod
function isHostMethod(o, p) { var t = typeof o[p]; return t == FUNCTION || (!!(t == OBJECT && o[p])) || t == "unknown"; }
javascript
function isHostMethod(o, p) { var t = typeof o[p]; return t == FUNCTION || (!!(t == OBJECT && o[p])) || t == "unknown"; }
[ "function", "isHostMethod", "(", "o", ",", "p", ")", "{", "var", "t", "=", "typeof", "o", "[", "p", "]", ";", "return", "t", "==", "FUNCTION", "||", "(", "!", "!", "(", "t", "==", "OBJECT", "&&", "o", "[", "p", "]", ")", ")", "||", "t", "==...
Trio of functions taken from Peter Michaux's article: http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
[ "Trio", "of", "functions", "taken", "from", "Peter", "Michaux", "s", "article", ":", "http", ":", "//", "peter", ".", "michaux", ".", "ca", "/", "articles", "/", "feature", "-", "detection", "-", "state", "-", "of", "-", "the", "-", "art", "-", "brow...
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L112-L115
train
Check if a method is a host method
[ 30522, 3853, 2003, 15006, 21246, 11031, 7716, 1006, 1051, 1010, 1052, 1007, 1063, 13075, 1056, 1027, 2828, 11253, 1051, 1031, 1052, 1033, 1025, 2709, 1056, 1027, 1027, 3853, 1064, 1064, 1006, 999, 999, 1006, 1056, 1027, 1027, 4874, 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...
Dogfalo/materialize
dist/js/materialize.js
Tabs
function Tabs(el, options) { _classCallCheck(this, Tabs); var _this22 = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options)); _this22.el.M_Tabs = _this22; /** * Options for the Tabs * @member Tabs#options * @prop {Number} duration * @prop {Function} onShow * @prop {Boolean} swipeable * @prop {Number} responsiveThreshold */ _this22.options = $.extend({}, Tabs.defaults, options); // Setup _this22.$tabLinks = _this22.$el.children('li.tab').children('a'); _this22.index = 0; _this22._setupActiveTabLink(); // Setup tabs content if (_this22.options.swipeable) { _this22._setupSwipeableTabs(); } else { _this22._setupNormalTabs(); } // Setup tabs indicator after content to ensure accurate widths _this22._setTabsAndTabWidth(); _this22._createIndicator(); _this22._setupEventHandlers(); return _this22; }
javascript
function Tabs(el, options) { _classCallCheck(this, Tabs); var _this22 = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options)); _this22.el.M_Tabs = _this22; /** * Options for the Tabs * @member Tabs#options * @prop {Number} duration * @prop {Function} onShow * @prop {Boolean} swipeable * @prop {Number} responsiveThreshold */ _this22.options = $.extend({}, Tabs.defaults, options); // Setup _this22.$tabLinks = _this22.$el.children('li.tab').children('a'); _this22.index = 0; _this22._setupActiveTabLink(); // Setup tabs content if (_this22.options.swipeable) { _this22._setupSwipeableTabs(); } else { _this22._setupNormalTabs(); } // Setup tabs indicator after content to ensure accurate widths _this22._setTabsAndTabWidth(); _this22._createIndicator(); _this22._setupEventHandlers(); return _this22; }
[ "function", "Tabs", "(", "el", ",", "options", ")", "{", "_classCallCheck", "(", "this", ",", "Tabs", ")", ";", "var", "_this22", "=", "_possibleConstructorReturn", "(", "this", ",", "(", "Tabs", ".", "__proto__", "||", "Object", ".", "getPrototypeOf", "("...
Construct Tabs instance @constructor @param {Element} el @param {Object} options
[ "Construct", "Tabs", "instance" ]
1122efadad8f1433d404696f7613e3cc13fb83a4
https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L3991-L4026
train
Construct Tabs instance
[ 30522, 3853, 21628, 2015, 1006, 3449, 1010, 7047, 1007, 1063, 1035, 2465, 9289, 29358, 11012, 1006, 2023, 1010, 21628, 2015, 1007, 1025, 13075, 1035, 2023, 19317, 1027, 1035, 2825, 8663, 3367, 6820, 16761, 13465, 14287, 1006, 2023, 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...
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function() { if (!this._oControl || this._bLoading) { return; } // if max item count not reached or if we do not know the count var oBinding = this._oControl.getBinding("items"); if (oBinding && !oBinding.isLengthFinal() || this._iLimit < this._oControl.getMaxItemsCount()) { // The GrowingEnablement has its own busy indicator. Do not show the busy indicator, if existing, of the parent control. if (this._oControl.getMetadata().hasProperty("enableBusyIndicator")) { this._bParentEnableBusyIndicator = this._oControl.getEnableBusyIndicator(); this._oControl.setEnableBusyIndicator(false); } this._iLimit += this._oControl.getGrowingThreshold(); this._updateTriggerDelayed(true); this.updateItems("Growing"); } }
javascript
function() { if (!this._oControl || this._bLoading) { return; } // if max item count not reached or if we do not know the count var oBinding = this._oControl.getBinding("items"); if (oBinding && !oBinding.isLengthFinal() || this._iLimit < this._oControl.getMaxItemsCount()) { // The GrowingEnablement has its own busy indicator. Do not show the busy indicator, if existing, of the parent control. if (this._oControl.getMetadata().hasProperty("enableBusyIndicator")) { this._bParentEnableBusyIndicator = this._oControl.getEnableBusyIndicator(); this._oControl.setEnableBusyIndicator(false); } this._iLimit += this._oControl.getGrowingThreshold(); this._updateTriggerDelayed(true); this.updateItems("Growing"); } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_oControl", "||", "this", ".", "_bLoading", ")", "{", "return", ";", "}", "// if max item count not reached or if we do not know the count", "var", "oBinding", "=", "this", ".", "_oControl", ".", "getBindi...
call to request new page
[ "call", "to", "request", "new", "page" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L173-L191
train
Updates the count of items in the control
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 999, 2023, 1012, 1035, 1051, 8663, 13181, 2140, 1064, 1064, 2023, 1012, 1035, 1038, 18570, 1007, 1063, 2709, 1025, 1065, 1013, 1013, 2065, 4098, 8875, 4175, 2025, 2584, 2030, 2065, 2057, 2079, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/node/selenium-webdriver/net/portprober.js
execute
function execute(cmd) { return new Promise((resolve, reject) => { exec(cmd, function(err, stdout) { if (err) { reject(err); } else { resolve(stdout); } }); }); }
javascript
function execute(cmd) { return new Promise((resolve, reject) => { exec(cmd, function(err, stdout) { if (err) { reject(err); } else { resolve(stdout); } }); }); }
[ "function", "execute", "(", "cmd", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "exec", "(", "cmd", ",", "function", "(", "err", ",", "stdout", ")", "{", "if", "(", "err", ")", "{", "reject", "(", "err...
Executes a command and returns its output if it succeeds. @param {string} cmd The command to execute. @return {!Promise<string>} A promise that will resolve with the command's stdout data.
[ "Executes", "a", "command", "and", "returns", "its", "output", "if", "it", "succeeds", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/net/portprober.js#L65-L75
train
Execute a command
[ 30522, 3853, 15389, 1006, 4642, 2094, 1007, 1063, 2709, 2047, 4872, 1006, 1006, 10663, 1010, 15454, 1007, 1027, 1028, 1063, 4654, 8586, 1006, 4642, 2094, 1010, 3853, 1006, 9413, 2099, 1010, 2358, 26797, 2102, 1007, 1063, 2065, 1006, 9413, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
plugins/previewers/prism-previewers.js
function(prefix, func, values) { if (values[0].indexOf('at') < 0) { // Looks like old syntax // Default values var position = 'center'; var shape = 'ellipse'; var size = 'farthest-corner'; if (/\bcenter|top|right|bottom|left\b|^\d+/.test(values[0])) { // Found a position // Remove angle value, if any position = values.shift().replace(/\s*-?\d+(?:rad|deg)\s*/, ''); } if (/\bcircle|ellipse|closest|farthest|contain|cover\b/.test(values[0])) { // Found a shape and/or size var shapeSizeParts = values.shift().split(/\s+/); if (shapeSizeParts[0] && (shapeSizeParts[0] === 'circle' || shapeSizeParts[0] === 'ellipse')) { shape = shapeSizeParts.shift(); } if (shapeSizeParts[0]) { size = shapeSizeParts.shift(); } // Old keywords are converted to their synonyms if (size === 'cover') { size = 'farthest-corner'; } else if (size === 'contain') { size = 'clothest-side'; } } return func + '(' + shape + ' ' + size + ' at ' + position + ',' + values.join(',') + ')'; } return func + '(' + values.join(',') + ')'; }
javascript
function(prefix, func, values) { if (values[0].indexOf('at') < 0) { // Looks like old syntax // Default values var position = 'center'; var shape = 'ellipse'; var size = 'farthest-corner'; if (/\bcenter|top|right|bottom|left\b|^\d+/.test(values[0])) { // Found a position // Remove angle value, if any position = values.shift().replace(/\s*-?\d+(?:rad|deg)\s*/, ''); } if (/\bcircle|ellipse|closest|farthest|contain|cover\b/.test(values[0])) { // Found a shape and/or size var shapeSizeParts = values.shift().split(/\s+/); if (shapeSizeParts[0] && (shapeSizeParts[0] === 'circle' || shapeSizeParts[0] === 'ellipse')) { shape = shapeSizeParts.shift(); } if (shapeSizeParts[0]) { size = shapeSizeParts.shift(); } // Old keywords are converted to their synonyms if (size === 'cover') { size = 'farthest-corner'; } else if (size === 'contain') { size = 'clothest-side'; } } return func + '(' + shape + ' ' + size + ' at ' + position + ',' + values.join(',') + ')'; } return func + '(' + values.join(',') + ')'; }
[ "function", "(", "prefix", ",", "func", ",", "values", ")", "{", "if", "(", "values", "[", "0", "]", ".", "indexOf", "(", "'at'", ")", "<", "0", ")", "{", "// Looks like old syntax", "// Default values", "var", "position", "=", "'center'", ";", "var", ...
Returns a W3C-valid radial gradient @param {string} prefix Vendor prefix if any ("-moz-", "-webkit-", etc.) @param {string} func Gradient function name ("linear-gradient") @param {string[]} values Array of the gradient function parameters (["0deg", "red 0%", "blue 100%"])
[ "Returns", "a", "W3C", "-", "valid", "radial", "gradient" ]
acceb3b56f0e8362a7ef274dbd85b17611df2ec4
https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/plugins/previewers/prism-previewers.js#L74-L109
train
Returns a function that will be used to generate a new function
[ 30522, 3853, 1006, 17576, 1010, 4569, 2278, 1010, 5300, 1007, 1063, 2065, 1006, 5300, 1031, 1014, 1033, 1012, 5950, 11253, 1006, 1005, 2012, 1005, 1007, 1026, 1014, 1007, 1063, 1013, 1013, 3504, 2066, 2214, 20231, 1013, 1013, 12398, 5300, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
postmanlabs/newman
lib/run/options.js
function (value, options, callback) { if (!value.length) { return callback(); // avoids empty string or array } if (Array.isArray(value) && value.length === 1) { return callback(null, value[0]); // avoids using multipleIdOrName strategy for a single item array } callback(null, value); }
javascript
function (value, options, callback) { if (!value.length) { return callback(); // avoids empty string or array } if (Array.isArray(value) && value.length === 1) { return callback(null, value[0]); // avoids using multipleIdOrName strategy for a single item array } callback(null, value); }
[ "function", "(", "value", ",", "options", ",", "callback", ")", "{", "if", "(", "!", "value", ".", "length", ")", "{", "return", "callback", "(", ")", ";", "// avoids empty string or array", "}", "if", "(", "Array", ".", "isArray", "(", "value", ")", "...
Helper function to sanitize folder option. @param {String[]|String} value - The list of folders to execute @param {Object} options - The set of wrapped options. @param {Function} callback - The callback function invoked to mark the end of the folder load routine. @returns {*}
[ "Helper", "function", "to", "sanitize", "folder", "option", "." ]
c05a5a1e82aa3c2021e94ba09e627ba4718af69e
https://github.com/postmanlabs/newman/blob/c05a5a1e82aa3c2021e94ba09e627ba4718af69e/lib/run/options.js#L240-L250
train
returns the id of the record
[ 30522, 3853, 1006, 3643, 1010, 7047, 1010, 2655, 5963, 1007, 1063, 2065, 1006, 999, 3643, 1012, 3091, 1007, 1063, 2709, 2655, 5963, 1006, 1007, 1025, 1013, 1013, 26777, 4064, 5164, 2030, 9140, 1065, 2065, 1006, 9140, 1012, 18061, 11335, 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...
vuejs/vue-devtools
src/backend/index.js
processInjected
function processInjected (instance) { const injected = instance.$options.inject if (injected) { return Object.keys(injected).map(key => { return { key, type: 'injected', value: instance[key] } }) } else { return [] } }
javascript
function processInjected (instance) { const injected = instance.$options.inject if (injected) { return Object.keys(injected).map(key => { return { key, type: 'injected', value: instance[key] } }) } else { return [] } }
[ "function", "processInjected", "(", "instance", ")", "{", "const", "injected", "=", "instance", ".", "$options", ".", "inject", "if", "(", "injected", ")", "{", "return", "Object", ".", "keys", "(", "injected", ")", ".", "map", "(", "key", "=>", "{", "...
Process Vuex getters. @param {Vue} instance @return {Array}
[ "Process", "Vuex", "getters", "." ]
4de4b86388453cd07f0c1bf967d43a4dd4b011c9
https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/index.js#L761-L775
train
Process injected terms
[ 30522, 3853, 2832, 2378, 24455, 1006, 6013, 1007, 1063, 9530, 3367, 19737, 1027, 6013, 1012, 1002, 7047, 1012, 1999, 20614, 2065, 1006, 19737, 1007, 1063, 2709, 4874, 1012, 6309, 1006, 19737, 1007, 1012, 4949, 1006, 3145, 1027, 1028, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
push_defaults_array
function push_defaults_array(target, defaults) { for(var j = 0; j != target.length; ++j) { var w = target[j]; for(var i=0; i != defaults.length; ++i) { var z = defaults[i]; if(w[z[0]] == null) w[z[0]] = z[1]; else switch(z[2]) { case "bool": if(typeof w[z[0]] == "string") w[z[0]] = parsexmlbool(w[z[0]]); break; case "int": if(typeof w[z[0]] == "string") w[z[0]] = parseInt(w[z[0]], 10); break; } } } }
javascript
function push_defaults_array(target, defaults) { for(var j = 0; j != target.length; ++j) { var w = target[j]; for(var i=0; i != defaults.length; ++i) { var z = defaults[i]; if(w[z[0]] == null) w[z[0]] = z[1]; else switch(z[2]) { case "bool": if(typeof w[z[0]] == "string") w[z[0]] = parsexmlbool(w[z[0]]); break; case "int": if(typeof w[z[0]] == "string") w[z[0]] = parseInt(w[z[0]], 10); break; } } } }
[ "function", "push_defaults_array", "(", "target", ",", "defaults", ")", "{", "for", "(", "var", "j", "=", "0", ";", "j", "!=", "target", ".", "length", ";", "++", "j", ")", "{", "var", "w", "=", "target", "[", "j", "]", ";", "for", "(", "var", ...
/* 18.2.3 (CT_CustomWorkbookView) Defaults /*var CustomWBViewDef = [ ['autoUpdate', 'false'], ['changesSavedWin', 'false'], ['includeHiddenRowCol', 'true'], ['includePrintSettings', 'true'], ['maximized', 'false'], ['minimized', 'false'], ['onlySync', 'false'], ['personalView', 'false'], ['showComments', 'commIndicator'], ['showFormulaBar', 'true'], ['showHorizontalScroll', 'true'], ['showObjects', 'all'], ['showSheetTabs', 'true'], ['showStatusbar', 'true'], ['showVerticalScroll', 'true'], ['tabRatio', '600'], ['xWindow', '0'], ['yWindow', '0'] ];
[ "/", "*", "18", ".", "2", ".", "3", "(", "CT_CustomWorkbookView", ")", "Defaults", "/", "*", "var", "CustomWBViewDef", "=", "[", "[", "autoUpdate", "false", "]", "[", "changesSavedWin", "false", "]", "[", "includeHiddenRowCol", "true", "]", "[", "includePr...
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L14467-L14477
train
push_defaults_array - push defaults to target
[ 30522, 3853, 5245, 1035, 12398, 2015, 1035, 9140, 1006, 4539, 1010, 12398, 2015, 1007, 1063, 2005, 1006, 13075, 1046, 1027, 1014, 1025, 1046, 999, 1027, 4539, 1012, 3091, 1025, 1009, 1009, 1046, 1007, 1063, 13075, 1059, 1027, 4539, 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...
angular/material
src/components/datepicker/js/calendar.spec.js
applyDateChange
function applyDateChange() { $timeout.flush(); $material.flushOutstandingAnimations(); // Internally, the calendar sets scrollTop to scroll to the month for a change. // The handler for that scroll won't be invoked unless we manually trigger it. var activeViewController = calendarMonthController || calendarYearController; if (activeViewController) { angular.element(activeViewController.calendarScroller).triggerHandler('scroll'); } // Need this to handle the nextTick when setting first scroll. $timeout.flush(); }
javascript
function applyDateChange() { $timeout.flush(); $material.flushOutstandingAnimations(); // Internally, the calendar sets scrollTop to scroll to the month for a change. // The handler for that scroll won't be invoked unless we manually trigger it. var activeViewController = calendarMonthController || calendarYearController; if (activeViewController) { angular.element(activeViewController.calendarScroller).triggerHandler('scroll'); } // Need this to handle the nextTick when setting first scroll. $timeout.flush(); }
[ "function", "applyDateChange", "(", ")", "{", "$timeout", ".", "flush", "(", ")", ";", "$material", ".", "flushOutstandingAnimations", "(", ")", ";", "// Internally, the calendar sets scrollTop to scroll to the month for a change.", "// The handler for that scroll won't be invoke...
To apply a change in the date, a scope $apply() AND a manual triggering of animation callbacks is necessary.
[ "To", "apply", "a", "change", "in", "the", "date", "a", "scope", "$apply", "()", "AND", "a", "manual", "triggering", "of", "animation", "callbacks", "is", "necessary", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.spec.js#L18-L31
train
This function is called when the calendar changes. It is called when the calendar changes.
[ 30522, 3853, 6611, 13701, 22305, 2063, 1006, 1007, 1063, 1002, 2051, 5833, 1012, 13862, 1006, 1007, 1025, 1002, 3430, 1012, 13862, 12166, 5794, 4667, 7088, 28649, 2015, 1006, 1007, 1025, 1013, 1013, 16058, 1010, 1996, 8094, 4520, 17186, 143...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/modules/es.string.split.js
function (regexp, limit) { var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit); if (res.done) return res.value; var rx = anObject(regexp); var S = String(this); var C = speciesConstructor(rx, RegExp); var unicodeMatching = rx.unicode; var flags = (rx.ignoreCase ? 'i' : '') + (rx.multiline ? 'm' : '') + (rx.unicode ? 'u' : '') + (SUPPORTS_Y ? 'y' : 'g'); // ^(? + rx + ) is needed, in combination with some S slicing, to // simulate the 'y' flag. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; if (lim === 0) return []; if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : []; var p = 0; var q = 0; var A = []; while (q < S.length) { splitter.lastIndex = SUPPORTS_Y ? q : 0; var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q)); var e; if ( z === null || (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p ) { q = advanceStringIndex(S, q, unicodeMatching); } else { A.push(S.slice(p, q)); if (A.length === lim) return A; for (var i = 1; i <= z.length - 1; i++) { A.push(z[i]); if (A.length === lim) return A; } q = p = e; } } A.push(S.slice(p)); return A; }
javascript
function (regexp, limit) { var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit); if (res.done) return res.value; var rx = anObject(regexp); var S = String(this); var C = speciesConstructor(rx, RegExp); var unicodeMatching = rx.unicode; var flags = (rx.ignoreCase ? 'i' : '') + (rx.multiline ? 'm' : '') + (rx.unicode ? 'u' : '') + (SUPPORTS_Y ? 'y' : 'g'); // ^(? + rx + ) is needed, in combination with some S slicing, to // simulate the 'y' flag. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; if (lim === 0) return []; if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : []; var p = 0; var q = 0; var A = []; while (q < S.length) { splitter.lastIndex = SUPPORTS_Y ? q : 0; var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q)); var e; if ( z === null || (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p ) { q = advanceStringIndex(S, q, unicodeMatching); } else { A.push(S.slice(p, q)); if (A.length === lim) return A; for (var i = 1; i <= z.length - 1; i++) { A.push(z[i]); if (A.length === lim) return A; } q = p = e; } } A.push(S.slice(p)); return A; }
[ "function", "(", "regexp", ",", "limit", ")", "{", "var", "res", "=", "maybeCallNative", "(", "internalSplit", ",", "regexp", ",", "this", ",", "limit", ",", "internalSplit", "!==", "nativeSplit", ")", ";", "if", "(", "res", ".", "done", ")", "return", ...
`RegExp.prototype[@@split]` method https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split NOTE: This cannot be properly polyfilled in engines that don't support the 'y' flag.
[ "RegExp", ".", "prototype", "[" ]
fe7c8511a6d27d03a9b8e075b3351416aae95c58
https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/es.string.split.js#L90-L134
train
Split a string into a list of matches
[ 30522, 3853, 1006, 19723, 10288, 2361, 1010, 5787, 1007, 1063, 13075, 24501, 1027, 2672, 9289, 19666, 8082, 1006, 4722, 13102, 15909, 1010, 19723, 10288, 2361, 1010, 2023, 1010, 5787, 1010, 4722, 13102, 15909, 999, 1027, 1027, 12493, 24759, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mui-org/material-ui
packages/material-ui-codemod/src/v1.0.0/color-imports.js
transformNamespaceImports
function transformNamespaceImports(j, root, importPath, targetPath) { // find namespace imports root.find(j.ImportDeclaration, { source: { value: importPath } }).forEach(importDeclaration => { const namespaceImportSpecifier = importDeclaration.node.specifiers.find( specifier => specifier.type === 'ImportNamespaceSpecifier', ); if (namespaceImportSpecifier) { j(importDeclaration).replaceWith( j.importDeclaration( [j.importNamespaceSpecifier(j.identifier(namespaceImportSpecifier.local.name))], j.literal(targetPath), ), ); transformMemberExpressions(namespaceImportSpecifier.local.name, j, root); } }); }
javascript
function transformNamespaceImports(j, root, importPath, targetPath) { // find namespace imports root.find(j.ImportDeclaration, { source: { value: importPath } }).forEach(importDeclaration => { const namespaceImportSpecifier = importDeclaration.node.specifiers.find( specifier => specifier.type === 'ImportNamespaceSpecifier', ); if (namespaceImportSpecifier) { j(importDeclaration).replaceWith( j.importDeclaration( [j.importNamespaceSpecifier(j.identifier(namespaceImportSpecifier.local.name))], j.literal(targetPath), ), ); transformMemberExpressions(namespaceImportSpecifier.local.name, j, root); } }); }
[ "function", "transformNamespaceImports", "(", "j", ",", "root", ",", "importPath", ",", "targetPath", ")", "{", "// find namespace imports", "root", ".", "find", "(", "j", ".", "ImportDeclaration", ",", "{", "source", ":", "{", "value", ":", "importPath", "}",...
Replace all namespace imports. e.g. import * as colors from 'material-ui/styles/colors' @param {jscodeshift_api_object} j @param {jscodeshift_ast_object} root @param {string} importPath @param {string} targetPath
[ "Replace", "all", "namespace", "imports", ".", "e", ".", "g", ".", "import", "*", "as", "colors", "from", "material", "-", "ui", "/", "styles", "/", "colors" ]
1555e52367835946382fbf2a8f681de71318915d
https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-codemod/src/v1.0.0/color-imports.js#L132-L148
train
transform the import path to the target path
[ 30522, 3853, 10938, 18442, 23058, 5714, 25378, 1006, 1046, 1010, 7117, 1010, 12324, 15069, 1010, 4539, 15069, 1007, 1063, 1013, 1013, 2424, 3415, 15327, 17589, 7117, 1012, 2424, 1006, 1046, 1012, 12324, 3207, 20464, 25879, 3258, 1010, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.f/src/sap/f/GridContainerSettings.js
cssSizeToPx
function cssSizeToPx(sCssSize) { if (sCssSize === 0 || sCssSize === "0") { return 0; } var aMatch = sCssSize.match(/^(\d+(\.\d+)?)(px|rem)$/), iValue; if (aMatch) { if (aMatch[3] === "px") { iValue = parseFloat(aMatch[1]); } else { iValue = Rem.toPx(parseFloat(aMatch[1])); } } else { Log.error("Css size '" + sCssSize + "' is not supported for GridContainer. Only 'px' and 'rem' are supported."); iValue = NaN; } return Math.ceil(iValue); }
javascript
function cssSizeToPx(sCssSize) { if (sCssSize === 0 || sCssSize === "0") { return 0; } var aMatch = sCssSize.match(/^(\d+(\.\d+)?)(px|rem)$/), iValue; if (aMatch) { if (aMatch[3] === "px") { iValue = parseFloat(aMatch[1]); } else { iValue = Rem.toPx(parseFloat(aMatch[1])); } } else { Log.error("Css size '" + sCssSize + "' is not supported for GridContainer. Only 'px' and 'rem' are supported."); iValue = NaN; } return Math.ceil(iValue); }
[ "function", "cssSizeToPx", "(", "sCssSize", ")", "{", "if", "(", "sCssSize", "===", "0", "||", "sCssSize", "===", "\"0\"", ")", "{", "return", "0", ";", "}", "var", "aMatch", "=", "sCssSize", ".", "match", "(", "/", "^(\\d+(\\.\\d+)?)(px|rem)$", "/", ")"...
Converts the given css size to its corresponding 'px' value. @private @param {string} sCssSize The css size to parse. For example '5rem'. @returns {int} The size in 'px'. The result is rounded up with Math.ceil(). Returns NaN if the size can not be parsed.
[ "Converts", "the", "given", "css", "size", "to", "its", "corresponding", "px", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/GridContainerSettings.js#L22-L41
train
Converts a CSS size to px
[ 30522, 3853, 20116, 18719, 4371, 14399, 2595, 1006, 8040, 4757, 5332, 4371, 1007, 1063, 2065, 1006, 8040, 4757, 5332, 4371, 1027, 1027, 1027, 1014, 1064, 1064, 8040, 4757, 5332, 4371, 1027, 1027, 1027, 1000, 1014, 1000, 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...
testing-library/dom-testing-library
src/events.js
setNativeValue
function setNativeValue(element, value) { const {set: valueSetter} = Object.getOwnPropertyDescriptor(element, 'value') || {} const prototype = Object.getPrototypeOf(element) const {set: prototypeValueSetter} = Object.getOwnPropertyDescriptor(prototype, 'value') || {} if (prototypeValueSetter && valueSetter !== prototypeValueSetter) { prototypeValueSetter.call(element, value) } /* istanbul ignore next (I don't want to bother) */ else if (valueSetter) { valueSetter.call(element, value) } else { throw new Error('The given element does not have a value setter') } }
javascript
function setNativeValue(element, value) { const {set: valueSetter} = Object.getOwnPropertyDescriptor(element, 'value') || {} const prototype = Object.getPrototypeOf(element) const {set: prototypeValueSetter} = Object.getOwnPropertyDescriptor(prototype, 'value') || {} if (prototypeValueSetter && valueSetter !== prototypeValueSetter) { prototypeValueSetter.call(element, value) } /* istanbul ignore next (I don't want to bother) */ else if (valueSetter) { valueSetter.call(element, value) } else { throw new Error('The given element does not have a value setter') } }
[ "function", "setNativeValue", "(", "element", ",", "value", ")", "{", "const", "{", "set", ":", "valueSetter", "}", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "element", ",", "'value'", ")", "||", "{", "}", "const", "prototype", "=", "Object", "....
function written after some investigation here: https://github.com/facebook/react/issues/10135#issuecomment-401496776
[ "function", "written", "after", "some", "investigation", "here", ":", "https", ":", "//", "github", ".", "com", "/", "facebook", "/", "react", "/", "issues", "/", "10135#issuecomment", "-", "401496776" ]
fcb2cbcffb7aff6ecff3be8731168c86eee82ce1
https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/events.js#L360-L373
train
Set the native value of an element
[ 30522, 3853, 2275, 19833, 3512, 10175, 5657, 1006, 5783, 1010, 3643, 1007, 1063, 9530, 3367, 1063, 2275, 1024, 5300, 7585, 2099, 1065, 1027, 4874, 1012, 2131, 12384, 21572, 4842, 3723, 6155, 23235, 2953, 1006, 5783, 1010, 1005, 3643, 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...
semantic-release/semantic-release
lib/git.js
isRefInHistory
async function isRefInHistory(ref, execaOpts) { try { await execa('git', ['merge-base', '--is-ancestor', ref, 'HEAD'], execaOpts); return true; } catch (error) { if (error.code === 1) { return false; } debug(error); throw error; } }
javascript
async function isRefInHistory(ref, execaOpts) { try { await execa('git', ['merge-base', '--is-ancestor', ref, 'HEAD'], execaOpts); return true; } catch (error) { if (error.code === 1) { return false; } debug(error); throw error; } }
[ "async", "function", "isRefInHistory", "(", "ref", ",", "execaOpts", ")", "{", "try", "{", "await", "execa", "(", "'git'", ",", "[", "'merge-base'", ",", "'--is-ancestor'", ",", "ref", ",", "'HEAD'", "]", ",", "execaOpts", ")", ";", "return", "true", ";"...
Verify if the `ref` is in the direct history of the current branch. @param {String} ref The reference to look for. @param {Object} [execaOpts] Options to pass to `execa`. @return {Boolean} `true` if the reference is in the history of the current branch, falsy otherwise.
[ "Verify", "if", "the", "ref", "is", "in", "the", "direct", "history", "of", "the", "current", "branch", "." ]
edf382f88838ed543c0b76cb6c914cca1fc1ddd1
https://github.com/semantic-release/semantic-release/blob/edf382f88838ed543c0b76cb6c914cca1fc1ddd1/lib/git.js#L43-L55
train
Check if a reference is in the history of the branch
[ 30522, 2004, 6038, 2278, 3853, 2003, 2890, 16294, 24158, 7062, 1006, 25416, 1010, 4654, 19281, 7361, 3215, 1007, 1063, 3046, 1063, 26751, 4654, 19281, 1006, 1005, 21025, 2102, 1005, 1010, 1031, 1005, 13590, 1011, 2918, 1005, 1010, 1005, 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
src/ol/format/GPX.js
applyLayoutOptions
function applyLayoutOptions(layoutOptions, flatCoordinates, ends) { let layout = GeometryLayout.XY; let stride = 2; if (layoutOptions.hasZ && layoutOptions.hasM) { layout = GeometryLayout.XYZM; stride = 4; } else if (layoutOptions.hasZ) { layout = GeometryLayout.XYZ; stride = 3; } else if (layoutOptions.hasM) { layout = GeometryLayout.XYM; stride = 3; } if (stride !== 4) { for (let i = 0, ii = flatCoordinates.length / 4; i < ii; i++) { flatCoordinates[i * stride] = flatCoordinates[i * 4]; flatCoordinates[i * stride + 1] = flatCoordinates[i * 4 + 1]; if (layoutOptions.hasZ) { flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 2]; } if (layoutOptions.hasM) { flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 3]; } } flatCoordinates.length = flatCoordinates.length / 4 * stride; if (ends) { for (let i = 0, ii = ends.length; i < ii; i++) { ends[i] = ends[i] / 4 * stride; } } } return layout; }
javascript
function applyLayoutOptions(layoutOptions, flatCoordinates, ends) { let layout = GeometryLayout.XY; let stride = 2; if (layoutOptions.hasZ && layoutOptions.hasM) { layout = GeometryLayout.XYZM; stride = 4; } else if (layoutOptions.hasZ) { layout = GeometryLayout.XYZ; stride = 3; } else if (layoutOptions.hasM) { layout = GeometryLayout.XYM; stride = 3; } if (stride !== 4) { for (let i = 0, ii = flatCoordinates.length / 4; i < ii; i++) { flatCoordinates[i * stride] = flatCoordinates[i * 4]; flatCoordinates[i * stride + 1] = flatCoordinates[i * 4 + 1]; if (layoutOptions.hasZ) { flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 2]; } if (layoutOptions.hasM) { flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 3]; } } flatCoordinates.length = flatCoordinates.length / 4 * stride; if (ends) { for (let i = 0, ii = ends.length; i < ii; i++) { ends[i] = ends[i] / 4 * stride; } } } return layout; }
[ "function", "applyLayoutOptions", "(", "layoutOptions", ",", "flatCoordinates", ",", "ends", ")", "{", "let", "layout", "=", "GeometryLayout", ".", "XY", ";", "let", "stride", "=", "2", ";", "if", "(", "layoutOptions", ".", "hasZ", "&&", "layoutOptions", "."...
Choose GeometryLayout based on flags in layoutOptions and adjust flatCoordinates and ends arrays by shrinking them accordingly (removing unused zero entries). @param {LayoutOptions} layoutOptions Layout options. @param {Array<number>} flatCoordinates Flat coordinates. @param {Array<number>=} ends Ends. @return {GeometryLayout} Layout.
[ "Choose", "GeometryLayout", "based", "on", "flags", "in", "layoutOptions", "and", "adjust", "flatCoordinates", "and", "ends", "arrays", "by", "shrinking", "them", "accordingly", "(", "removing", "unused", "zero", "entries", ")", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/GPX.js#L528-L560
train
Apply layout options to the coordinates
[ 30522, 3853, 6611, 8485, 5833, 7361, 9285, 1006, 9621, 7361, 9285, 1010, 4257, 3597, 8551, 28184, 1010, 4515, 1007, 1063, 2292, 9621, 1027, 10988, 8485, 5833, 1012, 1060, 2100, 1025, 2292, 18045, 1027, 1016, 1025, 2065, 1006, 9621, 7361, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/aggregation-layers/src/utils/gpu-grid-aggregation/grid-aggregation-utils.js
parseGridData
function parseGridData(data, getPosition, getWeight = null) { const pointCount = count(data); const positions = new Float32Array(pointCount * 2); const positions64xyLow = new Float32Array(pointCount * 2); const weightValues = new Float32Array(pointCount * 3); let yMin = Infinity; let yMax = -Infinity; let xMin = Infinity; let xMax = -Infinity; let y; let x; const {iterable, objectInfo} = createIterable(data); for (const object of iterable) { objectInfo.index++; const position = getPosition(object, objectInfo); const {index} = objectInfo; x = position[0]; y = position[1]; positions[index * 2] = x; positions[index * 2 + 1] = y; positions64xyLow[index * 2] = fp64LowPart(x); positions64xyLow[index * 2 + 1] = fp64LowPart(y); const weight = getWeight ? getWeight(object, objectInfo) : DEFAULT_WEIGHT; // Aggregator expects each weight is an array of size 3 if (Array.isArray(weight)) { weightValues[index * 3] = weight[0]; weightValues[index * 3 + 1] = weight[1]; weightValues[index * 3 + 2] = weight[2]; } else { // backward compitability weightValues[index * 3] = weight; } if (Number.isFinite(y) && Number.isFinite(x)) { yMin = y < yMin ? y : yMin; yMax = y > yMax ? y : yMax; xMin = x < xMin ? x : xMin; xMax = x > xMax ? x : xMax; } } const weights = { weight1: { size: 1, operation: AGGREGATION_OPERATION.SUM, needMax: true, values: weightValues } }; const boundingBox = {xMin, xMax, yMin, yMax}; return { positions, positions64xyLow, weights, boundingBox }; }
javascript
function parseGridData(data, getPosition, getWeight = null) { const pointCount = count(data); const positions = new Float32Array(pointCount * 2); const positions64xyLow = new Float32Array(pointCount * 2); const weightValues = new Float32Array(pointCount * 3); let yMin = Infinity; let yMax = -Infinity; let xMin = Infinity; let xMax = -Infinity; let y; let x; const {iterable, objectInfo} = createIterable(data); for (const object of iterable) { objectInfo.index++; const position = getPosition(object, objectInfo); const {index} = objectInfo; x = position[0]; y = position[1]; positions[index * 2] = x; positions[index * 2 + 1] = y; positions64xyLow[index * 2] = fp64LowPart(x); positions64xyLow[index * 2 + 1] = fp64LowPart(y); const weight = getWeight ? getWeight(object, objectInfo) : DEFAULT_WEIGHT; // Aggregator expects each weight is an array of size 3 if (Array.isArray(weight)) { weightValues[index * 3] = weight[0]; weightValues[index * 3 + 1] = weight[1]; weightValues[index * 3 + 2] = weight[2]; } else { // backward compitability weightValues[index * 3] = weight; } if (Number.isFinite(y) && Number.isFinite(x)) { yMin = y < yMin ? y : yMin; yMax = y > yMax ? y : yMax; xMin = x < xMin ? x : xMin; xMax = x > xMax ? x : xMax; } } const weights = { weight1: { size: 1, operation: AGGREGATION_OPERATION.SUM, needMax: true, values: weightValues } }; const boundingBox = {xMin, xMax, yMin, yMax}; return { positions, positions64xyLow, weights, boundingBox }; }
[ "function", "parseGridData", "(", "data", ",", "getPosition", ",", "getWeight", "=", "null", ")", "{", "const", "pointCount", "=", "count", "(", "data", ")", ";", "const", "positions", "=", "new", "Float32Array", "(", "pointCount", "*", "2", ")", ";", "c...
Parse input data to build positions, wights and bounding box. /* eslint-disable max-statements
[ "Parse", "input", "data", "to", "build", "positions", "wights", "and", "bounding", "box", ".", "/", "*", "eslint", "-", "disable", "max", "-", "statements" ]
a2010448b7f268bbd03617b812334c68a6b9e5b2
https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/aggregation-layers/src/utils/gpu-grid-aggregation/grid-aggregation-utils.js#L86-L145
train
Parse a grid of data
[ 30522, 3853, 11968, 3366, 16523, 3593, 2850, 2696, 1006, 2951, 1010, 2131, 26994, 1010, 2131, 11179, 1027, 19701, 1007, 1063, 9530, 3367, 2391, 3597, 16671, 1027, 4175, 1006, 2951, 1007, 1025, 9530, 3367, 4460, 1027, 2047, 14257, 16703, 290...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-warning-comments.js
checkComment
function checkComment(node) { if (astUtils.isDirectiveComment(node) && selfConfigRegEx.test(node.value)) { return; } const matches = commentContainsWarningTerm(node.value); matches.forEach(matchedTerm => { context.report({ node, message: "Unexpected '{{matchedTerm}}' comment.", data: { matchedTerm } }); }); }
javascript
function checkComment(node) { if (astUtils.isDirectiveComment(node) && selfConfigRegEx.test(node.value)) { return; } const matches = commentContainsWarningTerm(node.value); matches.forEach(matchedTerm => { context.report({ node, message: "Unexpected '{{matchedTerm}}' comment.", data: { matchedTerm } }); }); }
[ "function", "checkComment", "(", "node", ")", "{", "if", "(", "astUtils", ".", "isDirectiveComment", "(", "node", ")", "&&", "selfConfigRegEx", ".", "test", "(", "node", ".", "value", ")", ")", "{", "return", ";", "}", "const", "matches", "=", "commentCo...
Checks the specified node for matching warning comments and reports them. @param {ASTNode} node The AST node being checked. @returns {void} undefined.
[ "Checks", "the", "specified", "node", "for", "matching", "warning", "comments", "and", "reports", "them", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-warning-comments.js#L134-L150
train
Check comment for an invalid comment
[ 30522, 3853, 4638, 9006, 3672, 1006, 13045, 1007, 1063, 2065, 1006, 2004, 8525, 3775, 4877, 1012, 2003, 4305, 2890, 15277, 9006, 3672, 1006, 13045, 1007, 1004, 1004, 2969, 8663, 8873, 17603, 3351, 2595, 1012, 3231, 1006, 13045, 1012, 3643, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/JSUtils/ScopeManager.js
handleTimedOut
function handleTimedOut(response) { var detectedExclusions = PreferencesManager.get("jscodehints.detectedExclusions") || [], filePath = response.file; // Don't exclude the file currently being edited if (isFileBeingEdited(filePath)) { return; } // Handle file that is already excluded if (detectedExclusions.indexOf(filePath) !== -1) { console.log("JavaScriptCodeHints.handleTimedOut: file already in detectedExclusions array timed out: " + filePath); return; } // Save detected exclusion in project prefs so no further time is wasted on it detectedExclusions.push(filePath); PreferencesManager.set("jscodehints.detectedExclusions", detectedExclusions, { location: { scope: "project" } }); // Show informational dialog Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_INFO, Strings.DETECTED_EXCLUSION_TITLE, StringUtils.format( Strings.DETECTED_EXCLUSION_INFO, StringUtils.breakableUrl(filePath) ), [ { className : Dialogs.DIALOG_BTN_CLASS_PRIMARY, id : Dialogs.DIALOG_BTN_OK, text : Strings.OK } ] ); }
javascript
function handleTimedOut(response) { var detectedExclusions = PreferencesManager.get("jscodehints.detectedExclusions") || [], filePath = response.file; // Don't exclude the file currently being edited if (isFileBeingEdited(filePath)) { return; } // Handle file that is already excluded if (detectedExclusions.indexOf(filePath) !== -1) { console.log("JavaScriptCodeHints.handleTimedOut: file already in detectedExclusions array timed out: " + filePath); return; } // Save detected exclusion in project prefs so no further time is wasted on it detectedExclusions.push(filePath); PreferencesManager.set("jscodehints.detectedExclusions", detectedExclusions, { location: { scope: "project" } }); // Show informational dialog Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_INFO, Strings.DETECTED_EXCLUSION_TITLE, StringUtils.format( Strings.DETECTED_EXCLUSION_INFO, StringUtils.breakableUrl(filePath) ), [ { className : Dialogs.DIALOG_BTN_CLASS_PRIMARY, id : Dialogs.DIALOG_BTN_OK, text : Strings.OK } ] ); }
[ "function", "handleTimedOut", "(", "response", ")", "{", "var", "detectedExclusions", "=", "PreferencesManager", ".", "get", "(", "\"jscodehints.detectedExclusions\"", ")", "||", "[", "]", ",", "filePath", "=", "response", ".", "file", ";", "// Don't exclude the fil...
Handle timed out inference @param {{path: string, type: string}} response - the response from node domain
[ "Handle", "timed", "out", "inference" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L756-L792
train
Handle timed out
[ 30522, 3853, 5047, 7292, 26797, 2102, 1006, 3433, 1007, 1063, 13075, 11156, 10288, 20464, 22016, 1027, 18394, 24805, 4590, 1012, 2131, 1006, 1000, 1046, 9363, 25383, 18447, 2015, 1012, 11156, 10288, 20464, 22016, 1000, 1007, 1064, 1064, 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...
eslint/eslint
lib/rules/capitalized-comments.js
createRegExpForIgnorePatterns
function createRegExpForIgnorePatterns(normalizedOptions) { Object.keys(normalizedOptions).forEach(key => { const ignorePatternStr = normalizedOptions[key].ignorePattern; if (ignorePatternStr) { const regExp = RegExp(`^\\s*(?:${ignorePatternStr})`, "u"); normalizedOptions[key].ignorePatternRegExp = regExp; } }); }
javascript
function createRegExpForIgnorePatterns(normalizedOptions) { Object.keys(normalizedOptions).forEach(key => { const ignorePatternStr = normalizedOptions[key].ignorePattern; if (ignorePatternStr) { const regExp = RegExp(`^\\s*(?:${ignorePatternStr})`, "u"); normalizedOptions[key].ignorePatternRegExp = regExp; } }); }
[ "function", "createRegExpForIgnorePatterns", "(", "normalizedOptions", ")", "{", "Object", ".", "keys", "(", "normalizedOptions", ")", ".", "forEach", "(", "key", "=>", "{", "const", "ignorePatternStr", "=", "normalizedOptions", "[", "key", "]", ".", "ignorePatter...
Creates a regular expression for each ignorePattern defined in the rule options. This is done in order to avoid invoking the RegExp constructor repeatedly. @param {Object} normalizedOptions The normalized rule options. @returns {void}
[ "Creates", "a", "regular", "expression", "for", "each", "ignorePattern", "defined", "in", "the", "rule", "options", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/capitalized-comments.js#L89-L99
train
Create a regular expression for ignore patterns
[ 30522, 3853, 3443, 2890, 30524, 9285, 1007, 1063, 4874, 1012, 6309, 1006, 3671, 3550, 7361, 9285, 1007, 1012, 18921, 6776, 1006, 3145, 1027, 1028, 1063, 9530, 3367, 8568, 4502, 12079, 23808, 2099, 1027, 3671, 3550, 7361, 9285, 1031, 3145, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
bower_components/jquery-sparkline/src/base.js
function (el, x, y) { var currentRegion = this.currentRegion, highlightEnabled = !this.options.get('disableHighlight'), newRegion; if (x > this.canvasWidth || y > this.canvasHeight || x < 0 || y < 0) { return null; } newRegion = this.getRegion(el, x, y); if (currentRegion !== newRegion) { if (currentRegion !== undefined && highlightEnabled) { this.removeHighlight(); } this.currentRegion = newRegion; if (newRegion !== undefined && highlightEnabled) { this.renderHighlight(); } return true; } return false; }
javascript
function (el, x, y) { var currentRegion = this.currentRegion, highlightEnabled = !this.options.get('disableHighlight'), newRegion; if (x > this.canvasWidth || y > this.canvasHeight || x < 0 || y < 0) { return null; } newRegion = this.getRegion(el, x, y); if (currentRegion !== newRegion) { if (currentRegion !== undefined && highlightEnabled) { this.removeHighlight(); } this.currentRegion = newRegion; if (newRegion !== undefined && highlightEnabled) { this.renderHighlight(); } return true; } return false; }
[ "function", "(", "el", ",", "x", ",", "y", ")", "{", "var", "currentRegion", "=", "this", ".", "currentRegion", ",", "highlightEnabled", "=", "!", "this", ".", "options", ".", "get", "(", "'disableHighlight'", ")", ",", "newRegion", ";", "if", "(", "x"...
Highlight an item based on the moused-over x,y co-ordinate
[ "Highlight", "an", "item", "based", "on", "the", "moused", "-", "over", "x", "y", "co", "-", "ordinate" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jquery-sparkline/src/base.js#L224-L243
train
Returns true if region is different from current region
[ 30522, 3853, 1006, 3449, 1010, 1060, 1010, 1061, 1007, 1063, 13075, 2783, 23784, 1027, 2023, 1012, 2783, 23784, 1010, 12944, 8189, 23242, 1027, 999, 2023, 1012, 7047, 1012, 2131, 1006, 1005, 4487, 19150, 4048, 5603, 7138, 1005, 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...
Dogfalo/materialize
extras/noUiSlider/nouislider.js
addClass
function addClass ( el, className ) { if ( el.classList ) { el.classList.add(className); } else { el.className += ' ' + className; } }
javascript
function addClass ( el, className ) { if ( el.classList ) { el.classList.add(className); } else { el.className += ' ' + className; } }
[ "function", "addClass", "(", "el", ",", "className", ")", "{", "if", "(", "el", ".", "classList", ")", "{", "el", ".", "classList", ".", "add", "(", "className", ")", ";", "}", "else", "{", "el", ".", "className", "+=", "' '", "+", "className", ";"...
http://youmightnotneedjquery.com/#add_class
[ "http", ":", "//", "youmightnotneedjquery", ".", "com", "/", "#add_class" ]
1122efadad8f1433d404696f7613e3cc13fb83a4
https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L110-L116
train
Add class to element
[ 30522, 3853, 5587, 26266, 1006, 3449, 1010, 2465, 18442, 1007, 1063, 2065, 1006, 3449, 1012, 2465, 9863, 1007, 1063, 3449, 1012, 2465, 9863, 1012, 5587, 1006, 2465, 18442, 1007, 1025, 1065, 2842, 1063, 3449, 1012, 2465, 18442, 1009, 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...
SeleniumHQ/selenium
javascript/node/selenium-webdriver/net/portprober.js
findWindowsPortRange
async function findWindowsPortRange() { // First, check if we're running on XP. If this initial command fails, // we just fallback on the default IANA range. let stdout = await execute('cmd.exe /c ver'); if (/Windows XP/.test(stdout)) { // TODO: Try to read these values from the registry. return {min: 1025, max: 5000}; } else { stdout = await execute('netsh int ipv4 show dynamicport tcp'); /* > netsh int ipv4 show dynamicport tcp Protocol tcp Dynamic Port Range --------------------------------- Start Port : 49152 Number of Ports : 16384 */ let range = stdout.split(/\n/) .filter((line) => /.*:\s*\d+/.test(line)) .map((line) => Number(line.split(/:\s*/)[1])); return { min: range[0], max: range[0] + range[1] }; } }
javascript
async function findWindowsPortRange() { // First, check if we're running on XP. If this initial command fails, // we just fallback on the default IANA range. let stdout = await execute('cmd.exe /c ver'); if (/Windows XP/.test(stdout)) { // TODO: Try to read these values from the registry. return {min: 1025, max: 5000}; } else { stdout = await execute('netsh int ipv4 show dynamicport tcp'); /* > netsh int ipv4 show dynamicport tcp Protocol tcp Dynamic Port Range --------------------------------- Start Port : 49152 Number of Ports : 16384 */ let range = stdout.split(/\n/) .filter((line) => /.*:\s*\d+/.test(line)) .map((line) => Number(line.split(/:\s*/)[1])); return { min: range[0], max: range[0] + range[1] }; } }
[ "async", "function", "findWindowsPortRange", "(", ")", "{", "// First, check if we're running on XP. If this initial command fails,", "// we just fallback on the default IANA range.", "let", "stdout", "=", "await", "execute", "(", "'cmd.exe /c ver'", ")", ";", "if", "(", "/", ...
Computes the ephemeral port range for a Windows system. @return {!Promise<{min: number, max: number}>} A promise that will resolve with the ephemeral port range on the current system.
[ "Computes", "the", "ephemeral", "port", "range", "for", "a", "Windows", "system", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/net/portprober.js#L115-L138
train
Find the range of the Windows ports.
[ 30522, 2004, 6038, 2278, 3853, 2424, 11101, 15568, 6442, 24388, 2063, 30524, 1013, 2034, 1010, 4638, 2065, 2057, 1005, 2128, 2770, 2006, 26726, 1012, 2065, 2023, 3988, 3094, 11896, 1010, 1013, 1013, 2057, 2074, 2991, 5963, 2006, 1996, 12398...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
LLK/scratch-blocks
i18n/js_to_json.js
function (str) { str = str.split('Blockly.Msg.')[1].split(' '); return { key: str[0], value: str .splice(2, str.length) .join(' ') .slice(1, -2) // strip off initial ', and ending '; .replace(/\\'/g, "'") }; }
javascript
function (str) { str = str.split('Blockly.Msg.')[1].split(' '); return { key: str[0], value: str .splice(2, str.length) .join(' ') .slice(1, -2) // strip off initial ', and ending '; .replace(/\\'/g, "'") }; }
[ "function", "(", "str", ")", "{", "str", "=", "str", ".", "split", "(", "'Blockly.Msg.'", ")", "[", "1", "]", ".", "split", "(", "' '", ")", ";", "return", "{", "key", ":", "str", "[", "0", "]", ",", "value", ":", "str", ".", "splice", "(", "...
Extract key and value from message definition
[ "Extract", "key", "and", "value", "from", "message", "definition" ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/i18n/js_to_json.js#L22-L32
train
parse the key value pair
[ 30522, 3853, 1006, 2358, 2099, 1007, 1063, 2358, 2099, 1027, 2358, 2099, 1012, 3975, 1006, 1005, 3796, 2135, 1012, 5796, 2290, 1012, 1005, 1007, 1031, 1015, 1033, 1012, 3975, 1006, 1005, 1005, 1007, 1025, 2709, 1063, 3145, 1024, 2358, 209...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
openlayers/openlayers
src/ol/format/WKT.js
encode
function encode(geom) { let type = geom.getType(); const geometryEncoder = GeometryEncoder[type]; const enc = geometryEncoder(geom); type = type.toUpperCase(); if (typeof /** @type {?} */ (geom).getFlatCoordinates === 'function') { const dimInfo = encodeGeometryLayout(/** @type {import("../geom/SimpleGeometry.js").default} */ (geom)); if (dimInfo.length > 0) { type += ' ' + dimInfo; } } if (enc.length === 0) { return type + ' ' + EMPTY; } return type + '(' + enc + ')'; }
javascript
function encode(geom) { let type = geom.getType(); const geometryEncoder = GeometryEncoder[type]; const enc = geometryEncoder(geom); type = type.toUpperCase(); if (typeof /** @type {?} */ (geom).getFlatCoordinates === 'function') { const dimInfo = encodeGeometryLayout(/** @type {import("../geom/SimpleGeometry.js").default} */ (geom)); if (dimInfo.length > 0) { type += ' ' + dimInfo; } } if (enc.length === 0) { return type + ' ' + EMPTY; } return type + '(' + enc + ')'; }
[ "function", "encode", "(", "geom", ")", "{", "let", "type", "=", "geom", ".", "getType", "(", ")", ";", "const", "geometryEncoder", "=", "GeometryEncoder", "[", "type", "]", ";", "const", "enc", "=", "geometryEncoder", "(", "geom", ")", ";", "type", "=...
Encode a geometry as WKT. @param {!import("../geom/Geometry.js").default} geom The geometry to encode. @return {string} WKT string for the geometry.
[ "Encode", "a", "geometry", "as", "WKT", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/WKT.js#L859-L874
train
Encode geometry
[ 30522, 3853, 4372, 16044, 1006, 20248, 2213, 1007, 1063, 2292, 2828, 1027, 20248, 2213, 1012, 2131, 13874, 1006, 1007, 1025, 9530, 3367, 10988, 2368, 16044, 2099, 1027, 10988, 2368, 16044, 2099, 1031, 2828, 1033, 1025, 9530, 3367, 4372, 227...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
vuejs/vuepress
packages/@vuepress/core/lib/node/build/index.js
renderAttrs
function renderAttrs (attrs = {}) { const keys = Object.keys(attrs) if (keys.length) { return ' ' + keys.map(name => `${name}="${escape(attrs[name])}"`).join(' ') } else { return '' } }
javascript
function renderAttrs (attrs = {}) { const keys = Object.keys(attrs) if (keys.length) { return ' ' + keys.map(name => `${name}="${escape(attrs[name])}"`).join(' ') } else { return '' } }
[ "function", "renderAttrs", "(", "attrs", "=", "{", "}", ")", "{", "const", "keys", "=", "Object", ".", "keys", "(", "attrs", ")", "if", "(", "keys", ".", "length", ")", "{", "return", "' '", "+", "keys", ".", "map", "(", "name", "=>", "`", "${", ...
Render html attributes @param {Object} attrs @returns {string}
[ "Render", "html", "attributes" ]
15784acc0cf2e87de3c147895b2c3977b0195d78
https://github.com/vuejs/vuepress/blob/15784acc0cf2e87de3c147895b2c3977b0195d78/packages/@vuepress/core/lib/node/build/index.js#L218-L225
train
Render the attributes of the node
[ 30522, 3853, 17552, 19321, 2869, 1006, 2012, 16344, 2015, 1027, 1063, 1065, 1007, 1063, 9530, 3367, 6309, 1027, 4874, 1012, 6309, 1006, 2012, 16344, 2015, 1007, 2065, 1006, 6309, 1012, 3091, 1007, 1063, 2709, 1005, 1005, 1009, 6309, 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 (sBrowserLanguage) { if (!sBrowserLanguage || typeof sBrowserLanguage !== "string") { return ""; } var nIndex = sBrowserLanguage.indexOf("-"); if ((nIndex < 0) && (sBrowserLanguage.length <= 2)) { return sBrowserLanguage.toUpperCase(); } if (nIndex > 0 && nIndex <= 2) { return sBrowserLanguage.substring(0, nIndex).toUpperCase(); } return ""; }
javascript
function (sBrowserLanguage) { if (!sBrowserLanguage || typeof sBrowserLanguage !== "string") { return ""; } var nIndex = sBrowserLanguage.indexOf("-"); if ((nIndex < 0) && (sBrowserLanguage.length <= 2)) { return sBrowserLanguage.toUpperCase(); } if (nIndex > 0 && nIndex <= 2) { return sBrowserLanguage.substring(0, nIndex).toUpperCase(); } return ""; }
[ "function", "(", "sBrowserLanguage", ")", "{", "if", "(", "!", "sBrowserLanguage", "||", "typeof", "sBrowserLanguage", "!==", "\"string\"", ")", "{", "return", "\"\"", ";", "}", "var", "nIndex", "=", "sBrowserLanguage", ".", "indexOf", "(", "\"-\"", ")", ";"...
Converts the browser language into a 2-character ISO 639-1 language. If the browser language is in format RFC4646, the first part will be used: For example en-us will be converted to EN. If the browser language already is in ISO 639-1, it will be returned after an upper case conversion: For example de will be converted to DE. @param {String} sBrowserLanguage - Language in RFC4646 @returns {String} Language in ISO 639-1. Empty string if conversion was not successful @public @function @name sap.ui.fl.Utils.convertBrowserLanguageToISO639_1
[ "Converts", "the", "browser", "language", "into", "a", "2", "-", "character", "ISO", "639", "-", "1", "language", ".", "If", "the", "browser", "language", "is", "in", "format", "RFC4646", "the", "first", "part", "will", "be", "used", ":", "For", "example...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L766-L780
train
Converts the browser language to uppercase
[ 30522, 3853, 1006, 24829, 10524, 8043, 25023, 6692, 3351, 1007, 1063, 2065, 1006, 999, 24829, 10524, 8043, 25023, 6692, 3351, 1064, 1064, 2828, 11253, 24829, 10524, 8043, 25023, 6692, 3351, 999, 1027, 1027, 1000, 5164, 1000, 1007, 1063, 270...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/Agents/DOMHelpers.js
_findEach
function _findEach(src, match, quotes, comments, callback) { var from = 0; var to; while (from < src.length) { to = _find(src, match, from, quotes, comments); if (to < 0) { to = src.length; } callback(src.substr(from, to - from)); from = to + 1; } }
javascript
function _findEach(src, match, quotes, comments, callback) { var from = 0; var to; while (from < src.length) { to = _find(src, match, from, quotes, comments); if (to < 0) { to = src.length; } callback(src.substr(from, to - from)); from = to + 1; } }
[ "function", "_findEach", "(", "src", ",", "match", ",", "quotes", ",", "comments", ",", "callback", ")", "{", "var", "from", "=", "0", ";", "var", "to", ";", "while", "(", "from", "<", "src", ".", "length", ")", "{", "to", "=", "_find", "(", "src...
Callback iterator using `_find`
[ "Callback", "iterator", "using", "_find" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMHelpers.js#L99-L110
train
Find all the alternatives in a source string
[ 30522, 3853, 1035, 2424, 5243, 2818, 1006, 5034, 2278, 1010, 2674, 1010, 16614, 1010, 7928, 1010, 2655, 5963, 1007, 1063, 13075, 2013, 1027, 1014, 1025, 13075, 2000, 1025, 2096, 1006, 2013, 1026, 5034, 2278, 1012, 3091, 1007, 1063, 2000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/support/apps/contentbrowser/controller/LayerContentMaster.controller.js
function (oRouteMatch) { var that = this; var mRouteArguments = oRouteMatch.getParameter("arguments"); this.sLayer = mRouteArguments.layer; this.sNamespace = mRouteArguments.namespace || ""; var oPage = this.getView().getContent()[0]; oPage.setBusy(true); that.sNamespace = decodeURIComponent(that.sNamespace); oPage.setTitle(this._shortenNamespace()); LRepConnector.getContent(that.sLayer, that.sNamespace).then( that._onContentReceived.bind(that, oPage), function(){ oPage.setBusy(false); }).then(function () { LRepConnector.requestPending = false; }); }
javascript
function (oRouteMatch) { var that = this; var mRouteArguments = oRouteMatch.getParameter("arguments"); this.sLayer = mRouteArguments.layer; this.sNamespace = mRouteArguments.namespace || ""; var oPage = this.getView().getContent()[0]; oPage.setBusy(true); that.sNamespace = decodeURIComponent(that.sNamespace); oPage.setTitle(this._shortenNamespace()); LRepConnector.getContent(that.sLayer, that.sNamespace).then( that._onContentReceived.bind(that, oPage), function(){ oPage.setBusy(false); }).then(function () { LRepConnector.requestPending = false; }); }
[ "function", "(", "oRouteMatch", ")", "{", "var", "that", "=", "this", ";", "var", "mRouteArguments", "=", "oRouteMatch", ".", "getParameter", "(", "\"arguments\"", ")", ";", "this", ".", "sLayer", "=", "mRouteArguments", ".", "layer", ";", "this", ".", "sN...
Handler if a route was matched; Checks if the matched route is current route and then requests content from Layered Repository. @param {Object} oRouteMatch - route object specified in the router which was matched via regexp @private
[ "Handler", "if", "a", "route", "was", "matched", ";", "Checks", "if", "the", "matched", "route", "is", "current", "route", "and", "then", "requests", "content", "from", "Layered", "Repository", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L46-L63
train
This method is called when a route matches the content of the route
[ 30522, 3853, 1006, 20298, 10421, 18900, 2818, 1007, 1063, 13075, 2008, 1027, 2023, 1025, 13075, 2720, 5833, 14644, 22850, 11187, 1027, 20298, 10421, 18900, 2818, 1012, 2131, 28689, 22828, 1006, 1000, 9918, 1000, 1007, 1025, 2023, 1012, 20005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laurent22/joplin
ReactNativeClient/lib/reducer.js
handleItemDelete
function handleItemDelete(state, action) { let newState = Object.assign({}, state); const map = { 'FOLDER_DELETE': ['folders', 'selectedFolderId'], 'NOTE_DELETE': ['notes', 'selectedNoteIds'], 'TAG_DELETE': ['tags', 'selectedTagId'], 'SEARCH_DELETE': ['searches', 'selectedSearchId'], }; const listKey = map[action.type][0]; const selectedItemKey = map[action.type][1]; let previousIndex = 0; let newItems = []; const items = state[listKey]; for (let i = 0; i < items.length; i++) { let item = items[i]; if (item.id == action.id) { previousIndex = i; continue; } newItems.push(item); } newState = Object.assign({}, state); newState[listKey] = newItems; if (previousIndex >= newItems.length) { previousIndex = newItems.length - 1; } const newId = previousIndex >= 0 ? newItems[previousIndex].id : null; newState[selectedItemKey] = action.type === 'NOTE_DELETE' ? [newId] : newId; if (!newId && newState.notesParentType !== 'Folder') { newState.notesParentType = 'Folder'; } return newState; }
javascript
function handleItemDelete(state, action) { let newState = Object.assign({}, state); const map = { 'FOLDER_DELETE': ['folders', 'selectedFolderId'], 'NOTE_DELETE': ['notes', 'selectedNoteIds'], 'TAG_DELETE': ['tags', 'selectedTagId'], 'SEARCH_DELETE': ['searches', 'selectedSearchId'], }; const listKey = map[action.type][0]; const selectedItemKey = map[action.type][1]; let previousIndex = 0; let newItems = []; const items = state[listKey]; for (let i = 0; i < items.length; i++) { let item = items[i]; if (item.id == action.id) { previousIndex = i; continue; } newItems.push(item); } newState = Object.assign({}, state); newState[listKey] = newItems; if (previousIndex >= newItems.length) { previousIndex = newItems.length - 1; } const newId = previousIndex >= 0 ? newItems[previousIndex].id : null; newState[selectedItemKey] = action.type === 'NOTE_DELETE' ? [newId] : newId; if (!newId && newState.notesParentType !== 'Folder') { newState.notesParentType = 'Folder'; } return newState; }
[ "function", "handleItemDelete", "(", "state", ",", "action", ")", "{", "let", "newState", "=", "Object", ".", "assign", "(", "{", "}", ",", "state", ")", ";", "const", "map", "=", "{", "'FOLDER_DELETE'", ":", "[", "'folders'", ",", "'selectedFolderId'", ...
When deleting a note, tag or folder
[ "When", "deleting", "a", "note", "tag", "or", "folder" ]
beb428b246cecba4630a3ca57b472f43c0933a43
https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/ReactNativeClient/lib/reducer.js#L119-L159
train
Handle item deletion
[ 30522, 3853, 5047, 4221, 26876, 12260, 2618, 1006, 2110, 1010, 2895, 1007, 1063, 2292, 2739, 12259, 1027, 4874, 1012, 23911, 1006, 1063, 1065, 1010, 2110, 1007, 1025, 9530, 3367, 4949, 1027, 1063, 1005, 19622, 1035, 3972, 12870, 1005, 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...
angular/material
src/core/services/interimElement/interimElement.js
cancel
function cancel(reason, options) { var interim = showingInterims.pop(); if (!interim) { return $q.when(reason); } var cancelAction = interim .remove(reason, true, options || {}) .catch(function(reason) { return reason; }) .finally(function() { hidePromises.splice(hidePromises.indexOf(cancelAction), 1); }); hidePromises.push(cancelAction); // Since AngularJS 1.6.7, promises will be logged to $exceptionHandler when the promise // is not handling the rejection. We create a pseudo catch handler, which will prevent the // promise from being logged to the $exceptionHandler. return interim.deferred.promise.catch(angular.noop); }
javascript
function cancel(reason, options) { var interim = showingInterims.pop(); if (!interim) { return $q.when(reason); } var cancelAction = interim .remove(reason, true, options || {}) .catch(function(reason) { return reason; }) .finally(function() { hidePromises.splice(hidePromises.indexOf(cancelAction), 1); }); hidePromises.push(cancelAction); // Since AngularJS 1.6.7, promises will be logged to $exceptionHandler when the promise // is not handling the rejection. We create a pseudo catch handler, which will prevent the // promise from being logged to the $exceptionHandler. return interim.deferred.promise.catch(angular.noop); }
[ "function", "cancel", "(", "reason", ",", "options", ")", "{", "var", "interim", "=", "showingInterims", ".", "pop", "(", ")", ";", "if", "(", "!", "interim", ")", "{", "return", "$q", ".", "when", "(", "reason", ")", ";", "}", "var", "cancelAction",...
/* @ngdoc method @name $$interimElement.$service#cancel @kind function @description Removes the `$interimElement` from the DOM and rejects the promise returned from `show` @param {*} reason Data to reject the promise with @returns Promise that will be resolved after the element has been removed.
[ "/", "*", "@ngdoc", "method", "@name", "$$interimElement", ".", "$service#cancel", "@kind", "function" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L399-L418
train
Cancels the current interim
[ 30522, 3853, 17542, 1006, 3114, 1010, 7047, 1007, 1063, 13075, 9455, 1027, 4760, 18447, 11124, 5244, 1012, 3769, 1006, 1007, 1025, 2065, 1006, 999, 9455, 1007, 1063, 2709, 1002, 1053, 1012, 2043, 1006, 3114, 1007, 1025, 1065, 13075, 17542, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Inspector/Inspector.js
connect
function connect(socketURL) { disconnect().done(function () { _socket = new WebSocket(socketURL); _socket.onmessage = _onMessage; _socket.onopen = _onConnect; _socket.onclose = _onDisconnect; _socket.onerror = _onError; }); }
javascript
function connect(socketURL) { disconnect().done(function () { _socket = new WebSocket(socketURL); _socket.onmessage = _onMessage; _socket.onopen = _onConnect; _socket.onclose = _onDisconnect; _socket.onerror = _onError; }); }
[ "function", "connect", "(", "socketURL", ")", "{", "disconnect", "(", ")", ".", "done", "(", "function", "(", ")", "{", "_socket", "=", "new", "WebSocket", "(", "socketURL", ")", ";", "_socket", ".", "onmessage", "=", "_onMessage", ";", "_socket", ".", ...
Connect to the remote debugger WebSocket at the given URL. Clients must listen for the `connect` event. @param {string} WebSocket URL
[ "Connect", "to", "the", "remote", "debugger", "WebSocket", "at", "the", "given", "URL", ".", "Clients", "must", "listen", "for", "the", "connect", "event", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Inspector/Inspector.js#L308-L316
train
connect to the specified socket URL
[ 30522, 3853, 7532, 1006, 22278, 3126, 2140, 1007, 1063, 12532, 10087, 6593, 1006, 1007, 1012, 2589, 1006, 3853, 1006, 1007, 1063, 1035, 22278, 1027, 2047, 4773, 6499, 19869, 2102, 1006, 22278, 3126, 2140, 1007, 1025, 1035, 22278, 1012, 2006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/doctools.js
function() { if (document.location.hash && $.browser.mozilla) window.setTimeout(function() { document.location.href += ''; }, 10); }
javascript
function() { if (document.location.hash && $.browser.mozilla) window.setTimeout(function() { document.location.href += ''; }, 10); }
[ "function", "(", ")", "{", "if", "(", "document", ".", "location", ".", "hash", "&&", "$", ".", "browser", ".", "mozilla", ")", "window", ".", "setTimeout", "(", "function", "(", ")", "{", "document", ".", "location", ".", "href", "+=", "''", ";", ...
workaround a firefox stupidity
[ "workaround", "a", "firefox", "stupidity" ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/doctools.js#L168-L173
train
This function is called when the page is loaded
[ 30522, 3853, 1006, 1007, 1063, 2065, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/data/Tree.js
addChild
function addChild(child, node) { var children = node.children; if (child.parentNode === node) { return; } children.push(child); child.parentNode = node; }
javascript
function addChild(child, node) { var children = node.children; if (child.parentNode === node) { return; } children.push(child); child.parentNode = node; }
[ "function", "addChild", "(", "child", ",", "node", ")", "{", "var", "children", "=", "node", ".", "children", ";", "if", "(", "child", ".", "parentNode", "===", "node", ")", "{", "return", ";", "}", "children", ".", "push", "(", "child", ")", ";", ...
It is needed to consider the mess of 'list', 'hostModel' when creating a TreeNote, so this function is not ready and not necessary to be public. @param {(module:echarts/data/Tree~TreeNode|Object)} child
[ "It", "is", "needed", "to", "consider", "the", "mess", "of", "list", "hostModel", "when", "creating", "a", "TreeNote", "so", "this", "function", "is", "not", "ready", "and", "not", "necessary", "to", "be", "public", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/Tree.js#L531-L539
train
Add child node to node
[ 30522, 3853, 5587, 19339, 1006, 2775, 1010, 13045, 1007, 1063, 13075, 2336, 1027, 13045, 1012, 2336, 1025, 2065, 1006, 2775, 1012, 6687, 3630, 3207, 1027, 1027, 1027, 13045, 1007, 1063, 2709, 1025, 1065, 2336, 1012, 5245, 1006, 2775, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/curly.js
needsSemicolon
function needsSemicolon(closingBracket) { const tokenBefore = sourceCode.getTokenBefore(closingBracket); const tokenAfter = sourceCode.getTokenAfter(closingBracket); const lastBlockNode = sourceCode.getNodeByRangeIndex(tokenBefore.range[0]); if (astUtils.isSemicolonToken(tokenBefore)) { // If the last statement already has a semicolon, don't add another one. return false; } if (!tokenAfter) { // If there are no statements after this block, there is no need to add a semicolon. return false; } if (lastBlockNode.type === "BlockStatement" && lastBlockNode.parent.type !== "FunctionExpression" && lastBlockNode.parent.type !== "ArrowFunctionExpression") { /* * If the last node surrounded by curly brackets is a BlockStatement (other than a FunctionExpression or an ArrowFunctionExpression), * don't insert a semicolon. Otherwise, the semicolon would be parsed as a separate statement, which would cause * a SyntaxError if it was followed by `else`. */ return false; } if (tokenBefore.loc.end.line === tokenAfter.loc.start.line) { // If the next token is on the same line, insert a semicolon. return true; } if (/^[([/`+-]/u.test(tokenAfter.value)) { // If the next token starts with a character that would disrupt ASI, insert a semicolon. return true; } if (tokenBefore.type === "Punctuator" && (tokenBefore.value === "++" || tokenBefore.value === "--")) { // If the last token is ++ or --, insert a semicolon to avoid disrupting ASI. return true; } // Otherwise, do not insert a semicolon. return false; }
javascript
function needsSemicolon(closingBracket) { const tokenBefore = sourceCode.getTokenBefore(closingBracket); const tokenAfter = sourceCode.getTokenAfter(closingBracket); const lastBlockNode = sourceCode.getNodeByRangeIndex(tokenBefore.range[0]); if (astUtils.isSemicolonToken(tokenBefore)) { // If the last statement already has a semicolon, don't add another one. return false; } if (!tokenAfter) { // If there are no statements after this block, there is no need to add a semicolon. return false; } if (lastBlockNode.type === "BlockStatement" && lastBlockNode.parent.type !== "FunctionExpression" && lastBlockNode.parent.type !== "ArrowFunctionExpression") { /* * If the last node surrounded by curly brackets is a BlockStatement (other than a FunctionExpression or an ArrowFunctionExpression), * don't insert a semicolon. Otherwise, the semicolon would be parsed as a separate statement, which would cause * a SyntaxError if it was followed by `else`. */ return false; } if (tokenBefore.loc.end.line === tokenAfter.loc.start.line) { // If the next token is on the same line, insert a semicolon. return true; } if (/^[([/`+-]/u.test(tokenAfter.value)) { // If the next token starts with a character that would disrupt ASI, insert a semicolon. return true; } if (tokenBefore.type === "Punctuator" && (tokenBefore.value === "++" || tokenBefore.value === "--")) { // If the last token is ++ or --, insert a semicolon to avoid disrupting ASI. return true; } // Otherwise, do not insert a semicolon. return false; }
[ "function", "needsSemicolon", "(", "closingBracket", ")", "{", "const", "tokenBefore", "=", "sourceCode", ".", "getTokenBefore", "(", "closingBracket", ")", ";", "const", "tokenAfter", "=", "sourceCode", ".", "getTokenAfter", "(", "closingBracket", ")", ";", "cons...
Determines if a semicolon needs to be inserted after removing a set of curly brackets, in order to avoid a SyntaxError. @param {Token} closingBracket The } token @returns {boolean} `true` if a semicolon needs to be inserted after the last statement in the block.
[ "Determines", "if", "a", "semicolon", "needs", "to", "be", "inserted", "after", "removing", "a", "set", "of", "curly", "brackets", "in", "order", "to", "avoid", "a", "SyntaxError", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/curly.js#L161-L208
train
Check if the closing bracket is a semicolon.
[ 30522, 3853, 3791, 3366, 7712, 12898, 2078, 1006, 5494, 10024, 19869, 2102, 1007, 1063, 9530, 3367, 19204, 4783, 29278, 2063, 1027, 3120, 16044, 1012, 2131, 18715, 2368, 30524, 1007, 1025, 9530, 3367, 2197, 23467, 3630, 3207, 1027, 3120, 16...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/protractor
website/docgen/processors/tag-fixer.js
function(doc) { // Skip if the function has a name. if (doc.name) { return doc.name; } try { var node = doc.codeNode; // Is this a simple declaration? "var element = function() {". if (node.declarations && node.declarations.length) { return node.declarations[0].id.name; } // Is this an expression? "elementFinder.find = function() {". if (node.expression) { var parts = []; /** * Recursively create the function name by examining the object property. * @param obj Parsed object. * @return {string} The name of the function. */ function buildName(obj) { if (!obj) { return parts.join('.'); } if (obj.property && obj.property.name) { parts.unshift(obj.property.name); } if (obj.object && obj.object.name) { parts.unshift(obj.object.name); } return buildName(obj.object); } return buildName(node.expression.left); } } catch (e) { console.log('Could not find document name', doc.file, doc.endingLine); } }
javascript
function(doc) { // Skip if the function has a name. if (doc.name) { return doc.name; } try { var node = doc.codeNode; // Is this a simple declaration? "var element = function() {". if (node.declarations && node.declarations.length) { return node.declarations[0].id.name; } // Is this an expression? "elementFinder.find = function() {". if (node.expression) { var parts = []; /** * Recursively create the function name by examining the object property. * @param obj Parsed object. * @return {string} The name of the function. */ function buildName(obj) { if (!obj) { return parts.join('.'); } if (obj.property && obj.property.name) { parts.unshift(obj.property.name); } if (obj.object && obj.object.name) { parts.unshift(obj.object.name); } return buildName(obj.object); } return buildName(node.expression.left); } } catch (e) { console.log('Could not find document name', doc.file, doc.endingLine); } }
[ "function", "(", "doc", ")", "{", "// Skip if the function has a name.", "if", "(", "doc", ".", "name", ")", "{", "return", "doc", ".", "name", ";", "}", "try", "{", "var", "node", "=", "doc", ".", "codeNode", ";", "// Is this a simple declaration? \"var eleme...
Find the name of the function.
[ "Find", "the", "name", "of", "the", "function", "." ]
4f74a4ec753c97adfe955fe468a39286a0a55837
https://github.com/angular/protractor/blob/4f74a4ec753c97adfe955fe468a39286a0a55837/website/docgen/processors/tag-fixer.js#L16-L60
train
Returns the name of the function.
[ 30522, 3853, 1006, 9986, 1007, 1063, 1013, 1013, 13558, 2065, 1996, 3853, 2038, 1037, 2171, 1012, 2065, 1006, 9986, 1012, 2171, 1007, 1063, 2709, 9986, 1012, 2171, 1025, 1065, 3046, 1063, 13075, 13045, 1027, 9986, 1012, 3642, 3630, 3207, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
webdriverio/webdriverio
packages/wdio-sync/src/index.js
function (fn, repeatTest = 0, args = []) { /** * if a new hook gets executed we can assume that all commands should have finised * with exception of timeouts where `commandIsRunning` will never be reset but here */ // commandIsRunning = false return new Promise((resolve, reject) => { try { const res = fn.apply(this, args) resolve(res) } catch (e) { if (repeatTest) { return resolve(executeSync(fn, --repeatTest, args)) } /** * no need to modify stack if no stack available */ if (!e.stack) { return reject(e) } e.stack = e.stack.split('\n').filter(STACKTRACE_FILTER_FN).join('\n') reject(e) } }) }
javascript
function (fn, repeatTest = 0, args = []) { /** * if a new hook gets executed we can assume that all commands should have finised * with exception of timeouts where `commandIsRunning` will never be reset but here */ // commandIsRunning = false return new Promise((resolve, reject) => { try { const res = fn.apply(this, args) resolve(res) } catch (e) { if (repeatTest) { return resolve(executeSync(fn, --repeatTest, args)) } /** * no need to modify stack if no stack available */ if (!e.stack) { return reject(e) } e.stack = e.stack.split('\n').filter(STACKTRACE_FILTER_FN).join('\n') reject(e) } }) }
[ "function", "(", "fn", ",", "repeatTest", "=", "0", ",", "args", "=", "[", "]", ")", "{", "/**\n * if a new hook gets executed we can assume that all commands should have finised\n * with exception of timeouts where `commandIsRunning` will never be reset but here\n */", "//...
execute test or hook synchronously @param {Function} fn spec or hook method @param {Number} repeatTest number of retries @return {Promise} that gets resolved once test/hook is done or was retried enough
[ "execute", "test", "or", "hook", "synchronously" ]
8de7f1a3b12d97282ed4ee2e25e4c3c9a8940ac1
https://github.com/webdriverio/webdriverio/blob/8de7f1a3b12d97282ed4ee2e25e4c3c9a8940ac1/packages/wdio-sync/src/index.js#L19-L46
train
Execute a function in the current thread
[ 30522, 3853, 1006, 1042, 2078, 1010, 9377, 22199, 1027, 1014, 1010, 12098, 5620, 1027, 1031, 1033, 1007, 1063, 1013, 1008, 1008, 1008, 2065, 1037, 2047, 8103, 4152, 6472, 2057, 2064, 7868, 2008, 2035, 10954, 2323, 2031, 10346, 5084, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
bower_components/ion.rangeSlider/js/ion.rangeSlider.js
function (percent) { var rounded = Math.round(percent / this.coords.p_step) * this.coords.p_step; if (rounded > 100) { rounded = 100; } if (percent === 100) { rounded = 100; } return this.toFixed(rounded); }
javascript
function (percent) { var rounded = Math.round(percent / this.coords.p_step) * this.coords.p_step; if (rounded > 100) { rounded = 100; } if (percent === 100) { rounded = 100; } return this.toFixed(rounded); }
[ "function", "(", "percent", ")", "{", "var", "rounded", "=", "Math", ".", "round", "(", "percent", "/", "this", ".", "coords", ".", "p_step", ")", "*", "this", ".", "coords", ".", "p_step", ";", "if", "(", "rounded", ">", "100", ")", "{", "rounded"...
Round percent value with step @param percent {Number} @returns percent {Number} rounded
[ "Round", "percent", "value", "with", "step" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1843-L1854
train
get a page from a percent
[ 30522, 3853, 1006, 3867, 1007, 1063, 13075, 8352, 1027, 8785, 1012, 2461, 1006, 3867, 1013, 2023, 1012, 2522, 8551, 2015, 1012, 1052, 1035, 3357, 1007, 1008, 2023, 1012, 2522, 8551, 2015, 1012, 1052, 1035, 3357, 1025, 2065, 1006, 8352, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
docs/app/js/demoInclude.js
handleDemoIndexFile
function handleDemoIndexFile() { files.index.contentsPromise.then(function(contents) { demoContainer = angular.element( '<div class="demo-content ' + ngModule + '">' ); var isStandalone = !!ngModule; var demoScope; var demoCompileService; if (isStandalone) { angular.bootstrap(demoContainer[0], [ngModule]); demoScope = demoContainer.scope(); demoCompileService = demoContainer.injector().get('$compile'); scope.$on('$destroy', function() { demoScope.$destroy(); }); } else { demoScope = scope.$new(); demoCompileService = $compile; } // Once everything is loaded, put the demo into the DOM $q.all([ handleDemoStyles(), handleDemoTemplates() ]).finally(function() { demoScope.$evalAsync(function() { element.append(demoContainer); demoContainer.html(contents); demoCompileService(demoContainer.contents())(demoScope); }); }); }); }
javascript
function handleDemoIndexFile() { files.index.contentsPromise.then(function(contents) { demoContainer = angular.element( '<div class="demo-content ' + ngModule + '">' ); var isStandalone = !!ngModule; var demoScope; var demoCompileService; if (isStandalone) { angular.bootstrap(demoContainer[0], [ngModule]); demoScope = demoContainer.scope(); demoCompileService = demoContainer.injector().get('$compile'); scope.$on('$destroy', function() { demoScope.$destroy(); }); } else { demoScope = scope.$new(); demoCompileService = $compile; } // Once everything is loaded, put the demo into the DOM $q.all([ handleDemoStyles(), handleDemoTemplates() ]).finally(function() { demoScope.$evalAsync(function() { element.append(demoContainer); demoContainer.html(contents); demoCompileService(demoContainer.contents())(demoScope); }); }); }); }
[ "function", "handleDemoIndexFile", "(", ")", "{", "files", ".", "index", ".", "contentsPromise", ".", "then", "(", "function", "(", "contents", ")", "{", "demoContainer", "=", "angular", ".", "element", "(", "'<div class=\"demo-content '", "+", "ngModule", "+", ...
Fetch the index file, and if it contains its own ngModule then bootstrap a new angular app with that ngModule. Otherwise, compile the demo into the current ng-app.
[ "Fetch", "the", "index", "file", "and", "if", "it", "contains", "its", "own", "ngModule", "then", "bootstrap", "a", "new", "angular", "app", "with", "that", "ngModule", ".", "Otherwise", "compile", "the", "demo", "into", "the", "current", "ng", "-", "app",...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/app/js/demoInclude.js#L25-L60
train
Handle the demo index file
[ 30522, 3853, 8971, 6633, 28765, 3207, 2595, 8873, 2571, 1006, 1007, 1063, 6764, 1012, 5950, 1012, 8417, 21572, 28732, 1012, 2059, 1006, 3853, 1006, 8417, 1007, 1063, 9703, 8663, 18249, 2121, 1027, 16108, 1012, 5783, 1006, 1005, 1026, 4487, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-useless-constructor.js
isRedundantSuperCall
function isRedundantSuperCall(body, ctorParams) { return ( isSingleSuperCall(body) && ctorParams.every(isSimple) && ( isSpreadArguments(body[0].expression.arguments) || isPassingThrough(ctorParams, body[0].expression.arguments) ) ); }
javascript
function isRedundantSuperCall(body, ctorParams) { return ( isSingleSuperCall(body) && ctorParams.every(isSimple) && ( isSpreadArguments(body[0].expression.arguments) || isPassingThrough(ctorParams, body[0].expression.arguments) ) ); }
[ "function", "isRedundantSuperCall", "(", "body", ",", "ctorParams", ")", "{", "return", "(", "isSingleSuperCall", "(", "body", ")", "&&", "ctorParams", ".", "every", "(", "isSimple", ")", "&&", "(", "isSpreadArguments", "(", "body", "[", "0", "]", ".", "ex...
Checks whether the constructor body is a redundant super call. @param {Array} body - constructor body content. @param {Array} ctorParams - The params to check against super call. @returns {boolean} true if the construtor body is redundant
[ "Checks", "whether", "the", "constructor", "body", "is", "a", "redundant", "super", "call", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-constructor.js#L128-L137
train
Check if the body is a redundant super call
[ 30522, 3853, 2003, 5596, 18426, 7666, 6279, 2121, 9289, 2140, 1006, 2303, 1010, 14931, 2953, 28689, 5244, 1007, 1063, 2709, 1006, 26354, 2075, 4244, 6279, 2121, 9289, 2140, 1006, 2303, 1007, 1004, 1004, 14931, 2953, 28689, 5244, 1012, 2296,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/async/Targets.js
function (vTargets, vData, sTitleTarget) { var oSequencePromise = Promise.resolve(); return this._display(vTargets, vData, sTitleTarget, oSequencePromise); }
javascript
function (vTargets, vData, sTitleTarget) { var oSequencePromise = Promise.resolve(); return this._display(vTargets, vData, sTitleTarget, oSequencePromise); }
[ "function", "(", "vTargets", ",", "vData", ",", "sTitleTarget", ")", "{", "var", "oSequencePromise", "=", "Promise", ".", "resolve", "(", ")", ";", "return", "this", ".", "_display", "(", "vTargets", ",", "vData", ",", "sTitleTarget", ",", "oSequencePromise"...
Creates a view and puts it in an aggregation of the specified control. @param {string|string[]} vTargets the key of the target as specified in the {@link #constructor}. To display multiple targets you may also pass an array of keys. @param {object} [vData] an object that will be passed to the display event in the data property. If the target has parents, the data will also be passed to them. @param {string} [sTitleTarget] the name of the target from which the title option is taken for firing the {@link sap.ui.core.routing.Targets#event:titleChanged titleChanged} event @private @returns {Promise} resolving with {{name: *, view: *, control: *}|undefined} for every vTargets, object for single, array for multiple
[ "Creates", "a", "view", "and", "puts", "it", "in", "an", "aggregation", "of", "the", "specified", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/async/Targets.js#L23-L26
train
Display the sequence of targets and data.
[ 30522, 3853, 1006, 28879, 2906, 18150, 2015, 1010, 1058, 2850, 2696, 1010, 2358, 4183, 7485, 2906, 18150, 1007, 1063, 13075, 9808, 2063, 4226, 5897, 21572, 28732, 1027, 4872, 1012, 10663, 1006, 1007, 1025, 2709, 2023, 1012, 1035, 4653, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js
function() { if (!this._sLabelText) { this._sLabelText = this._oQueryResult.getEntityType().getLabelOfProperty(this.getName()); } if (!this._sLabelText && this._oQueryResult._oModel._oActivatedWorkarounds.CreateLabelsFromTechnicalNames) { this._sLabelText = odata4analytics.helper.tokenizeNametoLabelText(this.getName()); } return (this._sLabelText == null ? "" : this._sLabelText); }
javascript
function() { if (!this._sLabelText) { this._sLabelText = this._oQueryResult.getEntityType().getLabelOfProperty(this.getName()); } if (!this._sLabelText && this._oQueryResult._oModel._oActivatedWorkarounds.CreateLabelsFromTechnicalNames) { this._sLabelText = odata4analytics.helper.tokenizeNametoLabelText(this.getName()); } return (this._sLabelText == null ? "" : this._sLabelText); }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_sLabelText", ")", "{", "this", ".", "_sLabelText", "=", "this", ".", "_oQueryResult", ".", "getEntityType", "(", ")", ".", "getLabelOfProperty", "(", "this", ".", "getName", "(", ")", ")", ";", ...
Get label @returns {string} The (possibly language-dependent) label text for this dimension @public @function @name sap.ui.model.analytics.odata4analytics.Dimension#getLabelText
[ "Get", "label" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L1786-L1794
train
Returns the label text of the property
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 999, 2023, 1012, 1035, 17584, 20042, 10288, 2102, 1007, 1063, 2023, 1012, 1035, 17584, 20042, 10288, 2102, 1027, 2023, 1012, 1035, 1051, 4226, 2854, 6072, 11314, 1012, 2131, 4765, 3012, 13874, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js
function() { var sOptionString = this.renderUI5FilterArray(this._aConditionUI5Filter); for (var i = -1, aUI5Filter; (aUI5Filter = this._aUI5FilterArray[++i]) !== undefined; ) { sOptionString += (sOptionString == "" ? "" : " and ") + "(" + this.renderUI5FilterArray(aUI5Filter) + ")"; } return sOptionString; }
javascript
function() { var sOptionString = this.renderUI5FilterArray(this._aConditionUI5Filter); for (var i = -1, aUI5Filter; (aUI5Filter = this._aUI5FilterArray[++i]) !== undefined; ) { sOptionString += (sOptionString == "" ? "" : " and ") + "(" + this.renderUI5FilterArray(aUI5Filter) + ")"; } return sOptionString; }
[ "function", "(", ")", "{", "var", "sOptionString", "=", "this", ".", "renderUI5FilterArray", "(", "this", ".", "_aConditionUI5Filter", ")", ";", "for", "(", "var", "i", "=", "-", "1", ",", "aUI5Filter", ";", "(", "aUI5Filter", "=", "this", ".", "_aUI5Fil...
Get the value for the OData system query option $filter corresponding to this expression. @returns {string} The $filter value for the filter expression @public @function @name sap.ui.model.analytics.odata4analytics.FilterExpression#getURIFilterOptionValue
[ "Get", "the", "value", "for", "the", "OData", "system", "query", "option", "$filter", "corresponding", "to", "this", "expression", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L3484-L3490
train
Render the condition UI5 filter
[ 30522, 3853, 1006, 1007, 1063, 13075, 2061, 16790, 3367, 4892, 1027, 2023, 1012, 17552, 10179, 2629, 8873, 21928, 2906, 9447, 1006, 2023, 1012, 1035, 9353, 15422, 22753, 10179, 2629, 8873, 21928, 1007, 1025, 2005, 1006, 13075, 1045, 1027, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
caolan/async
lib/reduce.js
reduce
function reduce(coll, memo, iteratee, callback) { callback = once(callback); var _iteratee = wrapAsync(iteratee); return eachOfSeries(coll, (x, i, iterCb) => { _iteratee(memo, x, (err, v) => { memo = v; iterCb(err); }); }, err => callback(err, memo)); }
javascript
function reduce(coll, memo, iteratee, callback) { callback = once(callback); var _iteratee = wrapAsync(iteratee); return eachOfSeries(coll, (x, i, iterCb) => { _iteratee(memo, x, (err, v) => { memo = v; iterCb(err); }); }, err => callback(err, memo)); }
[ "function", "reduce", "(", "coll", ",", "memo", ",", "iteratee", ",", "callback", ")", "{", "callback", "=", "once", "(", "callback", ")", ";", "var", "_iteratee", "=", "wrapAsync", "(", "iteratee", ")", ";", "return", "eachOfSeries", "(", "coll", ",", ...
Reduces `coll` into a single value using an async `iteratee` to return each successive step. `memo` is the initial state of the reduction. This function only operates in series. For performance reasons, it may make sense to split a call to this function into a parallel map, and then use the normal `Array.prototype.reduce` on the results. This function is for situations where each step in the reduction needs to be async; if you can get the data before reducing it, then it's probably a good idea to do so. @name reduce @static @memberOf module:Collections @method @alias inject @alias foldl @category Collection @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. @param {*} memo - The initial state of the reduction. @param {AsyncFunction} iteratee - A function applied to each item in the array to produce the next step in the reduction. The `iteratee` should complete with the next state of the reduction. If the iteratee complete with an error, the reduction is stopped and the main `callback` is immediately called with the error. Invoked with (memo, item, callback). @param {Function} [callback] - A callback which is called after all the `iteratee` functions have finished. Result is the reduced value. Invoked with (err, result). @returns {Promise} a promise, if no callback is passed @example async.reduce([1,2,3], 0, function(memo, item, callback) { // pointless async: process.nextTick(function() { callback(null, memo + item) }); }, function(err, result) { // result is now equal to the last value of memo, which is 6 });
[ "Reduces", "coll", "into", "a", "single", "value", "using", "an", "async", "iteratee", "to", "return", "each", "successive", "step", ".", "memo", "is", "the", "initial", "state", "of", "the", "reduction", ".", "This", "function", "only", "operates", "in", ...
4330d536c106592139fa82062494c9dba0da1fdb
https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/reduce.js#L47-L56
train
Reduce a collection to a single value.
[ 30522, 3853, 5547, 1006, 8902, 2140, 1010, 24443, 1010, 2009, 22139, 2063, 1010, 2655, 5963, 1007, 1063, 2655, 5963, 1027, 2320, 1006, 2655, 5963, 1007, 1025, 13075, 1035, 2009, 22139, 2063, 1027, 10236, 3022, 6038, 2278, 1006, 2009, 22139,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/axisPointer/modelHelper.js
saveTooltipAxisInfo
function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) { var axisPointerModel = axis.model.getModel('axisPointer', globalAxisPointerModel); var axisPointerShow = axisPointerModel.get('show'); if (!axisPointerShow || ( axisPointerShow === 'auto' && !fromTooltip && !isHandleTrigger(axisPointerModel) )) { return; } if (triggerTooltip == null) { triggerTooltip = axisPointerModel.get('triggerTooltip'); } axisPointerModel = fromTooltip ? makeAxisPointerModel( axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip ) : axisPointerModel; var snap = axisPointerModel.get('snap'); var key = makeKey(axis.model); var involveSeries = triggerTooltip || snap || axis.type === 'category'; // If result.axesInfo[key] exist, override it (tooltip has higher priority). var axisInfo = result.axesInfo[key] = { key: key, axis: axis, coordSys: coordSys, axisPointerModel: axisPointerModel, triggerTooltip: triggerTooltip, involveSeries: involveSeries, snap: snap, useHandle: isHandleTrigger(axisPointerModel), seriesModels: [] }; axesInfoInCoordSys[key] = axisInfo; result.seriesInvolved |= involveSeries; var groupIndex = getLinkGroupIndex(linksOption, axis); if (groupIndex != null) { var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = {axesInfo: {}}); linkGroup.axesInfo[key] = axisInfo; linkGroup.mapper = linksOption[groupIndex].mapper; axisInfo.linkGroup = linkGroup; } }
javascript
function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) { var axisPointerModel = axis.model.getModel('axisPointer', globalAxisPointerModel); var axisPointerShow = axisPointerModel.get('show'); if (!axisPointerShow || ( axisPointerShow === 'auto' && !fromTooltip && !isHandleTrigger(axisPointerModel) )) { return; } if (triggerTooltip == null) { triggerTooltip = axisPointerModel.get('triggerTooltip'); } axisPointerModel = fromTooltip ? makeAxisPointerModel( axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip ) : axisPointerModel; var snap = axisPointerModel.get('snap'); var key = makeKey(axis.model); var involveSeries = triggerTooltip || snap || axis.type === 'category'; // If result.axesInfo[key] exist, override it (tooltip has higher priority). var axisInfo = result.axesInfo[key] = { key: key, axis: axis, coordSys: coordSys, axisPointerModel: axisPointerModel, triggerTooltip: triggerTooltip, involveSeries: involveSeries, snap: snap, useHandle: isHandleTrigger(axisPointerModel), seriesModels: [] }; axesInfoInCoordSys[key] = axisInfo; result.seriesInvolved |= involveSeries; var groupIndex = getLinkGroupIndex(linksOption, axis); if (groupIndex != null) { var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = {axesInfo: {}}); linkGroup.axesInfo[key] = axisInfo; linkGroup.mapper = linksOption[groupIndex].mapper; axisInfo.linkGroup = linkGroup; } }
[ "function", "saveTooltipAxisInfo", "(", "fromTooltip", ",", "triggerTooltip", ",", "axis", ")", "{", "var", "axisPointerModel", "=", "axis", ".", "model", ".", "getModel", "(", "'axisPointer'", ",", "globalAxisPointerModel", ")", ";", "var", "axisPointerShow", "="...
fromTooltip: true | false | 'cross' triggerTooltip: true | false | null
[ "fromTooltip", ":", "true", "|", "false", "|", "cross", "triggerTooltip", ":", "true", "|", "false", "|", "null" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/axisPointer/modelHelper.js#L111-L160
train
Save tooltip axis info
[ 30522, 3853, 3828, 3406, 27914, 11514, 8528, 17417, 2078, 14876, 1006, 2013, 3406, 27914, 11514, 1010, 9495, 3406, 27914, 11514, 1010, 8123, 1007, 1063, 13075, 8123, 8400, 2121, 5302, 9247, 1027, 8123, 1012, 2944, 1012, 2131, 5302, 9247, 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...