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
dequelabs/axe-core
lib/core/utils/flattened-tree.js
getSlotChildren
function getSlotChildren(node) { var retVal = []; node = node.firstChild; while (node) { retVal.push(node); node = node.nextSibling; } return retVal; }
javascript
function getSlotChildren(node) { var retVal = []; node = node.firstChild; while (node) { retVal.push(node); node = node.nextSibling; } return retVal; }
[ "function", "getSlotChildren", "(", "node", ")", "{", "var", "retVal", "=", "[", "]", ";", "node", "=", "node", ".", "firstChild", ";", "while", "(", "node", ")", "{", "retVal", ".", "push", "(", "node", ")", ";", "node", "=", "node", ".", "nextSib...
find all the fallback content for a <slot> and return these as an array this array will also include any #text nodes @param node {Node} - the slot Node @return Array{Nodes}
[ "find", "all", "the", "fallback", "content", "for", "a", "<slot", ">", "and", "return", "these", "as", "an", "array", "this", "array", "will", "also", "include", "any", "#text", "nodes" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/flattened-tree.js#L62-L71
train
Get the children of a node
[ 30522, 3853, 4152, 10994, 19339, 7389, 1006, 13045, 1007, 1063, 13075, 2128, 9189, 2389, 1027, 1031, 1033, 1025, 13045, 1027, 13045, 1012, 2034, 19339, 1025, 2096, 1006, 13045, 1007, 1063, 2128, 9189, 2389, 1012, 5245, 1006, 13045, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/datepicker/js/calendarYear.js
CalendarYearCtrl
function CalendarYearCtrl($element, $scope, $animate, $q, $$mdDateUtil, $mdUtil) { /** @final {!angular.JQLite} */ this.$element = $element; /** @final {!angular.Scope} */ this.$scope = $scope; /** @final {!angular.$animate} */ this.$animate = $animate; /** @final {!angular.$q} */ this.$q = $q; /** @final */ this.dateUtil = $$mdDateUtil; /** @final {HTMLElement} */ this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); /** @type {boolean} */ this.isInitialized = false; /** @type {boolean} */ this.isMonthTransitionInProgress = false; /** @final */ this.$mdUtil = $mdUtil; var self = this; /** * Handles a click event on a date cell. * Created here so that every cell can use the same function instance. * @this {HTMLTableCellElement} The cell that was clicked. */ this.cellClickHandler = function() { self.onTimestampSelected($$mdDateUtil.getTimestampFromNode(this)); }; }
javascript
function CalendarYearCtrl($element, $scope, $animate, $q, $$mdDateUtil, $mdUtil) { /** @final {!angular.JQLite} */ this.$element = $element; /** @final {!angular.Scope} */ this.$scope = $scope; /** @final {!angular.$animate} */ this.$animate = $animate; /** @final {!angular.$q} */ this.$q = $q; /** @final */ this.dateUtil = $$mdDateUtil; /** @final {HTMLElement} */ this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); /** @type {boolean} */ this.isInitialized = false; /** @type {boolean} */ this.isMonthTransitionInProgress = false; /** @final */ this.$mdUtil = $mdUtil; var self = this; /** * Handles a click event on a date cell. * Created here so that every cell can use the same function instance. * @this {HTMLTableCellElement} The cell that was clicked. */ this.cellClickHandler = function() { self.onTimestampSelected($$mdDateUtil.getTimestampFromNode(this)); }; }
[ "function", "CalendarYearCtrl", "(", "$element", ",", "$scope", ",", "$animate", ",", "$q", ",", "$$mdDateUtil", ",", "$mdUtil", ")", "{", "/** @final {!angular.JQLite} */", "this", ".", "$element", "=", "$element", ";", "/** @final {!angular.Scope} */", "this", "."...
Controller for the mdCalendar component. @ngInject @constructor
[ "Controller", "for", "the", "mdCalendar", "component", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarYear.js#L50-L90
train
The calendar year controller.
[ 30522, 3853, 8094, 29100, 6593, 12190, 1006, 1002, 5783, 1010, 1002, 9531, 1010, 1002, 2019, 21499, 1010, 1002, 1053, 1010, 1002, 1002, 9108, 13701, 21823, 2140, 1010, 1002, 9108, 21823, 2140, 1007, 1063, 1013, 1008, 1008, 1030, 2345, 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...
angular/material
src/components/datepicker/js/dateLocaleProvider.js
DateLocaleProvider
function DateLocaleProvider() { /** Array of full month names. E.g., ['January', 'February', ...] */ this.months = null; /** Array of abbreviated month names. E.g., ['Jan', 'Feb', ...] */ this.shortMonths = null; /** Array of full day of the week names. E.g., ['Monday', 'Tuesday', ...] */ this.days = null; /** Array of abbreviated dat of the week names. E.g., ['M', 'T', ...] */ this.shortDays = null; /** Array of dates of a month (1 - 31). Characters might be different in some locales. */ this.dates = null; /** Index of the first day of the week. 0 = Sunday, 1 = Monday, etc. */ this.firstDayOfWeek = 0; /** * Function that converts the date portion of a Date to a string. * @type {(function(Date): string)} */ this.formatDate = null; /** * Function that converts a date string to a Date object (the date portion) * @type {function(string): Date} */ this.parseDate = null; /** * Function that formats a Date into a month header string. * @type {function(Date): string} */ this.monthHeaderFormatter = null; /** * Function that formats a week number into a label for the week. * @type {function(number): string} */ this.weekNumberFormatter = null; /** * Function that formats a date into a long aria-label that is read * when the focused date changes. * @type {function(Date): string} */ this.longDateFormatter = null; /** * Function to determine whether a string makes sense to be * parsed to a Date object. * @type {function(string): boolean} */ this.isDateComplete = null; /** * ARIA label for the calendar "dialog" used in the datepicker. * @type {string} */ this.msgCalendar = ''; /** * ARIA label for the datepicker's "Open calendar" buttons. * @type {string} */ this.msgOpenCalendar = ''; }
javascript
function DateLocaleProvider() { /** Array of full month names. E.g., ['January', 'February', ...] */ this.months = null; /** Array of abbreviated month names. E.g., ['Jan', 'Feb', ...] */ this.shortMonths = null; /** Array of full day of the week names. E.g., ['Monday', 'Tuesday', ...] */ this.days = null; /** Array of abbreviated dat of the week names. E.g., ['M', 'T', ...] */ this.shortDays = null; /** Array of dates of a month (1 - 31). Characters might be different in some locales. */ this.dates = null; /** Index of the first day of the week. 0 = Sunday, 1 = Monday, etc. */ this.firstDayOfWeek = 0; /** * Function that converts the date portion of a Date to a string. * @type {(function(Date): string)} */ this.formatDate = null; /** * Function that converts a date string to a Date object (the date portion) * @type {function(string): Date} */ this.parseDate = null; /** * Function that formats a Date into a month header string. * @type {function(Date): string} */ this.monthHeaderFormatter = null; /** * Function that formats a week number into a label for the week. * @type {function(number): string} */ this.weekNumberFormatter = null; /** * Function that formats a date into a long aria-label that is read * when the focused date changes. * @type {function(Date): string} */ this.longDateFormatter = null; /** * Function to determine whether a string makes sense to be * parsed to a Date object. * @type {function(string): boolean} */ this.isDateComplete = null; /** * ARIA label for the calendar "dialog" used in the datepicker. * @type {string} */ this.msgCalendar = ''; /** * ARIA label for the datepicker's "Open calendar" buttons. * @type {string} */ this.msgOpenCalendar = ''; }
[ "function", "DateLocaleProvider", "(", ")", "{", "/** Array of full month names. E.g., ['January', 'February', ...] */", "this", ".", "months", "=", "null", ";", "/** Array of abbreviated month names. E.g., ['Jan', 'Feb', ...] */", "this", ".", "shortMonths", "=", "null", ";", ...
TODO(jelbourn): Assert provided values are correctly formatted. Need assertions. @constructor
[ "TODO", "(", "jelbourn", ")", ":", "Assert", "provided", "values", "are", "correctly", "formatted", ".", "Need", "assertions", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateLocaleProvider.js#L112-L180
train
DateLocaleProvider constructor.
[ 30522, 3853, 3058, 4135, 9289, 13699, 12298, 18688, 1006, 1007, 1063, 1013, 1008, 1008, 9140, 1997, 2440, 3204, 3415, 1012, 1041, 1012, 1043, 1012, 1010, 1031, 1005, 2254, 1005, 1010, 1005, 2337, 1005, 1010, 1012, 1012, 1012, 1033, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/HealthLogger.js
setHealthDataLog
function setHealthDataLog(key, dataObject) { var healthData = getStoredHealthData(); healthData[key] = dataObject; setHealthData(healthData); }
javascript
function setHealthDataLog(key, dataObject) { var healthData = getStoredHealthData(); healthData[key] = dataObject; setHealthData(healthData); }
[ "function", "setHealthDataLog", "(", "key", ",", "dataObject", ")", "{", "var", "healthData", "=", "getStoredHealthData", "(", ")", ";", "healthData", "[", "key", "]", "=", "dataObject", ";", "setHealthData", "(", "healthData", ")", ";", "}" ]
Sets the health data for the given key @param {Object} dataObject The object to be stored as health data for the key
[ "Sets", "the", "health", "data", "for", "the", "given", "key" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/HealthLogger.js#L116-L120
train
Set the data to be logged in the log
[ 30522, 3853, 6662, 15879, 2705, 2850, 9080, 8649, 1006, 3145, 1010, 2951, 16429, 20614, 1007, 1063, 13075, 2740, 2850, 2696, 1027, 4152, 19277, 16425, 15879, 2705, 2850, 2696, 1006, 1007, 1025, 2740, 2850, 2696, 1031, 3145, 1033, 1027, 2951...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function (pres) { Strophe.info("_sendTerminate was called"); var body = this._buildBody().attrs({type: "terminate"}); if (pres) { body.cnode(pres.tree()); } var req = new Strophe.Request(body.tree(), this._onRequestStateChange.bind( this, this._conn._dataRecv.bind(this._conn)), body.tree().getAttribute("rid")); this._requests.push(req); this._throttledRequestHandler(); }
javascript
function (pres) { Strophe.info("_sendTerminate was called"); var body = this._buildBody().attrs({type: "terminate"}); if (pres) { body.cnode(pres.tree()); } var req = new Strophe.Request(body.tree(), this._onRequestStateChange.bind( this, this._conn._dataRecv.bind(this._conn)), body.tree().getAttribute("rid")); this._requests.push(req); this._throttledRequestHandler(); }
[ "function", "(", "pres", ")", "{", "Strophe", ".", "info", "(", "\"_sendTerminate was called\"", ")", ";", "var", "body", "=", "this", ".", "_buildBody", "(", ")", ".", "attrs", "(", "{", "type", ":", "\"terminate\"", "}", ")", ";", "if", "(", "pres", ...
PrivateFunction: _sendTerminate _Private_ function to send initial disconnect sequence. This is the first step in a graceful disconnect. It sends the BOSH server a terminate body and includes an unavailable presence if authentication has completed.
[ "PrivateFunction", ":", "_sendTerminate", "_Private_", "function", "to", "send", "initial", "disconnect", "sequence", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L4638-L4654
train
Send terminate request
[ 30522, 3853, 1006, 3653, 2015, 1007, 1063, 2358, 18981, 5369, 1012, 18558, 1006, 1000, 1035, 4604, 3334, 19269, 2001, 2170, 1000, 1007, 1025, 13075, 2303, 1027, 2023, 1012, 1035, 3857, 23684, 1006, 1007, 1012, 2012, 16344, 2015, 1006, 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...
angular/material
src/components/datepicker/js/dateUtil.js
isSameDay
function isSameDay(d1, d2) { return d1.getDate() == d2.getDate() && isSameMonthAndYear(d1, d2); }
javascript
function isSameDay(d1, d2) { return d1.getDate() == d2.getDate() && isSameMonthAndYear(d1, d2); }
[ "function", "isSameDay", "(", "d1", ",", "d2", ")", "{", "return", "d1", ".", "getDate", "(", ")", "==", "d2", ".", "getDate", "(", ")", "&&", "isSameMonthAndYear", "(", "d1", ",", "d2", ")", ";", "}" ]
Gets whether two dates are the same day (not not necesarily the same time). @param {Date} d1 @param {Date} d2 @returns {boolean}
[ "Gets", "whether", "two", "dates", "are", "the", "same", "day", "(", "not", "not", "necesarily", "the", "same", "time", ")", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L87-L89
train
Returns true if the first day of the second day is the same day of the first day of the second day
[ 30522, 3853, 26354, 14074, 10259, 1006, 1040, 2487, 1010, 1040, 2475, 1007, 1063, 2709, 1040, 2487, 1012, 2131, 13701, 1006, 1007, 1027, 1027, 1040, 2475, 1012, 2131, 13701, 1006, 30524, 9629, 11774, 29100, 1006, 1040, 2487, 1010, 1040, 247...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/plugins/validateConfig.js
validateConfig
function validateConfig(book, plugins) { return Promise.reduce(plugins, function(newBook, plugin) { return validatePluginConfig(newBook, plugin); }, book); }
javascript
function validateConfig(book, plugins) { return Promise.reduce(plugins, function(newBook, plugin) { return validatePluginConfig(newBook, plugin); }, book); }
[ "function", "validateConfig", "(", "book", ",", "plugins", ")", "{", "return", "Promise", ".", "reduce", "(", "plugins", ",", "function", "(", "newBook", ",", "plugin", ")", "{", "return", "validatePluginConfig", "(", "newBook", ",", "plugin", ")", ";", "}...
Validate a book configuration for plugins and returns an update configuration with default values. @param {Book} @param {OrderedMap<String:Plugin>} @return {Promise<Book>}
[ "Validate", "a", "book", "configuration", "for", "plugins", "and", "returns", "an", "update", "configuration", "with", "default", "values", "." ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/plugins/validateConfig.js#L65-L69
train
Validate the book config
[ 30522, 3853, 9398, 3686, 8663, 8873, 2290, 1006, 2338, 1010, 13354, 7076, 1007, 1063, 2709, 4872, 1012, 5547, 1006, 13354, 7076, 1010, 3853, 1006, 2047, 8654, 1010, 13354, 2378, 1007, 1063, 2709, 9398, 3686, 24759, 15916, 2378, 8663, 8873, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebase-js-sdk
packages/auth/demo/public/web-worker.js
function(googleIdToken) { var inMemoryPersistence = firebase.auth.Auth.Persistence.NONE; var expectedDisplayName = 'Test User'; var oauthCredential = firebase.auth.GoogleAuthProvider.credential( googleIdToken); var provider = new firebase.auth.GoogleAuthProvider(); var OPERATION_NOT_SUPPORTED_CODE = 'auth/operation-not-supported-in-this-environment'; var email = 'user' + Math.floor(Math.random() * 10000000000).toString() + '@example.com'; var pass = 'password'; return firebase.auth().setPersistence(inMemoryPersistence) .then(function() { firebase.auth().useDeviceLanguage(); return firebase.auth().signInAnonymously(); }) .then(function(result) { if (!result.user.uid) { throw new Error('signInAnonymously unexpectedly failed!'); } return result.user.updateProfile({displayName: expectedDisplayName}); }) .then(function() { if (firebase.auth().currentUser.displayName != expectedDisplayName) { throw new Error('Profile update failed!'); } return firebase.auth().currentUser.delete(); }) .then(function() { if (firebase.auth().currentUser) { throw new Error('currentUser.delete unexpectedly failed!'); } return firebase.auth().createUserWithEmailAndPassword(email, pass); }) .then(function(result) { if (result.user.email != email) { throw new Error( 'createUserWithEmailAndPassword unexpectedly failed!'); } return firebase.auth().fetchProvidersForEmail(email); }).then(function(providers) { if (providers.length == 0 || providers[0] != 'password') { throw new Error('fetchProvidersForEmail failed!'); } return firebase.auth().signInWithEmailAndPassword(email, pass); }) .then(function(result) { if (result.user.email != email) { throw new Error('signInWithEmailAndPassword unexpectedly failed!'); } return result.user.delete(); }) .then(function() { return firebase.auth().signInWithPopup(provider) .catch(function(error) { if (error.code != OPERATION_NOT_SUPPORTED_CODE) { throw error; } }); }) .then(function() { return firebase.auth().signInWithRedirect(provider) .catch(function(error) { if (error.code != OPERATION_NOT_SUPPORTED_CODE) { throw error; } }); }) .then(function() { return Promise.resolve().then(function() { return new firebase.auth.RecaptchaVerifier('id'); }).then(function() { throw new Error( 'RecaptchaVerifer instantiation succeeded unexpectedly!'); }).catch(function(error) { if (error.code != OPERATION_NOT_SUPPORTED_CODE) { throw error; } }); }) .then(function() { return firebase.auth().signInWithCredential( oauthCredential); }) .then(function(result) { if (!result.user || !result.user.uid || !result.credential || !result.additionalUserInfo) { throw new Error( 'signInWithCredential unexpectedly failed!'); } return firebase.auth().signOut(); }) .then(function() { if (firebase.auth().currentUser) { throw new Error('signOut unexpectedly failed!'); } }); }
javascript
function(googleIdToken) { var inMemoryPersistence = firebase.auth.Auth.Persistence.NONE; var expectedDisplayName = 'Test User'; var oauthCredential = firebase.auth.GoogleAuthProvider.credential( googleIdToken); var provider = new firebase.auth.GoogleAuthProvider(); var OPERATION_NOT_SUPPORTED_CODE = 'auth/operation-not-supported-in-this-environment'; var email = 'user' + Math.floor(Math.random() * 10000000000).toString() + '@example.com'; var pass = 'password'; return firebase.auth().setPersistence(inMemoryPersistence) .then(function() { firebase.auth().useDeviceLanguage(); return firebase.auth().signInAnonymously(); }) .then(function(result) { if (!result.user.uid) { throw new Error('signInAnonymously unexpectedly failed!'); } return result.user.updateProfile({displayName: expectedDisplayName}); }) .then(function() { if (firebase.auth().currentUser.displayName != expectedDisplayName) { throw new Error('Profile update failed!'); } return firebase.auth().currentUser.delete(); }) .then(function() { if (firebase.auth().currentUser) { throw new Error('currentUser.delete unexpectedly failed!'); } return firebase.auth().createUserWithEmailAndPassword(email, pass); }) .then(function(result) { if (result.user.email != email) { throw new Error( 'createUserWithEmailAndPassword unexpectedly failed!'); } return firebase.auth().fetchProvidersForEmail(email); }).then(function(providers) { if (providers.length == 0 || providers[0] != 'password') { throw new Error('fetchProvidersForEmail failed!'); } return firebase.auth().signInWithEmailAndPassword(email, pass); }) .then(function(result) { if (result.user.email != email) { throw new Error('signInWithEmailAndPassword unexpectedly failed!'); } return result.user.delete(); }) .then(function() { return firebase.auth().signInWithPopup(provider) .catch(function(error) { if (error.code != OPERATION_NOT_SUPPORTED_CODE) { throw error; } }); }) .then(function() { return firebase.auth().signInWithRedirect(provider) .catch(function(error) { if (error.code != OPERATION_NOT_SUPPORTED_CODE) { throw error; } }); }) .then(function() { return Promise.resolve().then(function() { return new firebase.auth.RecaptchaVerifier('id'); }).then(function() { throw new Error( 'RecaptchaVerifer instantiation succeeded unexpectedly!'); }).catch(function(error) { if (error.code != OPERATION_NOT_SUPPORTED_CODE) { throw error; } }); }) .then(function() { return firebase.auth().signInWithCredential( oauthCredential); }) .then(function(result) { if (!result.user || !result.user.uid || !result.credential || !result.additionalUserInfo) { throw new Error( 'signInWithCredential unexpectedly failed!'); } return firebase.auth().signOut(); }) .then(function() { if (firebase.auth().currentUser) { throw new Error('signOut unexpectedly failed!'); } }); }
[ "function", "(", "googleIdToken", ")", "{", "var", "inMemoryPersistence", "=", "firebase", ".", "auth", ".", "Auth", ".", "Persistence", ".", "NONE", ";", "var", "expectedDisplayName", "=", "'Test User'", ";", "var", "oauthCredential", "=", "firebase", ".", "a...
Runs various Firebase Auth tests in a web worker environment and confirms the expected behavior. This is useful for manual testing in different browsers. @param {string} googleIdToken The Google ID token to sign in with. @return {!Promise<void>} A promise that resolves when all tests run successfully.
[ "Runs", "various", "Firebase", "Auth", "tests", "in", "a", "web", "worker", "environment", "and", "confirms", "the", "expected", "behavior", ".", "This", "is", "useful", "for", "manual", "testing", "in", "different", "browsers", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/web-worker.js#L61-L160
train
Creates a new user with the given Google ID token.
[ 30522, 3853, 1006, 8224, 3593, 18715, 2368, 1007, 1063, 13075, 1999, 4168, 5302, 2854, 7347, 27870, 5897, 1027, 2543, 15058, 1012, 8740, 2705, 1012, 8740, 2705, 1012, 28297, 1012, 3904, 1025, 13075, 3517, 10521, 13068, 18442, 1027, 1005, 32...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/utils/debounce.js
shouldInvoke
function shouldInvoke(time) { let timeSinceLastCall = time - lastCallTime; let timeSinceLastInvoke = time - lastInvokeTime; // 几种满足条件的情况 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); // 超过最大等待时间 }
javascript
function shouldInvoke(time) { let timeSinceLastCall = time - lastCallTime; let timeSinceLastInvoke = time - lastInvokeTime; // 几种满足条件的情况 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); // 超过最大等待时间 }
[ "function", "shouldInvoke", "(", "time", ")", "{", "let", "timeSinceLastCall", "=", "time", "-", "lastCallTime", ";", "let", "timeSinceLastInvoke", "=", "time", "-", "lastInvokeTime", ";", "// 几种满足条件的情况", "return", "(", "lastCallTime", "===", "undefined", "||", ...
根据时间判断 func 能否被执行
[ "根据时间判断", "func", "能否被执行" ]
d5405d27d994151b676eb91c12b389316d7f6679
https://github.com/heyui/heyui/blob/d5405d27d994151b676eb91c12b389316d7f6679/src/utils/debounce.js#L82-L91
train
Check if the last call time is within wait or maxWait
[ 30522, 3853, 2323, 2378, 6767, 3489, 1006, 2051, 1007, 1063, 2292, 2335, 2378, 29109, 14083, 9289, 2140, 1027, 2051, 1011, 2197, 9289, 7096, 14428, 1025, 2292, 2335, 2378, 29109, 14083, 2378, 6767, 3489, 1027, 2051, 1011, 2197, 2378, 6767, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/WorkingSetView.js
refresh
function refresh(rebuild) { _.forEach(_views, function (view) { var top = view.$openFilesContainer.scrollTop(); if (rebuild) { view._rebuildViewList(true); } else { view._redraw(); } view.$openFilesContainer.scrollTop(top); }); }
javascript
function refresh(rebuild) { _.forEach(_views, function (view) { var top = view.$openFilesContainer.scrollTop(); if (rebuild) { view._rebuildViewList(true); } else { view._redraw(); } view.$openFilesContainer.scrollTop(top); }); }
[ "function", "refresh", "(", "rebuild", ")", "{", "_", ".", "forEach", "(", "_views", ",", "function", "(", "view", ")", "{", "var", "top", "=", "view", ".", "$openFilesContainer", ".", "scrollTop", "(", ")", ";", "if", "(", "rebuild", ")", "{", "view...
Refreshes all Pane View List Views
[ "Refreshes", "all", "Pane", "View", "List", "Views" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetView.js#L120-L130
train
Refreshes views list
[ 30522, 3853, 25416, 21898, 1006, 14591, 1007, 1063, 1035, 1012, 18921, 6776, 1006, 1035, 5328, 1010, 3853, 1006, 3193, 1007, 1063, 13075, 2327, 1027, 3193, 1012, 1002, 2330, 8873, 4244, 8663, 18249, 2121, 1012, 17186, 14399, 1006, 1007, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
arrayLikeToArrayLike
function arrayLikeToArrayLike(arrayFrom, arrayTo) { for (var i = 0; i < arrayFrom.length; i++) { arrayTo[i] = arrayFrom[i]; } return arrayTo; }
javascript
function arrayLikeToArrayLike(arrayFrom, arrayTo) { for (var i = 0; i < arrayFrom.length; i++) { arrayTo[i] = arrayFrom[i]; } return arrayTo; }
[ "function", "arrayLikeToArrayLike", "(", "arrayFrom", ",", "arrayTo", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arrayFrom", ".", "length", ";", "i", "++", ")", "{", "arrayTo", "[", "i", "]", "=", "arrayFrom", "[", "i", "]", ";", ...
Copy the data from an array-like to an other array-like. @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.
[ "Copy", "the", "data", "from", "an", "array", "-", "like", "to", "an", "other", "array", "-", "like", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1492-L1497
train
Convert an array - like object to an array - like object
[ 30522, 3853, 9140, 10359, 3406, 2906, 9447, 10359, 1006, 9140, 19699, 5358, 1010, 9140, 3406, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 9140, 19699, 5358, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 9140, 3406, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/menu/js/menuServiceProvider.js
firstVisibleChild
function firstVisibleChild() { for (var i = 0; i < openMenuNode.children.length; ++i) { if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') { return openMenuNode.children[i]; } } }
javascript
function firstVisibleChild() { for (var i = 0; i < openMenuNode.children.length; ++i) { if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') { return openMenuNode.children[i]; } } }
[ "function", "firstVisibleChild", "(", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "openMenuNode", ".", "children", ".", "length", ";", "++", "i", ")", "{", "if", "(", "$window", ".", "getComputedStyle", "(", "openMenuNode", ".", "childre...
Gets the first visible child in the openMenuNode Necessary incase menu nodes are being dynamically hidden
[ "Gets", "the", "first", "visible", "child", "in", "the", "openMenuNode", "Necessary", "incase", "menu", "nodes", "are", "being", "dynamically", "hidden" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L569-L575
train
Returns the first visible child of the openMenu node
[ 30522, 3853, 2034, 11365, 7028, 19339, 1006, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 2330, 3549, 27819, 3207, 1012, 2336, 1012, 3091, 1025, 1009, 1009, 1045, 1007, 1063, 2065, 1006, 1002, 3332, 1012, 2131, 9006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/credentials/process_credentials.js
loadViaCredentialProcess
function loadViaCredentialProcess(profile, callback) { proc.exec(profile['credential_process'], function(err, stdOut, stdErr) { if (err) { callback(AWS.util.error( new Error('credential_process returned error'), { code: 'ProcessCredentialsProviderFailure'} ), null); } else { try { var credData = JSON.parse(stdOut); if (credData.Expiration) { var currentTime = AWS.util.date.getDate(); var expireTime = new Date(credData.Expiration); if (expireTime < currentTime) { throw Error('credential_process returned expired credentials'); } } if (credData.Version !== 1) { throw Error('credential_process does not return Version == 1'); } callback(null, credData); } catch (err) { callback(AWS.util.error( new Error(err.message), { code: 'ProcessCredentialsProviderFailure'} ), null); } } }); }
javascript
function loadViaCredentialProcess(profile, callback) { proc.exec(profile['credential_process'], function(err, stdOut, stdErr) { if (err) { callback(AWS.util.error( new Error('credential_process returned error'), { code: 'ProcessCredentialsProviderFailure'} ), null); } else { try { var credData = JSON.parse(stdOut); if (credData.Expiration) { var currentTime = AWS.util.date.getDate(); var expireTime = new Date(credData.Expiration); if (expireTime < currentTime) { throw Error('credential_process returned expired credentials'); } } if (credData.Version !== 1) { throw Error('credential_process does not return Version == 1'); } callback(null, credData); } catch (err) { callback(AWS.util.error( new Error(err.message), { code: 'ProcessCredentialsProviderFailure'} ), null); } } }); }
[ "function", "loadViaCredentialProcess", "(", "profile", ",", "callback", ")", "{", "proc", ".", "exec", "(", "profile", "[", "'credential_process'", "]", ",", "function", "(", "err", ",", "stdOut", ",", "stdErr", ")", "{", "if", "(", "err", ")", "{", "ca...
Executes the credential_process and retrieves credentials from the output @api private @param profile [map] credentials profile @throws ProcessCredentialsProviderFailure
[ "Executes", "the", "credential_process", "and", "retrieves", "credentials", "from", "the", "output" ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/credentials/process_credentials.js#L136-L166
train
Load via credential_process
[ 30522, 3853, 7170, 9035, 16748, 16454, 4818, 21572, 9623, 2015, 1006, 6337, 1010, 2655, 5963, 1007, 1063, 4013, 2278, 1012, 4654, 8586, 1006, 6337, 1031, 1005, 13675, 14728, 19909, 1035, 2832, 1005, 1033, 1010, 3853, 1006, 9413, 2099, 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...
eslint/eslint
lib/rules/key-spacing.js
getKey
function getKey(property) { const key = property.key; if (property.computed) { return sourceCode.getText().slice(key.range[0], key.range[1]); } return property.key.name || property.key.value; }
javascript
function getKey(property) { const key = property.key; if (property.computed) { return sourceCode.getText().slice(key.range[0], key.range[1]); } return property.key.name || property.key.value; }
[ "function", "getKey", "(", "property", ")", "{", "const", "key", "=", "property", ".", "key", ";", "if", "(", "property", ".", "computed", ")", "{", "return", "sourceCode", ".", "getText", "(", ")", ".", "slice", "(", "key", ".", "range", "[", "0", ...
Gets an object literal property's key as the identifier name or string value. @param {ASTNode} property Property node whose key to retrieve. @returns {string} The property's key.
[ "Gets", "an", "object", "literal", "property", "s", "key", "as", "the", "identifier", "name", "or", "string", "value", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/key-spacing.js#L399-L407
train
Get the key of a property
[ 30522, 3853, 2131, 14839, 1006, 3200, 1007, 1063, 9530, 3367, 3145, 1027, 3200, 1012, 3145, 1025, 2065, 1006, 3200, 1012, 24806, 1007, 1063, 2709, 3120, 16044, 1012, 2131, 18209, 1006, 1007, 1012, 14704, 1006, 3145, 1012, 2846, 1031, 1014, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
google/closure-library
closure/goog/html/sanitizer/noclobber.js
genericPropertyGet
function genericPropertyGet(fn, object, fallbackPropertyName, fallbackTest) { if (fn) { return fn.apply(object); } var propertyValue = object[fallbackPropertyName]; if (!fallbackTest(propertyValue)) { throw new Error('Clobbering detected'); } return propertyValue; }
javascript
function genericPropertyGet(fn, object, fallbackPropertyName, fallbackTest) { if (fn) { return fn.apply(object); } var propertyValue = object[fallbackPropertyName]; if (!fallbackTest(propertyValue)) { throw new Error('Clobbering detected'); } return propertyValue; }
[ "function", "genericPropertyGet", "(", "fn", ",", "object", ",", "fallbackPropertyName", ",", "fallbackTest", ")", "{", "if", "(", "fn", ")", "{", "return", "fn", ".", "apply", "(", "object", ")", ";", "}", "var", "propertyValue", "=", "object", "[", "fa...
Calls the provided DOM property descriptor and returns its result. If the descriptor is not available, use fallbackPropertyName to get the property value in a clobber-vulnerable way, and use fallbackTest to check if the property was clobbered, throwing an exception if so. @param {?Function} fn @param {*} object @param {string} fallbackPropertyName @param {function(*):boolean} fallbackTest @return {?}
[ "Calls", "the", "provided", "DOM", "property", "descriptor", "and", "returns", "its", "result", ".", "If", "the", "descriptor", "is", "not", "available", "use", "fallbackPropertyName", "to", "get", "the", "property", "value", "in", "a", "clobber", "-", "vulner...
97390e9ca4483cebb9628e06026139fbb3023d65
https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/html/sanitizer/noclobber.js#L123-L132
train
Generic property get
[ 30522, 3853, 12391, 21572, 30524, 1063, 2709, 1042, 2078, 1012, 6611, 1006, 4874, 1007, 1025, 1065, 13075, 3200, 10175, 5657, 1027, 4874, 1031, 2991, 5963, 21572, 4842, 25680, 14074, 1033, 1025, 2065, 1006, 999, 2991, 5963, 22199, 1006, 320...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/examples/grapheditor/www/js/Graph.js
checkNode
function checkNode(node, clone) { if (node != null) { if (clone.originalNode != node) { cleanNode(node); } else { node = node.firstChild; clone = clone.firstChild; while (node != null) { var nextNode = node.nextSibling; if (clone == null) { cleanNode(node); } else { checkNode(node, clone); clone = clone.nextSibling; } node = nextNode; } } } }
javascript
function checkNode(node, clone) { if (node != null) { if (clone.originalNode != node) { cleanNode(node); } else { node = node.firstChild; clone = clone.firstChild; while (node != null) { var nextNode = node.nextSibling; if (clone == null) { cleanNode(node); } else { checkNode(node, clone); clone = clone.nextSibling; } node = nextNode; } } } }
[ "function", "checkNode", "(", "node", ",", "clone", ")", "{", "if", "(", "node", "!=", "null", ")", "{", "if", "(", "clone", ".", "originalNode", "!=", "node", ")", "{", "cleanNode", "(", "node", ")", ";", "}", "else", "{", "node", "=", "node", "...
Checks the given node for new nodes, recursively
[ "Checks", "the", "given", "node", "for", "new", "nodes", "recursively" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/examples/grapheditor/www/js/Graph.js#L7157-L7188
train
Check node and clone
[ 30522, 3853, 4638, 3630, 3207, 1006, 13045, 1010, 17598, 1007, 1063, 2065, 1006, 13045, 999, 1027, 19701, 1007, 1063, 2065, 1006, 17598, 1012, 2434, 3630, 3207, 999, 1027, 13045, 1007, 1063, 4550, 3630, 3207, 1006, 13045, 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...
facebook/relay
packages/relay-compiler/codegen/deepMergeAssignments.js
formatJSAssignment
function formatJSAssignment( objectName: string, path: Array<string | number>, value: mixed, ): string { const assignmentPath = path .map(p => (typeof p === 'string' ? `.${p}` : `[${p}]`)) .join(''); const jsValue = value === undefined ? 'undefined' : JSON.stringify(value); // $FlowFixMe(>=0.95.0) JSON.stringify can return undefined return `${objectName}${assignmentPath} = ${jsValue};`; }
javascript
function formatJSAssignment( objectName: string, path: Array<string | number>, value: mixed, ): string { const assignmentPath = path .map(p => (typeof p === 'string' ? `.${p}` : `[${p}]`)) .join(''); const jsValue = value === undefined ? 'undefined' : JSON.stringify(value); // $FlowFixMe(>=0.95.0) JSON.stringify can return undefined return `${objectName}${assignmentPath} = ${jsValue};`; }
[ "function", "formatJSAssignment", "(", "objectName", ":", "string", ",", "path", ":", "Array", "<", "string", "|", "number", ">", ",", "value", ":", "mixed", ",", ")", ":", "string", "{", "const", "assignmentPath", "=", "path", ".", "map", "(", "p", "=...
Print a path/value pair as a JS assignment expression.
[ "Print", "a", "path", "/", "value", "pair", "as", "a", "JS", "assignment", "expression", "." ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/codegen/deepMergeAssignments.js#L46-L57
train
Format JS assignment
[ 30522, 3853, 4289, 22578, 12054, 24838, 1006, 4874, 18442, 1024, 5164, 1010, 4130, 1024, 9140, 1026, 5164, 1064, 2193, 1028, 1010, 3643, 1024, 3816, 1010, 1007, 1024, 5164, 1063, 9530, 3367, 8775, 15069, 1027, 4130, 1012, 4949, 1006, 1052, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.layout/src/sap/ui/layout/form/ResponsiveGridLayout.js
_setLayoutDataForLinebreak
function _setLayoutDataForLinebreak( oControl, oContainer, iVisibleContainer, oContainerNext, iVisibleContainers ) { var oLayout; if (oControl instanceof Panel) { oLayout = sap.ui.getCore().byId(oControl.getLayout()); } else { oLayout = oControl.__myParentLayout; } var oLD = oLayout.getLayoutDataForElement(oContainer, "sap.ui.layout.GridData"); if (!oLD) { // only needed if container has no own LayoutData var iColumnsM = oLayout.getColumnsM(); var iColumnsL = oLayout.getColumnsL(); // If the columsnXL is not set the value of columnsL is used var iColumnsXL = oLayout.getColumnsXL(); var bLinebreakL = (iVisibleContainer % iColumnsL) == 1; var bLastL = (iVisibleContainer % iColumnsL) == 0; var bLastRowL = iVisibleContainer > (iColumnsL * (Math.ceil(iVisibleContainers / iColumnsL) - 1)); var bFirstRowL = iVisibleContainer <= iColumnsL; var bLinebreakM = (iVisibleContainer % iColumnsM) == 1; var bLastM = (iVisibleContainer % iColumnsM) == 0; var bLastRowM = iVisibleContainer > (iColumnsM * (Math.ceil(iVisibleContainers / iColumnsM) - 1)); var bFirstRowM = iVisibleContainer <= iColumnsM; var bLinebreakXL = false; var bLastXL = bLastL; var bLastRowXL = bLastRowL; var bFirstRowXL = bFirstRowL; if (iColumnsXL > 0) { bLinebreakXL = (iVisibleContainer % iColumnsXL) == 1; bLastXL = (iVisibleContainer % iColumnsXL) == 0; bLastRowXL = iVisibleContainer > (iColumnsXL * (Math.ceil(iVisibleContainers / iColumnsXL) - 1)); bFirstRowXL = iVisibleContainer <= iColumnsXL; } if (oContainerNext) { var oLDNext = oLayout.getLayoutDataForElement(oContainerNext, "sap.ui.layout.GridData"); if (oLDNext && ( oLDNext.getLinebreak() || oLDNext.getLinebreakXL() )) { bLastXL = true; bLastRowXL = false; } if (oLDNext && ( oLDNext.getLinebreak() || oLDNext.getLinebreakL() )) { bLastL = true; bLastRowL = false; } if (oLDNext && ( oLDNext.getLinebreak() || oLDNext.getLinebreakM() )) { bLastM = true; bLastRowM = false; } } var sStyle = ""; if (bLastXL) { sStyle = "sapUiFormResGridLastContXL"; } if (bLastL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastContL"; } if (bLastM) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastContM"; } if (bLastRowXL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastRowXL"; } if (bLastRowL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastRowL"; } if (bLastRowM) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastRowM"; } if (bFirstRowXL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridFirstRowXL"; } if (bFirstRowL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridFirstRowL"; } if (bFirstRowM) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridFirstRowM"; } oLD = oControl.getLayoutData(); if (!oLD) { oLD = new GridData(oControl.getId() + "--LD", { linebreakL: bLinebreakL, linebreakM: bLinebreakM }); oControl.setLayoutData( oLD ); } else { oLD.setLinebreakL(bLinebreakL); oLD.setLinebreakM(bLinebreakM); } if (iColumnsXL > 0) { oLD.setLinebreakXL(bLinebreakXL); } oLD._setStylesInternal(sStyle); } }
javascript
function _setLayoutDataForLinebreak( oControl, oContainer, iVisibleContainer, oContainerNext, iVisibleContainers ) { var oLayout; if (oControl instanceof Panel) { oLayout = sap.ui.getCore().byId(oControl.getLayout()); } else { oLayout = oControl.__myParentLayout; } var oLD = oLayout.getLayoutDataForElement(oContainer, "sap.ui.layout.GridData"); if (!oLD) { // only needed if container has no own LayoutData var iColumnsM = oLayout.getColumnsM(); var iColumnsL = oLayout.getColumnsL(); // If the columsnXL is not set the value of columnsL is used var iColumnsXL = oLayout.getColumnsXL(); var bLinebreakL = (iVisibleContainer % iColumnsL) == 1; var bLastL = (iVisibleContainer % iColumnsL) == 0; var bLastRowL = iVisibleContainer > (iColumnsL * (Math.ceil(iVisibleContainers / iColumnsL) - 1)); var bFirstRowL = iVisibleContainer <= iColumnsL; var bLinebreakM = (iVisibleContainer % iColumnsM) == 1; var bLastM = (iVisibleContainer % iColumnsM) == 0; var bLastRowM = iVisibleContainer > (iColumnsM * (Math.ceil(iVisibleContainers / iColumnsM) - 1)); var bFirstRowM = iVisibleContainer <= iColumnsM; var bLinebreakXL = false; var bLastXL = bLastL; var bLastRowXL = bLastRowL; var bFirstRowXL = bFirstRowL; if (iColumnsXL > 0) { bLinebreakXL = (iVisibleContainer % iColumnsXL) == 1; bLastXL = (iVisibleContainer % iColumnsXL) == 0; bLastRowXL = iVisibleContainer > (iColumnsXL * (Math.ceil(iVisibleContainers / iColumnsXL) - 1)); bFirstRowXL = iVisibleContainer <= iColumnsXL; } if (oContainerNext) { var oLDNext = oLayout.getLayoutDataForElement(oContainerNext, "sap.ui.layout.GridData"); if (oLDNext && ( oLDNext.getLinebreak() || oLDNext.getLinebreakXL() )) { bLastXL = true; bLastRowXL = false; } if (oLDNext && ( oLDNext.getLinebreak() || oLDNext.getLinebreakL() )) { bLastL = true; bLastRowL = false; } if (oLDNext && ( oLDNext.getLinebreak() || oLDNext.getLinebreakM() )) { bLastM = true; bLastRowM = false; } } var sStyle = ""; if (bLastXL) { sStyle = "sapUiFormResGridLastContXL"; } if (bLastL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastContL"; } if (bLastM) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastContM"; } if (bLastRowXL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastRowXL"; } if (bLastRowL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastRowL"; } if (bLastRowM) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridLastRowM"; } if (bFirstRowXL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridFirstRowXL"; } if (bFirstRowL) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridFirstRowL"; } if (bFirstRowM) { if (sStyle) { sStyle = sStyle + " "; } sStyle = sStyle + "sapUiFormResGridFirstRowM"; } oLD = oControl.getLayoutData(); if (!oLD) { oLD = new GridData(oControl.getId() + "--LD", { linebreakL: bLinebreakL, linebreakM: bLinebreakM }); oControl.setLayoutData( oLD ); } else { oLD.setLinebreakL(bLinebreakL); oLD.setLinebreakM(bLinebreakM); } if (iColumnsXL > 0) { oLD.setLinebreakXL(bLinebreakXL); } oLD._setStylesInternal(sStyle); } }
[ "function", "_setLayoutDataForLinebreak", "(", "oControl", ",", "oContainer", ",", "iVisibleContainer", ",", "oContainerNext", ",", "iVisibleContainers", ")", "{", "var", "oLayout", ";", "if", "(", "oControl", "instanceof", "Panel", ")", "{", "oLayout", "=", "sap"...
every second container gets a Linebreak for large screens oControl could be a Panel or a Grid( if no panel used)
[ "every", "second", "container", "gets", "a", "Linebreak", "for", "large", "screens", "oControl", "could", "be", "a", "Panel", "or", "a", "Grid", "(", "if", "no", "panel", "used", ")" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/ResponsiveGridLayout.js#L1049-L1172
train
Sets the layout data for a line break.
[ 30522, 3853, 1035, 2275, 8485, 5833, 2850, 2696, 29278, 4179, 23890, 1006, 1051, 8663, 13181, 2140, 1010, 1051, 8663, 18249, 2121, 1010, 4921, 17417, 3468, 8663, 18249, 2121, 1010, 1051, 8663, 18249, 11795, 10288, 2102, 1010, 4921, 17417, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
zloirock/core-js
packages/core-js/modules/web.url-search-params.js
has
function has(name) { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; var i = 0; while (i < entries.length) if (entries[i++].key === key) return true; return false; }
javascript
function has(name) { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; var i = 0; while (i < entries.length) if (entries[i++].key === key) return true; return false; }
[ "function", "has", "(", "name", ")", "{", "validateArgumentsLength", "(", "arguments", ".", "length", ",", "1", ")", ";", "var", "entries", "=", "getInternalParamsState", "(", "this", ")", ".", "entries", ";", "var", "key", "=", "name", "+", "''", ";", ...
`URLSearchParams.prototype.has` method https://url.spec.whatwg.org/#dom-urlsearchparams-has
[ "URLSearchParams", ".", "prototype", ".", "has", "method", "https", ":", "//", "url", ".", "spec", ".", "whatwg", ".", "org", "/", "#dom", "-", "urlsearchparams", "-", "has" ]
fe7c8511a6d27d03a9b8e075b3351416aae95c58
https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/web.url-search-params.js#L193-L200
train
Returns true if the given parameter name exists in the internal params state.
[ 30522, 3853, 2038, 1006, 2171, 1007, 1063, 9398, 3686, 2906, 22850, 11187, 7770, 13512, 2232, 1006, 9918, 1012, 3091, 1010, 1015, 1007, 1025, 13075, 10445, 1027, 2131, 18447, 11795, 2389, 28689, 5244, 9153, 2618, 1006, 2023, 1007, 1012, 104...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ant-design/ant-design
.antd-tools.config.js
finalizeCompile
function finalizeCompile() { if (fs.existsSync(path.join(__dirname, './lib'))) { // Build package.json version to lib/version/index.js // prevent json-loader needing in user-side const versionFilePath = path.join(process.cwd(), 'lib', 'version', 'index.js'); const versionFileContent = fs.readFileSync(versionFilePath).toString(); fs.writeFileSync( versionFilePath, versionFileContent.replace( /require\(('|")\.\.\/\.\.\/package\.json('|")\)/, `{ version: '${packageInfo.version}' }`, ), ); // eslint-disable-next-line console.log('Wrote version into lib/version/index.js'); // Build package.json version to lib/version/index.d.ts // prevent https://github.com/ant-design/ant-design/issues/4935 const versionDefPath = path.join(process.cwd(), 'lib', 'version', 'index.d.ts'); fs.writeFileSync( versionDefPath, `declare var _default: "${packageInfo.version}";\nexport default _default;\n`, ); // eslint-disable-next-line console.log('Wrote version into lib/version/index.d.ts'); // Build a entry less file to dist/antd.less const componentsPath = path.join(process.cwd(), 'components'); let componentsLessContent = ''; // Build components in one file: lib/style/components.less fs.readdir(componentsPath, (err, files) => { files.forEach(file => { if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) { componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n`; } }); fs.writeFileSync( path.join(process.cwd(), 'lib', 'style', 'components.less'), componentsLessContent, ); }); } }
javascript
function finalizeCompile() { if (fs.existsSync(path.join(__dirname, './lib'))) { // Build package.json version to lib/version/index.js // prevent json-loader needing in user-side const versionFilePath = path.join(process.cwd(), 'lib', 'version', 'index.js'); const versionFileContent = fs.readFileSync(versionFilePath).toString(); fs.writeFileSync( versionFilePath, versionFileContent.replace( /require\(('|")\.\.\/\.\.\/package\.json('|")\)/, `{ version: '${packageInfo.version}' }`, ), ); // eslint-disable-next-line console.log('Wrote version into lib/version/index.js'); // Build package.json version to lib/version/index.d.ts // prevent https://github.com/ant-design/ant-design/issues/4935 const versionDefPath = path.join(process.cwd(), 'lib', 'version', 'index.d.ts'); fs.writeFileSync( versionDefPath, `declare var _default: "${packageInfo.version}";\nexport default _default;\n`, ); // eslint-disable-next-line console.log('Wrote version into lib/version/index.d.ts'); // Build a entry less file to dist/antd.less const componentsPath = path.join(process.cwd(), 'components'); let componentsLessContent = ''; // Build components in one file: lib/style/components.less fs.readdir(componentsPath, (err, files) => { files.forEach(file => { if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) { componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n`; } }); fs.writeFileSync( path.join(process.cwd(), 'lib', 'style', 'components.less'), componentsLessContent, ); }); } }
[ "function", "finalizeCompile", "(", ")", "{", "if", "(", "fs", ".", "existsSync", "(", "path", ".", "join", "(", "__dirname", ",", "'./lib'", ")", ")", ")", "{", "// Build package.json version to lib/version/index.js", "// prevent json-loader needing in user-side", "c...
We need compile additional content for antd user
[ "We", "need", "compile", "additional", "content", "for", "antd", "user" ]
6d845f60efe9bd50a25c0ce29eb1fee895b9c7b7
https://github.com/ant-design/ant-design/blob/6d845f60efe9bd50a25c0ce29eb1fee895b9c7b7/.antd-tools.config.js#L6-L48
train
Finalize the compile process
[ 30522, 3853, 2345, 4697, 9006, 22090, 1006, 1007, 1063, 2065, 1006, 1042, 2015, 1012, 6526, 6508, 12273, 1006, 4130, 1012, 3693, 1006, 1035, 1035, 16101, 18442, 1010, 1005, 1012, 1013, 5622, 2497, 1005, 1007, 1007, 1007, 1063, 1013, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.f/src/sap/f/cards/ActionEnablement.js
_setHeaderActionEnabledState
function _setHeaderActionEnabledState(mItem) { var oAction = mItem.actions[0], oBindingContext = this.getBindingContext(), mParameters = oAction.parameters, oModel = this.getModel(), sPath; if (oBindingContext) { sPath = oBindingContext.getPath(); } mParameters = BindingResolver.resolveValue(oAction.parameters, oModel, sPath); return new Promise(function (resolve) { this._oServiceManager.getService(_getServiceName(oAction.service)) .then(function (oNavigationService) { if (oNavigationService) { oNavigationService .enabled({ parameters: mParameters }) .then(function (bEnabled) { resolve(bEnabled); }) .catch(function () { resolve(false); }); } else { resolve(false); } }) .catch(function () { resolve(false); }); }.bind(this)); }
javascript
function _setHeaderActionEnabledState(mItem) { var oAction = mItem.actions[0], oBindingContext = this.getBindingContext(), mParameters = oAction.parameters, oModel = this.getModel(), sPath; if (oBindingContext) { sPath = oBindingContext.getPath(); } mParameters = BindingResolver.resolveValue(oAction.parameters, oModel, sPath); return new Promise(function (resolve) { this._oServiceManager.getService(_getServiceName(oAction.service)) .then(function (oNavigationService) { if (oNavigationService) { oNavigationService .enabled({ parameters: mParameters }) .then(function (bEnabled) { resolve(bEnabled); }) .catch(function () { resolve(false); }); } else { resolve(false); } }) .catch(function () { resolve(false); }); }.bind(this)); }
[ "function", "_setHeaderActionEnabledState", "(", "mItem", ")", "{", "var", "oAction", "=", "mItem", ".", "actions", "[", "0", "]", ",", "oBindingContext", "=", "this", ".", "getBindingContext", "(", ")", ",", "mParameters", "=", "oAction", ".", "parameters", ...
Header specific
[ "Header", "specific" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/cards/ActionEnablement.js#L89-L124
train
Sets the header action enabled state
[ 30522, 3853, 1035, 6662, 13775, 6906, 7542, 8189, 23242, 9153, 2618, 1006, 10210, 6633, 1007, 1063, 13075, 1051, 18908, 3258, 1027, 10210, 6633, 1012, 4506, 1031, 1014, 1033, 1010, 27885, 22254, 2075, 8663, 18209, 1027, 2023, 1012, 2131, 84...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
feathericons/feather
bin/process-svg.js
optimize
function optimize(svg) { const svgo = new Svgo({ plugins: [ { convertShapeToPath: false }, { mergePaths: false }, { removeAttrs: { attrs: '(fill|stroke.*)' } }, { removeTitle: true }, ], }); return new Promise(resolve => { svgo.optimize(svg, ({ data }) => resolve(data)); }); }
javascript
function optimize(svg) { const svgo = new Svgo({ plugins: [ { convertShapeToPath: false }, { mergePaths: false }, { removeAttrs: { attrs: '(fill|stroke.*)' } }, { removeTitle: true }, ], }); return new Promise(resolve => { svgo.optimize(svg, ({ data }) => resolve(data)); }); }
[ "function", "optimize", "(", "svg", ")", "{", "const", "svgo", "=", "new", "Svgo", "(", "{", "plugins", ":", "[", "{", "convertShapeToPath", ":", "false", "}", ",", "{", "mergePaths", ":", "false", "}", ",", "{", "removeAttrs", ":", "{", "attrs", ":"...
Optimize SVG with `svgo`. @param {string} svg - An SVG string. @returns {Promise<string>}
[ "Optimize", "SVG", "with", "svgo", "." ]
8f658193d25e943b196a2367319b5d9e85ee9f9f
https://github.com/feathericons/feather/blob/8f658193d25e943b196a2367319b5d9e85ee9f9f/bin/process-svg.js#L28-L41
train
optimize the given SVG
[ 30522, 3853, 23569, 27605, 4371, 1006, 17917, 2290, 1007, 1063, 9530, 3367, 17917, 3995, 1027, 2047, 17917, 3995, 1006, 1063, 13354, 7076, 1024, 1031, 1063, 19884, 3270, 22327, 29477, 2705, 1024, 6270, 1065, 1010, 1063, 13590, 15069, 2015, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
summernote/summernote
src/js/base/core/lists.js
from
function from(collection) { const result = []; const length = collection.length; let idx = -1; while (++idx < length) { result[idx] = collection[idx]; } return result; }
javascript
function from(collection) { const result = []; const length = collection.length; let idx = -1; while (++idx < length) { result[idx] = collection[idx]; } return result; }
[ "function", "from", "(", "collection", ")", "{", "const", "result", "=", "[", "]", ";", "const", "length", "=", "collection", ".", "length", ";", "let", "idx", "=", "-", "1", ";", "while", "(", "++", "idx", "<", "length", ")", "{", "result", "[", ...
returns a copy of the collection with array type. @param {Collection} collection - collection eg) node.childNodes, ...
[ "returns", "a", "copy", "of", "the", "collection", "with", "array", "type", "." ]
8dcafb8107453006b905ef697a529c42e76beb3f
https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/lists.js#L90-L98
train
Creates an array of the elements of the given array.
[ 30522, 3853, 2013, 1006, 3074, 1007, 1063, 9530, 3367, 2765, 1027, 1031, 1033, 1025, 9530, 3367, 3091, 1027, 3074, 1012, 3091, 1025, 2292, 8909, 2595, 1027, 1011, 1015, 1025, 2096, 1006, 1009, 1009, 8909, 2595, 1026, 3091, 1007, 1063, 276...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/callback-return.js
findClosestParentOfType
function findClosestParentOfType(node, types) { if (!node.parent) { return null; } if (types.indexOf(node.parent.type) === -1) { return findClosestParentOfType(node.parent, types); } return node.parent; }
javascript
function findClosestParentOfType(node, types) { if (!node.parent) { return null; } if (types.indexOf(node.parent.type) === -1) { return findClosestParentOfType(node.parent, types); } return node.parent; }
[ "function", "findClosestParentOfType", "(", "node", ",", "types", ")", "{", "if", "(", "!", "node", ".", "parent", ")", "{", "return", "null", ";", "}", "if", "(", "types", ".", "indexOf", "(", "node", ".", "parent", ".", "type", ")", "===", "-", "...
-------------------------------------------------------------------------- Helpers -------------------------------------------------------------------------- Find the closest parent matching a list of types. @param {ASTNode} node The node whose parents we are searching @param {Array} types The node types to match @returns {ASTNode} The matched node or undefined.
[ "--------------------------------------------------------------------------", "Helpers", "--------------------------------------------------------------------------", "Find", "the", "closest", "parent", "matching", "a", "list", "of", "types", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/callback-return.js#L47-L55
train
find closest parent of node of given type
[ 30522, 3853, 2424, 20464, 27465, 25856, 12069, 13663, 6199, 18863, 1006, 13045, 1010, 4127, 1007, 1063, 2065, 1006, 999, 13045, 1012, 6687, 1007, 1063, 2709, 19701, 1025, 1065, 2065, 1006, 4127, 1012, 5950, 11253, 1006, 13045, 1012, 6687, 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...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
getAncestorOrSelfWithJavascriptHref
function getAncestorOrSelfWithJavascriptHref(element) { if (hasJavascriptHref(element)) { return element; } if (element.parentNode == null) { return null; } return getAncestorOrSelfWithJavascriptHref(element.parentNode); }
javascript
function getAncestorOrSelfWithJavascriptHref(element) { if (hasJavascriptHref(element)) { return element; } if (element.parentNode == null) { return null; } return getAncestorOrSelfWithJavascriptHref(element.parentNode); }
[ "function", "getAncestorOrSelfWithJavascriptHref", "(", "element", ")", "{", "if", "(", "hasJavascriptHref", "(", "element", ")", ")", "{", "return", "element", ";", "}", "if", "(", "element", ".", "parentNode", "==", "null", ")", "{", "return", "null", ";",...
Returns the given element, or its nearest ancestor, that satisfies hasJavascriptHref(). Returns null if none is found. @param element the element whose ancestors to test
[ "Returns", "the", "given", "element", "or", "its", "nearest", "ancestor", "that", "satisfies", "hasJavascriptHref", "()", ".", "Returns", "null", "if", "none", "is", "found", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L1026-L1034
train
Returns the ancestor of the given element or the parent of the element that has a javascript href attribute
[ 30522, 3853, 2131, 26755, 4263, 5668, 2884, 2546, 24415, 3900, 12044, 23235, 28362, 2546, 1006, 5783, 1007, 1063, 2065, 1006, 2038, 3900, 12044, 23235, 28362, 2546, 1006, 5783, 1007, 1007, 1063, 2709, 5783, 1025, 1065, 2065, 1006, 5783, 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...
jgraph/mxgraph
javascript/mxClient.js
mxCurrentRootChange
function mxCurrentRootChange(view, root) { this.view = view; this.root = root; this.previous = root; this.isUp = root == null; if (!this.isUp) { var tmp = this.view.currentRoot; var model = this.view.graph.getModel(); while (tmp != null) { if (tmp == root) { this.isUp = true; break; } tmp = model.getParent(tmp); } } }
javascript
function mxCurrentRootChange(view, root) { this.view = view; this.root = root; this.previous = root; this.isUp = root == null; if (!this.isUp) { var tmp = this.view.currentRoot; var model = this.view.graph.getModel(); while (tmp != null) { if (tmp == root) { this.isUp = true; break; } tmp = model.getParent(tmp); } } }
[ "function", "mxCurrentRootChange", "(", "view", ",", "root", ")", "{", "this", ".", "view", "=", "view", ";", "this", ".", "root", "=", "root", ";", "this", ".", "previous", "=", "root", ";", "this", ".", "isUp", "=", "root", "==", "null", ";", "if...
Class: mxCurrentRootChange Action to change the current root in a view. Constructor: mxCurrentRootChange Constructs a change of the current root in the given view.
[ "Class", ":", "mxCurrentRootChange" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L54021-L54044
train
This function is called when the current root of the view changes
[ 30522, 3853, 25630, 10841, 14343, 3372, 3217, 4140, 22305, 2063, 1006, 3193, 1010, 7117, 1007, 1063, 2023, 1012, 3193, 1027, 3193, 1025, 2023, 1012, 7117, 1027, 7117, 1025, 2023, 1012, 3025, 1027, 7117, 1025, 2023, 1012, 2003, 6279, 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...
adobe/brackets
src/widgets/bootstrap-twipsy-mod.js
maybeCall
function maybeCall ( thing, ctx, args ) { return typeof thing == 'function' ? thing.apply(ctx, args) : thing }
javascript
function maybeCall ( thing, ctx, args ) { return typeof thing == 'function' ? thing.apply(ctx, args) : thing }
[ "function", "maybeCall", "(", "thing", ",", "ctx", ",", "args", ")", "{", "return", "typeof", "thing", "==", "'function'", "?", "thing", ".", "apply", "(", "ctx", ",", "args", ")", ":", "thing", "}" ]
/* TWIPSY PRIVATE METHODS ======================
[ "/", "*", "TWIPSY", "PRIVATE", "METHODS", "======================" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/widgets/bootstrap-twipsy-mod.js#L307-L309
train
If thing is a function call it with the given args
[ 30522, 3853, 2672, 9289, 2140, 1006, 2518, 1010, 14931, 2595, 1010, 12098, 5620, 1007, 1063, 2709, 2828, 11253, 2518, 1027, 1027, 1005, 3853, 1005, 1029, 2518, 1012, 6611, 1006, 14931, 2595, 1010, 12098, 5620, 1007, 1024, 2518, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
verifyTagName
async function verifyTagName(tagName, execaOpts) { try { return (await execa('git', ['check-ref-format', `refs/tags/${tagName}`], execaOpts)).code === 0; } catch (error) { debug(error); } }
javascript
async function verifyTagName(tagName, execaOpts) { try { return (await execa('git', ['check-ref-format', `refs/tags/${tagName}`], execaOpts)).code === 0; } catch (error) { debug(error); } }
[ "async", "function", "verifyTagName", "(", "tagName", ",", "execaOpts", ")", "{", "try", "{", "return", "(", "await", "execa", "(", "'git'", ",", "[", "'check-ref-format'", ",", "`", "${", "tagName", "}", "`", "]", ",", "execaOpts", ")", ")", ".", "cod...
Verify a tag name is a valid Git reference. @param {String} tagName the tag name to verify. @param {Object} [execaOpts] Options to pass to `execa`. @return {Boolean} `true` if valid, falsy otherwise.
[ "Verify", "a", "tag", "name", "is", "a", "valid", "Git", "reference", "." ]
edf382f88838ed543c0b76cb6c914cca1fc1ddd1
https://github.com/semantic-release/semantic-release/blob/edf382f88838ed543c0b76cb6c914cca1fc1ddd1/lib/git.js#L162-L168
train
Verify a tag name
[ 30522, 2004, 6038, 2278, 3853, 20410, 15900, 18442, 1006, 6415, 18442, 1010, 4654, 19281, 7361, 3215, 1007, 1063, 3046, 1063, 2709, 1006, 26751, 4654, 19281, 1006, 1005, 21025, 2102, 1005, 1010, 1031, 1005, 4638, 1011, 25416, 1011, 4289, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v2/ODataListBinding.js
getSortComparator
function getSortComparator(fnCompare) { return function(vValue1, vValue2) { if (vValue1 === vValue2) { return 0; } if (vValue1 === null) { return -1; } if (vValue2 === null) { return 1; } return fnCompare(vValue1, vValue2); }; }
javascript
function getSortComparator(fnCompare) { return function(vValue1, vValue2) { if (vValue1 === vValue2) { return 0; } if (vValue1 === null) { return -1; } if (vValue2 === null) { return 1; } return fnCompare(vValue1, vValue2); }; }
[ "function", "getSortComparator", "(", "fnCompare", ")", "{", "return", "function", "(", "vValue1", ",", "vValue2", ")", "{", "if", "(", "vValue1", "===", "vValue2", ")", "{", "return", "0", ";", "}", "if", "(", "vValue1", "===", "null", ")", "{", "retu...
Creates a comparator usable for sorting. The OData comparators return "NaN" for comparisons containing null values. While this is a valid result when used for filtering, for sorting the null values need to be put in order, so the comparator must return either -1 or 1 instead, to have null sorted at the top in ascending order and on the bottom in descending order. @private
[ "Creates", "a", "comparator", "usable", "for", "sorting", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v2/ODataListBinding.js#L1269-L1282
train
Returns a comparator function that compares two values
[ 30522, 3853, 4152, 11589, 9006, 28689, 4263, 1006, 1042, 15305, 8737, 12069, 1007, 1063, 2709, 3853, 1006, 1058, 10175, 5657, 2487, 1010, 1058, 10175, 5657, 2475, 1007, 1063, 2065, 1006, 1058, 10175, 5657, 2487, 1027, 1027, 1027, 1058, 1017...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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_ArrayParsedFormula
function parse_ArrayParsedFormula(blob, length, opts) { var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; var rgcb, cce = blob.read_shift(len); // length of rgce if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; var rgce = parse_Rgce(blob, cce, opts); if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); blob.l = target; return [rgce, rgcb]; }
javascript
function parse_ArrayParsedFormula(blob, length, opts) { var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; var rgcb, cce = blob.read_shift(len); // length of rgce if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; var rgce = parse_Rgce(blob, cce, opts); if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); blob.l = target; return [rgce, rgcb]; }
[ "function", "parse_ArrayParsedFormula", "(", "blob", ",", "length", ",", "opts", ")", "{", "var", "target", "=", "blob", ".", "l", "+", "length", ",", "len", "=", "opts", ".", "biff", "==", "2", "?", "1", ":", "2", ";", "var", "rgcb", ",", "cce", ...
/* [MS-XLS] 2.5.198.1 TODO
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "5", ".", "198", ".", "1", "TODO" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L11262-L11270
train
Parse an array of RGB values
[ 30522, 3853, 11968, 3366, 1035, 9140, 19362, 6924, 14192, 7068, 1006, 1038, 4135, 2497, 1010, 3091, 1010, 23569, 2015, 1007, 1063, 13075, 4539, 1027, 1038, 4135, 2497, 1012, 1048, 1009, 3091, 1010, 18798, 1027, 23569, 2015, 1012, 12170, 424...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/file/FileUtils.js
getNativeModuleDirectoryPath
function getNativeModuleDirectoryPath(module) { var path; if (module && module.uri) { path = decodeURI(module.uri); // Remove module name and trailing slash from path. path = path.substr(0, path.lastIndexOf("/")); } return path; }
javascript
function getNativeModuleDirectoryPath(module) { var path; if (module && module.uri) { path = decodeURI(module.uri); // Remove module name and trailing slash from path. path = path.substr(0, path.lastIndexOf("/")); } return path; }
[ "function", "getNativeModuleDirectoryPath", "(", "module", ")", "{", "var", "path", ";", "if", "(", "module", "&&", "module", ".", "uri", ")", "{", "path", "=", "decodeURI", "(", "module", ".", "uri", ")", ";", "// Remove module name and trailing slash from path...
Given the module object passed to JS module define function, convert the path to a native absolute path. Returns a native absolute path to the module folder. WARNING: unlike most paths in Brackets, this path EXCLUDES the trailing "/". @return {string}
[ "Given", "the", "module", "object", "passed", "to", "JS", "module", "define", "function", "convert", "the", "path", "to", "a", "native", "absolute", "path", ".", "Returns", "a", "native", "absolute", "path", "to", "the", "module", "folder", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/file/FileUtils.js#L318-L328
train
Get the directory path of a native module
[ 30522, 3853, 2131, 19833, 3512, 5302, 8566, 3709, 7442, 16761, 22571, 8988, 1006, 11336, 1007, 1063, 13075, 4130, 1025, 2065, 1006, 11336, 1004, 1004, 11336, 1012, 24471, 2072, 1007, 1063, 4130, 1027, 21933, 3207, 9496, 1006, 11336, 1012, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(mHarFileContent, aEntries, iIndex) { var sUrlGroup = this.createUrlGroup(aEntries[iIndex].request.method, aEntries[iIndex].request.url); var customGroupName = aEntries[iIndex]._customGroupName ? aEntries[iIndex]._customGroupName : this.sDefaultCustomGroup; if (!mHarFileContent._groupedEntries[customGroupName]) { mHarFileContent._groupedEntries[customGroupName] = {}; } if (!mHarFileContent._groupedEntries[customGroupName][sUrlGroup]) { mHarFileContent._groupedEntries[customGroupName][sUrlGroup] = []; } mHarFileContent._groupedEntries[customGroupName][sUrlGroup].push(iIndex); }
javascript
function(mHarFileContent, aEntries, iIndex) { var sUrlGroup = this.createUrlGroup(aEntries[iIndex].request.method, aEntries[iIndex].request.url); var customGroupName = aEntries[iIndex]._customGroupName ? aEntries[iIndex]._customGroupName : this.sDefaultCustomGroup; if (!mHarFileContent._groupedEntries[customGroupName]) { mHarFileContent._groupedEntries[customGroupName] = {}; } if (!mHarFileContent._groupedEntries[customGroupName][sUrlGroup]) { mHarFileContent._groupedEntries[customGroupName][sUrlGroup] = []; } mHarFileContent._groupedEntries[customGroupName][sUrlGroup].push(iIndex); }
[ "function", "(", "mHarFileContent", ",", "aEntries", ",", "iIndex", ")", "{", "var", "sUrlGroup", "=", "this", ".", "createUrlGroup", "(", "aEntries", "[", "iIndex", "]", ".", "request", ".", "method", ",", "aEntries", "[", "iIndex", "]", ".", "request", ...
Adds an entry to the mapping. The order needs to be prepared and considered when adding the entry. This is used to add each entry from from a provided har file or to add an entry during runtime when play is already started. The mapping is created at 1st by a custom group, and 2nd the method and the URL (e.g. "GET/somePath/file.js"). The custom group is optional and determined from a provided callback (e.g. It can determine the name of a test or can pop from an array of names). @param {object} mHarFileContent The har file content map. @param {array} aEntries The entries array. Default location of har files is within mHarFileContent.log.entries. @param {int} iIndex The index of the entry in the entries array. This is used as the key for the mapping.
[ "Adds", "an", "entry", "to", "the", "mapping", ".", "The", "order", "needs", "to", "be", "prepared", "and", "considered", "when", "adding", "the", "entry", ".", "This", "is", "used", "to", "add", "each", "entry", "from", "from", "a", "provided", "har", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L178-L188
train
Adds an entry to the hierarchical file
[ 30522, 3853, 1006, 1049, 8167, 8873, 2571, 8663, 6528, 2102, 1010, 29347, 3372, 5134, 1010, 2462, 13629, 2595, 1007, 1063, 13075, 7505, 2140, 17058, 1027, 2023, 1012, 3443, 3126, 2140, 17058, 1006, 29347, 3372, 5134, 1031, 2462, 13629, 2595...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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 () { this.coords.w_rs = this.$cache.rs.outerWidth(false); if (!this.coords.w_rs) { return; } if (this.coords.w_rs !== this.coords.w_rs_old) { this.target = "base"; this.is_resize = true; } if (this.coords.w_rs !== this.coords.w_rs_old || this.force_redraw) { this.setMinMax(); this.calc(true); this.drawLabels(); if (this.options.grid) { this.calcGridMargin(); this.calcGridLabels(); } this.force_redraw = true; this.coords.w_rs_old = this.coords.w_rs; this.drawShadow(); } if (!this.coords.w_rs) { return; } if (!this.dragging && !this.force_redraw && !this.is_key) { return; } if (this.old_from !== this.result.from || this.old_to !== this.result.to || this.force_redraw || this.is_key) { this.drawLabels(); this.$cache.bar[0].style.left = this.coords.p_bar_x + "%"; this.$cache.bar[0].style.width = this.coords.p_bar_w + "%"; if (this.options.type === "single") { this.$cache.bar[0].style.left = 0; this.$cache.bar[0].style.width = this.coords.p_bar_w + this.coords.p_bar_x + "%"; this.$cache.s_single[0].style.left = this.coords.p_single_fake + "%"; this.$cache.single[0].style.left = this.labels.p_single_left + "%"; } else { this.$cache.s_from[0].style.left = this.coords.p_from_fake + "%"; this.$cache.s_to[0].style.left = this.coords.p_to_fake + "%"; if (this.old_from !== this.result.from || this.force_redraw) { this.$cache.from[0].style.left = this.labels.p_from_left + "%"; } if (this.old_to !== this.result.to || this.force_redraw) { this.$cache.to[0].style.left = this.labels.p_to_left + "%"; } this.$cache.single[0].style.left = this.labels.p_single_left + "%"; } this.writeToInput(); if ((this.old_from !== this.result.from || this.old_to !== this.result.to) && !this.is_start) { this.$cache.input.trigger("change"); this.$cache.input.trigger("input"); } this.old_from = this.result.from; this.old_to = this.result.to; // callbacks call if (!this.is_resize && !this.is_update && !this.is_start && !this.is_finish) { this.callOnChange(); } if (this.is_key || this.is_click) { this.is_key = false; this.is_click = false; this.callOnFinish(); } this.is_update = false; this.is_resize = false; this.is_finish = false; } this.is_start = false; this.is_key = false; this.is_click = false; this.force_redraw = false; }
javascript
function () { this.coords.w_rs = this.$cache.rs.outerWidth(false); if (!this.coords.w_rs) { return; } if (this.coords.w_rs !== this.coords.w_rs_old) { this.target = "base"; this.is_resize = true; } if (this.coords.w_rs !== this.coords.w_rs_old || this.force_redraw) { this.setMinMax(); this.calc(true); this.drawLabels(); if (this.options.grid) { this.calcGridMargin(); this.calcGridLabels(); } this.force_redraw = true; this.coords.w_rs_old = this.coords.w_rs; this.drawShadow(); } if (!this.coords.w_rs) { return; } if (!this.dragging && !this.force_redraw && !this.is_key) { return; } if (this.old_from !== this.result.from || this.old_to !== this.result.to || this.force_redraw || this.is_key) { this.drawLabels(); this.$cache.bar[0].style.left = this.coords.p_bar_x + "%"; this.$cache.bar[0].style.width = this.coords.p_bar_w + "%"; if (this.options.type === "single") { this.$cache.bar[0].style.left = 0; this.$cache.bar[0].style.width = this.coords.p_bar_w + this.coords.p_bar_x + "%"; this.$cache.s_single[0].style.left = this.coords.p_single_fake + "%"; this.$cache.single[0].style.left = this.labels.p_single_left + "%"; } else { this.$cache.s_from[0].style.left = this.coords.p_from_fake + "%"; this.$cache.s_to[0].style.left = this.coords.p_to_fake + "%"; if (this.old_from !== this.result.from || this.force_redraw) { this.$cache.from[0].style.left = this.labels.p_from_left + "%"; } if (this.old_to !== this.result.to || this.force_redraw) { this.$cache.to[0].style.left = this.labels.p_to_left + "%"; } this.$cache.single[0].style.left = this.labels.p_single_left + "%"; } this.writeToInput(); if ((this.old_from !== this.result.from || this.old_to !== this.result.to) && !this.is_start) { this.$cache.input.trigger("change"); this.$cache.input.trigger("input"); } this.old_from = this.result.from; this.old_to = this.result.to; // callbacks call if (!this.is_resize && !this.is_update && !this.is_start && !this.is_finish) { this.callOnChange(); } if (this.is_key || this.is_click) { this.is_key = false; this.is_click = false; this.callOnFinish(); } this.is_update = false; this.is_resize = false; this.is_finish = false; } this.is_start = false; this.is_key = false; this.is_click = false; this.force_redraw = false; }
[ "function", "(", ")", "{", "this", ".", "coords", ".", "w_rs", "=", "this", ".", "$cache", ".", "rs", ".", "outerWidth", "(", "false", ")", ";", "if", "(", "!", "this", ".", "coords", ".", "w_rs", ")", "{", "return", ";", "}", "if", "(", "this"...
Draw handles
[ "Draw", "handles" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1355-L1445
train
update the css
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 2522, 8551, 2015, 1012, 1059, 1035, 12667, 1027, 2023, 1012, 1002, 17053, 1012, 12667, 1012, 6058, 9148, 11927, 2232, 1006, 6270, 1007, 1025, 2065, 1006, 999, 2023, 1012, 2522, 8551, 2015, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/keyword-spacing.js
checkSpacingForTryStatement
function checkSpacingForTryStatement(node) { checkSpacingAroundFirstToken(node); checkSpacingAroundFirstToken(node.handler); checkSpacingAroundTokenBefore(node.finalizer); }
javascript
function checkSpacingForTryStatement(node) { checkSpacingAroundFirstToken(node); checkSpacingAroundFirstToken(node.handler); checkSpacingAroundTokenBefore(node.finalizer); }
[ "function", "checkSpacingForTryStatement", "(", "node", ")", "{", "checkSpacingAroundFirstToken", "(", "node", ")", ";", "checkSpacingAroundFirstToken", "(", "node", ".", "handler", ")", ";", "checkSpacingAroundTokenBefore", "(", "node", ".", "finalizer", ")", ";", ...
Reports `try`, `catch`, and `finally` keywords of a given node if usage of spacing around those keywords is invalid. @param {ASTNode} node - A node to report. @returns {void}
[ "Reports", "try", "catch", "and", "finally", "keywords", "of", "a", "given", "node", "if", "usage", "of", "spacing", "around", "those", "keywords", "is", "invalid", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/keyword-spacing.js#L397-L401
train
Check spacing around the first token of a try statement.
[ 30522, 3853, 14148, 19498, 2075, 13028, 24769, 12259, 3672, 1006, 13045, 1007, 1063, 14148, 19498, 28234, 22494, 4859, 8873, 12096, 18715, 2368, 1006, 13045, 1007, 1025, 14148, 19498, 28234, 22494, 4859, 8873, 12096, 18715, 2368, 1006, 13045, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
keplergl/kepler.gl
src/components/kepler-gl.js
mergeActions
function mergeActions(actions, userActions) { const overrides = {}; for (const key in userActions) { if (userActions.hasOwnProperty(key) && actions.hasOwnProperty(key)) { overrides[key] = userActions[key]; } } return {...actions, ...overrides}; }
javascript
function mergeActions(actions, userActions) { const overrides = {}; for (const key in userActions) { if (userActions.hasOwnProperty(key) && actions.hasOwnProperty(key)) { overrides[key] = userActions[key]; } } return {...actions, ...overrides}; }
[ "function", "mergeActions", "(", "actions", ",", "userActions", ")", "{", "const", "overrides", "=", "{", "}", ";", "for", "(", "const", "key", "in", "userActions", ")", "{", "if", "(", "userActions", ".", "hasOwnProperty", "(", "key", ")", "&&", "action...
Override default maps-gl actions with user defined actions using the same key
[ "Override", "default", "maps", "-", "gl", "actions", "with", "user", "defined", "actions", "using", "the", "same", "key" ]
779238435707cc54335c2d00001e4b9334b314aa
https://github.com/keplergl/kepler.gl/blob/779238435707cc54335c2d00001e4b9334b314aa/src/components/kepler-gl.js#L374-L383
train
Merge the user s actions with the new ones
[ 30522, 3853, 13590, 18908, 8496, 1006, 4506, 1010, 5310, 18908, 8496, 1007, 1063, 9530, 3367, 2058, 15637, 2015, 1027, 1063, 1065, 1025, 2005, 1006, 9530, 3367, 3145, 1999, 5310, 18908, 8496, 1007, 1063, 2065, 1006, 5310, 18908, 8496, 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
lib/jsdoc/transform-apijson-for-sdk.js
function (sText, bSkipParagraphs) { let oSelf = this._oTopicData, oOwnLibrary = this._oOwnLibrary, oDependencyLibs = oChainObject.oDependentAPIs, oOptions = { linkFormatter: function (sTarget, sText) { let aMatch, aTarget; // keep the full target in the fallback text sText = sText || sTarget; // If the link has a protocol, do not modify, but open in a new window if (/:\/\//.test(sTarget)) { return this.handleExternalUrl(sTarget, sText); } // topic:xxx Topic aMatch = sTarget.match(/^topic:(\w{32})$/); if (aMatch) { return '<a target="_self" href="#/topic/' + aMatch[1] + '">' + sText + '</a>'; } // sap.x.Xxx.prototype.xxx - In case of prototype we have a link to method aMatch = sTarget.match(/([a-zA-Z0-9.$_]+?)\.prototype\.([a-zA-Z0-9.$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[2], type: "methods", className: aMatch[1], text: sText }); } // Heuristics: Extend is always a static method // sap.x.Xxx.extend // module:sap/x/Xxx.extend aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)\.extend$/); if (aMatch) { let [, sModule, sClass] = aMatch; return this.createLink({ name: sTarget.replace(/^module:/, ""), type: "methods", className: (sModule ? sModule : "") + sClass, text: sText }); } // Constructor links are handled in special manner by the SDK // sap.x.Xxx.constructor // sap.x.Xxx#constructor // module:sap/x/Xxx.constructor // #constructor aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)?[\.#]constructor$/i); if (aMatch) { let [, sModule, sClass] = aMatch, sName; if (sClass) { sName = (sModule ? sModule : "") + sClass; } else { sName = oSelf.name } return this.createLink({ name: sName, hrefAppend: "/constructor", text: sText }); } // #.setText - local static method // #setText - local instance method // #.setText.from - local nested method aMatch = sTarget.match(/^#(\.)?([a-zA-Z0-9.$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[1] ? `${oSelf.name}.${aMatch[2]}` : aMatch[2], type: "methods", className: oSelf.name, local: true, text: sText }); } // #event:press - local event aMatch = sTarget.match(/^#event:([a-zA-Z0-9$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[1], type: "events", className: oSelf.name, local: true, text: sText }); } // Event links // sap.m.Button#event:press // sap.m.Button.event:press // module:sap/m/Button.event:press // module:sap/m/Button#event:press aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)[.#]event:([a-zA-Z0-9$_]+)$/); if (aMatch) { let [, sModule, sClass, sEvent] = aMatch; return this.createLink({ name: sEvent, type: "events", className: (sModule ? sModule : "") + sClass, text: sText }); } // sap.m.Button#setText - instance method // module:sap/m/Button#setText aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+)#([a-zA-Z0-9.$_]+)$/); if (aMatch) { let [, sModule, sClass, sMethod] = aMatch; return this.createLink({ name: sMethod, type: "methods", className: (sModule ? sModule : "") + sClass, text: sText }); } // Unresolved type - try to discover target type // sap.x.Xxx.xxx // module:sap/x/Xxx.xxx if (/^(?:module:)?([a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/.test(sTarget)) { let [,sClass, sName] = sTarget.match(/^((?:module:)?[a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/), sResult = this.createLinkFromTargetType({ className: sClass, methodName: sName, target: sTarget, self: oSelf, ownLibrary: oOwnLibrary, dependencyLibs: oDependencyLibs, text: sText }); if (sResult) { return sResult; } } // Possible nested functions discovery - currently we do this only for regular symbols aTarget = sTarget.split("."); if (aTarget.length >= 3) { let sResult = this.createLinkFromTargetType({ methodName: aTarget.splice(-2).join("."), className: aTarget.join("."), target: sTarget, self: oSelf, ownLibrary: oOwnLibrary, dependencyLibs: oDependencyLibs, text: sText }); if (sResult) { return sResult; } } // Possible forward reference - we will treat them as symbol link return this.createLink({ name: sTarget, text: sText }); }.bind(this) }; if (bSkipParagraphs) { oOptions.beforeParagraph = ""; oOptions.afterParagraph = ""; } return this.JSDocUtil().formatTextBlock(sText, oOptions); }
javascript
function (sText, bSkipParagraphs) { let oSelf = this._oTopicData, oOwnLibrary = this._oOwnLibrary, oDependencyLibs = oChainObject.oDependentAPIs, oOptions = { linkFormatter: function (sTarget, sText) { let aMatch, aTarget; // keep the full target in the fallback text sText = sText || sTarget; // If the link has a protocol, do not modify, but open in a new window if (/:\/\//.test(sTarget)) { return this.handleExternalUrl(sTarget, sText); } // topic:xxx Topic aMatch = sTarget.match(/^topic:(\w{32})$/); if (aMatch) { return '<a target="_self" href="#/topic/' + aMatch[1] + '">' + sText + '</a>'; } // sap.x.Xxx.prototype.xxx - In case of prototype we have a link to method aMatch = sTarget.match(/([a-zA-Z0-9.$_]+?)\.prototype\.([a-zA-Z0-9.$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[2], type: "methods", className: aMatch[1], text: sText }); } // Heuristics: Extend is always a static method // sap.x.Xxx.extend // module:sap/x/Xxx.extend aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)\.extend$/); if (aMatch) { let [, sModule, sClass] = aMatch; return this.createLink({ name: sTarget.replace(/^module:/, ""), type: "methods", className: (sModule ? sModule : "") + sClass, text: sText }); } // Constructor links are handled in special manner by the SDK // sap.x.Xxx.constructor // sap.x.Xxx#constructor // module:sap/x/Xxx.constructor // #constructor aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)?[\.#]constructor$/i); if (aMatch) { let [, sModule, sClass] = aMatch, sName; if (sClass) { sName = (sModule ? sModule : "") + sClass; } else { sName = oSelf.name } return this.createLink({ name: sName, hrefAppend: "/constructor", text: sText }); } // #.setText - local static method // #setText - local instance method // #.setText.from - local nested method aMatch = sTarget.match(/^#(\.)?([a-zA-Z0-9.$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[1] ? `${oSelf.name}.${aMatch[2]}` : aMatch[2], type: "methods", className: oSelf.name, local: true, text: sText }); } // #event:press - local event aMatch = sTarget.match(/^#event:([a-zA-Z0-9$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[1], type: "events", className: oSelf.name, local: true, text: sText }); } // Event links // sap.m.Button#event:press // sap.m.Button.event:press // module:sap/m/Button.event:press // module:sap/m/Button#event:press aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)[.#]event:([a-zA-Z0-9$_]+)$/); if (aMatch) { let [, sModule, sClass, sEvent] = aMatch; return this.createLink({ name: sEvent, type: "events", className: (sModule ? sModule : "") + sClass, text: sText }); } // sap.m.Button#setText - instance method // module:sap/m/Button#setText aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+)#([a-zA-Z0-9.$_]+)$/); if (aMatch) { let [, sModule, sClass, sMethod] = aMatch; return this.createLink({ name: sMethod, type: "methods", className: (sModule ? sModule : "") + sClass, text: sText }); } // Unresolved type - try to discover target type // sap.x.Xxx.xxx // module:sap/x/Xxx.xxx if (/^(?:module:)?([a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/.test(sTarget)) { let [,sClass, sName] = sTarget.match(/^((?:module:)?[a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/), sResult = this.createLinkFromTargetType({ className: sClass, methodName: sName, target: sTarget, self: oSelf, ownLibrary: oOwnLibrary, dependencyLibs: oDependencyLibs, text: sText }); if (sResult) { return sResult; } } // Possible nested functions discovery - currently we do this only for regular symbols aTarget = sTarget.split("."); if (aTarget.length >= 3) { let sResult = this.createLinkFromTargetType({ methodName: aTarget.splice(-2).join("."), className: aTarget.join("."), target: sTarget, self: oSelf, ownLibrary: oOwnLibrary, dependencyLibs: oDependencyLibs, text: sText }); if (sResult) { return sResult; } } // Possible forward reference - we will treat them as symbol link return this.createLink({ name: sTarget, text: sText }); }.bind(this) }; if (bSkipParagraphs) { oOptions.beforeParagraph = ""; oOptions.afterParagraph = ""; } return this.JSDocUtil().formatTextBlock(sText, oOptions); }
[ "function", "(", "sText", ",", "bSkipParagraphs", ")", "{", "let", "oSelf", "=", "this", ".", "_oTopicData", ",", "oOwnLibrary", "=", "this", ".", "_oOwnLibrary", ",", "oDependencyLibs", "=", "oChainObject", ".", "oDependentAPIs", ",", "oOptions", "=", "{", ...
Pre-process links in text block @param {string} sText text block @param {boolean} bSkipParagraphs skip paragraphs @returns {string} processed text block @private
[ "Pre", "-", "process", "links", "in", "text", "block" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1426-L1602
train
Create a link to the topic
[ 30522, 3853, 1006, 26261, 18413, 1010, 18667, 3211, 13944, 29181, 24342, 2015, 1007, 1063, 2292, 9808, 2884, 2546, 1027, 2023, 1012, 1035, 27178, 7361, 2594, 2850, 2696, 1010, 1051, 12384, 29521, 19848, 2100, 1027, 2023, 1012, 1035, 1051, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js
function () { var oModel = this._oDialog.getModel("view"), oControl = this._getControl("customDebugValue", this._DEBUG_MODULES_ID), oTreeResults; try { this._validateCustomDebugValue(oControl.getValue()); } catch (oException) { this._showError(oControl, oException.message); return; } // convert boolean string to boolean value if (oModel.getProperty("/CustomDebugMode") === "true") { oModel.setProperty("/CustomDebugMode", true); } if (oModel.getProperty("/CustomDebugMode") === "false") { oModel.setProperty("/CustomDebugMode", false); } // set validated value and update tree accordingly window["sap-ui-debug"] = oModel.getProperty("/CustomDebugMode"); oTreeResults = this._treeHelper.toTreeModel(this._oModuleSystemInfo); oModel.setProperty("/DebugModules", [oTreeResults.tree]); // adopt tree depth to the deepest currently selected module this._getControl("tree", this._DEBUG_MODULES_ID).expandToLevel(Math.max(this._MIN_EXPAND_LEVEL_DEBUG_MODULES, oTreeResults.depth)); this._updateTreeInfos(); }
javascript
function () { var oModel = this._oDialog.getModel("view"), oControl = this._getControl("customDebugValue", this._DEBUG_MODULES_ID), oTreeResults; try { this._validateCustomDebugValue(oControl.getValue()); } catch (oException) { this._showError(oControl, oException.message); return; } // convert boolean string to boolean value if (oModel.getProperty("/CustomDebugMode") === "true") { oModel.setProperty("/CustomDebugMode", true); } if (oModel.getProperty("/CustomDebugMode") === "false") { oModel.setProperty("/CustomDebugMode", false); } // set validated value and update tree accordingly window["sap-ui-debug"] = oModel.getProperty("/CustomDebugMode"); oTreeResults = this._treeHelper.toTreeModel(this._oModuleSystemInfo); oModel.setProperty("/DebugModules", [oTreeResults.tree]); // adopt tree depth to the deepest currently selected module this._getControl("tree", this._DEBUG_MODULES_ID).expandToLevel(Math.max(this._MIN_EXPAND_LEVEL_DEBUG_MODULES, oTreeResults.depth)); this._updateTreeInfos(); }
[ "function", "(", ")", "{", "var", "oModel", "=", "this", ".", "_oDialog", ".", "getModel", "(", "\"view\"", ")", ",", "oControl", "=", "this", ".", "_getControl", "(", "\"customDebugValue\"", ",", "this", ".", "_DEBUG_MODULES_ID", ")", ",", "oTreeResults", ...
Sets the validated value from the input field and re-evaluates the module tree according to the input
[ "Sets", "the", "validated", "value", "from", "the", "input", "field", "and", "re", "-", "evaluates", "the", "module", "tree", "according", "to", "the", "input" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L245-L274
train
Validates the custom debug value of the module system
[ 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, 1051, 8663, 13181, 2140, 1027, 2023, 1012, 1035, 2131, 8663, 13181, 2140, 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...
angular/material
src/core/services/interimElement/interimElement.js
destroy
function destroy(targetEl) { var interim = !targetEl ? showingInterims.shift() : null; var parentEl = angular.element(targetEl).length && angular.element(targetEl)[0].parentNode; if (parentEl) { // Try to find the interim in the stack which corresponds to the supplied DOM element. var filtered = showingInterims.filter(function(entry) { return entry.options.element[0] === parentEl; }); // Note: This function might be called when the element already has been removed, // in which case we won't find any matches. if (filtered.length) { interim = filtered[0]; showingInterims.splice(showingInterims.indexOf(interim), 1); } } return interim ? interim.remove(SHOW_CANCELLED, false, { '$destroy': true }) : $q.when(SHOW_CANCELLED); }
javascript
function destroy(targetEl) { var interim = !targetEl ? showingInterims.shift() : null; var parentEl = angular.element(targetEl).length && angular.element(targetEl)[0].parentNode; if (parentEl) { // Try to find the interim in the stack which corresponds to the supplied DOM element. var filtered = showingInterims.filter(function(entry) { return entry.options.element[0] === parentEl; }); // Note: This function might be called when the element already has been removed, // in which case we won't find any matches. if (filtered.length) { interim = filtered[0]; showingInterims.splice(showingInterims.indexOf(interim), 1); } } return interim ? interim.remove(SHOW_CANCELLED, false, { '$destroy': true }) : $q.when(SHOW_CANCELLED); }
[ "function", "destroy", "(", "targetEl", ")", "{", "var", "interim", "=", "!", "targetEl", "?", "showingInterims", ".", "shift", "(", ")", ":", "null", ";", "var", "parentEl", "=", "angular", ".", "element", "(", "targetEl", ")", ".", "length", "&&", "a...
/* Special method to quick-remove the interim element without animations Note: interim elements are in "interim containers"
[ "/", "*", "Special", "method", "to", "quick", "-", "remove", "the", "interim", "element", "without", "animations", "Note", ":", "interim", "elements", "are", "in", "interim", "containers" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L449-L470
train
Destroy an element from the stack
[ 30522, 3853, 6033, 1006, 4539, 2884, 1007, 1063, 13075, 9455, 1027, 999, 4539, 2884, 1029, 4760, 18447, 11124, 5244, 1012, 5670, 1006, 1007, 1024, 19701, 1025, 13075, 6687, 2884, 1027, 16108, 1012, 5783, 1006, 4539, 2884, 1007, 1012, 3091, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-param-reassign.js
checkReference
function checkReference(reference, index, references) { const identifier = reference.identifier; if (identifier && !reference.init && /* * Destructuring assignments can have multiple default value, * so possibly there are multiple writeable references for the same identifier. */ (index === 0 || references[index - 1].identifier !== identifier) ) { if (reference.isWrite()) { context.report({ node: identifier, message: "Assignment to function parameter '{{name}}'.", data: { name: identifier.name } }); } else if (props && isModifyingProp(reference) && ignoredPropertyAssignmentsFor.indexOf(identifier.name) === -1) { context.report({ node: identifier, message: "Assignment to property of function parameter '{{name}}'.", data: { name: identifier.name } }); } } }
javascript
function checkReference(reference, index, references) { const identifier = reference.identifier; if (identifier && !reference.init && /* * Destructuring assignments can have multiple default value, * so possibly there are multiple writeable references for the same identifier. */ (index === 0 || references[index - 1].identifier !== identifier) ) { if (reference.isWrite()) { context.report({ node: identifier, message: "Assignment to function parameter '{{name}}'.", data: { name: identifier.name } }); } else if (props && isModifyingProp(reference) && ignoredPropertyAssignmentsFor.indexOf(identifier.name) === -1) { context.report({ node: identifier, message: "Assignment to property of function parameter '{{name}}'.", data: { name: identifier.name } }); } } }
[ "function", "checkReference", "(", "reference", ",", "index", ",", "references", ")", "{", "const", "identifier", "=", "reference", ".", "identifier", ";", "if", "(", "identifier", "&&", "!", "reference", ".", "init", "&&", "/*\n * Destructuring as...
Reports a reference if is non initializer and writable. @param {Reference} reference - A reference to check. @param {int} index - The index of the reference in the references. @param {Reference[]} references - The array that the reference belongs to. @returns {void}
[ "Reports", "a", "reference", "if", "is", "non", "initializer", "and", "writable", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-param-reassign.js#L135-L153
train
Check if a reference is valid
[ 30522, 3853, 4638, 2890, 25523, 1006, 4431, 1010, 5950, 1010, 7604, 1007, 1063, 9530, 3367, 8909, 4765, 18095, 1027, 4431, 1012, 8909, 4765, 18095, 1025, 2065, 1006, 8909, 4765, 18095, 1004, 1004, 999, 4431, 1012, 1999, 4183, 1004, 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...
moment/luxon
src/impl/util.js
asNumber
function asNumber(value) { const numericValue = Number(value); if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) throw new InvalidArgumentError(`Invalid unit value ${value}`); return numericValue; }
javascript
function asNumber(value) { const numericValue = Number(value); if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) throw new InvalidArgumentError(`Invalid unit value ${value}`); return numericValue; }
[ "function", "asNumber", "(", "value", ")", "{", "const", "numericValue", "=", "Number", "(", "value", ")", ";", "if", "(", "typeof", "value", "===", "\"boolean\"", "||", "value", "===", "\"\"", "||", "Number", ".", "isNaN", "(", "numericValue", ")", ")",...
COERCION
[ "COERCION" ]
236f2badea297ee73421aa39a83e06177c1be6d0
https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/impl/util.js#L222-L227
train
Converts value to a number
[ 30522, 3853, 2004, 19172, 5677, 1006, 3643, 1007, 1063, 9530, 3367, 16371, 25531, 10175, 5657, 1027, 2193, 1006, 3643, 1007, 1025, 2065, 1006, 2828, 11253, 3643, 1027, 1027, 1027, 1000, 22017, 20898, 1000, 1064, 1064, 3643, 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...
eslint/eslint
lib/rules/indent-legacy.js
getNodeIndent
function getNodeIndent(node, byLastLine) { const token = byLastLine ? sourceCode.getLastToken(node) : sourceCode.getFirstToken(node); const srcCharsBeforeNode = sourceCode.getText(token, token.loc.start.column).split(""); const indentChars = srcCharsBeforeNode.slice(0, srcCharsBeforeNode.findIndex(char => char !== " " && char !== "\t")); const spaces = indentChars.filter(char => char === " ").length; const tabs = indentChars.filter(char => char === "\t").length; return { space: spaces, tab: tabs, goodChar: indentType === "space" ? spaces : tabs, badChar: indentType === "space" ? tabs : spaces }; }
javascript
function getNodeIndent(node, byLastLine) { const token = byLastLine ? sourceCode.getLastToken(node) : sourceCode.getFirstToken(node); const srcCharsBeforeNode = sourceCode.getText(token, token.loc.start.column).split(""); const indentChars = srcCharsBeforeNode.slice(0, srcCharsBeforeNode.findIndex(char => char !== " " && char !== "\t")); const spaces = indentChars.filter(char => char === " ").length; const tabs = indentChars.filter(char => char === "\t").length; return { space: spaces, tab: tabs, goodChar: indentType === "space" ? spaces : tabs, badChar: indentType === "space" ? tabs : spaces }; }
[ "function", "getNodeIndent", "(", "node", ",", "byLastLine", ")", "{", "const", "token", "=", "byLastLine", "?", "sourceCode", ".", "getLastToken", "(", "node", ")", ":", "sourceCode", ".", "getFirstToken", "(", "node", ")", ";", "const", "srcCharsBeforeNode",...
Get the actual indent of node @param {ASTNode|Token} node Node to examine @param {boolean} [byLastLine=false] get indent of node's last line @returns {Object} The node's indent. Contains keys `space` and `tab`, representing the indent of each character. Also contains keys `goodChar` and `badChar`, where `goodChar` is the amount of the user's desired indentation character, and `badChar` is the amount of the other indentation character.
[ "Get", "the", "actual", "indent", "of", "node" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/indent-legacy.js#L340-L353
train
Get node indent
[ 30522, 3853, 2131, 3630, 3207, 22254, 4765, 1006, 13045, 1010, 2011, 8523, 19646, 3170, 1007, 1063, 9530, 3367, 19204, 1027, 2011, 8523, 19646, 3170, 1029, 3120, 16044, 1012, 2131, 8523, 9284, 7520, 1006, 13045, 1007, 1024, 3120, 16044, 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...
adobe/brackets
src/language/JSUtils.js
nextToken
function nextToken() { if (curOffset >= length) { return false; } if (stream) { // Set the start of the next token to the current stream position. stream.start = stream.pos; } while (!stream || stream.eol()) { if (!nextLine()) { return false; } } style = mode.token(stream, state); token = stream.current(); curOffset = lineStart + stream.pos; return true; }
javascript
function nextToken() { if (curOffset >= length) { return false; } if (stream) { // Set the start of the next token to the current stream position. stream.start = stream.pos; } while (!stream || stream.eol()) { if (!nextLine()) { return false; } } style = mode.token(stream, state); token = stream.current(); curOffset = lineStart + stream.pos; return true; }
[ "function", "nextToken", "(", ")", "{", "if", "(", "curOffset", ">=", "length", ")", "{", "return", "false", ";", "}", "if", "(", "stream", ")", "{", "// Set the start of the next token to the current stream position.", "stream", ".", "start", "=", "stream", "."...
Get the next token, updating the style and token to refer to the current token, and updating the curOffset to point to the end of the token (relative to the start of the original text).
[ "Get", "the", "next", "token", "updating", "the", "style", "and", "token", "to", "refer", "to", "the", "current", "token", "and", "updating", "the", "curOffset", "to", "point", "to", "the", "end", "of", "the", "token", "(", "relative", "to", "the", "star...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/JSUtils.js#L201-L218
train
Returns true if the next token in the stream
[ 30522, 3853, 2279, 18715, 2368, 1006, 1007, 1063, 2065, 1006, 12731, 3217, 21807, 3388, 1028, 1027, 3091, 1007, 1063, 2709, 6270, 1025, 1065, 2065, 1006, 5460, 1007, 1063, 1013, 1013, 2275, 1996, 2707, 1997, 1996, 2279, 19204, 2000, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/services/gesture/gesture.js
canFocus
function canFocus(element) { return ( !!element && element.getAttribute('tabindex') !== '-1' && !element.hasAttribute('disabled') && ( element.hasAttribute('tabindex') || element.hasAttribute('href') || element.isContentEditable || ['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA', 'VIDEO', 'AUDIO'].indexOf(element.nodeName) !== -1 ) ); }
javascript
function canFocus(element) { return ( !!element && element.getAttribute('tabindex') !== '-1' && !element.hasAttribute('disabled') && ( element.hasAttribute('tabindex') || element.hasAttribute('href') || element.isContentEditable || ['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA', 'VIDEO', 'AUDIO'].indexOf(element.nodeName) !== -1 ) ); }
[ "function", "canFocus", "(", "element", ")", "{", "return", "(", "!", "!", "element", "&&", "element", ".", "getAttribute", "(", "'tabindex'", ")", "!==", "'-1'", "&&", "!", "element", ".", "hasAttribute", "(", "'disabled'", ")", "&&", "(", "element", "....
Checks whether an element can be focused.
[ "Checks", "whether", "an", "element", "can", "be", "focused", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L782-L794
train
Returns true if the element can be focused.
[ 30522, 3853, 2064, 14876, 7874, 1006, 5783, 1007, 1063, 2709, 1006, 999, 999, 5783, 1004, 1004, 5783, 1012, 2131, 19321, 3089, 8569, 2618, 1006, 1005, 21628, 22254, 10288, 1005, 1007, 999, 1027, 1027, 1005, 1011, 1015, 1005, 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...
Freeboard/freeboard
js/freeboard.thirdparty.js
function(id, offset, period) { var target = $(id), inst = this._getInst(target[0]); if (this._isDisabledDatepicker(target[0])) { return; } this._adjustInstDate(inst, offset + (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning period); this._updateDatepicker(inst); }
javascript
function(id, offset, period) { var target = $(id), inst = this._getInst(target[0]); if (this._isDisabledDatepicker(target[0])) { return; } this._adjustInstDate(inst, offset + (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning period); this._updateDatepicker(inst); }
[ "function", "(", "id", ",", "offset", ",", "period", ")", "{", "var", "target", "=", "$", "(", "id", ")", ",", "inst", "=", "this", ".", "_getInst", "(", "target", "[", "0", "]", ")", ";", "if", "(", "this", ".", "_isDisabledDatepicker", "(", "ta...
/* Adjust one of the date sub-fields.
[ "/", "*", "Adjust", "one", "of", "the", "date", "sub", "-", "fields", "." ]
38789f6e8bd3d04f7d3b2c3427e509d00f2610fc
https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L8533-L8544
train
Adjusts the datepicker to the specified offset.
[ 30522, 3853, 1006, 8909, 1010, 16396, 1010, 2558, 1007, 1063, 13075, 4539, 1027, 1002, 1006, 8909, 1007, 1010, 16021, 2102, 1027, 2023, 1012, 1035, 2131, 7076, 2102, 1006, 4539, 1031, 1014, 1033, 1007, 1025, 2065, 1006, 2023, 1012, 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...
adobe/brackets
src/document/DocumentCommandHandlers.js
_configureEditorAndResolve
function _configureEditorAndResolve() { var editor = EditorManager.getActiveEditor(); if (editor) { if (settings) { editor.setSelections(settings.selections); editor.setScrollPos(settings.scrollPos.x, settings.scrollPos.y); } } result.resolve(newFile); }
javascript
function _configureEditorAndResolve() { var editor = EditorManager.getActiveEditor(); if (editor) { if (settings) { editor.setSelections(settings.selections); editor.setScrollPos(settings.scrollPos.x, settings.scrollPos.y); } } result.resolve(newFile); }
[ "function", "_configureEditorAndResolve", "(", ")", "{", "var", "editor", "=", "EditorManager", ".", "getActiveEditor", "(", ")", ";", "if", "(", "editor", ")", "{", "if", "(", "settings", ")", "{", "editor", ".", "setSelections", "(", "settings", ".", "se...
Reconstruct old doc's editor's view state, & finally resolve overall promise
[ "Reconstruct", "old", "doc", "s", "editor", "s", "view", "state", "&", "finally", "resolve", "overall", "promise" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L902-L911
train
Configure editor and resolve promise
[ 30522, 3853, 1035, 9530, 8873, 27390, 13089, 15660, 5685, 6072, 4747, 3726, 1006, 1007, 1063, 13075, 3559, 1027, 3559, 24805, 4590, 1012, 2131, 19620, 2098, 15660, 1006, 1007, 1025, 2065, 1006, 3559, 1007, 1063, 2065, 1006, 10906, 1007, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/NavigationAndHistory/main.js
_syncWithFileSystem
function _syncWithFileSystem() { _mrofList = _mrofList.filter(function (e) {return e; }); return Async.doSequentially(_mrofList, _checkExt, false); }
javascript
function _syncWithFileSystem() { _mrofList = _mrofList.filter(function (e) {return e; }); return Async.doSequentially(_mrofList, _checkExt, false); }
[ "function", "_syncWithFileSystem", "(", ")", "{", "_mrofList", "=", "_mrofList", ".", "filter", "(", "function", "(", "e", ")", "{", "return", "e", ";", "}", ")", ";", "return", "Async", ".", "doSequentially", "(", "_mrofList", ",", "_checkExt", ",", "fa...
Checks whether entries in MROF list actually exists in fileSystem to prevent access to deleted files @private
[ "Checks", "whether", "entries", "in", "MROF", "list", "actually", "exists", "in", "fileSystem", "to", "prevent", "access", "to", "deleted", "files" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/main.js#L190-L193
train
Syncs the file system with the local filesystem
[ 30522, 3853, 1035, 26351, 24415, 8873, 4244, 27268, 6633, 1006, 1007, 1063, 1035, 2720, 11253, 9863, 1027, 1035, 2720, 11253, 9863, 1012, 11307, 1006, 3853, 1006, 1041, 1007, 1063, 2709, 1041, 1025, 1065, 1007, 1025, 2709, 2004, 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
CuteFile
function CuteFile( file, chunkSize ) { var pending = [], blob = file.source, total = blob.size, chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, start = 0, index = 0, len, api; api = { file: file, has: function() { return !!pending.length; }, shift: function() { return pending.shift(); }, unshift: function( block ) { pending.unshift( block ); } }; while ( index < chunks ) { len = Math.min( chunkSize, total - start ); pending.push({ file: file, start: start, end: chunkSize ? (start + len) : total, total: total, chunks: chunks, chunk: index++, cuted: api }); start += len; } file.blocks = pending.concat(); file.remaning = pending.length; return api; }
javascript
function CuteFile( file, chunkSize ) { var pending = [], blob = file.source, total = blob.size, chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, start = 0, index = 0, len, api; api = { file: file, has: function() { return !!pending.length; }, shift: function() { return pending.shift(); }, unshift: function( block ) { pending.unshift( block ); } }; while ( index < chunks ) { len = Math.min( chunkSize, total - start ); pending.push({ file: file, start: start, end: chunkSize ? (start + len) : total, total: total, chunks: chunks, chunk: index++, cuted: api }); start += len; } file.blocks = pending.concat(); file.remaning = pending.length; return api; }
[ "function", "CuteFile", "(", "file", ",", "chunkSize", ")", "{", "var", "pending", "=", "[", "]", ",", "blob", "=", "file", ".", "source", ",", "total", "=", "blob", ".", "size", ",", "chunks", "=", "chunkSize", "?", "Math", ".", "ceil", "(", "tota...
负责将文件切片。
[ "负责将文件切片。" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L2960-L3004
train
CuteFile - Cute file
[ 30522, 3853, 10140, 8873, 2571, 1006, 5371, 1010, 24839, 4697, 1007, 1063, 13075, 14223, 1027, 1031, 1033, 1010, 1038, 4135, 2497, 1027, 5371, 1012, 3120, 1010, 2561, 1027, 1038, 4135, 2497, 1012, 2946, 1010, 24839, 1027, 24839, 4697, 1029,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
function(node, startListener, moveListener, endListener) { if (startListener != null) { mxEvent.addListener(node, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown', startListener); } if (moveListener != null) { mxEvent.addListener(node, (mxClient.IS_POINTER) ? 'pointermove' : 'mousemove', moveListener); } if (endListener != null) { mxEvent.addListener(node, (mxClient.IS_POINTER) ? 'pointerup' : 'mouseup', endListener); } if (!mxClient.IS_POINTER && mxClient.IS_TOUCH) { if (startListener != null) { mxEvent.addListener(node, 'touchstart', startListener); } if (moveListener != null) { mxEvent.addListener(node, 'touchmove', moveListener); } if (endListener != null) { mxEvent.addListener(node, 'touchend', endListener); } } }
javascript
function(node, startListener, moveListener, endListener) { if (startListener != null) { mxEvent.addListener(node, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown', startListener); } if (moveListener != null) { mxEvent.addListener(node, (mxClient.IS_POINTER) ? 'pointermove' : 'mousemove', moveListener); } if (endListener != null) { mxEvent.addListener(node, (mxClient.IS_POINTER) ? 'pointerup' : 'mouseup', endListener); } if (!mxClient.IS_POINTER && mxClient.IS_TOUCH) { if (startListener != null) { mxEvent.addListener(node, 'touchstart', startListener); } if (moveListener != null) { mxEvent.addListener(node, 'touchmove', moveListener); } if (endListener != null) { mxEvent.addListener(node, 'touchend', endListener); } } }
[ "function", "(", "node", ",", "startListener", ",", "moveListener", ",", "endListener", ")", "{", "if", "(", "startListener", "!=", "null", ")", "{", "mxEvent", ".", "addListener", "(", "node", ",", "(", "mxClient", ".", "IS_POINTER", ")", "?", "'pointerdo...
Function: addGestureListeners Adds the given listeners for touch, mouse and/or pointer events. If <mxClient.IS_POINTER> is true then pointer events will be registered, else the respective mouse events will be registered. If <mxClient.IS_POINTER> is false and <mxClient.IS_TOUCH> is true then the respective touch events will be registered as well as the mouse events.
[ "Function", ":", "addGestureListeners" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L9531-L9565
train
Adds a listener to a node
[ 30522, 3853, 1006, 13045, 1010, 2707, 9863, 24454, 1010, 2693, 9863, 24454, 1010, 2203, 9863, 24454, 30524, 2065, 1006, 2693, 9863, 24454, 999, 1027, 19701, 1007, 1063, 25630, 18697, 3372, 1012, 5587, 9863, 24454, 1006, 13045, 1010, 1006, 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...
NervJS/taro
packages/taro-transformer-wx/src/plugins/remove-dead-code.js
extractVars
function extractVars(path) { const declarators = []; if (path.isVariableDeclaration({ kind: "var" })) { for (const decl of path.node.declarations) { const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id)); declarators.push( ...bindingIds.map(name => t.variableDeclarator(t.identifier(name))) ); } } else { path.traverse({ VariableDeclaration(varPath) { if (!varPath.isVariableDeclaration({ kind: "var" })) return; if (!isSameFunctionScope(varPath, path)) return; for (const decl of varPath.node.declarations) { const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id)); declarators.push( ...bindingIds.map(name => t.variableDeclarator(t.identifier(name)) ) ); } } }); } if (declarators.length <= 0) return []; return [t.variableDeclaration("var", declarators)]; }
javascript
function extractVars(path) { const declarators = []; if (path.isVariableDeclaration({ kind: "var" })) { for (const decl of path.node.declarations) { const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id)); declarators.push( ...bindingIds.map(name => t.variableDeclarator(t.identifier(name))) ); } } else { path.traverse({ VariableDeclaration(varPath) { if (!varPath.isVariableDeclaration({ kind: "var" })) return; if (!isSameFunctionScope(varPath, path)) return; for (const decl of varPath.node.declarations) { const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id)); declarators.push( ...bindingIds.map(name => t.variableDeclarator(t.identifier(name)) ) ); } } }); } if (declarators.length <= 0) return []; return [t.variableDeclaration("var", declarators)]; }
[ "function", "extractVars", "(", "path", ")", "{", "const", "declarators", "=", "[", "]", ";", "if", "(", "path", ".", "isVariableDeclaration", "(", "{", "kind", ":", "\"var\"", "}", ")", ")", "{", "for", "(", "const", "decl", "of", "path", ".", "node...
Extracts vars from a path Useful for removing blocks or paths that can contain variable declarations inside them Note: drops are inits extractVars({ var x = 5, y = x }) => var x, y;
[ "Extracts", "vars", "from", "a", "path", "Useful", "for", "removing", "blocks", "or", "paths", "that", "can", "contain", "variable", "declarations", "inside", "them", "Note", ":", "drops", "are", "inits", "extractVars", "(", "{", "var", "x", "=", "5", "y",...
274e76d731d7f158141287e31cbd51f092d472c5
https://github.com/NervJS/taro/blob/274e76d731d7f158141287e31cbd51f092d472c5/packages/taro-transformer-wx/src/plugins/remove-dead-code.js#L1016-L1049
train
Extract variables from a path
[ 30522, 3853, 14817, 10755, 2015, 1006, 4130, 30524, 2003, 10755, 19210, 3207, 20464, 25879, 3258, 1006, 1063, 2785, 1024, 1000, 13075, 1000, 1065, 1007, 1007, 1063, 2005, 1006, 9530, 3367, 11703, 2140, 1997, 4130, 1012, 13045, 1012, 8170, 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...
GitbookIO/gitbook
lib/output/modifiers/highlightCode.js
highlightCode
function highlightCode(highlight, $) { return editHTMLElement($, 'code', function($code) { var classNames = ($code.attr('class') || '').split(' '); var lang = getLanguageForClass(classNames); var source = $code.text(); return Promise(highlight(lang, source)) .then(function(r) { if (is.string(r.html)) { $code.html(r.html); } else { $code.text(r.text); } }); }); }
javascript
function highlightCode(highlight, $) { return editHTMLElement($, 'code', function($code) { var classNames = ($code.attr('class') || '').split(' '); var lang = getLanguageForClass(classNames); var source = $code.text(); return Promise(highlight(lang, source)) .then(function(r) { if (is.string(r.html)) { $code.html(r.html); } else { $code.text(r.text); } }); }); }
[ "function", "highlightCode", "(", "highlight", ",", "$", ")", "{", "return", "editHTMLElement", "(", "$", ",", "'code'", ",", "function", "(", "$code", ")", "{", "var", "classNames", "=", "(", "$code", ".", "attr", "(", "'class'", ")", "||", "''", ")",...
Highlight all code elements @param {Function(lang, body) -> String} highlight @param {HTMLDom} $ @return {Promise}
[ "Highlight", "all", "code", "elements" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/modifiers/highlightCode.js#L41-L56
train
Highlights the code element
[ 30522, 3853, 12944, 16044, 1006, 12944, 1010, 1002, 1007, 1063, 2709, 13257, 21246, 2571, 16930, 4765, 1006, 1002, 1010, 1005, 3642, 1005, 1010, 3853, 1006, 1002, 3642, 1007, 1063, 13075, 2465, 18442, 2015, 1027, 1006, 1002, 3642, 1012, 201...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-compiler/core/GraphQLSchemaUtils.js
isAbstractType
function isAbstractType(type: GraphQLType): boolean { const rawType = getRawType(type); return ( rawType instanceof GraphQLInterfaceType || rawType instanceof GraphQLUnionType ); }
javascript
function isAbstractType(type: GraphQLType): boolean { const rawType = getRawType(type); return ( rawType instanceof GraphQLInterfaceType || rawType instanceof GraphQLUnionType ); }
[ "function", "isAbstractType", "(", "type", ":", "GraphQLType", ")", ":", "boolean", "{", "const", "rawType", "=", "getRawType", "(", "type", ")", ";", "return", "(", "rawType", "instanceof", "GraphQLInterfaceType", "||", "rawType", "instanceof", "GraphQLUnionType"...
Determine if a type is abstract (not concrete). Note: This is used in place of the `graphql` version of the function in order to not break `instanceof` checks with Jest. This version also unwraps non-null/list wrapper types.
[ "Determine", "if", "a", "type", "is", "abstract", "(", "not", "concrete", ")", "." ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/core/GraphQLSchemaUtils.js#L108-L114
train
Returns true if the given type is an abstract type.
[ 30522, 3853, 18061, 5910, 6494, 6593, 13874, 1006, 2828, 1024, 10629, 4160, 24228, 5051, 1007, 1024, 22017, 20898, 1063, 9530, 3367, 6315, 13874, 1027, 2131, 2527, 26677, 18863, 1006, 2828, 1007, 1025, 2709, 1006, 6315, 13874, 6013, 11253, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
function (oSchema, oAnnotations, sArrayName, fnCallback, iIndex) { var aParents = oSchema[sArrayName]; function visitParent(oParent, j) { var sQualifiedName = oSchema.namespace + "." + oParent.name, mChildAnnotations = Utils.getChildAnnotations(oAnnotations, sQualifiedName, sArrayName === "entityContainer"); Utils.liftSAPData(oParent); // @see sap.ui.model.odata.ODataMetadata#_getEntityTypeByName oParent.namespace = oSchema.namespace; oParent.$path = oSchema.$path + "/" + sArrayName + "/" + j; fnCallback(oParent, mChildAnnotations); // merge V4 annotations after child annotations are processed jQuery.extend(oParent, oAnnotations[sQualifiedName]); } if (!aParents) { return; } if (iIndex !== undefined) { visitParent(aParents[iIndex], iIndex); } else { aParents.forEach(visitParent); } }
javascript
function (oSchema, oAnnotations, sArrayName, fnCallback, iIndex) { var aParents = oSchema[sArrayName]; function visitParent(oParent, j) { var sQualifiedName = oSchema.namespace + "." + oParent.name, mChildAnnotations = Utils.getChildAnnotations(oAnnotations, sQualifiedName, sArrayName === "entityContainer"); Utils.liftSAPData(oParent); // @see sap.ui.model.odata.ODataMetadata#_getEntityTypeByName oParent.namespace = oSchema.namespace; oParent.$path = oSchema.$path + "/" + sArrayName + "/" + j; fnCallback(oParent, mChildAnnotations); // merge V4 annotations after child annotations are processed jQuery.extend(oParent, oAnnotations[sQualifiedName]); } if (!aParents) { return; } if (iIndex !== undefined) { visitParent(aParents[iIndex], iIndex); } else { aParents.forEach(visitParent); } }
[ "function", "(", "oSchema", ",", "oAnnotations", ",", "sArrayName", ",", "fnCallback", ",", "iIndex", ")", "{", "var", "aParents", "=", "oSchema", "[", "sArrayName", "]", ";", "function", "visitParent", "(", "oParent", ",", "j", ")", "{", "var", "sQualifie...
Visits all parents (or a single parent) inside the current schema's array of given name, lifts "SAPData" extensions, inlines OData V4 annotations, and adds <code>$path</code> for each parent. @param {object} oSchema OData data service schema @param {object} oAnnotations annotations "JSON" @param {string} sArrayName name of array of parents @param {function} fnCallback mandatory callback for each parent, child annotations are passed in @param {number} [iIndex] optional index of a single parent to visit; default is to visit all
[ "Visits", "all", "parents", "(", "or", "a", "single", "parent", ")", "inside", "the", "current", "schema", "s", "array", "of", "given", "name", "lifts", "SAPData", "extensions", "inlines", "OData", "V4", "annotations", "and", "adds", "<code", ">", "$path<", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L1112-L1138
train
Iterates over all parents of the given schema and adds them to the correct parent array
[ 30522, 3853, 1006, 9808, 5403, 2863, 1010, 1051, 11639, 17287, 9285, 1010, 18906, 9447, 18442, 1010, 1042, 20909, 3363, 5963, 1010, 2462, 13629, 2595, 1007, 1063, 13075, 9706, 12069, 7666, 1027, 9808, 5403, 2863, 1031, 18906, 9447, 18442, 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...
NetEase/pomelo
lib/connectors/hybridsocket.js
function(id, socket) { EventEmitter.call(this); this.id = id; this.socket = socket; if(!socket._socket) { this.remoteAddress = { ip: socket.address().address, port: socket.address().port }; } else { this.remoteAddress = { ip: socket._socket.remoteAddress, port: socket._socket.remotePort }; } var self = this; socket.once('close', this.emit.bind(this, 'disconnect')); socket.on('error', this.emit.bind(this, 'error')); socket.on('message', function(msg) { if(msg) { msg = Package.decode(msg); handler(self, msg); } }); this.state = ST_INITED; // TODO: any other events? }
javascript
function(id, socket) { EventEmitter.call(this); this.id = id; this.socket = socket; if(!socket._socket) { this.remoteAddress = { ip: socket.address().address, port: socket.address().port }; } else { this.remoteAddress = { ip: socket._socket.remoteAddress, port: socket._socket.remotePort }; } var self = this; socket.once('close', this.emit.bind(this, 'disconnect')); socket.on('error', this.emit.bind(this, 'error')); socket.on('message', function(msg) { if(msg) { msg = Package.decode(msg); handler(self, msg); } }); this.state = ST_INITED; // TODO: any other events? }
[ "function", "(", "id", ",", "socket", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "id", "=", "id", ";", "this", ".", "socket", "=", "socket", ";", "if", "(", "!", "socket", ".", "_socket", ")", "{", "this", ".", "...
Socket class that wraps socket and websocket to provide unified interface for up level.
[ "Socket", "class", "that", "wraps", "socket", "and", "websocket", "to", "provide", "unified", "interface", "for", "up", "level", "." ]
defcf019631ed399cc4dad932d3b028a04a039a4
https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/hybridsocket.js#L16-L48
train
A node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node
[ 30522, 3853, 1006, 8909, 1010, 22278, 1007, 1063, 2724, 23238, 12079, 1012, 2655, 1006, 2023, 1007, 1025, 2023, 1012, 8909, 1027, 8909, 1025, 2023, 1012, 22278, 1027, 22278, 1025, 2065, 1006, 999, 22278, 1012, 1035, 22278, 1007, 1063, 2023,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebase-js-sdk
packages/auth/demo/public/script.js
alertMessage_
function alertMessage_(message, cssClass) { var alertBox = $('<div></div>') .addClass(cssClass) .css('display', 'none') .text(message); $('#alert-messages').prepend(alertBox); alertBox.fadeIn({ complete: function() { setTimeout(function() { alertBox.slideUp(); }, 3000); } }); }
javascript
function alertMessage_(message, cssClass) { var alertBox = $('<div></div>') .addClass(cssClass) .css('display', 'none') .text(message); $('#alert-messages').prepend(alertBox); alertBox.fadeIn({ complete: function() { setTimeout(function() { alertBox.slideUp(); }, 3000); } }); }
[ "function", "alertMessage_", "(", "message", ",", "cssClass", ")", "{", "var", "alertBox", "=", "$", "(", "'<div></div>'", ")", ".", "addClass", "(", "cssClass", ")", ".", "css", "(", "'display'", ",", "'none'", ")", ".", "text", "(", "message", ")", "...
Displays for a few seconds a box with a specific message and then fades it out. @param {string} message Small message to display. @param {string} cssClass The class(s) to give the alert box. @private
[ "Displays", "for", "a", "few", "seconds", "a", "box", "with", "a", "specific", "message", "and", "then", "fades", "it", "out", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L94-L107
train
Show an alert message
[ 30522, 3853, 9499, 7834, 3736, 3351, 1035, 1006, 4471, 1010, 20116, 11020, 27102, 1007, 1063, 13075, 9499, 8758, 1027, 1002, 1006, 1005, 1026, 4487, 2615, 1028, 1026, 1013, 4487, 2615, 1028, 1005, 1007, 1012, 5587, 26266, 1006, 20116, 11020...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled) { var funct = mxMarker.markers[type]; return (funct != null) ? funct(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled) : null; }
javascript
function(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled) { var funct = mxMarker.markers[type]; return (funct != null) ? funct(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled) : null; }
[ "function", "(", "canvas", ",", "shape", ",", "type", ",", "pe", ",", "unitX", ",", "unitY", ",", "size", ",", "source", ",", "sw", ",", "filled", ")", "{", "var", "funct", "=", "mxMarker", ".", "markers", "[", "type", "]", ";", "return", "(", "f...
Function: createMarker Returns a function to paint the given marker.
[ "Function", ":", "createMarker" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L24638-L24643
train
Returns a marker object
[ 30522, 3853, 1006, 10683, 1010, 4338, 1010, 2828, 1010, 21877, 1010, 3131, 2595, 1010, 8499, 1010, 2946, 1010, 3120, 1010, 25430, 1010, 3561, 1007, 1063, 13075, 4569, 6593, 1027, 25630, 10665, 2121, 1012, 16387, 1031, 2828, 1033, 1025, 2709...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
google/closure-library
browser_capabilities.js
getBrowserCapabilities
function getBrowserCapabilities(browsers) { for (var i = 0; i < browsers.length; i++) { var b = browsers[i]; b['tunnel-identifier'] = process.env.TRAVIS_JOB_NUMBER; b['build'] = process.env.TRAVIS_BUILD_NUMBER; b['name'] = getJobName(b); } return browsers; }
javascript
function getBrowserCapabilities(browsers) { for (var i = 0; i < browsers.length; i++) { var b = browsers[i]; b['tunnel-identifier'] = process.env.TRAVIS_JOB_NUMBER; b['build'] = process.env.TRAVIS_BUILD_NUMBER; b['name'] = getJobName(b); } return browsers; }
[ "function", "getBrowserCapabilities", "(", "browsers", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "browsers", ".", "length", ";", "i", "++", ")", "{", "var", "b", "=", "browsers", "[", "i", "]", ";", "b", "[", "'tunnel-identifier'", ...
Adds 'name', 'build', and 'tunnel-identifier' properties to all elements, based on runtime information from the environment. @param {!Array<!Object>} browsers @return {!Array<!Object>} The original array, whose objects are augmented.
[ "Adds", "name", "build", "and", "tunnel", "-", "identifier", "properties", "to", "all", "elements", "based", "on", "runtime", "information", "from", "the", "environment", "." ]
97390e9ca4483cebb9628e06026139fbb3023d65
https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/browser_capabilities.js#L50-L58
train
Get the list of browsers
[ 30522, 3853, 2131, 12618, 9333, 2121, 17695, 28518, 15909, 3111, 1006, 16602, 2015, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 30524, 4372, 2615, 1012, 10001, 1035, 3105, 1035, 2193, 1025, 1038, 1031, 1005, 3857, 1005, 1033, 1027, 283...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/src/Hidden/Hidden.js
Hidden
function Hidden(props) { const { implementation, ...other } = props; if (implementation === 'js') { return <HiddenJs {...other} />; } return <HiddenCss {...other} />; }
javascript
function Hidden(props) { const { implementation, ...other } = props; if (implementation === 'js') { return <HiddenJs {...other} />; } return <HiddenCss {...other} />; }
[ "function", "Hidden", "(", "props", ")", "{", "const", "{", "implementation", ",", "...", "other", "}", "=", "props", ";", "if", "(", "implementation", "===", "'js'", ")", "{", "return", "<", "HiddenJs", "{", "...", "other", "}", "/", ">", ";", "}", ...
Responsively hides children based on the selected implementation.
[ "Responsively", "hides", "children", "based", "on", "the", "selected", "implementation", "." ]
1555e52367835946382fbf2a8f681de71318915d
https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui/src/Hidden/Hidden.js#L9-L17
train
Returns a hidden element
[ 30522, 3853, 5023, 1006, 24387, 1007, 1063, 9530, 3367, 1063, 7375, 1010, 1012, 1012, 1012, 2060, 1065, 1027, 24387, 1025, 2065, 1006, 7375, 1027, 1027, 1027, 1005, 1046, 2015, 1005, 1007, 1063, 2709, 1026, 5023, 22578, 1063, 1012, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/credentials/credential_provider_chain.js
resolve
function resolve(callback) { var self = this; if (self.providers.length === 0) { callback(new Error('No providers')); return self; } if (self.resolveCallbacks.push(callback) === 1) { var index = 0; var providers = self.providers.slice(0); function resolveNext(err, creds) { if ((!err && creds) || index === providers.length) { AWS.util.arrayEach(self.resolveCallbacks, function (callback) { callback(err, creds); }); self.resolveCallbacks.length = 0; return; } var provider = providers[index++]; if (typeof provider === 'function') { creds = provider.call(); } else { creds = provider; } if (creds.get) { creds.get(function (getErr) { resolveNext(getErr, getErr ? null : creds); }); } else { resolveNext(null, creds); } } resolveNext(); } return self; }
javascript
function resolve(callback) { var self = this; if (self.providers.length === 0) { callback(new Error('No providers')); return self; } if (self.resolveCallbacks.push(callback) === 1) { var index = 0; var providers = self.providers.slice(0); function resolveNext(err, creds) { if ((!err && creds) || index === providers.length) { AWS.util.arrayEach(self.resolveCallbacks, function (callback) { callback(err, creds); }); self.resolveCallbacks.length = 0; return; } var provider = providers[index++]; if (typeof provider === 'function') { creds = provider.call(); } else { creds = provider; } if (creds.get) { creds.get(function (getErr) { resolveNext(getErr, getErr ? null : creds); }); } else { resolveNext(null, creds); } } resolveNext(); } return self; }
[ "function", "resolve", "(", "callback", ")", "{", "var", "self", "=", "this", ";", "if", "(", "self", ".", "providers", ".", "length", "===", "0", ")", "{", "callback", "(", "new", "Error", "(", "'No providers'", ")", ")", ";", "return", "self", ";",...
@!method resolvePromise() Returns a 'thenable' promise. Resolves the provider chain by searching for the first set of credentials in {providers}. Two callbacks can be provided to the `then` method on the returned promise. The first callback will be called if the promise is fulfilled, and the second callback will be called if the promise is rejected. @callback fulfilledCallback function(credentials) Called if the promise is fulfilled and the provider resolves the chain to a credentials object @param credentials [AWS.Credentials] the credentials object resolved by the provider chain. @callback rejectedCallback function(error) Called if the promise is rejected. @param err [Error] the error object returned if no credentials are found. @return [Promise] A promise that represents the state of the `resolve` method call. @example Calling the `resolvePromise` method. var promise = chain.resolvePromise(); promise.then(function(credentials) { ... }, function(err) { ... }); Resolves the provider chain by searching for the first set of credentials in {providers}. @callback callback function(err, credentials) Called when the provider resolves the chain to a credentials object or null if no credentials can be found. @param err [Error] the error object returned if no credentials are found. @param credentials [AWS.Credentials] the credentials object resolved by the provider chain. @return [AWS.CredentialProviderChain] the provider, for chaining.
[ "@!method", "resolvePromise", "()", "Returns", "a", "thenable", "promise", ".", "Resolves", "the", "provider", "chain", "by", "searching", "for", "the", "first", "set", "of", "credentials", "in", "{", "providers", "}", "." ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/credentials/credential_provider_chain.js#L97-L137
train
Resolves the resource with the list of providers
[ 30522, 3853, 10663, 1006, 2655, 5963, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 2065, 1006, 2969, 1012, 11670, 1012, 3091, 1027, 1027, 1027, 1014, 1007, 1063, 2655, 5963, 1006, 2047, 7561, 1006, 1005, 2053, 11670, 1005, 1007, 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...
SAP/openui5
src/sap.ui.layout/src/sap/ui/layout/form/FormElement.js
_fieldsChanged
function _fieldsChanged(oChanges) { if (oChanges.child) { _fieldChanged.call(this, oChanges.child, oChanges.mutation); } else if (oChanges.children) { for (var i = 0; i < oChanges.chlidren.length; i++) { _fieldChanged.call(this, oChanges.children[i], oChanges.mutation); } } _updateLabelFor.call(this); }
javascript
function _fieldsChanged(oChanges) { if (oChanges.child) { _fieldChanged.call(this, oChanges.child, oChanges.mutation); } else if (oChanges.children) { for (var i = 0; i < oChanges.chlidren.length; i++) { _fieldChanged.call(this, oChanges.children[i], oChanges.mutation); } } _updateLabelFor.call(this); }
[ "function", "_fieldsChanged", "(", "oChanges", ")", "{", "if", "(", "oChanges", ".", "child", ")", "{", "_fieldChanged", ".", "call", "(", "this", ",", "oChanges", ".", "child", ",", "oChanges", ".", "mutation", ")", ";", "}", "else", "if", "(", "oChan...
*** Private helper functions ***
[ "***", "Private", "helper", "functions", "***" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/FormElement.js#L342-L354
train
called when the field changes
[ 30522, 3853, 1035, 4249, 22305, 2098, 1006, 28166, 22043, 2015, 1007, 1063, 2065, 1006, 28166, 22043, 2015, 1012, 2775, 1007, 1063, 1035, 2492, 22305, 2098, 1012, 2655, 1006, 2023, 1010, 28166, 22043, 2015, 1012, 2775, 1010, 28166, 22043, 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...
TryGhost/Ghost
core/server/helpers/get.js
parseOptions
function parseOptions(globals, data, options) { if (_.isString(options.filter)) { options.filter = resolvePaths(globals, data, options.filter); } return options; }
javascript
function parseOptions(globals, data, options) { if (_.isString(options.filter)) { options.filter = resolvePaths(globals, data, options.filter); } return options; }
[ "function", "parseOptions", "(", "globals", ",", "data", ",", "options", ")", "{", "if", "(", "_", ".", "isString", "(", "options", ".", "filter", ")", ")", "{", "options", ".", "filter", "=", "resolvePaths", "(", "globals", ",", "data", ",", "options"...
## Parse Options Ensure options passed in make sense @param {Object} data @param {Object} options @returns {*}
[ "##", "Parse", "Options", "Ensure", "options", "passed", "in", "make", "sense" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/helpers/get.js#L116-L122
train
Parse options from the config
[ 30522, 3853, 11968, 3366, 7361, 9285, 1006, 3795, 2015, 1010, 2951, 1010, 7047, 1007, 1063, 2065, 1006, 1035, 1012, 26354, 18886, 3070, 1006, 7047, 1012, 11307, 1007, 1007, 1063, 7047, 1012, 11307, 1027, 10663, 15069, 2015, 1006, 3795, 2015...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
function(parent, count) { count = count || 1; var br = null; for (var i = 0; i < count; i++) { if (parent != null) { br = parent.ownerDocument.createElement('br'); parent.appendChild(br); } } return br; }
javascript
function(parent, count) { count = count || 1; var br = null; for (var i = 0; i < count; i++) { if (parent != null) { br = parent.ownerDocument.createElement('br'); parent.appendChild(br); } } return br; }
[ "function", "(", "parent", ",", "count", ")", "{", "count", "=", "count", "||", "1", ";", "var", "br", "=", "null", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "if", "(", "parent", "!=", "null", ...
Function: br Appends a linebreak to the given parent and returns the linebreak. Parameters: parent - DOM node to append the linebreak to.
[ "Function", ":", "br" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3300-L3315
train
Creates a new BR element for the given parent element.
[ 30522, 3853, 1006, 6687, 1010, 4175, 1007, 1063, 4175, 1027, 4175, 1064, 1064, 1015, 1025, 13075, 7987, 1027, 19701, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 4175, 1025, 1045, 1009, 1009, 1007, 1063, 2065, 1006, 6687, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/newline-after-var.js
getLastCommentLineOfBlock
function getLastCommentLineOfBlock(commentStartLine) { const currentCommentEnd = commentEndLine[commentStartLine]; return commentEndLine[currentCommentEnd + 1] ? getLastCommentLineOfBlock(currentCommentEnd + 1) : currentCommentEnd; }
javascript
function getLastCommentLineOfBlock(commentStartLine) { const currentCommentEnd = commentEndLine[commentStartLine]; return commentEndLine[currentCommentEnd + 1] ? getLastCommentLineOfBlock(currentCommentEnd + 1) : currentCommentEnd; }
[ "function", "getLastCommentLineOfBlock", "(", "commentStartLine", ")", "{", "const", "currentCommentEnd", "=", "commentEndLine", "[", "commentStartLine", "]", ";", "return", "commentEndLine", "[", "currentCommentEnd", "+", "1", "]", "?", "getLastCommentLineOfBlock", "("...
Gets the last line of a group of consecutive comments @param {number} commentStartLine The starting line of the group @returns {number} The number of the last comment line of the group
[ "Gets", "the", "last", "line", "of", "a", "group", "of", "consecutive", "comments" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/newline-after-var.js#L141-L145
train
Get last comment line of a block
[ 30522, 3853, 2131, 8523, 13535, 5358, 3672, 4179, 11253, 23467, 1006, 7928, 7559, 19646, 3170, 1007, 1063, 9530, 3367, 2783, 9006, 3672, 10497, 1027, 7615, 10497, 4179, 1031, 7928, 7559, 19646, 3170, 1033, 1025, 2709, 7615, 10497, 4179, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
zeit/now-cli
src/commands/list.js
filterUniqueApps
function filterUniqueApps() { const uniqueApps = new Set(); return function uniqueAppFilter([appName]) { if (uniqueApps.has(appName)) { return false; } uniqueApps.add(appName); return true; }; }
javascript
function filterUniqueApps() { const uniqueApps = new Set(); return function uniqueAppFilter([appName]) { if (uniqueApps.has(appName)) { return false; } uniqueApps.add(appName); return true; }; }
[ "function", "filterUniqueApps", "(", ")", "{", "const", "uniqueApps", "=", "new", "Set", "(", ")", ";", "return", "function", "uniqueAppFilter", "(", "[", "appName", "]", ")", "{", "if", "(", "uniqueApps", ".", "has", "(", "appName", ")", ")", "{", "re...
filters only one deployment per app, so that the user doesn't see so many deployments at once. this mode can be bypassed by supplying an app name
[ "filters", "only", "one", "deployment", "per", "app", "so", "that", "the", "user", "doesn", "t", "see", "so", "many", "deployments", "at", "once", ".", "this", "mode", "can", "be", "bypassed", "by", "supplying", "an", "app", "name" ]
b53d907b745126113bc3e251ac2451088026a363
https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/commands/list.js#L337-L346
train
Returns a function that filters out the apps that are not already in the database.
[ 30522, 3853, 11307, 19496, 4226, 29098, 2015, 1006, 1007, 1063, 9530, 3367, 4310, 29098, 2015, 1027, 2047, 2275, 1006, 1007, 1025, 2709, 3853, 4310, 29098, 8873, 21928, 1006, 1031, 10439, 18442, 1033, 1007, 1063, 2065, 1006, 4310, 29098, 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...
ColorlibHQ/AdminLTE
dist/js/demo.js
changeSkin
function changeSkin(cls) { $.each(mySkins, function (i) { $('body').removeClass(mySkins[i]) }) $('body').addClass(cls) store('skin', cls) return false }
javascript
function changeSkin(cls) { $.each(mySkins, function (i) { $('body').removeClass(mySkins[i]) }) $('body').addClass(cls) store('skin', cls) return false }
[ "function", "changeSkin", "(", "cls", ")", "{", "$", ".", "each", "(", "mySkins", ",", "function", "(", "i", ")", "{", "$", "(", "'body'", ")", ".", "removeClass", "(", "mySkins", "[", "i", "]", ")", "}", ")", "$", "(", "'body'", ")", ".", "add...
Replaces the old skin with the new skin @param String cls the new skin class @returns Boolean false to prevent link's default action
[ "Replaces", "the", "old", "skin", "with", "the", "new", "skin" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/dist/js/demo.js#L96-L104
train
Change skin
[ 30522, 3853, 3431, 4939, 1006, 18856, 2015, 1007, 1063, 1002, 1012, 2169, 1006, 2026, 29334, 2015, 1010, 3853, 1006, 1045, 1007, 1063, 1002, 1006, 1005, 2303, 1005, 1007, 1012, 6366, 26266, 1006, 2026, 29334, 2015, 1031, 1045, 1033, 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...
GitbookIO/gitbook
lib/modifiers/summary/indexArticleLevels.js
indexArticleLevels
function indexArticleLevels(article, baseLevel) { baseLevel = baseLevel || article.getLevel(); var articles = article.getArticles(); articles = articles.map(function(inner, i) { return indexArticleLevels(inner, baseLevel + '.' + (i + 1)); }); return article.merge({ level: baseLevel, articles: articles }); }
javascript
function indexArticleLevels(article, baseLevel) { baseLevel = baseLevel || article.getLevel(); var articles = article.getArticles(); articles = articles.map(function(inner, i) { return indexArticleLevels(inner, baseLevel + '.' + (i + 1)); }); return article.merge({ level: baseLevel, articles: articles }); }
[ "function", "indexArticleLevels", "(", "article", ",", "baseLevel", ")", "{", "baseLevel", "=", "baseLevel", "||", "article", ".", "getLevel", "(", ")", ";", "var", "articles", "=", "article", ".", "getArticles", "(", ")", ";", "articles", "=", "articles", ...
Index levels in an article tree @param {Article} @param {String} baseLevel @return {Article}
[ "Index", "levels", "in", "an", "article", "tree" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/modifiers/summary/indexArticleLevels.js#L9-L21
train
indexArticleLevels - Index an article level
[ 30522, 3853, 5950, 8445, 25128, 20414, 9050, 1006, 3720, 1010, 14040, 18697, 2140, 1007, 1063, 14040, 18697, 2140, 1027, 14040, 18697, 2140, 1064, 1064, 3720, 1012, 2131, 20414, 2884, 1006, 1007, 1025, 13075, 4790, 1027, 3720, 1012, 2131, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-use-before-define.js
findVariablesInScope
function findVariablesInScope(scope) { scope.references.forEach(reference => { const variable = reference.resolved; /* * Skips when the reference is: * - initialization's. * - referring to an undefined variable. * - referring to a global environment variable (there're no identifiers). * - located preceded by the variable (except in initializers). * - allowed by options. */ if (reference.init || !variable || variable.identifiers.length === 0 || (variable.identifiers[0].range[1] < reference.identifier.range[1] && !isInInitializer(variable, reference)) || !isForbidden(variable, reference) ) { return; } // Reports. context.report({ node: reference.identifier, message: "'{{name}}' was used before it was defined.", data: reference.identifier }); }); scope.childScopes.forEach(findVariablesInScope); }
javascript
function findVariablesInScope(scope) { scope.references.forEach(reference => { const variable = reference.resolved; /* * Skips when the reference is: * - initialization's. * - referring to an undefined variable. * - referring to a global environment variable (there're no identifiers). * - located preceded by the variable (except in initializers). * - allowed by options. */ if (reference.init || !variable || variable.identifiers.length === 0 || (variable.identifiers[0].range[1] < reference.identifier.range[1] && !isInInitializer(variable, reference)) || !isForbidden(variable, reference) ) { return; } // Reports. context.report({ node: reference.identifier, message: "'{{name}}' was used before it was defined.", data: reference.identifier }); }); scope.childScopes.forEach(findVariablesInScope); }
[ "function", "findVariablesInScope", "(", "scope", ")", "{", "scope", ".", "references", ".", "forEach", "(", "reference", "=>", "{", "const", "variable", "=", "reference", ".", "resolved", ";", "/*\n * Skips when the reference is:\n * - ini...
Finds and validates all variables in a given scope. @param {Scope} scope The scope object. @returns {void} @private
[ "Finds", "and", "validates", "all", "variables", "in", "a", "given", "scope", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-use-before-define.js#L196-L226
train
Find variables in the given scope
[ 30522, 3853, 2424, 10755, 19210, 11493, 26127, 1006, 9531, 1007, 1063, 9531, 1012, 7604, 1012, 18921, 6776, 1006, 4431, 1027, 1028, 1063, 9530, 3367, 8023, 1027, 4431, 1012, 10395, 1025, 1013, 1008, 1008, 13558, 2015, 2043, 1996, 4431, 2003...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/cli/getBook.js
getBook
function getBook(args, kwargs) { var input = path.resolve(args[0] || process.cwd()); var logLevel = kwargs.log; var fs = createNodeFS(input); var book = Book.createForFS(fs); return book.setLogLevel(logLevel); }
javascript
function getBook(args, kwargs) { var input = path.resolve(args[0] || process.cwd()); var logLevel = kwargs.log; var fs = createNodeFS(input); var book = Book.createForFS(fs); return book.setLogLevel(logLevel); }
[ "function", "getBook", "(", "args", ",", "kwargs", ")", "{", "var", "input", "=", "path", ".", "resolve", "(", "args", "[", "0", "]", "||", "process", ".", "cwd", "(", ")", ")", ";", "var", "logLevel", "=", "kwargs", ".", "log", ";", "var", "fs",...
Return a book instance to work on from command line args/kwargs @param {Array} args @param {Object} kwargs @return {Book}
[ "Return", "a", "book", "instance", "to", "work", "on", "from", "command", "line", "args", "/", "kwargs" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/cli/getBook.js#L13-L21
train
Get a book
[ 30522, 3853, 2131, 8654, 1006, 12098, 5620, 1010, 6448, 2906, 5620, 1007, 1063, 13075, 7953, 1027, 4130, 1012, 10663, 1006, 12098, 5620, 1031, 1014, 1033, 1064, 1064, 2832, 1012, 19296, 2094, 1006, 1007, 1007, 1025, 13075, 8833, 20414, 2884...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/cli-engine.js
calculateStatsPerRun
function calculateStatsPerRun(results) { return results.reduce((stat, result) => { stat.errorCount += result.errorCount; stat.warningCount += result.warningCount; stat.fixableErrorCount += result.fixableErrorCount; stat.fixableWarningCount += result.fixableWarningCount; return stat; }, { errorCount: 0, warningCount: 0, fixableErrorCount: 0, fixableWarningCount: 0 }); }
javascript
function calculateStatsPerRun(results) { return results.reduce((stat, result) => { stat.errorCount += result.errorCount; stat.warningCount += result.warningCount; stat.fixableErrorCount += result.fixableErrorCount; stat.fixableWarningCount += result.fixableWarningCount; return stat; }, { errorCount: 0, warningCount: 0, fixableErrorCount: 0, fixableWarningCount: 0 }); }
[ "function", "calculateStatsPerRun", "(", "results", ")", "{", "return", "results", ".", "reduce", "(", "(", "stat", ",", "result", ")", "=>", "{", "stat", ".", "errorCount", "+=", "result", ".", "errorCount", ";", "stat", ".", "warningCount", "+=", "result...
It will calculate the error and warning count for collection of results from all files @param {Object[]} results - Collection of messages from all the files @returns {Object} Contains the stats @private
[ "It", "will", "calculate", "the", "error", "and", "warning", "count", "for", "collection", "of", "results", "from", "all", "files" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/cli-engine.js#L140-L153
train
Calculates the stats per run for a given set of results
[ 30522, 3853, 18422, 9153, 3215, 4842, 15532, 1006, 3463, 1007, 1063, 2709, 3463, 1012, 5547, 1006, 1006, 28093, 1010, 2765, 1007, 1027, 1028, 1063, 28093, 1012, 7561, 3597, 16671, 1009, 1027, 2765, 1012, 7561, 3597, 16671, 1025, 28093, 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...
moleculerjs/moleculer
bin/moleculer-runner.js
loadEnvFile
function loadEnvFile() { if (flags.env || flags.envfile) { try { const dotenv = require("dotenv"); if (flags.envfile) dotenv.config({ path: flags.envfile }); else dotenv.config(); } catch(err) { throw new Error("The 'dotenv' package is missing! Please install it with 'npm install dotenv --save' command."); } } }
javascript
function loadEnvFile() { if (flags.env || flags.envfile) { try { const dotenv = require("dotenv"); if (flags.envfile) dotenv.config({ path: flags.envfile }); else dotenv.config(); } catch(err) { throw new Error("The 'dotenv' package is missing! Please install it with 'npm install dotenv --save' command."); } } }
[ "function", "loadEnvFile", "(", ")", "{", "if", "(", "flags", ".", "env", "||", "flags", ".", "envfile", ")", "{", "try", "{", "const", "dotenv", "=", "require", "(", "\"dotenv\"", ")", ";", "if", "(", "flags", ".", "envfile", ")", "dotenv", ".", "...
Load environment variables from '.env' file
[ "Load", "environment", "variables", "from", ".", "env", "file" ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/bin/moleculer-runner.js#L101-L114
train
Load the environment file
[ 30522, 3853, 7170, 2368, 2615, 8873, 2571, 1006, 1007, 1063, 2065, 1006, 9245, 1012, 4372, 2615, 1064, 1064, 9245, 1012, 4372, 2615, 8873, 2571, 1007, 1063, 3046, 1063, 9530, 3367, 11089, 2368, 2615, 1027, 5478, 1006, 1000, 11089, 2368, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js
addMessages
function addMessages(aMessages, sInstancePath, sContextUrl) { bHasMessages = true; if (aMessages && aMessages.length) { mPathToODataMessages[sInstancePath] = aMessages; aMessages.forEach(function (oMessage) { if (oMessage.longtextUrl) { oMessage.longtextUrl = _Helper.makeAbsolute(oMessage.longtextUrl, sContextUrl); } }); } }
javascript
function addMessages(aMessages, sInstancePath, sContextUrl) { bHasMessages = true; if (aMessages && aMessages.length) { mPathToODataMessages[sInstancePath] = aMessages; aMessages.forEach(function (oMessage) { if (oMessage.longtextUrl) { oMessage.longtextUrl = _Helper.makeAbsolute(oMessage.longtextUrl, sContextUrl); } }); } }
[ "function", "addMessages", "(", "aMessages", ",", "sInstancePath", ",", "sContextUrl", ")", "{", "bHasMessages", "=", "true", ";", "if", "(", "aMessages", "&&", "aMessages", ".", "length", ")", "{", "mPathToODataMessages", "[", "sInstancePath", "]", "=", "aMes...
/* Adds the messages to mPathToODataMessages after adjusting the message longtext @param {object[]} aMessages The message list @param {string} sInstancePath The path of the instance in the cache @param {string} sContextUrl The context URL for message longtexts
[ "/", "*", "Adds", "the", "messages", "to", "mPathToODataMessages", "after", "adjusting", "the", "message", "longtext" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L1034-L1045
train
Adds the messages to the data object
[ 30522, 3853, 5587, 7834, 3736, 8449, 1006, 19900, 3736, 8449, 1010, 15516, 26897, 15069, 1010, 8040, 28040, 18413, 3126, 2140, 1007, 1063, 1038, 14949, 7834, 3736, 8449, 1027, 2995, 1025, 2065, 1006, 19900, 3736, 8449, 1004, 1004, 19900, 37...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
goldfire/howler.js
examples/3d/js/map.js
function(rise, run, x, y, inverted) { if (run === 0) { return {len2: Infinity}; } var dx = run > 0 ? Math.floor(x + 1) - x : Math.ceil(x - 1) - x; var dy = dx * (rise / run); return { x: inverted ? y + dy : x + dx, y: inverted ? x + dx : y + dy, len2: dx * dx + dy * dy }; }
javascript
function(rise, run, x, y, inverted) { if (run === 0) { return {len2: Infinity}; } var dx = run > 0 ? Math.floor(x + 1) - x : Math.ceil(x - 1) - x; var dy = dx * (rise / run); return { x: inverted ? y + dy : x + dx, y: inverted ? x + dx : y + dy, len2: dx * dx + dy * dy }; }
[ "function", "(", "rise", ",", "run", ",", "x", ",", "y", ",", "inverted", ")", "{", "if", "(", "run", "===", "0", ")", "{", "return", "{", "len2", ":", "Infinity", "}", ";", "}", "var", "dx", "=", "run", ">", "0", "?", "Math", ".", "floor", ...
Processes each step along the ray. @param {Number} rise Slope of line: sine of the cast angle. @param {Number} run Slope of line: cosine of the cast angle. @param {Number} x Origin x-position. @param {Number} y Origin y-position. @param {Boolean} inverted
[ "Processes", "each", "step", "along", "the", "ray", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/3d/js/map.js#L90-L103
train
Compute the polynomial of the polynomial
[ 30522, 3853, 1006, 4125, 1010, 2448, 1010, 1060, 1010, 1061, 1010, 20037, 1007, 1063, 2065, 1006, 2448, 1027, 1027, 1027, 1014, 1007, 1063, 2709, 1063, 18798, 2475, 1024, 15579, 1065, 1025, 1065, 13075, 1040, 2595, 1027, 2448, 1028, 1014, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/colors/colors.js
MdColorsService
function MdColorsService($mdTheming, $mdUtil, $log) { colorPalettes = colorPalettes || Object.keys($mdTheming.PALETTES); // Publish service instance return { applyThemeColors: applyThemeColors, getThemeColor: getThemeColor, hasTheme: hasTheme }; // ******************************************** // Internal Methods // ******************************************** /** * @ngdoc method * @name $mdColors#applyThemeColors * * @description * Lookup a set of colors by hue, theme, and palette, then apply those colors * with the provided opacity (via `rgba()`) to the specified CSS property. * * @param {angular.element} element the element to apply the styles to * @param {Object} colorExpression Keys are CSS properties and values are strings representing * the `theme-palette-hue-opacity` of the desired color. For example: * `{'color': 'red-A200-0.3', 'background-color': 'myTheme-primary-700-0.8'}`. Theme, hue, and * opacity are optional. */ function applyThemeColors(element, colorExpression) { try { if (colorExpression) { // Assign the calculate RGBA color values directly as inline CSS element.css(interpolateColors(colorExpression)); } } catch (e) { $log.error(e.message); } } /** * @ngdoc method * @name $mdColors#getThemeColor * * @description * Get a parsed RGBA color using a string representing the `theme-palette-hue-opacity` of the * desired color. * * @param {string} expression color expression like `'red-A200-0.3'` or * `'myTheme-primary-700-0.8'`. Theme, hue, and opacity are optional. * @returns {string} a CSS color value like `rgba(211, 47, 47, 0.8)` */ function getThemeColor(expression) { var color = extractColorOptions(expression); return parseColor(color); } /** * Return the parsed color * @param {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} color hash map of color * definitions * @param {boolean=} contrast whether use contrast color for foreground. Defaults to false. * @returns {string} rgba color string */ function parseColor(color, contrast) { contrast = contrast || false; var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; rgbValues = contrast ? rgbValues.contrast : rgbValues.value; return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] ); } /** * Convert the color expression into an object with scope-interpolated values * Then calculate the rgba() values based on the theme color parts * @param {Object} themeColors json object, keys are css properties and values are string of * the wanted color, for example: `{color: 'red-A200-0.3'}`. * @return {Object} Hashmap of CSS properties with associated `rgba()` string values */ function interpolateColors(themeColors) { var rgbColors = {}; var hasColorProperty = themeColors.hasOwnProperty('color'); angular.forEach(themeColors, function (value, key) { var color = extractColorOptions(value); var hasBackground = key.indexOf('background') > -1; rgbColors[key] = parseColor(color); if (hasBackground && !hasColorProperty) { rgbColors.color = parseColor(color, true); } }); return rgbColors; } /** * Check if expression has defined theme * For instance: * 'myTheme-primary' => true * 'red-800' => false * @param {string} expression color expression like 'red-800', 'red-A200-0.3', * 'myTheme-primary', or 'myTheme-primary-400' * @return {boolean} true if the expression has a theme part, false otherwise. */ function hasTheme(expression) { return angular.isDefined($mdTheming.THEMES[expression.split('-')[0]]); } /** * For the evaluated expression, extract the color parts into a hash map * @param {string} expression color expression like 'red-800', 'red-A200-0.3', * 'myTheme-primary', or 'myTheme-primary-400' * @returns {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} */ function extractColorOptions(expression) { var parts = expression.split('-'); var hasTheme = angular.isDefined($mdTheming.THEMES[parts[0]]); var theme = hasTheme ? parts.splice(0, 1)[0] : $mdTheming.defaultTheme(); return { theme: theme, palette: extractPalette(parts, theme), hue: extractHue(parts, theme), opacity: parts[2] || 1 }; } /** * Calculate the theme palette name * @param {Array} parts * @param {string} theme name * @return {string} */ function extractPalette(parts, theme) { // If the next section is one of the palettes we assume it's a two word palette // Two word palette can be also written in camelCase, forming camelCase to dash-case var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1; var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); if (isTwoWord) palette = parts[0] + '-' + parts.splice(1, 1); if (colorPalettes.indexOf(palette) === -1) { // If the palette is not in the palette list it's one of primary/accent/warn/background var scheme = $mdTheming.THEMES[theme].colors[palette]; if (!scheme) { throw new Error($mdUtil.supplant( 'mdColors: couldn\'t find \'{palette}\' in the palettes.', {palette: palette})); } palette = scheme.name; } return palette; } /** * @param {Array} parts * @param {string} theme name * @return {*} */ function extractHue(parts, theme) { var themeColors = $mdTheming.THEMES[theme].colors; if (parts[1] === 'hue') { var hueNumber = parseInt(parts.splice(2, 1)[0], 10); if (hueNumber < 1 || hueNumber > 3) { throw new Error($mdUtil.supplant( 'mdColors: \'hue-{hueNumber}\' is not a valid hue, can be only \'hue-1\', \'hue-2\' and \'hue-3\'', {hueNumber: hueNumber})); } parts[1] = 'hue-' + hueNumber; if (!(parts[0] in themeColors)) { throw new Error($mdUtil.supplant( 'mdColors: \'hue-x\' can only be used with [{availableThemes}], but was used with \'{usedTheme}\'', { availableThemes: Object.keys(themeColors).join(', '), usedTheme: parts[0] })); } return themeColors[parts[0]].hues[parts[1]]; } return parts[1] || themeColors[parts[0] in themeColors ? parts[0] : 'primary'].hues['default']; } }
javascript
function MdColorsService($mdTheming, $mdUtil, $log) { colorPalettes = colorPalettes || Object.keys($mdTheming.PALETTES); // Publish service instance return { applyThemeColors: applyThemeColors, getThemeColor: getThemeColor, hasTheme: hasTheme }; // ******************************************** // Internal Methods // ******************************************** /** * @ngdoc method * @name $mdColors#applyThemeColors * * @description * Lookup a set of colors by hue, theme, and palette, then apply those colors * with the provided opacity (via `rgba()`) to the specified CSS property. * * @param {angular.element} element the element to apply the styles to * @param {Object} colorExpression Keys are CSS properties and values are strings representing * the `theme-palette-hue-opacity` of the desired color. For example: * `{'color': 'red-A200-0.3', 'background-color': 'myTheme-primary-700-0.8'}`. Theme, hue, and * opacity are optional. */ function applyThemeColors(element, colorExpression) { try { if (colorExpression) { // Assign the calculate RGBA color values directly as inline CSS element.css(interpolateColors(colorExpression)); } } catch (e) { $log.error(e.message); } } /** * @ngdoc method * @name $mdColors#getThemeColor * * @description * Get a parsed RGBA color using a string representing the `theme-palette-hue-opacity` of the * desired color. * * @param {string} expression color expression like `'red-A200-0.3'` or * `'myTheme-primary-700-0.8'`. Theme, hue, and opacity are optional. * @returns {string} a CSS color value like `rgba(211, 47, 47, 0.8)` */ function getThemeColor(expression) { var color = extractColorOptions(expression); return parseColor(color); } /** * Return the parsed color * @param {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} color hash map of color * definitions * @param {boolean=} contrast whether use contrast color for foreground. Defaults to false. * @returns {string} rgba color string */ function parseColor(color, contrast) { contrast = contrast || false; var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; rgbValues = contrast ? rgbValues.contrast : rgbValues.value; return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] ); } /** * Convert the color expression into an object with scope-interpolated values * Then calculate the rgba() values based on the theme color parts * @param {Object} themeColors json object, keys are css properties and values are string of * the wanted color, for example: `{color: 'red-A200-0.3'}`. * @return {Object} Hashmap of CSS properties with associated `rgba()` string values */ function interpolateColors(themeColors) { var rgbColors = {}; var hasColorProperty = themeColors.hasOwnProperty('color'); angular.forEach(themeColors, function (value, key) { var color = extractColorOptions(value); var hasBackground = key.indexOf('background') > -1; rgbColors[key] = parseColor(color); if (hasBackground && !hasColorProperty) { rgbColors.color = parseColor(color, true); } }); return rgbColors; } /** * Check if expression has defined theme * For instance: * 'myTheme-primary' => true * 'red-800' => false * @param {string} expression color expression like 'red-800', 'red-A200-0.3', * 'myTheme-primary', or 'myTheme-primary-400' * @return {boolean} true if the expression has a theme part, false otherwise. */ function hasTheme(expression) { return angular.isDefined($mdTheming.THEMES[expression.split('-')[0]]); } /** * For the evaluated expression, extract the color parts into a hash map * @param {string} expression color expression like 'red-800', 'red-A200-0.3', * 'myTheme-primary', or 'myTheme-primary-400' * @returns {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} */ function extractColorOptions(expression) { var parts = expression.split('-'); var hasTheme = angular.isDefined($mdTheming.THEMES[parts[0]]); var theme = hasTheme ? parts.splice(0, 1)[0] : $mdTheming.defaultTheme(); return { theme: theme, palette: extractPalette(parts, theme), hue: extractHue(parts, theme), opacity: parts[2] || 1 }; } /** * Calculate the theme palette name * @param {Array} parts * @param {string} theme name * @return {string} */ function extractPalette(parts, theme) { // If the next section is one of the palettes we assume it's a two word palette // Two word palette can be also written in camelCase, forming camelCase to dash-case var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1; var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); if (isTwoWord) palette = parts[0] + '-' + parts.splice(1, 1); if (colorPalettes.indexOf(palette) === -1) { // If the palette is not in the palette list it's one of primary/accent/warn/background var scheme = $mdTheming.THEMES[theme].colors[palette]; if (!scheme) { throw new Error($mdUtil.supplant( 'mdColors: couldn\'t find \'{palette}\' in the palettes.', {palette: palette})); } palette = scheme.name; } return palette; } /** * @param {Array} parts * @param {string} theme name * @return {*} */ function extractHue(parts, theme) { var themeColors = $mdTheming.THEMES[theme].colors; if (parts[1] === 'hue') { var hueNumber = parseInt(parts.splice(2, 1)[0], 10); if (hueNumber < 1 || hueNumber > 3) { throw new Error($mdUtil.supplant( 'mdColors: \'hue-{hueNumber}\' is not a valid hue, can be only \'hue-1\', \'hue-2\' and \'hue-3\'', {hueNumber: hueNumber})); } parts[1] = 'hue-' + hueNumber; if (!(parts[0] in themeColors)) { throw new Error($mdUtil.supplant( 'mdColors: \'hue-x\' can only be used with [{availableThemes}], but was used with \'{usedTheme}\'', { availableThemes: Object.keys(themeColors).join(', '), usedTheme: parts[0] })); } return themeColors[parts[0]].hues[parts[1]]; } return parts[1] || themeColors[parts[0] in themeColors ? parts[0] : 'primary'].hues['default']; } }
[ "function", "MdColorsService", "(", "$mdTheming", ",", "$mdUtil", ",", "$log", ")", "{", "colorPalettes", "=", "colorPalettes", "||", "Object", ".", "keys", "(", "$mdTheming", ".", "PALETTES", ")", ";", "// Publish service instance", "return", "{", "applyThemeColo...
@ngdoc service @name $mdColors @module material.components.colors @description By default, defining a theme does not make its colors available for applying to non AngularJS Material elements. The `$mdColors` service is used by the `md-color` directive to convert a set of color expressions to RGBA values and then apply those values to the element as CSS property values. @usage Getting a color based on a theme <hljs lang="js"> angular.controller('myCtrl', function ($mdColors) { var color = $mdColors.getThemeColor('myTheme-primary-900-0.5'); ... }); </hljs> Applying a color from a palette to an element <hljs lang="js"> app.directive('myDirective', function($mdColors) { return { ... link: function (scope, elem) { $mdColors.applyThemeColors(elem, {color: 'red-A200-0.2'}); } } }); </hljs>
[ "@ngdoc", "service", "@name", "$mdColors", "@module", "material", ".", "components", ".", "colors" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/colors/colors.js#L56-L249
train
The MdColorsService provides a service that can be used to apply theme colors to an element.
[ 30522, 3853, 9108, 18717, 18116, 7903, 2063, 1006, 1002, 9108, 10760, 6562, 1010, 1002, 9108, 21823, 2140, 1010, 1002, 8833, 1007, 1063, 3609, 12952, 26592, 1027, 3609, 12952, 26592, 1064, 1064, 4874, 1012, 6309, 1006, 1002, 9108, 10760, 65...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/RecentProjects/main.js
add
function add() { var root = FileUtils.stripTrailingSlash(ProjectManager.getProjectRoot().fullPath), recentProjects = getRecentProjects(), index = recentProjects.indexOf(root); if (index !== -1) { recentProjects.splice(index, 1); } recentProjects.unshift(root); if (recentProjects.length > MAX_PROJECTS) { recentProjects = recentProjects.slice(0, MAX_PROJECTS); } PreferencesManager.setViewState("recentProjects", recentProjects); }
javascript
function add() { var root = FileUtils.stripTrailingSlash(ProjectManager.getProjectRoot().fullPath), recentProjects = getRecentProjects(), index = recentProjects.indexOf(root); if (index !== -1) { recentProjects.splice(index, 1); } recentProjects.unshift(root); if (recentProjects.length > MAX_PROJECTS) { recentProjects = recentProjects.slice(0, MAX_PROJECTS); } PreferencesManager.setViewState("recentProjects", recentProjects); }
[ "function", "add", "(", ")", "{", "var", "root", "=", "FileUtils", ".", "stripTrailingSlash", "(", "ProjectManager", ".", "getProjectRoot", "(", ")", ".", "fullPath", ")", ",", "recentProjects", "=", "getRecentProjects", "(", ")", ",", "index", "=", "recentP...
Add a project to the stored list of recent projects, up to MAX_PROJECTS.
[ "Add", "a", "project", "to", "the", "stored", "list", "of", "recent", "projects", "up", "to", "MAX_PROJECTS", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/RecentProjects/main.js#L78-L91
train
Add a project to the list of recent projects
[ 30522, 3853, 5587, 1006, 1007, 1063, 13075, 7117, 1027, 5371, 21823, 4877, 1012, 6167, 6494, 16281, 14540, 11823, 1006, 2622, 24805, 4590, 1012, 2131, 21572, 20614, 3217, 30524, 21572, 20614, 2015, 1012, 11867, 13231, 1006, 5950, 1010, 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...
eslint/eslint
lib/rules/sort-imports.js
usedMemberSyntax
function usedMemberSyntax(node) { if (node.specifiers.length === 0) { return "none"; } if (node.specifiers[0].type === "ImportNamespaceSpecifier") { return "all"; } if (node.specifiers.length === 1) { return "single"; } return "multiple"; }
javascript
function usedMemberSyntax(node) { if (node.specifiers.length === 0) { return "none"; } if (node.specifiers[0].type === "ImportNamespaceSpecifier") { return "all"; } if (node.specifiers.length === 1) { return "single"; } return "multiple"; }
[ "function", "usedMemberSyntax", "(", "node", ")", "{", "if", "(", "node", ".", "specifiers", ".", "length", "===", "0", ")", "{", "return", "\"none\"", ";", "}", "if", "(", "node", ".", "specifiers", "[", "0", "]", ".", "type", "===", "\"ImportNamespac...
Gets the used member syntax style. import "my-module.js" --> none import * as myModule from "my-module.js" --> all import {myMember} from "my-module.js" --> single import {foo, bar} from "my-module.js" --> multiple @param {ASTNode} node - the ImportDeclaration node. @returns {string} used member parameter style, ["all", "multiple", "single"]
[ "Gets", "the", "used", "member", "syntax", "style", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/sort-imports.js#L77-L89
train
returns the syntax used by member
[ 30522, 3853, 2109, 4168, 21784, 6508, 12380, 2595, 1006, 13045, 1007, 1063, 2065, 1006, 13045, 1012, 28699, 28295, 1012, 3091, 1027, 1027, 1027, 1014, 1007, 1063, 2709, 1000, 3904, 1000, 1025, 1065, 2065, 1006, 13045, 1012, 28699, 28295, 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/project/WorkingSetSort.js
register
function register(command, compareFn, events) { var commandID = ""; if (!command || !compareFn) { console.log("Attempting to register a Sort method with a missing required parameter: command or compare function"); return; } if (typeof command === "string") { commandID = command; } else { commandID = command.getID(); } if (_sorts[commandID]) { console.log("Attempting to register an already-registered Sort method: " + command); return; } // Adds ".sort" to the end of each event to make them specific for the automatic sort. if (events) { events = events.split(" "); events.forEach(function (event, index) { events[index] = events[index].trim() + ".sort"; }); events = events.join(" "); } var sort = new Sort(commandID, compareFn, events); _sorts[commandID] = sort; return sort; }
javascript
function register(command, compareFn, events) { var commandID = ""; if (!command || !compareFn) { console.log("Attempting to register a Sort method with a missing required parameter: command or compare function"); return; } if (typeof command === "string") { commandID = command; } else { commandID = command.getID(); } if (_sorts[commandID]) { console.log("Attempting to register an already-registered Sort method: " + command); return; } // Adds ".sort" to the end of each event to make them specific for the automatic sort. if (events) { events = events.split(" "); events.forEach(function (event, index) { events[index] = events[index].trim() + ".sort"; }); events = events.join(" "); } var sort = new Sort(commandID, compareFn, events); _sorts[commandID] = sort; return sort; }
[ "function", "register", "(", "command", ",", "compareFn", ",", "events", ")", "{", "var", "commandID", "=", "\"\"", ";", "if", "(", "!", "command", "||", "!", "compareFn", ")", "{", "console", ".", "log", "(", "\"Attempting to register a Sort method with a mis...
Registers a working set sort method. @param {(string|Command)} command A command ID or a command object @param {function(File, File): number} compareFn The function that will be used inside JavaScript's sort function. The return a value should be >0 (sort a to a lower index than b), =0 (leaves a and b unchanged with respect to each other) or <0 (sort b to a lower index than a) and must always returns the same value when given a specific pair of elements a and b as its two arguments. Documentation at: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort @param {?string} events One or more space-separated event types that DocumentManger uses. Each event passed will trigger the automatic sort. If no events are passed, the automatic sort will be disabled for that sort method. @return {?Sort}
[ "Registers", "a", "working", "set", "sort", "method", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetSort.js#L289-L319
train
Registers a Sort method with the daemon.
[ 30522, 3853, 4236, 1006, 3094, 1010, 12826, 2546, 2078, 1010, 2824, 1007, 1063, 13075, 3094, 3593, 1027, 1000, 1000, 1025, 2065, 1006, 999, 3094, 1064, 1064, 999, 12826, 2546, 2078, 1007, 1063, 10122, 1012, 8833, 1006, 1000, 7161, 2000, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Targets.js
function (vName) { var that = this, aResult = []; if (Array.isArray(vName)) { vName.forEach(function (sName) { var oTarget = that._mTargets[sName]; if (oTarget) { aResult.push(oTarget); } else { Log.error("The target you tried to get \"" + sName + "\" does not exist!", that); } }); return aResult; } return this._mTargets[vName]; }
javascript
function (vName) { var that = this, aResult = []; if (Array.isArray(vName)) { vName.forEach(function (sName) { var oTarget = that._mTargets[sName]; if (oTarget) { aResult.push(oTarget); } else { Log.error("The target you tried to get \"" + sName + "\" does not exist!", that); } }); return aResult; } return this._mTargets[vName]; }
[ "function", "(", "vName", ")", "{", "var", "that", "=", "this", ",", "aResult", "=", "[", "]", ";", "if", "(", "Array", ".", "isArray", "(", "vName", ")", ")", "{", "vName", ".", "forEach", "(", "function", "(", "sName", ")", "{", "var", "oTarget...
Returns a target by its name (if you pass myTarget: { view: "myView" }) in the config myTarget is the name. @param {string|string[]} vName the name of a single target or the name of multiple targets @return {sap.ui.core.routing.Target|undefined|sap.ui.core.routing.Target[]} The target with the coresponding name or undefined. If an array way passed as name this will return an array with all found targets. Non existing targets will not be returned but will log an error. @public
[ "Returns", "a", "target", "by", "its", "name", "(", "if", "you", "pass", "myTarget", ":", "{", "view", ":", "myView", "}", ")", "in", "the", "config", "myTarget", "is", "the", "name", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L398-L416
train
Returns an array of all targets that match the given name.
[ 30522, 3853, 1006, 1058, 18442, 1007, 1063, 13075, 2008, 1027, 2023, 1010, 23631, 11314, 1027, 1031, 1033, 1025, 2065, 1006, 9140, 1012, 18061, 11335, 2100, 1006, 1058, 18442, 1007, 1007, 1063, 1058, 18442, 1012, 18921, 6776, 1006, 3853, 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
lib/jsdoc/ui5/template/publish.js
makeSignature
function makeSignature(params) { var r = ['('], desc; if ( params ) { for (var i = 0, p; (p = params[i]); i++) { // ignore @param tags for 'virtual' params that are used to document members of config-like params // (e.g. like "@param param1.key ...") if (p.name && p.name.indexOf('.') == -1) { if (i > 0) { r.push(', '); } r.push('<span'); var types = listTypes(p.type, true); if ( (desc = asPlainSummary(p.description)) || types ) { r.push(' title="'); if (types) { r.push('('); r.push(types); r.push(') '); } r.push(desc); r.push('"'); } r.push('>'); r.push(p.name); r.push('</span>'); if ( p.optional ) { r.push('<i class="help" title="Optional parameter">?</i>'); } } } } r.push(')'); return r.join(''); }
javascript
function makeSignature(params) { var r = ['('], desc; if ( params ) { for (var i = 0, p; (p = params[i]); i++) { // ignore @param tags for 'virtual' params that are used to document members of config-like params // (e.g. like "@param param1.key ...") if (p.name && p.name.indexOf('.') == -1) { if (i > 0) { r.push(', '); } r.push('<span'); var types = listTypes(p.type, true); if ( (desc = asPlainSummary(p.description)) || types ) { r.push(' title="'); if (types) { r.push('('); r.push(types); r.push(') '); } r.push(desc); r.push('"'); } r.push('>'); r.push(p.name); r.push('</span>'); if ( p.optional ) { r.push('<i class="help" title="Optional parameter">?</i>'); } } } } r.push(')'); return r.join(''); }
[ "function", "makeSignature", "(", "params", ")", "{", "var", "r", "=", "[", "'('", "]", ",", "desc", ";", "if", "(", "params", ")", "{", "for", "(", "var", "i", "=", "0", ",", "p", ";", "(", "p", "=", "params", "[", "i", "]", ")", ";", "i",...
/* Build output for displaying function parameters.
[ "/", "*", "Build", "output", "for", "displaying", "function", "parameters", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L1462-L1498
train
Creates a signature string from an array of parameters
[ 30522, 3853, 3084, 23773, 4017, 5397, 1006, 11498, 5244, 1007, 1063, 13075, 1054, 1027, 1031, 1005, 1006, 1005, 1033, 1010, 4078, 2278, 1025, 2065, 1006, 11498, 5244, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 1010, 1052, 1025, 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...
eslint/eslint
lib/rules/vars-on-top.js
globalVarCheck
function globalVarCheck(node, parent) { if (!isVarOnTop(node, parent.body)) { context.report({ node, messageId: "top" }); } }
javascript
function globalVarCheck(node, parent) { if (!isVarOnTop(node, parent.body)) { context.report({ node, messageId: "top" }); } }
[ "function", "globalVarCheck", "(", "node", ",", "parent", ")", "{", "if", "(", "!", "isVarOnTop", "(", "node", ",", "parent", ".", "body", ")", ")", "{", "context", ".", "report", "(", "{", "node", ",", "messageId", ":", "\"top\"", "}", ")", ";", "...
Checks whether variable is on top at the global level @param {ASTNode} node - The node to check @param {ASTNode} parent - Parent of the node @returns {void}
[ "Checks", "whether", "variable", "is", "on", "top", "at", "the", "global", "level" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/vars-on-top.js#L106-L110
train
Check if the variable is on top of the body
[ 30522, 3853, 3795, 10755, 5403, 3600, 1006, 13045, 1010, 6687, 1007, 1063, 2065, 1006, 999, 2003, 10755, 12162, 7361, 1006, 13045, 1010, 6687, 1012, 2303, 1007, 1007, 1063, 6123, 1012, 3189, 1006, 1063, 13045, 1010, 4471, 3593, 1024, 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...
eslint/eslint
lib/code-path-analysis/code-path-analyzer.js
preprocess
function preprocess(analyzer, node) { const codePath = analyzer.codePath; const state = CodePath.getState(codePath); const parent = node.parent; switch (parent.type) { case "LogicalExpression": if ( parent.right === node && isHandledLogicalOperator(parent.operator) ) { state.makeLogicalRight(); } break; case "ConditionalExpression": case "IfStatement": /* * Fork if this node is at `consequent`/`alternate`. * `popForkContext()` exists at `IfStatement:exit` and * `ConditionalExpression:exit`. */ if (parent.consequent === node) { state.makeIfConsequent(); } else if (parent.alternate === node) { state.makeIfAlternate(); } break; case "SwitchCase": if (parent.consequent[0] === node) { state.makeSwitchCaseBody(false, !parent.test); } break; case "TryStatement": if (parent.handler === node) { state.makeCatchBlock(); } else if (parent.finalizer === node) { state.makeFinallyBlock(); } break; case "WhileStatement": if (parent.test === node) { state.makeWhileTest(getBooleanValueIfSimpleConstant(node)); } else { assert(parent.body === node); state.makeWhileBody(); } break; case "DoWhileStatement": if (parent.body === node) { state.makeDoWhileBody(); } else { assert(parent.test === node); state.makeDoWhileTest(getBooleanValueIfSimpleConstant(node)); } break; case "ForStatement": if (parent.test === node) { state.makeForTest(getBooleanValueIfSimpleConstant(node)); } else if (parent.update === node) { state.makeForUpdate(); } else if (parent.body === node) { state.makeForBody(); } break; case "ForInStatement": case "ForOfStatement": if (parent.left === node) { state.makeForInOfLeft(); } else if (parent.right === node) { state.makeForInOfRight(); } else { assert(parent.body === node); state.makeForInOfBody(); } break; case "AssignmentPattern": /* * Fork if this node is at `right`. * `left` is executed always, so it uses the current path. * `popForkContext()` exists at `AssignmentPattern:exit`. */ if (parent.right === node) { state.pushForkContext(); state.forkBypassPath(); state.forkPath(); } break; default: break; } }
javascript
function preprocess(analyzer, node) { const codePath = analyzer.codePath; const state = CodePath.getState(codePath); const parent = node.parent; switch (parent.type) { case "LogicalExpression": if ( parent.right === node && isHandledLogicalOperator(parent.operator) ) { state.makeLogicalRight(); } break; case "ConditionalExpression": case "IfStatement": /* * Fork if this node is at `consequent`/`alternate`. * `popForkContext()` exists at `IfStatement:exit` and * `ConditionalExpression:exit`. */ if (parent.consequent === node) { state.makeIfConsequent(); } else if (parent.alternate === node) { state.makeIfAlternate(); } break; case "SwitchCase": if (parent.consequent[0] === node) { state.makeSwitchCaseBody(false, !parent.test); } break; case "TryStatement": if (parent.handler === node) { state.makeCatchBlock(); } else if (parent.finalizer === node) { state.makeFinallyBlock(); } break; case "WhileStatement": if (parent.test === node) { state.makeWhileTest(getBooleanValueIfSimpleConstant(node)); } else { assert(parent.body === node); state.makeWhileBody(); } break; case "DoWhileStatement": if (parent.body === node) { state.makeDoWhileBody(); } else { assert(parent.test === node); state.makeDoWhileTest(getBooleanValueIfSimpleConstant(node)); } break; case "ForStatement": if (parent.test === node) { state.makeForTest(getBooleanValueIfSimpleConstant(node)); } else if (parent.update === node) { state.makeForUpdate(); } else if (parent.body === node) { state.makeForBody(); } break; case "ForInStatement": case "ForOfStatement": if (parent.left === node) { state.makeForInOfLeft(); } else if (parent.right === node) { state.makeForInOfRight(); } else { assert(parent.body === node); state.makeForInOfBody(); } break; case "AssignmentPattern": /* * Fork if this node is at `right`. * `left` is executed always, so it uses the current path. * `popForkContext()` exists at `AssignmentPattern:exit`. */ if (parent.right === node) { state.pushForkContext(); state.forkBypassPath(); state.forkPath(); } break; default: break; } }
[ "function", "preprocess", "(", "analyzer", ",", "node", ")", "{", "const", "codePath", "=", "analyzer", ".", "codePath", ";", "const", "state", "=", "CodePath", ".", "getState", "(", "codePath", ")", ";", "const", "parent", "=", "node", ".", "parent", ";...
Updates the code path due to the position of a given node in the parent node thereof. For example, if the node is `parent.consequent`, this creates a fork from the current path. @param {CodePathAnalyzer} analyzer - The instance. @param {ASTNode} node - The current AST node. @returns {void}
[ "Updates", "the", "code", "path", "due", "to", "the", "position", "of", "a", "given", "node", "in", "the", "parent", "node", "thereof", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/code-path-analysis/code-path-analyzer.js#L237-L338
train
Preprocess a node.
[ 30522, 3853, 17463, 3217, 9623, 2015, 1006, 17908, 2099, 1010, 13045, 1007, 1063, 9530, 3367, 3642, 15069, 1027, 17908, 2099, 1012, 3642, 15069, 1025, 9530, 3367, 2110, 1027, 3642, 15069, 1012, 4152, 12259, 1006, 3642, 15069, 1007, 1025, 95...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GeekyAnts/vue-native-core
packages/vue-server-renderer/build.js
toObject
function toObject (arr) { var res = {}; for (var i = 0; i < arr.length; i++) { if (arr[i]) { extend(res, arr[i]); } } return res }
javascript
function toObject (arr) { var res = {}; for (var i = 0; i < arr.length; i++) { if (arr[i]) { extend(res, arr[i]); } } return res }
[ "function", "toObject", "(", "arr", ")", "{", "var", "res", "=", "{", "}", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "if", "(", "arr", "[", "i", "]", ")", "{", "extend", "(", "re...
Merge an Array of Objects into a single Object.
[ "Merge", "an", "Array", "of", "Objects", "into", "a", "single", "Object", "." ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L159-L167
train
Convert an array of objects to an object
[ 30522, 3853, 2205, 2497, 20614, 1006, 12098, 2099, 1007, 1063, 13075, 24501, 1027, 1063, 1065, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 12098, 2099, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 2065, 1006, 12098, 2099...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
youzan/vant
build/build-style-entry.js
analyzeDependencies
function analyzeDependencies(component) { const checkList = ['base']; search( dependencyTree({ directory: dir, filename: path.join(dir, component, 'index.js'), filter: path => !~path.indexOf('node_modules') }), component, checkList ); if (!whiteList.includes(component)) { checkList.push(component); } return checkList.filter(item => checkComponentHasStyle(item)); }
javascript
function analyzeDependencies(component) { const checkList = ['base']; search( dependencyTree({ directory: dir, filename: path.join(dir, component, 'index.js'), filter: path => !~path.indexOf('node_modules') }), component, checkList ); if (!whiteList.includes(component)) { checkList.push(component); } return checkList.filter(item => checkComponentHasStyle(item)); }
[ "function", "analyzeDependencies", "(", "component", ")", "{", "const", "checkList", "=", "[", "'base'", "]", ";", "search", "(", "dependencyTree", "(", "{", "directory", ":", "dir", ",", "filename", ":", "path", ".", "join", "(", "dir", ",", "component", ...
analyze component dependencies
[ "analyze", "component", "dependencies" ]
21589c9b9fd70b750deed1d31226b8d2c74d62c0
https://github.com/youzan/vant/blob/21589c9b9fd70b750deed1d31226b8d2c74d62c0/build/build-style-entry.js#L42-L60
train
Analyzes the dependencies of a component
[ 30522, 3853, 16578, 13699, 10497, 15266, 1006, 6922, 1007, 1063, 9530, 3367, 4638, 9863, 1027, 1031, 1005, 2918, 1005, 1033, 1025, 3945, 1006, 24394, 13334, 30524, 1027, 1028, 999, 1066, 4130, 1012, 5950, 11253, 1006, 1005, 13045, 1035, 141...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/component/dataZoom/AxisProxy.js
function (dimName, axisIndex, dataZoomModel, ecModel) { /** * @private * @type {string} */ this._dimName = dimName; /** * @private */ this._axisIndex = axisIndex; /** * @private * @type {Array.<number>} */ this._valueWindow; /** * @private * @type {Array.<number>} */ this._percentWindow; /** * @private * @type {Array.<number>} */ this._dataExtent; /** * {minSpan, maxSpan, minValueSpan, maxValueSpan} * @private * @type {Object} */ this._minMaxSpan; /** * @readOnly * @type {module: echarts/model/Global} */ this.ecModel = ecModel; /** * @private * @type {module: echarts/component/dataZoom/DataZoomModel} */ this._dataZoomModel = dataZoomModel; // /** // * @readOnly // * @private // */ // this.hasSeriesStacked; }
javascript
function (dimName, axisIndex, dataZoomModel, ecModel) { /** * @private * @type {string} */ this._dimName = dimName; /** * @private */ this._axisIndex = axisIndex; /** * @private * @type {Array.<number>} */ this._valueWindow; /** * @private * @type {Array.<number>} */ this._percentWindow; /** * @private * @type {Array.<number>} */ this._dataExtent; /** * {minSpan, maxSpan, minValueSpan, maxValueSpan} * @private * @type {Object} */ this._minMaxSpan; /** * @readOnly * @type {module: echarts/model/Global} */ this.ecModel = ecModel; /** * @private * @type {module: echarts/component/dataZoom/DataZoomModel} */ this._dataZoomModel = dataZoomModel; // /** // * @readOnly // * @private // */ // this.hasSeriesStacked; }
[ "function", "(", "dimName", ",", "axisIndex", ",", "dataZoomModel", ",", "ecModel", ")", "{", "/**\n * @private\n * @type {string}\n */", "this", ".", "_dimName", "=", "dimName", ";", "/**\n * @private\n */", "this", ".", "_axisIndex", "=", "axisInde...
Operate single axis. One axis can only operated by one axis operator. Different dataZoomModels may be defined to operate the same axis. (i.e. 'inside' data zoom and 'slider' data zoom components) So dataZoomModels share one axisProxy in that case. @class
[ "Operate", "single", "axis", ".", "One", "axis", "can", "only", "operated", "by", "one", "axis", "operator", ".", "Different", "dataZoomModels", "may", "be", "defined", "to", "operate", "the", "same", "axis", ".", "(", "i", ".", "e", ".", "inside", "data...
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/dataZoom/AxisProxy.js#L37-L92
train
A series is a series of series
[ 30522, 3853, 1006, 11737, 18442, 1010, 8123, 22254, 10288, 1010, 2951, 23221, 7382, 10244, 2140, 1010, 14925, 5302, 9247, 1007, 1063, 1013, 1008, 1008, 1008, 1030, 2797, 1008, 1030, 2828, 1063, 5164, 1065, 1008, 1013, 2023, 1012, 1035, 1173...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Freeboard/freeboard
js/freeboard.thirdparty.js
function( origin, original ) { var y, x; switch ( origin[ 0 ] ) { case "top": y = 0; break; case "middle": y = 0.5; break; case "bottom": y = 1; break; default: y = origin[ 0 ] / original.height; } switch ( origin[ 1 ] ) { case "left": x = 0; break; case "center": x = 0.5; break; case "right": x = 1; break; default: x = origin[ 1 ] / original.width; } return { x: x, y: y }; }
javascript
function( origin, original ) { var y, x; switch ( origin[ 0 ] ) { case "top": y = 0; break; case "middle": y = 0.5; break; case "bottom": y = 1; break; default: y = origin[ 0 ] / original.height; } switch ( origin[ 1 ] ) { case "left": x = 0; break; case "center": x = 0.5; break; case "right": x = 1; break; default: x = origin[ 1 ] / original.width; } return { x: x, y: y }; }
[ "function", "(", "origin", ",", "original", ")", "{", "var", "y", ",", "x", ";", "switch", "(", "origin", "[", "0", "]", ")", "{", "case", "\"top\"", ":", "y", "=", "0", ";", "break", ";", "case", "\"middle\"", ":", "y", "=", "0.5", ";", "break...
Translates a [top,left] array into a baseline value this should be a little more flexible in the future to handle a string & hash
[ "Translates", "a", "[", "top", "left", "]", "array", "into", "a", "baseline", "value", "this", "should", "be", "a", "little", "more", "flexible", "in", "the", "future", "to", "handle", "a", "string", "&", "hash" ]
38789f6e8bd3d04f7d3b2c3427e509d00f2610fc
https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L5713-L5731
train
Returns the coordinates of the image in the specified coordinates
[ 30522, 3853, 1006, 4761, 1010, 2434, 1007, 1063, 13075, 1061, 1010, 1060, 1025, 6942, 1006, 4761, 1031, 1014, 1033, 1007, 1063, 2553, 1000, 2327, 1000, 1024, 1061, 1027, 1014, 1025, 3338, 1025, 2553, 1000, 2690, 1000, 1024, 1061, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/by.js
escapeCss
function escapeCss(css) { if (typeof css !== 'string') { throw new TypeError('input must be a string'); } let ret = ''; const n = css.length; for (let i = 0; i < n; i++) { const c = css.charCodeAt(i); if (c == 0x0) { throw new InvalidCharacterError(); } if ((c >= 0x0001 && c <= 0x001F) || c == 0x007F || (i == 0 && c >= 0x0030 && c <= 0x0039) || (i == 1 && c >= 0x0030 && c <= 0x0039 && css.charCodeAt(0) == 0x002D)) { ret += '\\' + c.toString(16) + ' '; continue; } if (i == 0 && c == 0x002D && n == 1) { ret += '\\' + css.charAt(i); continue; } if (c >= 0x0080 || c == 0x002D // - || c == 0x005F // _ || (c >= 0x0030 && c <= 0x0039) // [0-9] || (c >= 0x0041 && c <= 0x005A) // [A-Z] || (c >= 0x0061 && c <= 0x007A)) { // [a-z] ret += css.charAt(i); continue; } ret += '\\' + css.charAt(i); } return ret; }
javascript
function escapeCss(css) { if (typeof css !== 'string') { throw new TypeError('input must be a string'); } let ret = ''; const n = css.length; for (let i = 0; i < n; i++) { const c = css.charCodeAt(i); if (c == 0x0) { throw new InvalidCharacterError(); } if ((c >= 0x0001 && c <= 0x001F) || c == 0x007F || (i == 0 && c >= 0x0030 && c <= 0x0039) || (i == 1 && c >= 0x0030 && c <= 0x0039 && css.charCodeAt(0) == 0x002D)) { ret += '\\' + c.toString(16) + ' '; continue; } if (i == 0 && c == 0x002D && n == 1) { ret += '\\' + css.charAt(i); continue; } if (c >= 0x0080 || c == 0x002D // - || c == 0x005F // _ || (c >= 0x0030 && c <= 0x0039) // [0-9] || (c >= 0x0041 && c <= 0x005A) // [A-Z] || (c >= 0x0061 && c <= 0x007A)) { // [a-z] ret += css.charAt(i); continue; } ret += '\\' + css.charAt(i); } return ret; }
[ "function", "escapeCss", "(", "css", ")", "{", "if", "(", "typeof", "css", "!==", "'string'", ")", "{", "throw", "new", "TypeError", "(", "'input must be a string'", ")", ";", "}", "let", "ret", "=", "''", ";", "const", "n", "=", "css", ".", "length", ...
Escapes a CSS string. @param {string} css the string to escape. @return {string} the escaped string. @throws {TypeError} if the input value is not a string. @throws {InvalidCharacterError} if the string contains an invalid character. @see https://drafts.csswg.org/cssom/#serialize-an-identifier
[ "Escapes", "a", "CSS", "string", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/by.js#L70-L109
train
Escape a CSS string
[ 30522, 3853, 4019, 6169, 2015, 1006, 20116, 2015, 1007, 1063, 2065, 1006, 2828, 11253, 20116, 2015, 999, 1027, 1027, 1005, 5164, 1005, 1007, 1063, 5466, 2047, 2828, 2121, 29165, 1006, 1005, 7953, 2442, 2022, 1037, 5164, 1005, 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...
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/NotificationBar.js
function(oThis, oMN) { if (oMN && oMN.hasItems()) { var $messageCount = oMN.$("counter"); // remove all possible classes $messageCount.removeClass("sapUiMessageInformation"); $messageCount.removeClass("sapUiMessageSuccess"); $messageCount.removeClass("sapUiMessageWarning"); $messageCount.removeClass("sapUiMessageError"); // re-sort the messages and re-calc the severity level because they could have been changed // if the NotiBar was invisible fnSortMessages(oThis, oMN); // add new corresponding class var sLvl = oThis._sSeverestMessageLevel; $messageCount.addClass("sapUiMessage" + sLvl); // create key for description text var iCount = oMN.getMessages().length; var sKey = "NOTIBAR_MESSAGE_NOTIFIER_DESC_LEVEL_" + sLvl.toUpperCase() + (iCount === 1 ? "_SING" : "_PL"); // set description (i.e. "3 messages available: Highest severity // "Error") fnSetNotifierDescription(oThis, oMN, sKey, iCount); } }
javascript
function(oThis, oMN) { if (oMN && oMN.hasItems()) { var $messageCount = oMN.$("counter"); // remove all possible classes $messageCount.removeClass("sapUiMessageInformation"); $messageCount.removeClass("sapUiMessageSuccess"); $messageCount.removeClass("sapUiMessageWarning"); $messageCount.removeClass("sapUiMessageError"); // re-sort the messages and re-calc the severity level because they could have been changed // if the NotiBar was invisible fnSortMessages(oThis, oMN); // add new corresponding class var sLvl = oThis._sSeverestMessageLevel; $messageCount.addClass("sapUiMessage" + sLvl); // create key for description text var iCount = oMN.getMessages().length; var sKey = "NOTIBAR_MESSAGE_NOTIFIER_DESC_LEVEL_" + sLvl.toUpperCase() + (iCount === 1 ? "_SING" : "_PL"); // set description (i.e. "3 messages available: Highest severity // "Error") fnSetNotifierDescription(oThis, oMN, sKey, iCount); } }
[ "function", "(", "oThis", ",", "oMN", ")", "{", "if", "(", "oMN", "&&", "oMN", ".", "hasItems", "(", ")", ")", "{", "var", "$messageCount", "=", "oMN", ".", "$", "(", "\"counter\"", ")", ";", "// remove all possible classes", "$messageCount", ".", "remov...
This method sets the corresponding CSS class to the message notifier's counter to set its corresponding color and sets the corresponding ARIA information to the notifier's description element @private
[ "This", "method", "sets", "the", "corresponding", "CSS", "class", "to", "the", "message", "notifier", "s", "counter", "to", "set", "its", "corresponding", "color", "and", "sets", "the", "corresponding", "ARIA", "information", "to", "the", "notifier", "s", "des...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBar.js#L986-L1011
train
Updates the notifier description
[ 30522, 3853, 1006, 27178, 24158, 1010, 18168, 2078, 1007, 1063, 2065, 1006, 18168, 2078, 1004, 1004, 18168, 2078, 1012, 2038, 4221, 5244, 1006, 1007, 1007, 1063, 13075, 1002, 4471, 3597, 16671, 1027, 18168, 2078, 1012, 1002, 1006, 1000, 467...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/JavaScriptCodeHints/main.js
handleActiveEditorChange
function handleActiveEditorChange(event, current, previous) { // Uninstall "languageChanged" event listeners on previous editor's document & put them on current editor's doc if (previous) { previous.document .off(HintUtils.eventName("languageChanged")); } if (current) { current.document .on(HintUtils.eventName("languageChanged"), function () { // If current doc's language changed, reset our state by treating it as if the user switched to a // different document altogether uninstallEditorListeners(current); installEditorListeners(current); }); } uninstallEditorListeners(previous); installEditorListeners(current, previous); }
javascript
function handleActiveEditorChange(event, current, previous) { // Uninstall "languageChanged" event listeners on previous editor's document & put them on current editor's doc if (previous) { previous.document .off(HintUtils.eventName("languageChanged")); } if (current) { current.document .on(HintUtils.eventName("languageChanged"), function () { // If current doc's language changed, reset our state by treating it as if the user switched to a // different document altogether uninstallEditorListeners(current); installEditorListeners(current); }); } uninstallEditorListeners(previous); installEditorListeners(current, previous); }
[ "function", "handleActiveEditorChange", "(", "event", ",", "current", ",", "previous", ")", "{", "// Uninstall \"languageChanged\" event listeners on previous editor's document & put them on current editor's doc", "if", "(", "previous", ")", "{", "previous", ".", "document", "....
/* Handle the activeEditorChange event fired by EditorManager. Uninstalls the change listener on the previous editor and installs a change listener on the new editor. @param {Event} event - editor change event (ignored) @param {Editor} current - the new current editor context @param {Editor} previous - the previous editor context
[ "/", "*", "Handle", "the", "activeEditorChange", "event", "fired", "by", "EditorManager", ".", "Uninstalls", "the", "change", "listener", "on", "the", "previous", "editor", "and", "installs", "a", "change", "listener", "on", "the", "new", "editor", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptCodeHints/main.js#L702-L720
train
Handle active editor change
[ 30522, 3853, 5047, 19620, 2098, 15660, 22305, 2063, 1006, 2724, 1010, 2783, 1010, 3025, 1007, 1063, 1013, 1013, 4895, 7076, 9080, 2140, 1000, 2653, 22305, 2098, 1000, 2724, 13810, 2006, 3025, 3559, 1005, 1055, 6254, 1004, 2404, 2068, 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...
firebase/firebaseui-web
demo/public/app.js
function(authResult, redirectUrl) { if (authResult.user) { handleSignedInUser(authResult.user); } if (authResult.additionalUserInfo) { document.getElementById('is-new-user').textContent = authResult.additionalUserInfo.isNewUser ? 'New User' : 'Existing User'; } // Do not redirect. return false; }
javascript
function(authResult, redirectUrl) { if (authResult.user) { handleSignedInUser(authResult.user); } if (authResult.additionalUserInfo) { document.getElementById('is-new-user').textContent = authResult.additionalUserInfo.isNewUser ? 'New User' : 'Existing User'; } // Do not redirect. return false; }
[ "function", "(", "authResult", ",", "redirectUrl", ")", "{", "if", "(", "authResult", ".", "user", ")", "{", "handleSignedInUser", "(", "authResult", ".", "user", ")", ";", "}", "if", "(", "authResult", ".", "additionalUserInfo", ")", "{", "document", ".",...
Called when the user has been successfully signed in.
[ "Called", "when", "the", "user", "has", "been", "successfully", "signed", "in", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/demo/public/app.js#L26-L37
train
Handle the result of the authentication process
[ 30522, 3853, 1006, 8740, 2705, 6072, 11314, 1010, 30524, 8740, 2705, 6072, 11314, 1012, 3176, 20330, 2378, 14876, 1007, 1063, 6254, 1012, 2131, 12260, 3672, 3762, 3593, 1006, 1005, 2003, 1011, 2047, 1011, 5310, 1005, 1007, 1012, 3793, 8663,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_clearSearchField
function addonsManager_clearSearchField() { var textbox = this.getElement({type: "search_textbox"}); var cmdKey = utils.getEntity(this.dtds, "selectAllCmd.key"); this._controller.keypress(textbox, cmdKey, {accelKey: true}); this._controller.keypress(textbox, 'VK_DELETE', {}); }
javascript
function addonsManager_clearSearchField() { var textbox = this.getElement({type: "search_textbox"}); var cmdKey = utils.getEntity(this.dtds, "selectAllCmd.key"); this._controller.keypress(textbox, cmdKey, {accelKey: true}); this._controller.keypress(textbox, 'VK_DELETE', {}); }
[ "function", "addonsManager_clearSearchField", "(", ")", "{", "var", "textbox", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"search_textbox\"", "}", ")", ";", "var", "cmdKey", "=", "utils", ".", "getEntity", "(", "this", ".", "dtds", ",", "\"se...
///////////////////////////// Search section ///////////////////////////// Clear the search field
[ "/////////////////////////////", "Search", "section", "/////////////////////////////", "Clear", "the", "search", "field" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L774-L780
train
Clear the search field
[ 30522, 3853, 5587, 5644, 24805, 4590, 1035, 28837, 14644, 22693, 1006, 1007, 1063, 13075, 3793, 8758, 1027, 2023, 1012, 2131, 12260, 3672, 1006, 1063, 2828, 1024, 1000, 3945, 1035, 3793, 8758, 1000, 1065, 1007, 1025, 13075, 4642, 2094, 1483...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
template/web-server/public/js/lib/build/build.js
encode2UTF8
function encode2UTF8(charCode){ if(charCode <= 0x7f){ return [charCode]; }else if(charCode <= 0x7ff){ return [0xc0|(charCode>>6), 0x80|(charCode & 0x3f)]; }else{ return [0xe0|(charCode>>12), 0x80|((charCode & 0xfc0)>>6), 0x80|(charCode & 0x3f)]; } }
javascript
function encode2UTF8(charCode){ if(charCode <= 0x7f){ return [charCode]; }else if(charCode <= 0x7ff){ return [0xc0|(charCode>>6), 0x80|(charCode & 0x3f)]; }else{ return [0xe0|(charCode>>12), 0x80|((charCode & 0xfc0)>>6), 0x80|(charCode & 0x3f)]; } }
[ "function", "encode2UTF8", "(", "charCode", ")", "{", "if", "(", "charCode", "<=", "0x7f", ")", "{", "return", "[", "charCode", "]", ";", "}", "else", "if", "(", "charCode", "<=", "0x7ff", ")", "{", "return", "[", "0xc0", "|", "(", "charCode", ">>", ...
Encode a unicode16 char code to utf8 bytes
[ "Encode", "a", "unicode16", "char", "code", "to", "utf8", "bytes" ]
defcf019631ed399cc4dad932d3b028a04a039a4
https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/template/web-server/public/js/lib/build/build.js#L974-L982
train
Encode a character to UTF8
[ 30522, 3853, 4372, 16044, 2475, 4904, 2546, 2620, 1006, 25869, 16044, 1007, 1063, 2065, 1006, 25869, 16044, 1026, 1027, 1014, 2595, 2581, 2546, 1007, 1063, 2709, 1031, 25869, 16044, 1033, 1025, 1065, 2842, 2065, 1006, 25869, 16044, 1026, 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...
moleculerjs/moleculer
src/middlewares/circuit-breaker.js
trip
function trip(item, ctx) { item.state = C.CIRCUIT_OPEN; item.ep.state = false; if (item.cbTimer) { clearTimeout(item.cbTimer); item.cbTimer = null; } item.cbTimer = setTimeout(() => halfOpen(item, ctx), item.opts.halfOpenTime); item.cbTimer.unref(); const rate = item.count > 0 ? item.failures / item.count : 0; logger.debug(`Circuit breaker has been opened on '${item.ep.name}' endpoint.`, { nodeID: item.ep.id, action: item.ep.action.name, failures: item.failures, count: item.count, rate }); broker.broadcast("$circuit-breaker.opened", { nodeID: item.ep.id, action: item.ep.action.name, failures: item.failures, count: item.count, rate }); }
javascript
function trip(item, ctx) { item.state = C.CIRCUIT_OPEN; item.ep.state = false; if (item.cbTimer) { clearTimeout(item.cbTimer); item.cbTimer = null; } item.cbTimer = setTimeout(() => halfOpen(item, ctx), item.opts.halfOpenTime); item.cbTimer.unref(); const rate = item.count > 0 ? item.failures / item.count : 0; logger.debug(`Circuit breaker has been opened on '${item.ep.name}' endpoint.`, { nodeID: item.ep.id, action: item.ep.action.name, failures: item.failures, count: item.count, rate }); broker.broadcast("$circuit-breaker.opened", { nodeID: item.ep.id, action: item.ep.action.name, failures: item.failures, count: item.count, rate }); }
[ "function", "trip", "(", "item", ",", "ctx", ")", "{", "item", ".", "state", "=", "C", ".", "CIRCUIT_OPEN", ";", "item", ".", "ep", ".", "state", "=", "false", ";", "if", "(", "item", ".", "cbTimer", ")", "{", "clearTimeout", "(", "item", ".", "c...
Trip the circuit-breaker, change the status to open @param {Object} item @param {Context} ctx
[ "Trip", "the", "circuit", "-", "breaker", "change", "the", "status", "to", "open" ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/circuit-breaker.js#L122-L137
train
Trip function for circuit breaker
[ 30522, 3853, 4440, 1006, 8875, 1010, 14931, 2595, 1007, 1063, 8875, 1012, 2110, 1027, 1039, 1012, 4984, 1035, 2330, 1025, 8875, 1012, 4958, 1012, 2110, 1027, 6270, 1025, 2065, 1006, 8875, 1012, 17324, 7292, 2099, 1007, 1063, 3154, 7292, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/prefer-spread.js
isValidThisArg
function isValidThisArg(expectedThis, thisArg, context) { if (!expectedThis) { return astUtils.isNullOrUndefined(thisArg); } return astUtils.equalTokens(expectedThis, thisArg, context); }
javascript
function isValidThisArg(expectedThis, thisArg, context) { if (!expectedThis) { return astUtils.isNullOrUndefined(thisArg); } return astUtils.equalTokens(expectedThis, thisArg, context); }
[ "function", "isValidThisArg", "(", "expectedThis", ",", "thisArg", ",", "context", ")", "{", "if", "(", "!", "expectedThis", ")", "{", "return", "astUtils", ".", "isNullOrUndefined", "(", "thisArg", ")", ";", "}", "return", "astUtils", ".", "equalTokens", "(...
Checks whether or not `thisArg` is not changed by `.apply()`. @param {ASTNode|null} expectedThis - The node that is the owner of the applied function. @param {ASTNode} thisArg - The node that is given to the first argument of the `.apply()`. @param {RuleContext} context - The ESLint rule context object. @returns {boolean} Whether or not `thisArg` is not changed by `.apply()`.
[ "Checks", "whether", "or", "not", "thisArg", "is", "not", "changed", "by", ".", "apply", "()", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-spread.js#L39-L44
train
Check if the argument is valid
[ 30522, 3853, 2003, 10175, 3593, 15222, 10286, 2290, 1006, 3517, 15222, 2015, 1010, 2023, 2906, 2290, 1010, 6123, 1007, 1063, 2065, 1006, 999, 3517, 15222, 2015, 1007, 1063, 2709, 2004, 8525, 3775, 4877, 1012, 3475, 18083, 2953, 8630, 28344,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
websockets/ws
lib/websocket.js
socketOnError
function socketOnError() { const websocket = this[kWebSocket]; this.removeListener('error', socketOnError); this.on('error', NOOP); websocket.readyState = WebSocket.CLOSING; this.destroy(); }
javascript
function socketOnError() { const websocket = this[kWebSocket]; this.removeListener('error', socketOnError); this.on('error', NOOP); websocket.readyState = WebSocket.CLOSING; this.destroy(); }
[ "function", "socketOnError", "(", ")", "{", "const", "websocket", "=", "this", "[", "kWebSocket", "]", ";", "this", ".", "removeListener", "(", "'error'", ",", "socketOnError", ")", ";", "this", ".", "on", "(", "'error'", ",", "NOOP", ")", ";", "websocke...
The listener of the `net.Socket` `'error'` event. @private
[ "The", "listener", "of", "the", "net", ".", "Socket", "error", "event", "." ]
995c527c87d0d4833d8093c18dcfa2e4a41d9582
https://github.com/websockets/ws/blob/995c527c87d0d4833d8093c18dcfa2e4a41d9582/lib/websocket.js#L894-L902
train
Socket error handler.
[ 30522, 3853, 22278, 5643, 18933, 2099, 1006, 1007, 1063, 9530, 3367, 4773, 6499, 19869, 2102, 1027, 2023, 1031, 6448, 15878, 6499, 19869, 2102, 1033, 1025, 2023, 1012, 6366, 9863, 24454, 1006, 1005, 7561, 1005, 1010, 22278, 5643, 18933, 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...
lovell/sharp
lib/operation.js
convolve
function convolve (kernel) { if (!is.object(kernel) || !Array.isArray(kernel.kernel) || !is.integer(kernel.width) || !is.integer(kernel.height) || !is.inRange(kernel.width, 3, 1001) || !is.inRange(kernel.height, 3, 1001) || kernel.height * kernel.width !== kernel.kernel.length ) { // must pass in a kernel throw new Error('Invalid convolution kernel'); } // Default scale is sum of kernel values if (!is.integer(kernel.scale)) { kernel.scale = kernel.kernel.reduce(function (a, b) { return a + b; }, 0); } // Clip scale to a minimum value of 1 if (kernel.scale < 1) { kernel.scale = 1; } if (!is.integer(kernel.offset)) { kernel.offset = 0; } this.options.convKernel = kernel; return this; }
javascript
function convolve (kernel) { if (!is.object(kernel) || !Array.isArray(kernel.kernel) || !is.integer(kernel.width) || !is.integer(kernel.height) || !is.inRange(kernel.width, 3, 1001) || !is.inRange(kernel.height, 3, 1001) || kernel.height * kernel.width !== kernel.kernel.length ) { // must pass in a kernel throw new Error('Invalid convolution kernel'); } // Default scale is sum of kernel values if (!is.integer(kernel.scale)) { kernel.scale = kernel.kernel.reduce(function (a, b) { return a + b; }, 0); } // Clip scale to a minimum value of 1 if (kernel.scale < 1) { kernel.scale = 1; } if (!is.integer(kernel.offset)) { kernel.offset = 0; } this.options.convKernel = kernel; return this; }
[ "function", "convolve", "(", "kernel", ")", "{", "if", "(", "!", "is", ".", "object", "(", "kernel", ")", "||", "!", "Array", ".", "isArray", "(", "kernel", ".", "kernel", ")", "||", "!", "is", ".", "integer", "(", "kernel", ".", "width", ")", "|...
Convolve the image with the specified kernel. @example sharp(input) .convolve({ width: 3, height: 3, kernel: [-1, 0, 1, -2, 0, 2, -1, 0, 1] }) .raw() .toBuffer(function(err, data, info) { // data contains the raw pixel data representing the convolution // of the input image with the horizontal Sobel operator }); @param {Object} kernel @param {Number} kernel.width - width of the kernel in pixels. @param {Number} kernel.height - width of the kernel in pixels. @param {Array<Number>} kernel.kernel - Array of length `width*height` containing the kernel values. @param {Number} [kernel.scale=sum] - the scale of the kernel in pixels. @param {Number} [kernel.offset=0] - the offset of the kernel in pixels. @returns {Sharp} @throws {Error} Invalid parameters
[ "Convolve", "the", "image", "with", "the", "specified", "kernel", "." ]
05d76eeadfe54713606a615185b2da047923406b
https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/operation.js#L275-L299
train
Convolve the kernel
[ 30522, 3853, 9530, 6767, 2140, 3726, 1006, 16293, 1007, 1063, 2065, 1006, 999, 2003, 1012, 4874, 1006, 16293, 1007, 1064, 1064, 999, 9140, 1012, 18061, 11335, 2100, 1006, 16293, 1012, 16293, 1007, 1064, 1064, 999, 2003, 1012, 16109, 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...
LLK/scratch-blocks
core/connection_db.js
checkConnection_
function checkConnection_(yIndex) { var dx = currentX - db[yIndex].x_; var dy = currentY - db[yIndex].y_; var r = Math.sqrt(dx * dx + dy * dy); if (r <= maxRadius) { neighbours.push(db[yIndex]); } return dy < maxRadius; }
javascript
function checkConnection_(yIndex) { var dx = currentX - db[yIndex].x_; var dy = currentY - db[yIndex].y_; var r = Math.sqrt(dx * dx + dy * dy); if (r <= maxRadius) { neighbours.push(db[yIndex]); } return dy < maxRadius; }
[ "function", "checkConnection_", "(", "yIndex", ")", "{", "var", "dx", "=", "currentX", "-", "db", "[", "yIndex", "]", ".", "x_", ";", "var", "dy", "=", "currentY", "-", "db", "[", "yIndex", "]", ".", "y_", ";", "var", "r", "=", "Math", ".", "sqrt...
Computes if the current connection is within the allowed radius of another connection. This function is a closure and has access to outside variables. @param {number} yIndex The other connection's index in the database. @return {boolean} True if the current connection's vertical distance from the other connection is less than the allowed radius.
[ "Computes", "if", "the", "current", "connection", "is", "within", "the", "allowed", "radius", "of", "another", "connection", ".", "This", "function", "is", "a", "closure", "and", "has", "access", "to", "outside", "variables", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/core/connection_db.js#L185-L193
train
check connection
[ 30522, 3853, 4638, 8663, 2638, 7542, 1035, 1006, 18208, 3207, 2595, 1007, 1063, 13075, 1040, 2595, 1027, 2783, 2595, 1011, 16962, 1031, 18208, 3207, 2595, 1033, 1012, 1060, 1035, 1025, 13075, 1040, 2100, 1027, 2783, 2100, 1011, 16962, 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/slider/slider.js
keydownListener
function keydownListener(ev) { if (isDisabled()) return; var keyCodes = $mdConstant.KEY_CODE; var changeAmount; switch (ev.keyCode) { case keyCodes.DOWN_ARROW: case keyCodes.LEFT_ARROW: ev.preventDefault(); changeAmount = -step; break; case keyCodes.UP_ARROW: case keyCodes.RIGHT_ARROW: ev.preventDefault(); changeAmount = step; break; case keyCodes.PAGE_DOWN: ev.preventDefault(); changeAmount = -step * stepPageSize; break; case keyCodes.PAGE_UP: ev.preventDefault(); changeAmount = step * stepPageSize; break; case keyCodes.HOME: ev.preventDefault(); ev.stopPropagation(); updateValue(min); break; case keyCodes.END: ev.preventDefault(); ev.stopPropagation(); updateValue(max); break; } if (changeAmount) { changeAmount = invert ? -changeAmount : changeAmount; if (ev.metaKey || ev.ctrlKey || ev.altKey) { changeAmount *= modifierMultiplier; } ev.preventDefault(); ev.stopPropagation(); updateValue(ngModelCtrl.$viewValue + changeAmount); } }
javascript
function keydownListener(ev) { if (isDisabled()) return; var keyCodes = $mdConstant.KEY_CODE; var changeAmount; switch (ev.keyCode) { case keyCodes.DOWN_ARROW: case keyCodes.LEFT_ARROW: ev.preventDefault(); changeAmount = -step; break; case keyCodes.UP_ARROW: case keyCodes.RIGHT_ARROW: ev.preventDefault(); changeAmount = step; break; case keyCodes.PAGE_DOWN: ev.preventDefault(); changeAmount = -step * stepPageSize; break; case keyCodes.PAGE_UP: ev.preventDefault(); changeAmount = step * stepPageSize; break; case keyCodes.HOME: ev.preventDefault(); ev.stopPropagation(); updateValue(min); break; case keyCodes.END: ev.preventDefault(); ev.stopPropagation(); updateValue(max); break; } if (changeAmount) { changeAmount = invert ? -changeAmount : changeAmount; if (ev.metaKey || ev.ctrlKey || ev.altKey) { changeAmount *= modifierMultiplier; } ev.preventDefault(); ev.stopPropagation(); updateValue(ngModelCtrl.$viewValue + changeAmount); } }
[ "function", "keydownListener", "(", "ev", ")", "{", "if", "(", "isDisabled", "(", ")", ")", "return", ";", "var", "keyCodes", "=", "$mdConstant", ".", "KEY_CODE", ";", "var", "changeAmount", ";", "switch", "(", "ev", ".", "keyCode", ")", "{", "case", "...
left/right/up/down arrow listener @param {!KeyboardEvent} ev
[ "left", "/", "right", "/", "up", "/", "down", "arrow", "listener" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/slider/slider.js#L406-L450
train
The keydown listener for the keydown event.
[ 30522, 3853, 3145, 7698, 9863, 24454, 1006, 23408, 1007, 1063, 2065, 1006, 2003, 10521, 3085, 2094, 1006, 1007, 1007, 2709, 1025, 13075, 3145, 23237, 1027, 1002, 9108, 8663, 12693, 2102, 1012, 3145, 1035, 3642, 1025, 13075, 2689, 22591, 166...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/http/index.js
sendRequest
function sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries) { var hostname = options.hostname; var port = options.port; if (opt_proxy) { let proxy = /** @type {RequestOptions} */(opt_proxy); // RFC 2616, section 5.1.2: // The absoluteURI form is REQUIRED when the request is being made to a // proxy. let absoluteUri = url.format(options); // RFC 2616, section 14.23: // An HTTP/1.1 proxy MUST ensure that any request message it forwards does // contain an appropriate Host header field that identifies the service // being requested by the proxy. let targetHost = options.hostname; if (options.port) { targetHost += ':' + options.port; } // Update the request options with our proxy info. options.headers['Host'] = targetHost; options.path = absoluteUri; options.host = proxy.host; options.hostname = proxy.hostname; options.port = proxy.port; if (proxy.auth) { options.headers['Proxy-Authorization'] = 'Basic ' + new Buffer(proxy.auth).toString('base64'); } } let requestFn = options.protocol === 'https:' ? https.request : http.request; var request = requestFn(options, function onResponse(response) { if (response.statusCode == 302 || response.statusCode == 303) { try { var location = url.parse(response.headers['location']); } catch (ex) { onError(Error( 'Failed to parse "Location" header for server redirect: ' + ex.message + '\nResponse was: \n' + new httpLib.Response(response.statusCode, response.headers, ''))); return; } if (!location.hostname) { location.hostname = hostname; location.port = port; } request.abort(); sendRequest({ method: 'GET', protocol: location.protocol || options.protocol, hostname: location.hostname, port: location.port, path: location.path, pathname: location.pathname, search: location.search, hash: location.hash, headers: { 'Accept': 'application/json; charset=utf-8', 'User-Agent': USER_AGENT, } }, onOk, onError, undefined, opt_proxy); return; } var body = []; response.on('data', body.push.bind(body)); response.on('end', function() { var resp = new httpLib.Response( /** @type {number} */(response.statusCode), /** @type {!Object<string>} */(response.headers), body.join('').replace(/\0/g, '')); onOk(resp); }); }); request.on('error', function(e) { if (typeof opt_retries === 'undefined') { opt_retries = 0; } if (shouldRetryRequest(opt_retries, e)) { opt_retries += 1; setTimeout(function() { sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries); }, 15); } else { var message = e.message; if (e.code) { message = e.code + ' ' + message; } onError(new Error(message)); } }); if (opt_data) { request.write(opt_data); } request.end(); }
javascript
function sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries) { var hostname = options.hostname; var port = options.port; if (opt_proxy) { let proxy = /** @type {RequestOptions} */(opt_proxy); // RFC 2616, section 5.1.2: // The absoluteURI form is REQUIRED when the request is being made to a // proxy. let absoluteUri = url.format(options); // RFC 2616, section 14.23: // An HTTP/1.1 proxy MUST ensure that any request message it forwards does // contain an appropriate Host header field that identifies the service // being requested by the proxy. let targetHost = options.hostname; if (options.port) { targetHost += ':' + options.port; } // Update the request options with our proxy info. options.headers['Host'] = targetHost; options.path = absoluteUri; options.host = proxy.host; options.hostname = proxy.hostname; options.port = proxy.port; if (proxy.auth) { options.headers['Proxy-Authorization'] = 'Basic ' + new Buffer(proxy.auth).toString('base64'); } } let requestFn = options.protocol === 'https:' ? https.request : http.request; var request = requestFn(options, function onResponse(response) { if (response.statusCode == 302 || response.statusCode == 303) { try { var location = url.parse(response.headers['location']); } catch (ex) { onError(Error( 'Failed to parse "Location" header for server redirect: ' + ex.message + '\nResponse was: \n' + new httpLib.Response(response.statusCode, response.headers, ''))); return; } if (!location.hostname) { location.hostname = hostname; location.port = port; } request.abort(); sendRequest({ method: 'GET', protocol: location.protocol || options.protocol, hostname: location.hostname, port: location.port, path: location.path, pathname: location.pathname, search: location.search, hash: location.hash, headers: { 'Accept': 'application/json; charset=utf-8', 'User-Agent': USER_AGENT, } }, onOk, onError, undefined, opt_proxy); return; } var body = []; response.on('data', body.push.bind(body)); response.on('end', function() { var resp = new httpLib.Response( /** @type {number} */(response.statusCode), /** @type {!Object<string>} */(response.headers), body.join('').replace(/\0/g, '')); onOk(resp); }); }); request.on('error', function(e) { if (typeof opt_retries === 'undefined') { opt_retries = 0; } if (shouldRetryRequest(opt_retries, e)) { opt_retries += 1; setTimeout(function() { sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries); }, 15); } else { var message = e.message; if (e.code) { message = e.code + ' ' + message; } onError(new Error(message)); } }); if (opt_data) { request.write(opt_data); } request.end(); }
[ "function", "sendRequest", "(", "options", ",", "onOk", ",", "onError", ",", "opt_data", ",", "opt_proxy", ",", "opt_retries", ")", "{", "var", "hostname", "=", "options", ".", "hostname", ";", "var", "port", "=", "options", ".", "port", ";", "if", "(", ...
Sends a single HTTP request. @param {!Object} options The request options. @param {function(!httpLib.Response)} onOk The function to call if the request succeeds. @param {function(!Error)} onError The function to call if the request fails. @param {?string=} opt_data The data to send with the request. @param {?RequestOptions=} opt_proxy The proxy server to use for the request. @param {number=} opt_retries The current number of retries.
[ "Sends", "a", "single", "HTTP", "request", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/http/index.js#L162-L267
train
Sends a request to the service using the specified options.
[ 30522, 3853, 4604, 2890, 15500, 1006, 7047, 1010, 21058, 2243, 1010, 2028, 18933, 2099, 1010, 23569, 1035, 2951, 1010, 23569, 1035, 24540, 1010, 23569, 1035, 2128, 21011, 1007, 1063, 13075, 3677, 18442, 1027, 7047, 1012, 3677, 18442, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js
walk
function walk(node) { if (node.tag) { var attrText = " data-brackets-id='" + node.tagID + "'"; // If the dom was fully rebuilt, use its offsets. Otherwise, use the marks in the // associated editor, since they'll be more up to date. var startOffset; if (dom.fullBuild) { startOffset = node.start; } else { var mark = markCache[node.tagID]; if (mark) { startOffset = editor._codeMirror.indexFromPos(mark.range.from); } else { console.warn("generateInstrumentedHTML(): couldn't find existing mark for tagID " + node.tagID); startOffset = node.start; } } // Insert the attribute as the first attribute in the tag. var insertIndex = startOffset + node.tag.length + 1; gen += orig.substr(lastIndex, insertIndex - lastIndex) + attrText; lastIndex = insertIndex; // If we have a script to inject and this is the head tag, inject it immediately // after the open tag. if (remoteScript && !remoteScriptInserted && node.tag === "head") { insertIndex = node.openEnd; gen += orig.substr(lastIndex, insertIndex - lastIndex) + remoteScript; lastIndex = insertIndex; remoteScriptInserted = true; } } if (node.isElement()) { node.children.forEach(walk); } }
javascript
function walk(node) { if (node.tag) { var attrText = " data-brackets-id='" + node.tagID + "'"; // If the dom was fully rebuilt, use its offsets. Otherwise, use the marks in the // associated editor, since they'll be more up to date. var startOffset; if (dom.fullBuild) { startOffset = node.start; } else { var mark = markCache[node.tagID]; if (mark) { startOffset = editor._codeMirror.indexFromPos(mark.range.from); } else { console.warn("generateInstrumentedHTML(): couldn't find existing mark for tagID " + node.tagID); startOffset = node.start; } } // Insert the attribute as the first attribute in the tag. var insertIndex = startOffset + node.tag.length + 1; gen += orig.substr(lastIndex, insertIndex - lastIndex) + attrText; lastIndex = insertIndex; // If we have a script to inject and this is the head tag, inject it immediately // after the open tag. if (remoteScript && !remoteScriptInserted && node.tag === "head") { insertIndex = node.openEnd; gen += orig.substr(lastIndex, insertIndex - lastIndex) + remoteScript; lastIndex = insertIndex; remoteScriptInserted = true; } } if (node.isElement()) { node.children.forEach(walk); } }
[ "function", "walk", "(", "node", ")", "{", "if", "(", "node", ".", "tag", ")", "{", "var", "attrText", "=", "\" data-brackets-id='\"", "+", "node", ".", "tagID", "+", "\"'\"", ";", "// If the dom was fully rebuilt, use its offsets. Otherwise, use the marks in the", ...
Walk through the dom nodes and insert the 'data-brackets-id' attribute at the end of the open tag
[ "Walk", "through", "the", "dom", "nodes", "and", "insert", "the", "data", "-", "brackets", "-", "id", "attribute", "at", "the", "end", "of", "the", "open", "tag" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js#L762-L799
train
Walk through the nodes and insert them into the generated HTML.
[ 30522, 3853, 3328, 1006, 13045, 1007, 1063, 2065, 1006, 13045, 1012, 6415, 1007, 1063, 13075, 2012, 16344, 18209, 1027, 1000, 2951, 1011, 19719, 1011, 8909, 1027, 1005, 1000, 1009, 13045, 1012, 6415, 3593, 1009, 1000, 1005, 1000, 1025, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
airyland/vux
build/build-docs.js
camelCase
function camelCase(input) { let str = input.toLowerCase().replace(/-(.)/g, function (match, group1) { return group1.toUpperCase(); }); str = str.replace(/_(.)/g, function (match, group1) { return group1.toUpperCase(); }); return str }
javascript
function camelCase(input) { let str = input.toLowerCase().replace(/-(.)/g, function (match, group1) { return group1.toUpperCase(); }); str = str.replace(/_(.)/g, function (match, group1) { return group1.toUpperCase(); }); return str }
[ "function", "camelCase", "(", "input", ")", "{", "let", "str", "=", "input", ".", "toLowerCase", "(", ")", ".", "replace", "(", "/", "-(.)", "/", "g", ",", "function", "(", "match", ",", "group1", ")", "{", "return", "group1", ".", "toUpperCase", "("...
function transform (object, name) { let rs = { en: {}, 'zh-CN': {} } for(let i in object) { rs['en'][`vux.${name}.${i}`] = object[i]['en'] rs['zh-CN'][`vux.${name}.${i}`] = object[i]['zh-CN'] } return rs }
[ "function", "transform", "(", "object", "name", ")", "{", "let", "rs", "=", "{", "en", ":", "{}", "zh", "-", "CN", ":", "{}", "}", "for", "(", "let", "i", "in", "object", ")", "{", "rs", "[", "en", "]", "[", "vux", ".", "$", "{", "name", "}...
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/build/build-docs.js#L644-L653
train
Convert a string to camelCase
[ 30522, 3853, 19130, 18382, 1006, 7953, 1007, 1063, 2292, 2358, 2099, 1027, 7953, 1012, 2000, 27663, 18992, 3366, 1006, 1007, 1012, 5672, 1006, 1013, 1011, 1006, 1012, 1007, 1013, 1043, 1010, 3853, 1006, 2674, 1010, 2177, 2487, 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...
PrismJS/prism
scripts/utopia.js
function(element) { var left = 0, top = 0, el = element; if (el.parentNode) { do { left += el.offsetLeft; top += el.offsetTop; } while ((el = el.offsetParent) && el.nodeType < 9); el = element; do { left -= el.scrollLeft; top -= el.scrollTop; } while ((el = el.parentNode) && !/body/i.test(el.nodeName)); } return { top: top, right: innerWidth - left - element.offsetWidth, bottom: innerHeight - top - element.offsetHeight, left: left, }; }
javascript
function(element) { var left = 0, top = 0, el = element; if (el.parentNode) { do { left += el.offsetLeft; top += el.offsetTop; } while ((el = el.offsetParent) && el.nodeType < 9); el = element; do { left -= el.scrollLeft; top -= el.scrollTop; } while ((el = el.parentNode) && !/body/i.test(el.nodeName)); } return { top: top, right: innerWidth - left - element.offsetWidth, bottom: innerHeight - top - element.offsetHeight, left: left, }; }
[ "function", "(", "element", ")", "{", "var", "left", "=", "0", ",", "top", "=", "0", ",", "el", "=", "element", ";", "if", "(", "el", ".", "parentNode", ")", "{", "do", "{", "left", "+=", "el", ".", "offsetLeft", ";", "top", "+=", "el", ".", ...
Returns the absolute X, Y offsets for an element
[ "Returns", "the", "absolute", "X", "Y", "offsets", "for", "an", "element" ]
acceb3b56f0e8362a7ef274dbd85b17611df2ec4
https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/scripts/utopia.js#L420-L443
train
Returns the position of an element in the DOM.
[ 30522, 3853, 1006, 5783, 1007, 1063, 13075, 2187, 1027, 1014, 1010, 2327, 1027, 1014, 1010, 3449, 1027, 5783, 1025, 2065, 1006, 3449, 1012, 6687, 3630, 3207, 1007, 1063, 2079, 1063, 2187, 1009, 1027, 3449, 30524, 1025, 2079, 1063, 2187, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js
function(oEvent) { var $Body = jQuery(document.body), $Document = jQuery(document), $This = this.$(), $Ghost = this.$("ghost"), iLocationY = ExtensionHelper._getEventPosition(oEvent, this).y; var iNewHeight = iLocationY - $This.find(".sapUiTableCCnt").offset().top - $Ghost.height() - $This.find(".sapUiTableFtr").height(); // TBD: Move this to the table code this._updateRows(this._calculateRowsToDisplay(iNewHeight), TableUtils.RowsUpdateReason.Resize); this._setRowContentHeight(iNewHeight); $Ghost.remove(); this.$("rzoverlay").remove(); $Body.unbind("selectstart", InteractiveResizeHelper.onSelectStartWhileInteractiveResizing); $Document.unbind("touchend.sapUiTableInteractiveResize"); $Document.unbind("touchmove.sapUiTableInteractiveResize"); $Document.unbind("mouseup.sapUiTableInteractiveResize"); $Document.unbind("mousemove.sapUiTableInteractiveResize"); this._enableTextSelection(); }
javascript
function(oEvent) { var $Body = jQuery(document.body), $Document = jQuery(document), $This = this.$(), $Ghost = this.$("ghost"), iLocationY = ExtensionHelper._getEventPosition(oEvent, this).y; var iNewHeight = iLocationY - $This.find(".sapUiTableCCnt").offset().top - $Ghost.height() - $This.find(".sapUiTableFtr").height(); // TBD: Move this to the table code this._updateRows(this._calculateRowsToDisplay(iNewHeight), TableUtils.RowsUpdateReason.Resize); this._setRowContentHeight(iNewHeight); $Ghost.remove(); this.$("rzoverlay").remove(); $Body.unbind("selectstart", InteractiveResizeHelper.onSelectStartWhileInteractiveResizing); $Document.unbind("touchend.sapUiTableInteractiveResize"); $Document.unbind("touchmove.sapUiTableInteractiveResize"); $Document.unbind("mouseup.sapUiTableInteractiveResize"); $Document.unbind("mousemove.sapUiTableInteractiveResize"); this._enableTextSelection(); }
[ "function", "(", "oEvent", ")", "{", "var", "$Body", "=", "jQuery", "(", "document", ".", "body", ")", ",", "$Document", "=", "jQuery", "(", "document", ")", ",", "$This", "=", "this", ".", "$", "(", ")", ",", "$Ghost", "=", "this", ".", "$", "("...
/* Drops the previous dragged horizontal splitter bar and recalculates the amount of rows to be displayed.
[ "/", "*", "Drops", "the", "previous", "dragged", "horizontal", "splitter", "bar", "and", "recalculates", "the", "amount", "of", "rows", "to", "be", "displayed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L399-L422
train
Resize the table
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 13075, 1002, 2303, 1027, 1046, 4226, 2854, 1006, 6254, 1012, 2303, 1007, 1010, 1002, 6254, 1027, 1046, 4226, 2854, 1006, 6254, 1007, 1010, 1002, 2023, 1027, 2023, 1012, 1002, 1006, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...