repo stringclasses 192 values | path stringlengths 4 115 | func_name stringlengths 0 45 | original_string stringlengths 74 24k | language stringclasses 1 value | code stringlengths 74 24k | code_tokens listlengths 23 4.2k | docstring stringlengths 2 23.7k | docstring_tokens listlengths 1 810 | sha stringclasses 192 values | url stringlengths 90 200 | partition stringclasses 1 value | summary stringlengths 6 313 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NetEase/pomelo | template/web-server/public/js/lib/pomeloclient.js | processCall | function processCall(msg) {
var route = msg.route;
if(!!route) {
if (!!msg.body) {
var body = msg.body.body;
if (!body) {body = msg.body;}
pomelo.emit(route, body);
} else {
pomelo.emit(route,msg);
}
} else {
pomelo.emit(msg.body.route,msg.body);
}
} | javascript | function processCall(msg) {
var route = msg.route;
if(!!route) {
if (!!msg.body) {
var body = msg.body.body;
if (!body) {body = msg.body;}
pomelo.emit(route, body);
} else {
pomelo.emit(route,msg);
}
} else {
pomelo.emit(msg.body.route,msg.body);
}
} | [
"function",
"processCall",
"(",
"msg",
")",
"{",
"var",
"route",
"=",
"msg",
".",
"route",
";",
"if",
"(",
"!",
"!",
"route",
")",
"{",
"if",
"(",
"!",
"!",
"msg",
".",
"body",
")",
"{",
"var",
"body",
"=",
"msg",
".",
"body",
".",
"body",
";... | if no id then it should be a server push message | [
"if",
"no",
"id",
"then",
"it",
"should",
"be",
"a",
"server",
"push",
"message"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/template/web-server/public/js/lib/pomeloclient.js#L424-L437 | train | Process call | [
30522,
3853,
2832,
9289,
2140,
1006,
5796,
2290,
1007,
1063,
13075,
2799,
1027,
5796,
2290,
1012,
2799,
1025,
2065,
1006,
999,
999,
2799,
1007,
1063,
2065,
1006,
999,
999,
5796,
2290,
1012,
2303,
1007,
1063,
13075,
2303,
1027,
5796,
2290,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | src/platforms/weex/framework.js | createVueModuleInstance | function createVueModuleInstance (instanceId, moduleGetter) {
const exports = {}
VueFactory(exports, renderer)
const Vue = exports.Vue
const instance = instances[instanceId]
// patch reserved tag detection to account for dynamically registered
// components
const isReservedTag = Vue.config.isReservedTag || (() => false)
Vue.config.isReservedTag = name => {
return components[name] || isReservedTag(name)
}
// expose weex-specific info
Vue.prototype.$instanceId = instanceId
Vue.prototype.$document = instance.document
// expose weex native module getter on subVue prototype so that
// vdom runtime modules can access native modules via vnode.context
Vue.prototype.$requireWeexModule = moduleGetter
// Hack `Vue` behavior to handle instance information and data
// before root component created.
Vue.mixin({
beforeCreate () {
const options = this.$options
// root component (vm)
if (options.el) {
// set external data of instance
const dataOption = options.data
const internalData = (typeof dataOption === 'function' ? dataOption() : dataOption) || {}
options.data = Object.assign(internalData, instance.data)
// record instance by id
instance.app = this
}
}
})
/**
* @deprecated Just instance variable `weex.config`
* Get instance config.
* @return {object}
*/
Vue.prototype.$getConfig = function () {
if (instance.app instanceof Vue) {
return instance.config
}
}
return Vue
} | javascript | function createVueModuleInstance (instanceId, moduleGetter) {
const exports = {}
VueFactory(exports, renderer)
const Vue = exports.Vue
const instance = instances[instanceId]
// patch reserved tag detection to account for dynamically registered
// components
const isReservedTag = Vue.config.isReservedTag || (() => false)
Vue.config.isReservedTag = name => {
return components[name] || isReservedTag(name)
}
// expose weex-specific info
Vue.prototype.$instanceId = instanceId
Vue.prototype.$document = instance.document
// expose weex native module getter on subVue prototype so that
// vdom runtime modules can access native modules via vnode.context
Vue.prototype.$requireWeexModule = moduleGetter
// Hack `Vue` behavior to handle instance information and data
// before root component created.
Vue.mixin({
beforeCreate () {
const options = this.$options
// root component (vm)
if (options.el) {
// set external data of instance
const dataOption = options.data
const internalData = (typeof dataOption === 'function' ? dataOption() : dataOption) || {}
options.data = Object.assign(internalData, instance.data)
// record instance by id
instance.app = this
}
}
})
/**
* @deprecated Just instance variable `weex.config`
* Get instance config.
* @return {object}
*/
Vue.prototype.$getConfig = function () {
if (instance.app instanceof Vue) {
return instance.config
}
}
return Vue
} | [
"function",
"createVueModuleInstance",
"(",
"instanceId",
",",
"moduleGetter",
")",
"{",
"const",
"exports",
"=",
"{",
"}",
"VueFactory",
"(",
"exports",
",",
"renderer",
")",
"const",
"Vue",
"=",
"exports",
".",
"Vue",
"const",
"instance",
"=",
"instances",
... | Create a fresh instance of Vue for each Weex instance. | [
"Create",
"a",
"fresh",
"instance",
"of",
"Vue",
"for",
"each",
"Weex",
"instance",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/src/platforms/weex/framework.js#L234-L285 | train | Create a new instance of a Vue module. | [
30522,
3853,
3443,
19722,
6633,
7716,
9307,
7076,
26897,
1006,
6013,
3593,
1010,
11336,
18150,
3334,
1007,
1063,
9530,
3367,
14338,
1027,
1063,
1065,
24728,
12879,
18908,
10253,
1006,
14338,
1010,
17552,
2121,
1007,
9530,
3367,
24728,
2063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-regex-spaces.js | checkRegex | function checkRegex(node, value, valueStart) {
const multipleSpacesRegex = /( {2,})( [+*{?]|[^+*{?]|$)/u,
regexResults = multipleSpacesRegex.exec(value);
if (regexResults !== null) {
const count = regexResults[1].length;
context.report({
node,
message: "Spaces are hard to count. Use {{{count}}}.",
data: { count },
fix(fixer) {
return fixer.replaceTextRange(
[valueStart + regexResults.index, valueStart + regexResults.index + count],
` {${count}}`
);
}
});
/*
* TODO: (platinumazure) Fix message to use rule message
* substitution when api.report is fixed in lib/eslint.js.
*/
}
} | javascript | function checkRegex(node, value, valueStart) {
const multipleSpacesRegex = /( {2,})( [+*{?]|[^+*{?]|$)/u,
regexResults = multipleSpacesRegex.exec(value);
if (regexResults !== null) {
const count = regexResults[1].length;
context.report({
node,
message: "Spaces are hard to count. Use {{{count}}}.",
data: { count },
fix(fixer) {
return fixer.replaceTextRange(
[valueStart + regexResults.index, valueStart + regexResults.index + count],
` {${count}}`
);
}
});
/*
* TODO: (platinumazure) Fix message to use rule message
* substitution when api.report is fixed in lib/eslint.js.
*/
}
} | [
"function",
"checkRegex",
"(",
"node",
",",
"value",
",",
"valueStart",
")",
"{",
"const",
"multipleSpacesRegex",
"=",
"/",
"( {2,})( [+*{?]|[^+*{?]|$)",
"/",
"u",
",",
"regexResults",
"=",
"multipleSpacesRegex",
".",
"exec",
"(",
"value",
")",
";",
"if",
"(",... | Validate regular expressions
@param {ASTNode} node node to validate
@param {string} value regular expression to validate
@param {number} valueStart The start location of the regex/string literal. It will always be the case that
`sourceCode.getText().slice(valueStart, valueStart + value.length) === value`
@returns {void}
@private | [
"Validate",
"regular",
"expressions"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-regex-spaces.js#L41-L65 | train | Check if the value is a multiple spaces | [
30522,
3853,
4638,
2890,
3351,
2595,
1006,
13045,
1010,
3643,
1010,
5300,
7559,
2102,
1007,
1063,
9530,
3367,
3674,
23058,
21338,
24746,
2595,
1027,
1013,
1006,
1063,
1016,
1010,
1065,
1007,
1006,
1031,
1009,
1008,
1063,
1029,
1033,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/panel/panel.js | MdPanelPosition | function MdPanelPosition($injector) {
/** @private @const {!angular.$window} */
this._$window = $injector.get('$window');
/** @private {boolean} */
this._isRTL = $injector.get('$mdUtil').bidi() === 'rtl';
/** @private @const {!angular.$mdConstant} */
this._$mdConstant = $injector.get('$mdConstant');
/** @private {boolean} */
this._absolute = false;
/** @private {!angular.JQLite} */
this._relativeToEl;
/** @private {string} */
this._top = '';
/** @private {string} */
this._bottom = '';
/** @private {string} */
this._left = '';
/** @private {string} */
this._right = '';
/** @private {!Array<string>} */
this._translateX = [];
/** @private {!Array<string>} */
this._translateY = [];
/** @private {!Array<{x:string, y:string}>} */
this._positions = [];
/** @private {?{x:string, y:string}} */
this._actualPosition;
} | javascript | function MdPanelPosition($injector) {
/** @private @const {!angular.$window} */
this._$window = $injector.get('$window');
/** @private {boolean} */
this._isRTL = $injector.get('$mdUtil').bidi() === 'rtl';
/** @private @const {!angular.$mdConstant} */
this._$mdConstant = $injector.get('$mdConstant');
/** @private {boolean} */
this._absolute = false;
/** @private {!angular.JQLite} */
this._relativeToEl;
/** @private {string} */
this._top = '';
/** @private {string} */
this._bottom = '';
/** @private {string} */
this._left = '';
/** @private {string} */
this._right = '';
/** @private {!Array<string>} */
this._translateX = [];
/** @private {!Array<string>} */
this._translateY = [];
/** @private {!Array<{x:string, y:string}>} */
this._positions = [];
/** @private {?{x:string, y:string}} */
this._actualPosition;
} | [
"function",
"MdPanelPosition",
"(",
"$injector",
")",
"{",
"/** @private @const {!angular.$window} */",
"this",
".",
"_$window",
"=",
"$injector",
".",
"get",
"(",
"'$window'",
")",
";",
"/** @private {boolean} */",
"this",
".",
"_isRTL",
"=",
"$injector",
".",
"get... | ***************************************************************************
MdPanelPosition *
***************************************************************************
Position configuration object. To use, create an MdPanelPosition with the
desired properties, then pass the object as part of $mdPanel creation.
Example:
var panelPosition = new MdPanelPosition()
.relativeTo(myButtonEl)
.addPanelPosition(
$mdPanel.xPosition.CENTER,
$mdPanel.yPosition.ALIGN_TOPS
);
$mdPanel.create({
position: panelPosition
});
@param {!angular.$injector} $injector
@final @constructor | [
"***************************************************************************",
"MdPanelPosition",
"*",
"***************************************************************************",
"Position",
"configuration",
"object",
".",
"To",
"use",
"create",
"an",
"MdPanelPosition",
"with",
"the",... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/panel/panel.js#L2539-L2578 | train | The position of the panel. | [
30522,
3853,
9108,
9739,
2884,
26994,
1006,
1002,
1999,
20614,
2953,
1007,
1063,
1013,
1008,
1008,
1030,
2797,
1030,
9530,
3367,
1063,
999,
16108,
1012,
1002,
3332,
1065,
1008,
1013,
2023,
1012,
1035,
1002,
3332,
1027,
1002,
1999,
20614,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | showMenu | function showMenu() {
opts.parent.append(element);
element[0].style.display = '';
return $q(function(resolve) {
var position = calculateMenuPosition(element, opts);
element.removeClass('md-leave');
// Animate the menu scaling, and opacity [from its position origin (default == top-left)]
// to normal scale.
$animateCss(element, {
addClass: 'md-active',
from: animator.toCss(position),
to: animator.toCss({transform: ''})
})
.start()
.then(resolve);
});
} | javascript | function showMenu() {
opts.parent.append(element);
element[0].style.display = '';
return $q(function(resolve) {
var position = calculateMenuPosition(element, opts);
element.removeClass('md-leave');
// Animate the menu scaling, and opacity [from its position origin (default == top-left)]
// to normal scale.
$animateCss(element, {
addClass: 'md-active',
from: animator.toCss(position),
to: animator.toCss({transform: ''})
})
.start()
.then(resolve);
});
} | [
"function",
"showMenu",
"(",
")",
"{",
"opts",
".",
"parent",
".",
"append",
"(",
"element",
")",
";",
"element",
"[",
"0",
"]",
".",
"style",
".",
"display",
"=",
"''",
";",
"return",
"$q",
"(",
"function",
"(",
"resolve",
")",
"{",
"var",
"positi... | Place the menu into the DOM and call positioning related functions | [
"Place",
"the",
"menu",
"into",
"the",
"DOM",
"and",
"call",
"positioning",
"related",
"functions"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L149-L169 | train | Show the menu | [
30522,
3853,
2265,
3549,
2226,
1006,
1007,
1063,
23569,
2015,
1012,
6687,
1012,
10439,
10497,
1006,
5783,
1007,
1025,
5783,
1031,
1014,
1033,
1012,
2806,
1012,
4653,
1027,
1005,
1005,
1025,
2709,
1002,
1053,
1006,
3853,
1006,
10663,
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... |
angular/material | src/components/datepicker/js/calendarMonth.js | calendarDirective | function calendarDirective() {
return {
template:
'<table aria-hidden="true" class="md-calendar-day-header"><thead></thead></table>' +
'<div class="md-calendar-scroll-mask">' +
'<md-virtual-repeat-container class="md-calendar-scroll-container" ' +
'md-offset-size="' + (TBODY_SINGLE_ROW_HEIGHT - TBODY_HEIGHT) + '">' +
'<table role="grid" tabindex="0" class="md-calendar" aria-readonly="true">' +
'<tbody ' +
'md-calendar-month-body ' +
'role="rowgroup" ' +
'md-virtual-repeat="i in monthCtrl.items" ' +
'md-month-offset="$index" ' +
'class="md-calendar-month" ' +
'md-start-index="monthCtrl.getSelectedMonthIndex()" ' +
'md-item-size="' + TBODY_HEIGHT + '">' +
// The <tr> ensures that the <tbody> will always have the
// proper height, even if it's empty. If it's content is
// compiled, the <tr> will be overwritten.
'<tr aria-hidden="true" md-force-height="\'' + TBODY_HEIGHT + 'px\'"></tr>' +
'</tbody>' +
'</table>' +
'</md-virtual-repeat-container>' +
'</div>',
require: ['^^mdCalendar', 'mdCalendarMonth'],
controller: CalendarMonthCtrl,
controllerAs: 'monthCtrl',
bindToController: true,
link: function(scope, element, attrs, controllers) {
var calendarCtrl = controllers[0];
var monthCtrl = controllers[1];
monthCtrl.initialize(calendarCtrl);
}
};
} | javascript | function calendarDirective() {
return {
template:
'<table aria-hidden="true" class="md-calendar-day-header"><thead></thead></table>' +
'<div class="md-calendar-scroll-mask">' +
'<md-virtual-repeat-container class="md-calendar-scroll-container" ' +
'md-offset-size="' + (TBODY_SINGLE_ROW_HEIGHT - TBODY_HEIGHT) + '">' +
'<table role="grid" tabindex="0" class="md-calendar" aria-readonly="true">' +
'<tbody ' +
'md-calendar-month-body ' +
'role="rowgroup" ' +
'md-virtual-repeat="i in monthCtrl.items" ' +
'md-month-offset="$index" ' +
'class="md-calendar-month" ' +
'md-start-index="monthCtrl.getSelectedMonthIndex()" ' +
'md-item-size="' + TBODY_HEIGHT + '">' +
// The <tr> ensures that the <tbody> will always have the
// proper height, even if it's empty. If it's content is
// compiled, the <tr> will be overwritten.
'<tr aria-hidden="true" md-force-height="\'' + TBODY_HEIGHT + 'px\'"></tr>' +
'</tbody>' +
'</table>' +
'</md-virtual-repeat-container>' +
'</div>',
require: ['^^mdCalendar', 'mdCalendarMonth'],
controller: CalendarMonthCtrl,
controllerAs: 'monthCtrl',
bindToController: true,
link: function(scope, element, attrs, controllers) {
var calendarCtrl = controllers[0];
var monthCtrl = controllers[1];
monthCtrl.initialize(calendarCtrl);
}
};
} | [
"function",
"calendarDirective",
"(",
")",
"{",
"return",
"{",
"template",
":",
"'<table aria-hidden=\"true\" class=\"md-calendar-day-header\"><thead></thead></table>'",
"+",
"'<div class=\"md-calendar-scroll-mask\">'",
"+",
"'<md-virtual-repeat-container class=\"md-calendar-scroll-contain... | Private directive that represents a list of months inside the calendar. | [
"Private",
"directive",
"that",
"represents",
"a",
"list",
"of",
"months",
"inside",
"the",
"calendar",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarMonth.js#L20-L55 | train | A calendar directive that is used to generate the calendar calendar. | [
30522,
3853,
8094,
4305,
2890,
15277,
1006,
1007,
1063,
2709,
1063,
23561,
1024,
1005,
1026,
2795,
9342,
1011,
5023,
1027,
1000,
2995,
1000,
2465,
1027,
1000,
9108,
1011,
8094,
1011,
2154,
1011,
20346,
1000,
1028,
1026,
1996,
4215,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wuchangming/spy-debugger | buildin_modules/weinre/web/client/CSSStyleModel.js | function(propertyText, majorChange, userCallback)
{
function enabledCallback(style)
{
if (style)
WebInspector.cssModel._styleSheetChanged(style.id.styleSheetId, majorChange);
if (userCallback)
userCallback(style);
}
function callback(stylePayload)
{
if (stylePayload) {
this.text = propertyText;
var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
var newProperty = style.allProperties[this.index];
if (newProperty && this.disabled && !propertyText.match(/^\s*$/)) {
newProperty.setDisabled(false, enabledCallback);
return;
} else
WebInspector.cssModel._styleSheetChanged(style.id.styleSheetId, majorChange);
if (userCallback)
userCallback(style);
} else {
if (userCallback)
userCallback(null);
}
}
if (!this.ownerStyle)
throw "No ownerStyle for property";
// An index past all the properties adds a new property to the style.
InspectorBackend.setPropertyText(this.ownerStyle.id, this.index, propertyText, this.index < this.ownerStyle.pastLastSourcePropertyIndex(), callback.bind(this));
} | javascript | function(propertyText, majorChange, userCallback)
{
function enabledCallback(style)
{
if (style)
WebInspector.cssModel._styleSheetChanged(style.id.styleSheetId, majorChange);
if (userCallback)
userCallback(style);
}
function callback(stylePayload)
{
if (stylePayload) {
this.text = propertyText;
var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
var newProperty = style.allProperties[this.index];
if (newProperty && this.disabled && !propertyText.match(/^\s*$/)) {
newProperty.setDisabled(false, enabledCallback);
return;
} else
WebInspector.cssModel._styleSheetChanged(style.id.styleSheetId, majorChange);
if (userCallback)
userCallback(style);
} else {
if (userCallback)
userCallback(null);
}
}
if (!this.ownerStyle)
throw "No ownerStyle for property";
// An index past all the properties adds a new property to the style.
InspectorBackend.setPropertyText(this.ownerStyle.id, this.index, propertyText, this.index < this.ownerStyle.pastLastSourcePropertyIndex(), callback.bind(this));
} | [
"function",
"(",
"propertyText",
",",
"majorChange",
",",
"userCallback",
")",
"{",
"function",
"enabledCallback",
"(",
"style",
")",
"{",
"if",
"(",
"style",
")",
"WebInspector",
".",
"cssModel",
".",
"_styleSheetChanged",
"(",
"style",
".",
"id",
".",
"sty... | Replaces "propertyName: propertyValue [!important];" in the stylesheet by an arbitrary propertyText. | [
"Replaces",
"propertyName",
":",
"propertyValue",
"[",
"!important",
"]",
";",
"in",
"the",
"stylesheet",
"by",
"an",
"arbitrary",
"propertyText",
"."
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/CSSStyleModel.js#L457-L492 | train | Set the text of the property | [
30522,
3853,
1006,
3200,
18209,
1010,
2350,
22305,
2063,
1010,
5310,
9289,
20850,
8684,
1007,
1063,
3853,
9124,
9289,
20850,
8684,
1006,
2806,
1007,
1063,
2065,
1006,
2806,
1007,
4773,
7076,
5051,
16761,
1012,
20116,
25855,
9247,
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... | |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function (mPropertyBag) {
var sAppVersion = mPropertyBag.appVersion;
var bDeveloperMode = mPropertyBag.developerMode;
var sScenario = mPropertyBag.scenario;
var oValidAppVersions = {
creation: sAppVersion,
from: sAppVersion
};
if (this._isValidAppVersionToRequired(sAppVersion, bDeveloperMode, sScenario)) {
oValidAppVersions.to = sAppVersion;
}
return oValidAppVersions;
} | javascript | function (mPropertyBag) {
var sAppVersion = mPropertyBag.appVersion;
var bDeveloperMode = mPropertyBag.developerMode;
var sScenario = mPropertyBag.scenario;
var oValidAppVersions = {
creation: sAppVersion,
from: sAppVersion
};
if (this._isValidAppVersionToRequired(sAppVersion, bDeveloperMode, sScenario)) {
oValidAppVersions.to = sAppVersion;
}
return oValidAppVersions;
} | [
"function",
"(",
"mPropertyBag",
")",
"{",
"var",
"sAppVersion",
"=",
"mPropertyBag",
".",
"appVersion",
";",
"var",
"bDeveloperMode",
"=",
"mPropertyBag",
".",
"developerMode",
";",
"var",
"sScenario",
"=",
"mPropertyBag",
".",
"scenario",
";",
"var",
"oValidAp... | Generates a ValidAppVersions object for changes and variants; Depending on the parameters passed a 'to' field is included.
@param {map} mPropertyBag
@param {string} mPropertyBag.appVersion Version to be filled into the validAppVersions object fields
@param {boolean} mPropertyBag.developerMode Flag if the creation of the object takes place in the developer mode
@param {sap.ui.fl.Scenario} mPropertyBag.scenario Depending on the scenario a 'to' field must be filled
@returns {{creation: {string}, from: {string} [,to: {string}]}} | [
"Generates",
"a",
"ValidAppVersions",
"object",
"for",
"changes",
"and",
"variants",
";",
"Depending",
"on",
"the",
"parameters",
"passed",
"a",
"to",
"field",
"is",
"included",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1043-L1055 | train | Returns an object with the app version and the to property | [
30522,
3853,
1006,
6131,
18981,
15010,
16078,
1007,
1063,
13075,
20066,
2361,
27774,
1027,
6131,
18981,
15010,
16078,
1012,
10439,
27774,
1025,
13075,
1038,
24844,
18349,
4842,
5302,
3207,
1027,
6131,
18981,
15010,
16078,
1012,
9722,
5302,
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... | |
NervJS/taro | packages/taro/src/internal/_common.js | isHostObject | function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false
if (value != null && typeof value.toString !== 'function') {
try {
result = !!(value + '')
} catch (e) {}
}
return result
} | javascript | function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false
if (value != null && typeof value.toString !== 'function') {
try {
result = !!(value + '')
} catch (e) {}
}
return result
} | [
"function",
"isHostObject",
"(",
"value",
")",
"{",
"// Many host objects are `Object` objects that can coerce to strings",
"// despite having improperly defined `toString` methods.",
"var",
"result",
"=",
"false",
"if",
"(",
"value",
"!=",
"null",
"&&",
"typeof",
"value",
".... | Checks if `value` is a host object in IE < 9.
@private
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is a host object, else `false`. | [
"Checks",
"if",
"value",
"is",
"a",
"host",
"object",
"in",
"IE",
"<",
"9",
"."
] | 274e76d731d7f158141287e31cbd51f092d472c5 | https://github.com/NervJS/taro/blob/274e76d731d7f158141287e31cbd51f092d472c5/packages/taro/src/internal/_common.js#L76-L86 | train | Check if value is a host object | [
30522,
3853,
2003,
15006,
3406,
2497,
20614,
1006,
3643,
1007,
1063,
1013,
1013,
2116,
3677,
5200,
2024,
1036,
4874,
1036,
5200,
2008,
2064,
24873,
19170,
2000,
7817,
1013,
1013,
2750,
2383,
24156,
2135,
4225,
1036,
2000,
3367,
4892,
1036,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/sessionstore.js | aboutSessionRestore_getTabs | function aboutSessionRestore_getTabs(window) {
var tabs = [ ];
var tree = this.tabList.getNode();
// Add entries when they are tabs (no container)
var ii = window.listIndex + 1;
while (ii < tree.view.rowCount && !tree.view.isContainer(ii)) {
tabs.push({
index: tabs.length,
listIndex : ii,
restore: tree.view.getCellValue(ii, tree.columns.getColumnAt(0)),
title: tree.view.getCellText(ii, tree.columns.getColumnAt(2))
});
ii++;
}
return tabs;
} | javascript | function aboutSessionRestore_getTabs(window) {
var tabs = [ ];
var tree = this.tabList.getNode();
// Add entries when they are tabs (no container)
var ii = window.listIndex + 1;
while (ii < tree.view.rowCount && !tree.view.isContainer(ii)) {
tabs.push({
index: tabs.length,
listIndex : ii,
restore: tree.view.getCellValue(ii, tree.columns.getColumnAt(0)),
title: tree.view.getCellText(ii, tree.columns.getColumnAt(2))
});
ii++;
}
return tabs;
} | [
"function",
"aboutSessionRestore_getTabs",
"(",
"window",
")",
"{",
"var",
"tabs",
"=",
"[",
"]",
";",
"var",
"tree",
"=",
"this",
".",
"tabList",
".",
"getNode",
"(",
")",
";",
"// Add entries when they are tabs (no container)",
"var",
"ii",
"=",
"window",
".... | Get restorable tabs under the given window
@param {object} window
Window inside the tree
@returns List of tabs
@type {array of object} | [
"Get",
"restorable",
"tabs",
"under",
"the",
"given",
"window"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/sessionstore.js#L169-L186 | train | Get the tabs from the session restore table | [
30522,
3853,
2055,
8583,
10992,
28533,
5686,
1035,
2131,
2696,
5910,
1006,
3332,
1007,
1063,
13075,
21628,
2015,
1027,
1031,
1033,
1025,
13075,
3392,
1027,
2023,
1012,
21628,
9863,
1012,
2131,
3630,
3207,
1006,
1007,
1025,
1013,
1013,
5587,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | extras/noUiSlider/nouislider.js | fireEvent | function fireEvent ( eventName, handleNumber, tap ) {
Object.keys(scope_Events).forEach(function( targetEvent ) {
var eventType = targetEvent.split('.')[0];
if ( eventName === eventType ) {
scope_Events[targetEvent].forEach(function( callback ) {
callback.call(
// Use the slider public API as the scope ('this')
scope_Self,
// Return values as array, so arg_1[arg_2] is always valid.
scope_Values.map(options.format.to),
// Handle index, 0 or 1
handleNumber,
// Unformatted slider values
scope_Values.slice(),
// Event is fired by tap, true or false
tap || false,
// Left offset of the handle, in relation to the slider
scope_Locations.slice()
);
});
}
});
} | javascript | function fireEvent ( eventName, handleNumber, tap ) {
Object.keys(scope_Events).forEach(function( targetEvent ) {
var eventType = targetEvent.split('.')[0];
if ( eventName === eventType ) {
scope_Events[targetEvent].forEach(function( callback ) {
callback.call(
// Use the slider public API as the scope ('this')
scope_Self,
// Return values as array, so arg_1[arg_2] is always valid.
scope_Values.map(options.format.to),
// Handle index, 0 or 1
handleNumber,
// Unformatted slider values
scope_Values.slice(),
// Event is fired by tap, true or false
tap || false,
// Left offset of the handle, in relation to the slider
scope_Locations.slice()
);
});
}
});
} | [
"function",
"fireEvent",
"(",
"eventName",
",",
"handleNumber",
",",
"tap",
")",
"{",
"Object",
".",
"keys",
"(",
"scope_Events",
")",
".",
"forEach",
"(",
"function",
"(",
"targetEvent",
")",
"{",
"var",
"eventType",
"=",
"targetEvent",
".",
"split",
"(",... | External event handling | [
"External",
"event",
"handling"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L1447-L1473 | train | Fire an event | [
30522,
3853,
2543,
18697,
3372,
1006,
2724,
18442,
1010,
5047,
19172,
5677,
1010,
11112,
1007,
1063,
4874,
1012,
6309,
1006,
9531,
1035,
2824,
1007,
1012,
18921,
6776,
1006,
3853,
1006,
4539,
18697,
3372,
1007,
1063,
13075,
2724,
13874,
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.support/src/sap/ui/support/supportRules/util/RuleValidator.js | function(sId) {
//Match camelCase - case sensitive
var idRegEx = /^[a-z][a-zA-Z]+$/;
if (
!sId || typeof sId !== 'string') {
return false;
}
if (sId.match(idRegEx) && this.validateStringLength(sId, 6, 50)) {
return true;
}
return false;
} | javascript | function(sId) {
//Match camelCase - case sensitive
var idRegEx = /^[a-z][a-zA-Z]+$/;
if (
!sId || typeof sId !== 'string') {
return false;
}
if (sId.match(idRegEx) && this.validateStringLength(sId, 6, 50)) {
return true;
}
return false;
} | [
"function",
"(",
"sId",
")",
"{",
"//Match camelCase - case sensitive",
"var",
"idRegEx",
"=",
"/",
"^[a-z][a-zA-Z]+$",
"/",
";",
"if",
"(",
"!",
"sId",
"||",
"typeof",
"sId",
"!==",
"'string'",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"sId",
".... | Validates the id of a rule each id. The Id has to be of type string, and needs to be camelCase.
Positive cases :
- "validId"
@private
@param {string} sId Id in string format.
@returns {boolean} Boolean response if the provided id is valid. | [
"Validates",
"the",
"id",
"of",
"a",
"rule",
"each",
"id",
".",
"The",
"Id",
"has",
"to",
"be",
"of",
"type",
"string",
"and",
"needs",
"to",
"be",
"camelCase",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/util/RuleValidator.js#L94-L109 | train | Checks if the given string is a valid ID | [
30522,
3853,
1006,
15765,
1007,
1063,
1013,
1013,
2674,
19130,
18382,
1011,
2553,
7591,
13075,
8909,
2890,
3351,
2595,
1027,
1013,
1034,
1031,
1037,
1011,
1062,
1033,
1031,
1037,
1011,
23564,
1011,
1062,
1033,
1009,
1002,
1013,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ecomfe/zrender | src/mixin/Animatable.js | function (forwardToLast) {
var animators = this.animators;
var len = animators.length;
for (var i = 0; i < len; i++) {
animators[i].stop(forwardToLast);
}
animators.length = 0;
return this;
} | javascript | function (forwardToLast) {
var animators = this.animators;
var len = animators.length;
for (var i = 0; i < len; i++) {
animators[i].stop(forwardToLast);
}
animators.length = 0;
return this;
} | [
"function",
"(",
"forwardToLast",
")",
"{",
"var",
"animators",
"=",
"this",
".",
"animators",
";",
"var",
"len",
"=",
"animators",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"animators",
... | 停止动画
@param {boolean} forwardToLast If move to last frame before stop | [
"停止动画"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/mixin/Animatable.js#L100-L109 | train | Stop all the animators | [
30522,
3853,
1006,
2830,
3406,
8523,
2102,
1007,
1063,
13075,
25132,
2015,
1027,
2023,
1012,
25132,
2015,
1025,
13075,
18798,
1027,
25132,
2015,
1012,
3091,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
18798,
1025,
1045,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/language/HTMLDOMDiff.js | function () {
if (!oldNodeMap[newChild.tagID]) {
newEdit = {
type: "elementInsert",
tag: newChild.tag,
tagID: newChild.tagID,
parentID: newChild.parent.tagID,
attributes: newChild.attributes
};
newEdits.push(newEdit);
// This newly inserted node needs to have edits generated for its
// children, so we add it to the queue.
newElements.push(newChild);
// A textInsert edit that follows this elementInsert should use
// this element's ID.
textAfterID = newChild.tagID;
// new element means we need to move on to compare the next
// of the current tree with the one from the old tree that we
// just compared
newIndex++;
return true;
}
return false;
} | javascript | function () {
if (!oldNodeMap[newChild.tagID]) {
newEdit = {
type: "elementInsert",
tag: newChild.tag,
tagID: newChild.tagID,
parentID: newChild.parent.tagID,
attributes: newChild.attributes
};
newEdits.push(newEdit);
// This newly inserted node needs to have edits generated for its
// children, so we add it to the queue.
newElements.push(newChild);
// A textInsert edit that follows this elementInsert should use
// this element's ID.
textAfterID = newChild.tagID;
// new element means we need to move on to compare the next
// of the current tree with the one from the old tree that we
// just compared
newIndex++;
return true;
}
return false;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"oldNodeMap",
"[",
"newChild",
".",
"tagID",
"]",
")",
"{",
"newEdit",
"=",
"{",
"type",
":",
"\"elementInsert\"",
",",
"tag",
":",
"newChild",
".",
"tag",
",",
"tagID",
":",
"newChild",
".",
"tagID",
",",
... | If the current element was not in the old DOM, then we will create
an elementInsert edit for it.
If the element was in the old DOM, this will return false and the
main loop will either spot this element later in the child list
or the element has been moved.
@return {boolean} true if an elementInsert was created | [
"If",
"the",
"current",
"element",
"was",
"not",
"in",
"the",
"old",
"DOM",
"then",
"we",
"will",
"create",
"an",
"elementInsert",
"edit",
"for",
"it",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/HTMLDOMDiff.js#L161-L188 | train | This function is called when a new node is inserted. | [
30522,
3853,
1006,
1007,
1063,
2065,
1006,
999,
2214,
3630,
3207,
2863,
2361,
1031,
2047,
19339,
1012,
6415,
3593,
1033,
1007,
1063,
2047,
2098,
4183,
1027,
1063,
2828,
1024,
1000,
5783,
7076,
8743,
1000,
1010,
6415,
1024,
2047,
19339,
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/transform-apijson-for-sdk.js | function (sSince, sDescription, sEntityType) {
var aResult;
// Build deprecation message
// Note: there may be no since or no description text available
aResult = ["Deprecated"];
if (sSince) {
aResult.push(" as of version " + sSince);
}
if (sDescription) {
// Evaluate code blocks - Handle <code>...</code> pattern
sDescription = sDescription.replace(/<code>(\S+)<\/code>/gi, function (sMatch, sCodeEntity) {
return ['<em>', sCodeEntity, '</em>'].join("");
}
);
// Evaluate links in the deprecation description
aResult.push(". " + this._preProcessLinksInTextBlock(sDescription, true));
}
return aResult.join("");
} | javascript | function (sSince, sDescription, sEntityType) {
var aResult;
// Build deprecation message
// Note: there may be no since or no description text available
aResult = ["Deprecated"];
if (sSince) {
aResult.push(" as of version " + sSince);
}
if (sDescription) {
// Evaluate code blocks - Handle <code>...</code> pattern
sDescription = sDescription.replace(/<code>(\S+)<\/code>/gi, function (sMatch, sCodeEntity) {
return ['<em>', sCodeEntity, '</em>'].join("");
}
);
// Evaluate links in the deprecation description
aResult.push(". " + this._preProcessLinksInTextBlock(sDescription, true));
}
return aResult.join("");
} | [
"function",
"(",
"sSince",
",",
"sDescription",
",",
"sEntityType",
")",
"{",
"var",
"aResult",
";",
"// Build deprecation message",
"// Note: there may be no since or no description text available",
"aResult",
"=",
"[",
"\"Deprecated\"",
"]",
";",
"if",
"(",
"sSince",
... | Formats the entity deprecation message and pre-process jsDoc link and code blocks
@param {string} sSince since text
@param {string} sDescription deprecation description text
@param {string} sEntityType string representation of entity type
@returns {string} formatted deprecation message | [
"Formats",
"the",
"entity",
"deprecation",
"message",
"and",
"pre",
"-",
"process",
"jsDoc",
"link",
"and",
"code",
"blocks"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1670-L1691 | train | Build deprecation message | [
30522,
3853,
1006,
7020,
2378,
3401,
1010,
17371,
2229,
23235,
3258,
1010,
2741,
3012,
13874,
1007,
1063,
13075,
23631,
11314,
1025,
1013,
1013,
3857,
2139,
28139,
10719,
4471,
1013,
1013,
3602,
1024,
2045,
2089,
2022,
2053,
2144,
2030,
205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
quasarframework/quasar | ui/src/components/datetime/persian.js | jalCalLeap | function jalCalLeap (jy) {
let bl = breaks.length,
jp = breaks[0],
jm,
jump,
leap,
n,
i
if (jy < jp || jy >= breaks[bl - 1]) { throw new Error('Invalid Jalaali year ' + jy) }
for (i = 1; i < bl; i += 1) {
jm = breaks[i]
jump = jm - jp
if (jy < jm) { break }
jp = jm
}
n = jy - jp
if (jump - n < 6) { n = n - jump + div(jump + 4, 33) * 33 }
leap = mod(mod(n + 1, 33) - 1, 4)
if (leap === -1) {
leap = 4
}
return leap
} | javascript | function jalCalLeap (jy) {
let bl = breaks.length,
jp = breaks[0],
jm,
jump,
leap,
n,
i
if (jy < jp || jy >= breaks[bl - 1]) { throw new Error('Invalid Jalaali year ' + jy) }
for (i = 1; i < bl; i += 1) {
jm = breaks[i]
jump = jm - jp
if (jy < jm) { break }
jp = jm
}
n = jy - jp
if (jump - n < 6) { n = n - jump + div(jump + 4, 33) * 33 }
leap = mod(mod(n + 1, 33) - 1, 4)
if (leap === -1) {
leap = 4
}
return leap
} | [
"function",
"jalCalLeap",
"(",
"jy",
")",
"{",
"let",
"bl",
"=",
"breaks",
".",
"length",
",",
"jp",
"=",
"breaks",
"[",
"0",
"]",
",",
"jm",
",",
"jump",
",",
"leap",
",",
"n",
",",
"i",
"if",
"(",
"jy",
"<",
"jp",
"||",
"jy",
">=",
"breaks"... | /*
This function determines if the Jalaali (Persian) year is
leap (366-day long) or is the common year (365 days)
@param jy Jalaali calendar year (-61 to 3177)
@returns number of years since the last leap year (0 to 4) | [
"/",
"*",
"This",
"function",
"determines",
"if",
"the",
"Jalaali",
"(",
"Persian",
")",
"year",
"is",
"leap",
"(",
"366",
"-",
"day",
"long",
")",
"or",
"is",
"the",
"common",
"year",
"(",
"365",
"days",
")"
] | 5d2fb6c96bff6095236f8ca6fe07a037e32e06b3 | https://github.com/quasarframework/quasar/blob/5d2fb6c96bff6095236f8ca6fe07a037e32e06b3/ui/src/components/datetime/persian.js#L62-L88 | train | Jalaali leap year | [
30522,
3853,
14855,
15472,
24164,
9331,
1006,
1046,
2100,
1007,
1063,
2292,
1038,
2140,
1027,
7807,
1012,
3091,
1010,
16545,
1027,
7807,
1031,
1014,
1033,
1010,
1046,
2213,
1010,
5376,
1010,
11679,
1010,
1050,
1010,
1045,
2065,
1006,
1046,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(codec)
{
if (codec != null)
{
var name = codec.getName();
mxCodecRegistry.codecs[name] = codec;
var classname = mxUtils.getFunctionName(codec.template.constructor);
if (classname != name)
{
mxCodecRegistry.addAlias(classname, name);
}
}
return codec;
} | javascript | function(codec)
{
if (codec != null)
{
var name = codec.getName();
mxCodecRegistry.codecs[name] = codec;
var classname = mxUtils.getFunctionName(codec.template.constructor);
if (classname != name)
{
mxCodecRegistry.addAlias(classname, name);
}
}
return codec;
} | [
"function",
"(",
"codec",
")",
"{",
"if",
"(",
"codec",
"!=",
"null",
")",
"{",
"var",
"name",
"=",
"codec",
".",
"getName",
"(",
")",
";",
"mxCodecRegistry",
".",
"codecs",
"[",
"name",
"]",
"=",
"codec",
";",
"var",
"classname",
"=",
"mxUtils",
"... | Function: register
Registers a new codec and associates the name of the template
constructor in the codec with the codec object.
Parameters:
codec - <mxObjectCodec> to be registered. | [
"Function",
":",
"register"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L86015-L86031 | train | Registers a codec | [
30522,
3853,
1006,
3642,
2278,
1007,
1063,
2065,
1006,
3642,
2278,
999,
1027,
19701,
1007,
1063,
13075,
2171,
1027,
3642,
2278,
1012,
2131,
18442,
1006,
1007,
1025,
25630,
16044,
16748,
24063,
2854,
1012,
3642,
6169,
1031,
2171,
1033,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (oInstance, sMetaPath, mTypeForMetaPath, bReturnAlias) {
var bFailed,
mKey2Value = {};
bFailed = mTypeForMetaPath[sMetaPath].$Key.some(function (vKey) {
var sKey, sKeyPath, aPath, sPropertyName, oType, vValue;
if (typeof vKey === "string") {
sKey = sKeyPath = vKey;
} else {
sKey = Object.keys(vKey)[0]; // alias
sKeyPath = vKey[sKey];
if (!bReturnAlias) {
sKey = sKeyPath;
}
}
aPath = sKeyPath.split("/");
vValue = _Helper.drillDown(oInstance, aPath);
if (vValue === undefined) {
return true;
}
// the last path segment is the name of the simple property
sPropertyName = aPath.pop();
// find the type containing the simple property
oType = mTypeForMetaPath[_Helper.buildPath(sMetaPath, aPath.join("/"))];
vValue = _Helper.formatLiteral(vValue, oType[sPropertyName].$Type);
mKey2Value[sKey] = vValue;
});
return bFailed ? undefined : mKey2Value;
} | javascript | function (oInstance, sMetaPath, mTypeForMetaPath, bReturnAlias) {
var bFailed,
mKey2Value = {};
bFailed = mTypeForMetaPath[sMetaPath].$Key.some(function (vKey) {
var sKey, sKeyPath, aPath, sPropertyName, oType, vValue;
if (typeof vKey === "string") {
sKey = sKeyPath = vKey;
} else {
sKey = Object.keys(vKey)[0]; // alias
sKeyPath = vKey[sKey];
if (!bReturnAlias) {
sKey = sKeyPath;
}
}
aPath = sKeyPath.split("/");
vValue = _Helper.drillDown(oInstance, aPath);
if (vValue === undefined) {
return true;
}
// the last path segment is the name of the simple property
sPropertyName = aPath.pop();
// find the type containing the simple property
oType = mTypeForMetaPath[_Helper.buildPath(sMetaPath, aPath.join("/"))];
vValue = _Helper.formatLiteral(vValue, oType[sPropertyName].$Type);
mKey2Value[sKey] = vValue;
});
return bFailed ? undefined : mKey2Value;
} | [
"function",
"(",
"oInstance",
",",
"sMetaPath",
",",
"mTypeForMetaPath",
",",
"bReturnAlias",
")",
"{",
"var",
"bFailed",
",",
"mKey2Value",
"=",
"{",
"}",
";",
"bFailed",
"=",
"mTypeForMetaPath",
"[",
"sMetaPath",
"]",
".",
"$Key",
".",
"some",
"(",
"func... | Returns the key properties mapped to values from the given entity using the given
meta data.
@param {object} oInstance
Entity instance runtime data
@param {string} sMetaPath
The absolute meta path of the given instance
@param {object} mTypeForMetaPath
Maps meta paths to the corresponding entity or complex types
@param {boolean} [bReturnAlias=false]
Whether to return the aliases instead of the keys
@returns {object}
The key properties map. For the meta data
<Key>
<PropertyRef Name="Info/ID" Alias="EntityInfoID"/>
</Key>
the following map is returned:
- {EntityInfoID : 42}, if bReturnAlias = true;
- {"Info/ID" : 42}, if bReturnAlias = false;
- undefined, if at least one key property is undefined.
@throws {Error}
In case the entity type has no key properties according to metadata | [
"Returns",
"the",
"key",
"properties",
"mapped",
"to",
"values",
"from",
"the",
"given",
"entity",
"using",
"the",
"given",
"meta",
"data",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L572-L604 | train | drill down the property value | [
30522,
3853,
1006,
1051,
7076,
26897,
1010,
15488,
12928,
15069,
1010,
11047,
18863,
14192,
12928,
15069,
1010,
25626,
14287,
22786,
2015,
1007,
1063,
13075,
28939,
17440,
1010,
12395,
3240,
2475,
10175,
5657,
1027,
1063,
1065,
1025,
28939,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js | function (oReferences) {
// Setup
this._sTopicId = oReferences.sTopicId;
this._oModel = oReferences.oModel;
this._oControlData = this._oModel.getData();
this._aApiIndex = oReferences.aApiIndex;
this._aAllowedMembers = oReferences.aAllowedMembers;
this._sEntityType = oReferences.sEntityType;
this._sEntityId = oReferences.sEntityId;
this._oEntityData = oReferences.oEntityData;
this._oContainerController = oReferences.oContainerController;
this._oContainerView = oReferences.oContainerView;
// Override instance getOwnerComponent so correct component will be used for the controller
this.getOwnerComponent = function () {
return oReferences.oOwnerComponent;
};
// Cache router instance
this._oRouter = this.getRouter();
// Attach the model to the view
this.setModel(this._oModel);
// Build needed resources and pre-process data
this._oEntityData.appComponent = this._oControlData.component || this.NOT_AVAILABLE;
this._oEntityData.hasSample = this._oControlData.hasSample;
this._oEntityData.sample = this._oControlData.hasSample ? this._sTopicId : this.NOT_AVAILABLE;
this._buildHeaderLayout(this._oControlData, this._oEntityData);
setTimeout(function () {
// Initial prettify
this._prettify();
// Attach prettify for un-stashed sub sections
this._objectPage.attachEvent("subSectionEnteredViewPort", function () {
// Clear previous calls if any
if (this._sPrettyPrintDelayedCallID) {
clearTimeout(this._sPrettyPrintDelayedCallID);
}
this._sPrettyPrintDelayedCallID = setTimeout(function () {
// The event is called even if all the sub-sections are un-stashed so apply the class and prettyPrint only when we have un-processed targets.
var $aNotApplied = jQuery('.sapUxAPObjectPageContainer .APIDetailMethodsSection pre:not(.prettyprint)', this._objectPage.$());
if ($aNotApplied.length > 0) {
$aNotApplied.addClass('prettyprint');
window.prettyPrint();
}
}.bind(this), 200);
}, this);
// Init scrolling right after busy indicator is cleared and prettify is ready
setTimeout(function () {
if (this._sEntityType) {
this._scrollToEntity(this._sEntityType, this._sEntityId);
}
// Add listener's with a slight delay so they don't break scroll to entity
setTimeout(function () {
this._objectPage.attachEvent("_sectionChange", function (oEvent) {
var oSection = oEvent.getParameter("section"),
oSubSection = oEvent.getParameter("subSection");
if (this._oNavigatingTo) {
if (this._oNavigatingTo === oSubSection) {
// Destination is reached
this._oNavigatingTo = null;
}
return;
}
this._modifyURL(oSection, oSubSection, false);
}, this);
this._objectPage.attachEvent("navigate", function (oEvent) {
var oSection = oEvent.getParameter("section"),
oSubSection = oEvent.getParameter("subSection");
this._oNavigatingTo = oSubSection;
this._modifyURL(oSection, oSubSection, true);
}, this);
}.bind(this), 500);
}.bind(this), 1000);
}.bind(this), 0);
this.searchResultsButtonVisibilitySwitch(this.byId("apiDetailBackToSearch"));
} | javascript | function (oReferences) {
// Setup
this._sTopicId = oReferences.sTopicId;
this._oModel = oReferences.oModel;
this._oControlData = this._oModel.getData();
this._aApiIndex = oReferences.aApiIndex;
this._aAllowedMembers = oReferences.aAllowedMembers;
this._sEntityType = oReferences.sEntityType;
this._sEntityId = oReferences.sEntityId;
this._oEntityData = oReferences.oEntityData;
this._oContainerController = oReferences.oContainerController;
this._oContainerView = oReferences.oContainerView;
// Override instance getOwnerComponent so correct component will be used for the controller
this.getOwnerComponent = function () {
return oReferences.oOwnerComponent;
};
// Cache router instance
this._oRouter = this.getRouter();
// Attach the model to the view
this.setModel(this._oModel);
// Build needed resources and pre-process data
this._oEntityData.appComponent = this._oControlData.component || this.NOT_AVAILABLE;
this._oEntityData.hasSample = this._oControlData.hasSample;
this._oEntityData.sample = this._oControlData.hasSample ? this._sTopicId : this.NOT_AVAILABLE;
this._buildHeaderLayout(this._oControlData, this._oEntityData);
setTimeout(function () {
// Initial prettify
this._prettify();
// Attach prettify for un-stashed sub sections
this._objectPage.attachEvent("subSectionEnteredViewPort", function () {
// Clear previous calls if any
if (this._sPrettyPrintDelayedCallID) {
clearTimeout(this._sPrettyPrintDelayedCallID);
}
this._sPrettyPrintDelayedCallID = setTimeout(function () {
// The event is called even if all the sub-sections are un-stashed so apply the class and prettyPrint only when we have un-processed targets.
var $aNotApplied = jQuery('.sapUxAPObjectPageContainer .APIDetailMethodsSection pre:not(.prettyprint)', this._objectPage.$());
if ($aNotApplied.length > 0) {
$aNotApplied.addClass('prettyprint');
window.prettyPrint();
}
}.bind(this), 200);
}, this);
// Init scrolling right after busy indicator is cleared and prettify is ready
setTimeout(function () {
if (this._sEntityType) {
this._scrollToEntity(this._sEntityType, this._sEntityId);
}
// Add listener's with a slight delay so they don't break scroll to entity
setTimeout(function () {
this._objectPage.attachEvent("_sectionChange", function (oEvent) {
var oSection = oEvent.getParameter("section"),
oSubSection = oEvent.getParameter("subSection");
if (this._oNavigatingTo) {
if (this._oNavigatingTo === oSubSection) {
// Destination is reached
this._oNavigatingTo = null;
}
return;
}
this._modifyURL(oSection, oSubSection, false);
}, this);
this._objectPage.attachEvent("navigate", function (oEvent) {
var oSection = oEvent.getParameter("section"),
oSubSection = oEvent.getParameter("subSection");
this._oNavigatingTo = oSubSection;
this._modifyURL(oSection, oSubSection, true);
}, this);
}.bind(this), 500);
}.bind(this), 1000);
}.bind(this), 0);
this.searchResultsButtonVisibilitySwitch(this.byId("apiDetailBackToSearch"));
} | [
"function",
"(",
"oReferences",
")",
"{",
"// Setup",
"this",
".",
"_sTopicId",
"=",
"oReferences",
".",
"sTopicId",
";",
"this",
".",
"_oModel",
"=",
"oReferences",
".",
"oModel",
";",
"this",
".",
"_oControlData",
"=",
"this",
".",
"_oModel",
".",
"getDa... | /* =========================================================== /* lifecycle methods /* =========================================================== | [
"/",
"*",
"===========================================================",
"/",
"*",
"lifecycle",
"methods",
"/",
"*",
"==========================================================="
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js#L46-L136 | train | Initializes the data structures for the control and the view | [
30522,
3853,
1006,
10848,
25523,
2015,
1007,
1063,
1013,
1013,
16437,
30524,
25523,
2015,
1012,
18168,
10244,
2140,
1025,
2023,
1012,
1035,
1051,
8663,
13181,
15150,
2696,
1027,
2023,
1012,
1035,
18168,
10244,
2140,
1012,
2131,
2850,
2696,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/base/ManagedObjectMetadata.js | SpecialSetting | function SpecialSetting(oClass, name, info) {
info = typeof info !== 'object' ? { type: info } : info;
this.name = name;
this.type = info.type || 'any';
this.visibility = info.visibility || 'public';
this.defaultValue = info.defaultValue;
this.appData = remainder(this, info);
this._oParent = oClass;
this._sUID = "special:" + name;
this._iKind = Kind.SPECIAL_SETTING;
} | javascript | function SpecialSetting(oClass, name, info) {
info = typeof info !== 'object' ? { type: info } : info;
this.name = name;
this.type = info.type || 'any';
this.visibility = info.visibility || 'public';
this.defaultValue = info.defaultValue;
this.appData = remainder(this, info);
this._oParent = oClass;
this._sUID = "special:" + name;
this._iKind = Kind.SPECIAL_SETTING;
} | [
"function",
"SpecialSetting",
"(",
"oClass",
",",
"name",
",",
"info",
")",
"{",
"info",
"=",
"typeof",
"info",
"!==",
"'object'",
"?",
"{",
"type",
":",
"info",
"}",
":",
"info",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"type",
"="... | ---- SpecialSetting --------------------------------------------------------------------
SpecialSetting info object
@private
@since 1.27.1 | [
"----",
"SpecialSetting",
"--------------------------------------------------------------------",
"SpecialSetting",
"info",
"object"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js#L150-L160 | train | Special setting constructor. | [
30522,
3853,
19247,
18319,
3070,
1006,
1051,
26266,
1010,
2171,
1010,
18558,
1007,
1063,
18558,
1027,
2828,
11253,
18558,
999,
1027,
1027,
1005,
4874,
1005,
1029,
1063,
2828,
1024,
18558,
1065,
1024,
18558,
1025,
2023,
1012,
2171,
1027,
217... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
expressjs/express | examples/content-negotiation/index.js | format | function format(path) {
var obj = require(path);
return function(req, res){
res.format(obj);
};
} | javascript | function format(path) {
var obj = require(path);
return function(req, res){
res.format(obj);
};
} | [
"function",
"format",
"(",
"path",
")",
"{",
"var",
"obj",
"=",
"require",
"(",
"path",
")",
";",
"return",
"function",
"(",
"req",
",",
"res",
")",
"{",
"res",
".",
"format",
"(",
"obj",
")",
";",
"}",
";",
"}"
] | or you could write a tiny middleware like this to add a layer of abstraction and make things a bit more declarative: | [
"or",
"you",
"could",
"write",
"a",
"tiny",
"middleware",
"like",
"this",
"to",
"add",
"a",
"layer",
"of",
"abstraction",
"and",
"make",
"things",
"a",
"bit",
"more",
"declarative",
":"
] | dc538f6e810bd462c98ee7e6aae24c64d4b1da93 | https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/examples/content-negotiation/index.js#L31-L36 | train | Returns a function that formats the given object. | [
30522,
3853,
4289,
1006,
4130,
1007,
1063,
13075,
27885,
3501,
1027,
5478,
1006,
4130,
1007,
1025,
2709,
3853,
1006,
2128,
4160,
1010,
24501,
1007,
1063,
24501,
1012,
4289,
1006,
27885,
3501,
1007,
1025,
1065,
1025,
1065,
102,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | examples/svg/svg.js | function () {
var total = this.stats.length
return this.stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, total)
return point.x + ',' + point.y
}).join(' ')
} | javascript | function () {
var total = this.stats.length
return this.stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, total)
return point.x + ',' + point.y
}).join(' ')
} | [
"function",
"(",
")",
"{",
"var",
"total",
"=",
"this",
".",
"stats",
".",
"length",
"return",
"this",
".",
"stats",
".",
"map",
"(",
"function",
"(",
"stat",
",",
"i",
")",
"{",
"var",
"point",
"=",
"valueToPoint",
"(",
"stat",
".",
"value",
",",
... | a computed property for the polygon's points | [
"a",
"computed",
"property",
"for",
"the",
"polygon",
"s",
"points"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/examples/svg/svg.js#L17-L23 | train | Returns the sequence of points in the log file | [
30522,
3853,
1006,
1007,
1063,
13075,
2561,
1027,
2023,
1012,
26319,
1012,
3091,
2709,
2023,
1012,
26319,
1012,
4949,
1006,
3853,
1006,
28093,
1010,
1045,
1007,
1063,
13075,
2391,
1027,
3643,
14399,
25785,
1006,
28093,
1012,
3643,
1010,
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... | |
SAP/openui5 | src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js | _togglePrevNext | function _togglePrevNext(bSkipMonthCheck){
var oDate = new UniversalDate(_getStartDate.call(this).getTime());
var iItems = this._getItems();
var iYear = oDate.getJSDate().getUTCFullYear();
var iYearMax = this._oMaxDate.getJSDate().getUTCFullYear();
var iYearMin = this._oMinDate.getJSDate().getUTCFullYear();
var iMonth = oDate.getJSDate().getUTCMonth();
var iMonthMax = this._oMaxDate.getJSDate().getUTCMonth();
var iMonthMin = this._oMinDate.getJSDate().getUTCMonth();
var iDate = oDate.getJSDate().getUTCDate();
var iDateMax = this._oMaxDate.getJSDate().getUTCDate();
var iDateMin = this._oMinDate.getJSDate().getUTCDate();
var iHours = oDate.getJSDate().getUTCHours();
var iHoursMax = this._oMaxDate.getJSDate().getUTCHours();
var iHoursMin = this._oMinDate.getJSDate().getUTCHours();
var iMinutes = oDate.getJSDate().getUTCMinutes();
var iMinutesMax = this._oMaxDate.getJSDate().getUTCMinutes();
var iMinutesMin = this._oMinDate.getJSDate().getUTCMinutes();
var oHeader = this.getAggregation("header");
if (this._iMode == 2 && !bSkipMonthCheck) {
// in line month picker don't disable buttons
var oMonthPicker = this.getAggregation("monthPicker");
var iMonths = oMonthPicker.getMonths();
var iStartMonth = oMonthPicker.getStartMonth();
var iEndMonth = iStartMonth + iMonths - 1;
if (iStartMonth == 0 || (iYear == iYearMin && iStartMonth <= iMonthMin)) {
oHeader.setEnabledPrevious(false);
} else {
oHeader.setEnabledPrevious(true);
}
if (iEndMonth > 10 || (iYear == iYearMax && iEndMonth >= iMonthMax)) {
oHeader.setEnabledNext(false);
} else {
oHeader.setEnabledNext(true);
}
return;
}
if ((iYear < iYearMin ||
(iYear == iYearMin && ( !bSkipMonthCheck || ( iMonth < iMonthMin ||
(iMonth == iMonthMin && (iDate < iDateMin ||
(iDate == iDateMin && (iHours < iHoursMin ||
(iHours == iHoursMin && iMinutes <= iMinutesMin)))))))))
|| ((this._iMode == 1 || this._iMode == 2) && this.getPickerPopup())) {
oHeader.setEnabledPrevious(false);
}else {
oHeader.setEnabledPrevious(true);
}
oDate.setUTCMinutes(oDate.getUTCMinutes() + (iItems) * this.getIntervalMinutes() - 1);
iYear = oDate.getJSDate().getUTCFullYear();
iMonth = oDate.getJSDate().getUTCMonth();
iDate = oDate.getJSDate().getUTCDate();
iHours = oDate.getJSDate().getUTCHours();
iMinutes = oDate.getJSDate().getUTCMinutes();
if ((iYear > iYearMax ||
(iYear == iYearMax && ( !bSkipMonthCheck || ( iMonth > iMonthMax ||
(iMonth == iMonthMax && (iDate > iDateMax ||
(iDate == iDateMax && (iHours > iHoursMax ||
(iHours == iHoursMax && iMinutes >= iMinutesMax)))))))))
|| ((this._iMode == 1 || this._iMode == 2) && this.getPickerPopup())) {
oHeader.setEnabledNext(false);
}else {
oHeader.setEnabledNext(true);
}
} | javascript | function _togglePrevNext(bSkipMonthCheck){
var oDate = new UniversalDate(_getStartDate.call(this).getTime());
var iItems = this._getItems();
var iYear = oDate.getJSDate().getUTCFullYear();
var iYearMax = this._oMaxDate.getJSDate().getUTCFullYear();
var iYearMin = this._oMinDate.getJSDate().getUTCFullYear();
var iMonth = oDate.getJSDate().getUTCMonth();
var iMonthMax = this._oMaxDate.getJSDate().getUTCMonth();
var iMonthMin = this._oMinDate.getJSDate().getUTCMonth();
var iDate = oDate.getJSDate().getUTCDate();
var iDateMax = this._oMaxDate.getJSDate().getUTCDate();
var iDateMin = this._oMinDate.getJSDate().getUTCDate();
var iHours = oDate.getJSDate().getUTCHours();
var iHoursMax = this._oMaxDate.getJSDate().getUTCHours();
var iHoursMin = this._oMinDate.getJSDate().getUTCHours();
var iMinutes = oDate.getJSDate().getUTCMinutes();
var iMinutesMax = this._oMaxDate.getJSDate().getUTCMinutes();
var iMinutesMin = this._oMinDate.getJSDate().getUTCMinutes();
var oHeader = this.getAggregation("header");
if (this._iMode == 2 && !bSkipMonthCheck) {
// in line month picker don't disable buttons
var oMonthPicker = this.getAggregation("monthPicker");
var iMonths = oMonthPicker.getMonths();
var iStartMonth = oMonthPicker.getStartMonth();
var iEndMonth = iStartMonth + iMonths - 1;
if (iStartMonth == 0 || (iYear == iYearMin && iStartMonth <= iMonthMin)) {
oHeader.setEnabledPrevious(false);
} else {
oHeader.setEnabledPrevious(true);
}
if (iEndMonth > 10 || (iYear == iYearMax && iEndMonth >= iMonthMax)) {
oHeader.setEnabledNext(false);
} else {
oHeader.setEnabledNext(true);
}
return;
}
if ((iYear < iYearMin ||
(iYear == iYearMin && ( !bSkipMonthCheck || ( iMonth < iMonthMin ||
(iMonth == iMonthMin && (iDate < iDateMin ||
(iDate == iDateMin && (iHours < iHoursMin ||
(iHours == iHoursMin && iMinutes <= iMinutesMin)))))))))
|| ((this._iMode == 1 || this._iMode == 2) && this.getPickerPopup())) {
oHeader.setEnabledPrevious(false);
}else {
oHeader.setEnabledPrevious(true);
}
oDate.setUTCMinutes(oDate.getUTCMinutes() + (iItems) * this.getIntervalMinutes() - 1);
iYear = oDate.getJSDate().getUTCFullYear();
iMonth = oDate.getJSDate().getUTCMonth();
iDate = oDate.getJSDate().getUTCDate();
iHours = oDate.getJSDate().getUTCHours();
iMinutes = oDate.getJSDate().getUTCMinutes();
if ((iYear > iYearMax ||
(iYear == iYearMax && ( !bSkipMonthCheck || ( iMonth > iMonthMax ||
(iMonth == iMonthMax && (iDate > iDateMax ||
(iDate == iDateMax && (iHours > iHoursMax ||
(iHours == iHoursMax && iMinutes >= iMinutesMax)))))))))
|| ((this._iMode == 1 || this._iMode == 2) && this.getPickerPopup())) {
oHeader.setEnabledNext(false);
}else {
oHeader.setEnabledNext(true);
}
} | [
"function",
"_togglePrevNext",
"(",
"bSkipMonthCheck",
")",
"{",
"var",
"oDate",
"=",
"new",
"UniversalDate",
"(",
"_getStartDate",
".",
"call",
"(",
"this",
")",
".",
"getTime",
"(",
")",
")",
";",
"var",
"iItems",
"=",
"this",
".",
"_getItems",
"(",
")... | Enables / Disables previous and next button in the Header.
This function assumes there is a "monthPicker" aggregation unless the bSkipMonthCheck flag is false.
So callers must take care.
@param {boolean} bSkipMonthCheck if month picker should be examined or not
@return {void}
@private | [
"Enables",
"/",
"Disables",
"previous",
"and",
"next",
"button",
"in",
"the",
"Header",
".",
"This",
"function",
"assumes",
"there",
"is",
"a",
"monthPicker",
"aggregation",
"unless",
"the",
"bSkipMonthCheck",
"flag",
"is",
"false",
".",
"So",
"callers",
"must... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1606-L1677 | train | Toggles the previous and next buttons | [
30522,
3853,
1035,
2000,
24679,
28139,
16022,
10288,
2102,
1006,
18667,
3211,
9737,
12162,
16257,
5369,
3600,
1007,
1063,
13075,
1051,
13701,
1027,
2047,
5415,
13701,
1006,
1035,
4152,
7559,
2102,
13701,
1012,
2655,
1006,
2023,
1007,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
caolan/async | support/jsdoc/theme/publish.js | writeSearchData | function writeSearchData(methodNames, sourceFilenames) {
var dataDir = path.join(outdir, 'data');
fsExtra.mkdirsSync(dataDir);
fsExtra.writeJsonSync(path.join(dataDir, 'methodNames.json'), sortStrs(methodNames), 'utf8');
fsExtra.writeJsonSync(path.join(dataDir, 'sourceFiles.json'), sortStrs(sourceFilenames), 'utf8');
} | javascript | function writeSearchData(methodNames, sourceFilenames) {
var dataDir = path.join(outdir, 'data');
fsExtra.mkdirsSync(dataDir);
fsExtra.writeJsonSync(path.join(dataDir, 'methodNames.json'), sortStrs(methodNames), 'utf8');
fsExtra.writeJsonSync(path.join(dataDir, 'sourceFiles.json'), sortStrs(sourceFilenames), 'utf8');
} | [
"function",
"writeSearchData",
"(",
"methodNames",
",",
"sourceFilenames",
")",
"{",
"var",
"dataDir",
"=",
"path",
".",
"join",
"(",
"outdir",
",",
"'data'",
")",
";",
"fsExtra",
".",
"mkdirsSync",
"(",
"dataDir",
")",
";",
"fsExtra",
".",
"writeJsonSync",
... | Prints into <outdir>/data a `methodNames.json` and a `sourceFiles.json`
JSON file that contains methods and files that can be searched on the
generated doc site.
@param {Array<String>} methodNames - A list of method names
@param {Array<String>} sourceFilenames - A list of source filenames | [
"Prints",
"into",
"<outdir",
">",
"/",
"data",
"a",
"methodNames",
".",
"json",
"and",
"a",
"sourceFiles",
".",
"json",
"JSON",
"file",
"that",
"contains",
"methods",
"and",
"files",
"that",
"can",
"be",
"searched",
"on",
"the",
"generated",
"doc",
"site",... | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/support/jsdoc/theme/publish.js#L417-L422 | train | Writes the search data to the specified directory | [
30522,
3853,
7009,
14644,
2818,
2850,
2696,
1006,
4118,
18442,
2015,
1010,
3120,
8873,
20844,
7834,
1007,
1063,
13075,
2951,
4305,
2099,
1027,
4130,
1012,
3693,
1006,
2041,
4305,
2099,
1010,
1005,
2951,
1005,
1007,
1025,
1042,
3366,
18413,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | docs/config/processors/buildConfig.js | getCommitDate | function getCommitDate() {
const deferred = q.defer();
exec('git show -s --format=%ci HEAD', function(error, stdout) {
buildConfig.date = stdout && stdout.toString().trim();
deferred.resolve(buildConfig.date);
});
return deferred.promise;
} | javascript | function getCommitDate() {
const deferred = q.defer();
exec('git show -s --format=%ci HEAD', function(error, stdout) {
buildConfig.date = stdout && stdout.toString().trim();
deferred.resolve(buildConfig.date);
});
return deferred.promise;
} | [
"function",
"getCommitDate",
"(",
")",
"{",
"const",
"deferred",
"=",
"q",
".",
"defer",
"(",
")",
";",
"exec",
"(",
"'git show -s --format=%ci HEAD'",
",",
"function",
"(",
"error",
",",
"stdout",
")",
"{",
"buildConfig",
".",
"date",
"=",
"stdout",
"&&",... | Get the commit date for the most recent commit on origin/master
@returns {*} | [
"Get",
"the",
"commit",
"date",
"for",
"the",
"most",
"recent",
"commit",
"on",
"origin",
"/",
"master"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/config/processors/buildConfig.js#L45-L54 | train | Get commit date | [
30522,
3853,
2131,
9006,
22930,
13701,
1006,
1007,
1063,
9530,
3367,
13366,
28849,
2094,
1027,
1053,
1012,
13366,
2121,
1006,
1007,
1025,
4654,
8586,
1006,
1005,
21025,
2102,
2265,
1011,
1055,
1011,
1011,
4289,
1027,
1003,
25022,
2132,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var that = this,
oldHtml,
cleanHtml;
if (wysihtml5.browser.supportsModenPaste()) {
this.on("paste:composer", function(event) {
event.preventDefault();
oldHtml = wysihtml5.dom.getPastedHtml(event);
if (oldHtml) {
that._cleanAndPaste(oldHtml);
}
});
} else {
this.on("beforepaste:composer", function(event) {
event.preventDefault();
wysihtml5.dom.getPastedHtmlWithDiv(that.composer, function(pastedHTML) {
if (pastedHTML) {
that._cleanAndPaste(pastedHTML);
}
});
});
}
} | javascript | function() {
var that = this,
oldHtml,
cleanHtml;
if (wysihtml5.browser.supportsModenPaste()) {
this.on("paste:composer", function(event) {
event.preventDefault();
oldHtml = wysihtml5.dom.getPastedHtml(event);
if (oldHtml) {
that._cleanAndPaste(oldHtml);
}
});
} else {
this.on("beforepaste:composer", function(event) {
event.preventDefault();
wysihtml5.dom.getPastedHtmlWithDiv(that.composer, function(pastedHTML) {
if (pastedHTML) {
that._cleanAndPaste(pastedHTML);
}
});
});
}
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
",",
"oldHtml",
",",
"cleanHtml",
";",
"if",
"(",
"wysihtml5",
".",
"browser",
".",
"supportsModenPaste",
"(",
")",
")",
"{",
"this",
".",
"on",
"(",
"\"paste:composer\"",
",",
"function",
"(",
"ev... | Prepare html parser logic
- Observes for paste and drop | [
"Prepare",
"html",
"parser",
"logic",
"-",
"Observes",
"for",
"paste",
"and",
"drop"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13395-L13420 | train | This function is called by the paste event handler. It is called by the paste event handler. It is also called by the paste event handler. | [
30522,
3853,
1006,
1007,
1063,
13075,
2008,
1027,
2023,
1010,
2214,
11039,
19968,
1010,
4550,
11039,
19968,
1025,
2065,
1006,
1059,
7274,
19190,
21246,
2140,
2629,
1012,
16602,
1012,
6753,
5302,
4181,
19707,
2618,
1006,
1007,
1007,
1063,
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... | |
eslint/eslint | lib/util/apply-disable-directives.js | compareLocations | function compareLocations(itemA, itemB) {
return itemA.line - itemB.line || itemA.column - itemB.column;
} | javascript | function compareLocations(itemA, itemB) {
return itemA.line - itemB.line || itemA.column - itemB.column;
} | [
"function",
"compareLocations",
"(",
"itemA",
",",
"itemB",
")",
"{",
"return",
"itemA",
".",
"line",
"-",
"itemB",
".",
"line",
"||",
"itemA",
".",
"column",
"-",
"itemB",
".",
"column",
";",
"}"
] | Compares the locations of two objects in a source file
@param {{line: number, column: number}} itemA The first object
@param {{line: number, column: number}} itemB The second object
@returns {number} A value less than 1 if itemA appears before itemB in the source file, greater than 1 if
itemA appears after itemB in the source file, or 0 if itemA and itemB have the same location. | [
"Compares",
"the",
"locations",
"of",
"two",
"objects",
"in",
"a",
"source",
"file"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/apply-disable-directives.js#L17-L19 | train | Compare two locations of the given line and column of the given line and column of the given line and column of the given line and column of the given line or column of the given line. | [
30522,
3853,
12826,
4135,
10719,
2015,
1006,
8875,
2050,
1010,
8875,
2497,
1007,
1063,
2709,
8875,
2050,
1012,
2240,
1011,
8875,
2497,
1012,
2240,
1064,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | trailingEdge | function trailingEdge(time) {
timerId = undefined;
// 有lastArgs才执行,
// 意味着只有 func 已经被 debounced 过一次以后才会在 trailing edge 执行
if (trailing && lastArgs) {
return invokeFunc(time);
}
// 每次 trailingEdge 都会清除 lastArgs 和 lastThis,目的是避免最后一次函数被执行了两次
// 举个例子:最后一次函数执行的时候,可能恰巧是前一次的 trailing edge,函数被调用,而这个函数又需要在自己时延的 trailing edge 触发,导致触发多次
lastArgs = lastThis = undefined;
return result;
} | javascript | function trailingEdge(time) {
timerId = undefined;
// 有lastArgs才执行,
// 意味着只有 func 已经被 debounced 过一次以后才会在 trailing edge 执行
if (trailing && lastArgs) {
return invokeFunc(time);
}
// 每次 trailingEdge 都会清除 lastArgs 和 lastThis,目的是避免最后一次函数被执行了两次
// 举个例子:最后一次函数执行的时候,可能恰巧是前一次的 trailing edge,函数被调用,而这个函数又需要在自己时延的 trailing edge 触发,导致触发多次
lastArgs = lastThis = undefined;
return result;
} | [
"function",
"trailingEdge",
"(",
"time",
")",
"{",
"timerId",
"=",
"undefined",
";",
"// 有lastArgs才执行,",
"// 意味着只有 func 已经被 debounced 过一次以后才会在 trailing edge 执行",
"if",
"(",
"trailing",
"&&",
"lastArgs",
")",
"{",
"return",
"invokeFunc",
"(",
"time",
")",
";",
"}",
... | 在trailing edge阶段执行函数 | [
"在trailing",
"edge阶段执行函数"
] | d5405d27d994151b676eb91c12b389316d7f6679 | https://github.com/heyui/heyui/blob/d5405d27d994151b676eb91c12b389316d7f6679/src/utils/debounce.js#L105-L116 | train | trailingEdge 执行发生时间 | [
30522,
3853,
12542,
24225,
1006,
2051,
1007,
1063,
25309,
3593,
1027,
6151,
28344,
1025,
1013,
1013,
1873,
2197,
2906,
5620,
100,
100,
1945,
1989,
1013,
1013,
100,
100,
100,
100,
1873,
4569,
2278,
100,
100,
100,
2139,
5092,
22392,
100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/spaced-comment.js | reportBegin | function reportBegin(node, message, match, refChar) {
const type = node.type.toLowerCase(),
commentIdentifier = type === "block" ? "/*" : "//";
context.report({
node,
fix(fixer) {
const start = node.range[0];
let end = start + 2;
if (requireSpace) {
if (match) {
end += match[0].length;
}
return fixer.insertTextAfterRange([start, end], " ");
}
end += match[0].length;
return fixer.replaceTextRange([start, end], commentIdentifier + (match[1] ? match[1] : ""));
},
message,
data: { refChar }
});
} | javascript | function reportBegin(node, message, match, refChar) {
const type = node.type.toLowerCase(),
commentIdentifier = type === "block" ? "/*" : "//";
context.report({
node,
fix(fixer) {
const start = node.range[0];
let end = start + 2;
if (requireSpace) {
if (match) {
end += match[0].length;
}
return fixer.insertTextAfterRange([start, end], " ");
}
end += match[0].length;
return fixer.replaceTextRange([start, end], commentIdentifier + (match[1] ? match[1] : ""));
},
message,
data: { refChar }
});
} | [
"function",
"reportBegin",
"(",
"node",
",",
"message",
",",
"match",
",",
"refChar",
")",
"{",
"const",
"type",
"=",
"node",
".",
"type",
".",
"toLowerCase",
"(",
")",
",",
"commentIdentifier",
"=",
"type",
"===",
"\"block\"",
"?",
"\"/*\"",
":",
"\"//\... | Reports a beginning spacing error with an appropriate message.
@param {ASTNode} node - A comment node to check.
@param {string} message - An error message to report.
@param {Array} match - An array of match results for markers.
@param {string} refChar - Character used for reference in the error message.
@returns {void} | [
"Reports",
"a",
"beginning",
"spacing",
"error",
"with",
"an",
"appropriate",
"message",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/spaced-comment.js#L269-L292 | train | Report begin of a node | [
30522,
3853,
3189,
4783,
11528,
1006,
13045,
1010,
4471,
1010,
2674,
1010,
25416,
7507,
2099,
1007,
1063,
9530,
3367,
2828,
1027,
13045,
1012,
2828,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1010,
7615,
5178,
16778,
8873,
2121,
1027,
2828... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sass/node-sass | lib/extensions.js | getPlatformVariant | function getPlatformVariant() {
var contents = '';
if (process.platform !== 'linux') {
return '';
}
try {
contents = fs.readFileSync(process.execPath);
// Buffer.indexOf was added in v1.5.0 so cast to string for old node
// Delay contents.toStrings because it's expensive
if (!contents.indexOf) {
contents = contents.toString();
}
if (contents.indexOf('libc.musl-x86_64.so.1') !== -1) {
return 'musl';
}
} catch (err) { } // eslint-disable-line no-empty
return '';
} | javascript | function getPlatformVariant() {
var contents = '';
if (process.platform !== 'linux') {
return '';
}
try {
contents = fs.readFileSync(process.execPath);
// Buffer.indexOf was added in v1.5.0 so cast to string for old node
// Delay contents.toStrings because it's expensive
if (!contents.indexOf) {
contents = contents.toString();
}
if (contents.indexOf('libc.musl-x86_64.so.1') !== -1) {
return 'musl';
}
} catch (err) { } // eslint-disable-line no-empty
return '';
} | [
"function",
"getPlatformVariant",
"(",
")",
"{",
"var",
"contents",
"=",
"''",
";",
"if",
"(",
"process",
".",
"platform",
"!==",
"'linux'",
")",
"{",
"return",
"''",
";",
"}",
"try",
"{",
"contents",
"=",
"fs",
".",
"readFileSync",
"(",
"process",
"."... | Gets the platform variant, currently either an empty string or 'musl' for Linux/musl platforms.
@api public | [
"Gets",
"the",
"platform",
"variant",
"currently",
"either",
"an",
"empty",
"string",
"or",
"musl",
"for",
"Linux",
"/",
"musl",
"platforms",
"."
] | 0c1a49eefa37544d16041c5fe5b2e3d9168004b7 | https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/extensions.js#L425-L447 | train | Get the platform variant | [
30522,
3853,
2131,
24759,
4017,
14192,
10755,
2937,
2102,
1006,
1007,
1063,
13075,
8417,
1027,
1005,
1005,
1025,
2065,
1006,
2832,
1012,
4132,
999,
1027,
1027,
1005,
11603,
1005,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
3046,
1063,
8417,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/layout/barPolar.js | calRadialBar | function calRadialBar(barSeries, api) {
// Columns info on each category axis. Key is polar name
var columnsMap = {};
zrUtil.each(barSeries, function (seriesModel, idx) {
var data = seriesModel.getData();
var polar = seriesModel.coordinateSystem;
var baseAxis = polar.getBaseAxis();
var axisKey = getAxisKey(polar, baseAxis);
var axisExtent = baseAxis.getExtent();
var bandWidth = baseAxis.type === 'category'
? baseAxis.getBandWidth()
: (Math.abs(axisExtent[1] - axisExtent[0]) / data.count());
var columnsOnAxis = columnsMap[axisKey] || {
bandWidth: bandWidth,
remainedWidth: bandWidth,
autoWidthCount: 0,
categoryGap: '20%',
gap: '30%',
stacks: {}
};
var stacks = columnsOnAxis.stacks;
columnsMap[axisKey] = columnsOnAxis;
var stackId = getSeriesStackId(seriesModel);
if (!stacks[stackId]) {
columnsOnAxis.autoWidthCount++;
}
stacks[stackId] = stacks[stackId] || {
width: 0,
maxWidth: 0
};
var barWidth = parsePercent(
seriesModel.get('barWidth'),
bandWidth
);
var barMaxWidth = parsePercent(
seriesModel.get('barMaxWidth'),
bandWidth
);
var barGap = seriesModel.get('barGap');
var barCategoryGap = seriesModel.get('barCategoryGap');
if (barWidth && !stacks[stackId].width) {
barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth);
stacks[stackId].width = barWidth;
columnsOnAxis.remainedWidth -= barWidth;
}
barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth);
(barGap != null) && (columnsOnAxis.gap = barGap);
(barCategoryGap != null) && (columnsOnAxis.categoryGap = barCategoryGap);
});
var result = {};
zrUtil.each(columnsMap, function (columnsOnAxis, coordSysName) {
result[coordSysName] = {};
var stacks = columnsOnAxis.stacks;
var bandWidth = columnsOnAxis.bandWidth;
var categoryGap = parsePercent(columnsOnAxis.categoryGap, bandWidth);
var barGapPercent = parsePercent(columnsOnAxis.gap, 1);
var remainedWidth = columnsOnAxis.remainedWidth;
var autoWidthCount = columnsOnAxis.autoWidthCount;
var autoWidth = (remainedWidth - categoryGap)
/ (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
autoWidth = Math.max(autoWidth, 0);
// Find if any auto calculated bar exceeded maxBarWidth
zrUtil.each(stacks, function (column, stack) {
var maxWidth = column.maxWidth;
if (maxWidth && maxWidth < autoWidth) {
maxWidth = Math.min(maxWidth, remainedWidth);
if (column.width) {
maxWidth = Math.min(maxWidth, column.width);
}
remainedWidth -= maxWidth;
column.width = maxWidth;
autoWidthCount--;
}
});
// Recalculate width again
autoWidth = (remainedWidth - categoryGap)
/ (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
autoWidth = Math.max(autoWidth, 0);
var widthSum = 0;
var lastColumn;
zrUtil.each(stacks, function (column, idx) {
if (!column.width) {
column.width = autoWidth;
}
lastColumn = column;
widthSum += column.width * (1 + barGapPercent);
});
if (lastColumn) {
widthSum -= lastColumn.width * barGapPercent;
}
var offset = -widthSum / 2;
zrUtil.each(stacks, function (column, stackId) {
result[coordSysName][stackId] = result[coordSysName][stackId] || {
offset: offset,
width: column.width
};
offset += column.width * (1 + barGapPercent);
});
});
return result;
} | javascript | function calRadialBar(barSeries, api) {
// Columns info on each category axis. Key is polar name
var columnsMap = {};
zrUtil.each(barSeries, function (seriesModel, idx) {
var data = seriesModel.getData();
var polar = seriesModel.coordinateSystem;
var baseAxis = polar.getBaseAxis();
var axisKey = getAxisKey(polar, baseAxis);
var axisExtent = baseAxis.getExtent();
var bandWidth = baseAxis.type === 'category'
? baseAxis.getBandWidth()
: (Math.abs(axisExtent[1] - axisExtent[0]) / data.count());
var columnsOnAxis = columnsMap[axisKey] || {
bandWidth: bandWidth,
remainedWidth: bandWidth,
autoWidthCount: 0,
categoryGap: '20%',
gap: '30%',
stacks: {}
};
var stacks = columnsOnAxis.stacks;
columnsMap[axisKey] = columnsOnAxis;
var stackId = getSeriesStackId(seriesModel);
if (!stacks[stackId]) {
columnsOnAxis.autoWidthCount++;
}
stacks[stackId] = stacks[stackId] || {
width: 0,
maxWidth: 0
};
var barWidth = parsePercent(
seriesModel.get('barWidth'),
bandWidth
);
var barMaxWidth = parsePercent(
seriesModel.get('barMaxWidth'),
bandWidth
);
var barGap = seriesModel.get('barGap');
var barCategoryGap = seriesModel.get('barCategoryGap');
if (barWidth && !stacks[stackId].width) {
barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth);
stacks[stackId].width = barWidth;
columnsOnAxis.remainedWidth -= barWidth;
}
barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth);
(barGap != null) && (columnsOnAxis.gap = barGap);
(barCategoryGap != null) && (columnsOnAxis.categoryGap = barCategoryGap);
});
var result = {};
zrUtil.each(columnsMap, function (columnsOnAxis, coordSysName) {
result[coordSysName] = {};
var stacks = columnsOnAxis.stacks;
var bandWidth = columnsOnAxis.bandWidth;
var categoryGap = parsePercent(columnsOnAxis.categoryGap, bandWidth);
var barGapPercent = parsePercent(columnsOnAxis.gap, 1);
var remainedWidth = columnsOnAxis.remainedWidth;
var autoWidthCount = columnsOnAxis.autoWidthCount;
var autoWidth = (remainedWidth - categoryGap)
/ (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
autoWidth = Math.max(autoWidth, 0);
// Find if any auto calculated bar exceeded maxBarWidth
zrUtil.each(stacks, function (column, stack) {
var maxWidth = column.maxWidth;
if (maxWidth && maxWidth < autoWidth) {
maxWidth = Math.min(maxWidth, remainedWidth);
if (column.width) {
maxWidth = Math.min(maxWidth, column.width);
}
remainedWidth -= maxWidth;
column.width = maxWidth;
autoWidthCount--;
}
});
// Recalculate width again
autoWidth = (remainedWidth - categoryGap)
/ (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
autoWidth = Math.max(autoWidth, 0);
var widthSum = 0;
var lastColumn;
zrUtil.each(stacks, function (column, idx) {
if (!column.width) {
column.width = autoWidth;
}
lastColumn = column;
widthSum += column.width * (1 + barGapPercent);
});
if (lastColumn) {
widthSum -= lastColumn.width * barGapPercent;
}
var offset = -widthSum / 2;
zrUtil.each(stacks, function (column, stackId) {
result[coordSysName][stackId] = result[coordSysName][stackId] || {
offset: offset,
width: column.width
};
offset += column.width * (1 + barGapPercent);
});
});
return result;
} | [
"function",
"calRadialBar",
"(",
"barSeries",
",",
"api",
")",
"{",
"// Columns info on each category axis. Key is polar name",
"var",
"columnsMap",
"=",
"{",
"}",
";",
"zrUtil",
".",
"each",
"(",
"barSeries",
",",
"function",
"(",
"seriesModel",
",",
"idx",
")",
... | Calculate bar width and offset for radial bar charts | [
"Calculate",
"bar",
"width",
"and",
"offset",
"for",
"radial",
"bar",
"charts"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/layout/barPolar.js#L180-L301 | train | CalRadialBar calRadialBar | [
30522,
3853,
10250,
12173,
4818,
8237,
1006,
6963,
28077,
1010,
17928,
1007,
1063,
1013,
1013,
7753,
18558,
2006,
2169,
4696,
8123,
1012,
3145,
2003,
11508,
2171,
13075,
7753,
2863,
2361,
1027,
1063,
1065,
1025,
1062,
22134,
4014,
1012,
216... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | checkEnum | function checkEnum(oEnum, sValue, sPropertyName) {
var aValidValues = [];
for (var sKey in oEnum) {
if (oEnum.hasOwnProperty(sKey)) {
if (oEnum[sKey] === sValue) {
return;
}
aValidValues.push(oEnum[sKey]);
}
}
throw new Error("Unsupported Enumeration value for " + sPropertyName + ", valid values are: " + aValidValues.join(", "));
} | javascript | function checkEnum(oEnum, sValue, sPropertyName) {
var aValidValues = [];
for (var sKey in oEnum) {
if (oEnum.hasOwnProperty(sKey)) {
if (oEnum[sKey] === sValue) {
return;
}
aValidValues.push(oEnum[sKey]);
}
}
throw new Error("Unsupported Enumeration value for " + sPropertyName + ", valid values are: " + aValidValues.join(", "));
} | [
"function",
"checkEnum",
"(",
"oEnum",
",",
"sValue",
",",
"sPropertyName",
")",
"{",
"var",
"aValidValues",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"sKey",
"in",
"oEnum",
")",
"{",
"if",
"(",
"oEnum",
".",
"hasOwnProperty",
"(",
"sKey",
")",
")",
"{"... | Checks if a value exists within an enumerable list.
@param {object} oEnum Enumeration object with values for validation
@param {string} sValue Value to check against enumerable list
@param {string} sPropertyName Name of the property which is checked
@throws {Error} If the value could not be found, an error is thrown | [
"Checks",
"if",
"a",
"value",
"exists",
"within",
"an",
"enumerable",
"list",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1613-L1624 | train | Checks if the value of the given enumeration is valid | [
30522,
3853,
4638,
2368,
2819,
1006,
1051,
2368,
30524,
1006,
15315,
3240,
1007,
1007,
1063,
2065,
1006,
1051,
2368,
2819,
1031,
15315,
3240,
1033,
1027,
1027,
1027,
17917,
2389,
5657,
1007,
1063,
2709,
1025,
1065,
10927,
21273,
10175,
1580... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js | function(oTable, bConsiderVisibility) {
var iFixed = oTable.getComputedFixedColumnCount();
if (!bConsiderVisibility) {
return iFixed;
}
if (iFixed <= 0 || oTable._bIgnoreFixedColumnCount) {
return 0;
}
var aColumns = oTable.getColumns();
var iVisibleFixedColumnCount = 0;
iFixed = Math.min(iFixed, aColumns.length);
for (var i = 0; i < iFixed; i++) {
if (aColumns[i].shouldRender()) {
iVisibleFixedColumnCount++;
}
}
return iVisibleFixedColumnCount;
} | javascript | function(oTable, bConsiderVisibility) {
var iFixed = oTable.getComputedFixedColumnCount();
if (!bConsiderVisibility) {
return iFixed;
}
if (iFixed <= 0 || oTable._bIgnoreFixedColumnCount) {
return 0;
}
var aColumns = oTable.getColumns();
var iVisibleFixedColumnCount = 0;
iFixed = Math.min(iFixed, aColumns.length);
for (var i = 0; i < iFixed; i++) {
if (aColumns[i].shouldRender()) {
iVisibleFixedColumnCount++;
}
}
return iVisibleFixedColumnCount;
} | [
"function",
"(",
"oTable",
",",
"bConsiderVisibility",
")",
"{",
"var",
"iFixed",
"=",
"oTable",
".",
"getComputedFixedColumnCount",
"(",
")",
";",
"if",
"(",
"!",
"bConsiderVisibility",
")",
"{",
"return",
"iFixed",
";",
"}",
"if",
"(",
"iFixed",
"<=",
"0... | Returns the number of fixed columns depending on the parameter <code>bConsiderVisibility</code>.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {boolean} bConsiderVisibility If <code>false</code> the result of the <code>getComputedFixedColumnCount</code> function of the
table is returned. If <code>true</code> the visibility is included into the determination of the
count.
@returns {int} Returns the number of fixed columns depending on the parameter <code>bConsiderVisibility</code>. | [
"Returns",
"the",
"number",
"of",
"fixed",
"columns",
"depending",
"on",
"the",
"parameter",
"<code",
">",
"bConsiderVisibility<",
"/",
"code",
">",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L727-L749 | train | Returns the number of visible columns in the table. | [
30522,
3853,
1006,
27178,
3085,
1010,
4647,
5644,
18688,
11365,
13464,
1007,
1063,
13075,
2065,
7646,
2098,
1027,
27178,
3085,
1012,
2131,
9006,
29462,
23901,
25778,
2819,
15305,
16671,
1006,
1007,
1025,
2065,
1006,
999,
4647,
5644,
18688,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-native-helper/build.js | getSlots | function getSlots(children) {
var slots = {};
if (children == null) {
return slots
}
if (!Array.isArray(children)) {
children = [children];
}
children = children.filter(function (v) { return v != null; });
children.forEach(function (v, _i) {
if (typeof v === 'string' || typeof v === 'number' || v === null) {
slots.default = slots.default || [];
slots.default.push(v);
} else if (v.type === COMMON.template.type) {
slots[v['data-slot']] = slots[v['data-slot']] || [];
slots[v['data-slot']].push(v.render);
} else if (v.props) {
var dataSlot = v.props['data-slot'];
if (dataSlot == null) {
slots.default = slots.default || [];
slots.default.push(v);
} else {
slots[dataSlot] = slots[dataSlot] || [];
slots[dataSlot].push(v);
}
}
});
return slots
} | javascript | function getSlots(children) {
var slots = {};
if (children == null) {
return slots
}
if (!Array.isArray(children)) {
children = [children];
}
children = children.filter(function (v) { return v != null; });
children.forEach(function (v, _i) {
if (typeof v === 'string' || typeof v === 'number' || v === null) {
slots.default = slots.default || [];
slots.default.push(v);
} else if (v.type === COMMON.template.type) {
slots[v['data-slot']] = slots[v['data-slot']] || [];
slots[v['data-slot']].push(v.render);
} else if (v.props) {
var dataSlot = v.props['data-slot'];
if (dataSlot == null) {
slots.default = slots.default || [];
slots.default.push(v);
} else {
slots[dataSlot] = slots[dataSlot] || [];
slots[dataSlot].push(v);
}
}
});
return slots
} | [
"function",
"getSlots",
"(",
"children",
")",
"{",
"var",
"slots",
"=",
"{",
"}",
";",
"if",
"(",
"children",
"==",
"null",
")",
"{",
"return",
"slots",
"}",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"children",
")",
")",
"{",
"children",
"=",
... | for 'this.$solts'
@param {this.props.children} children | [
"for",
"this",
".",
"$solts"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-native-helper/build.js#L1741-L1769 | train | Get the slots for a given children | [
30522,
3853,
4152,
10994,
2015,
1006,
2336,
1007,
1063,
13075,
19832,
1027,
1063,
1065,
1025,
2065,
1006,
2336,
1027,
1027,
19701,
1007,
1063,
2709,
19832,
1065,
2065,
1006,
999,
9140,
1012,
18061,
11335,
2100,
1006,
2336,
1007,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/search/node/FindInFilesDomain.js | setResults | function setResults(fullpath, resultInfo, maxResultsToReturn) {
if (results[fullpath]) {
numMatches -= results[fullpath].matches.length;
delete results[fullpath];
}
if (foundMaximum || !resultInfo || !resultInfo.matches || !resultInfo.matches.length) {
return;
}
// Make sure that the optional `collapsed` property is explicitly set to either true or false,
// to avoid logic issues later with comparing values.
resultInfo.collapsed = collapseResults;
results[fullpath] = resultInfo;
numMatches += resultInfo.matches.length;
evaluatedMatches += resultInfo.matches.length;
maxResultsToReturn = maxResultsToReturn || MAX_RESULTS_TO_RETURN;
if (numMatches >= maxResultsToReturn || evaluatedMatches > MAX_TOTAL_RESULTS) {
foundMaximum = true;
}
} | javascript | function setResults(fullpath, resultInfo, maxResultsToReturn) {
if (results[fullpath]) {
numMatches -= results[fullpath].matches.length;
delete results[fullpath];
}
if (foundMaximum || !resultInfo || !resultInfo.matches || !resultInfo.matches.length) {
return;
}
// Make sure that the optional `collapsed` property is explicitly set to either true or false,
// to avoid logic issues later with comparing values.
resultInfo.collapsed = collapseResults;
results[fullpath] = resultInfo;
numMatches += resultInfo.matches.length;
evaluatedMatches += resultInfo.matches.length;
maxResultsToReturn = maxResultsToReturn || MAX_RESULTS_TO_RETURN;
if (numMatches >= maxResultsToReturn || evaluatedMatches > MAX_TOTAL_RESULTS) {
foundMaximum = true;
}
} | [
"function",
"setResults",
"(",
"fullpath",
",",
"resultInfo",
",",
"maxResultsToReturn",
")",
"{",
"if",
"(",
"results",
"[",
"fullpath",
"]",
")",
"{",
"numMatches",
"-=",
"results",
"[",
"fullpath",
"]",
".",
"matches",
".",
"length",
";",
"delete",
"res... | Sets the list of matches for the given path, removing the previous match info, if any, and updating
the total match count. Note that for the count to remain accurate, the previous match info must not have
been mutated since it was set.
@param {string} fullpath Full path to the file containing the matches.
@param {!{matches: Object, collapsed: boolean=}} resultInfo Info for the matches to set:
matches - Array of matches, in the format returned by FindInFiles.getSearchMatches()
collapsed - Optional: whether the results should be collapsed in the UI (default false). | [
"Sets",
"the",
"list",
"of",
"matches",
"for",
"the",
"given",
"path",
"removing",
"the",
"previous",
"match",
"info",
"if",
"any",
"and",
"updating",
"the",
"total",
"match",
"count",
".",
"Note",
"that",
"for",
"the",
"count",
"to",
"remain",
"accurate",... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/node/FindInFilesDomain.js#L237-L258 | train | Sets the results for a given path to the given resultInfo object. | [
30522,
3853,
2275,
6072,
11314,
2015,
1006,
2440,
15069,
1010,
2765,
2378,
14876,
1010,
4098,
6072,
11314,
23809,
3388,
14287,
1007,
1063,
2065,
1006,
3463,
1031,
2440,
15069,
1033,
1007,
1063,
16371,
14760,
10649,
2229,
1011,
1027,
3463,
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/model/odata/AnnotationHelper.js | function (aParts, fnRootFormatter) {
var bMergeNeeded = false,
vPropertySetting;
aParts = aParts.slice(); // shallow copy to avoid changes visible to caller
aParts.forEach(function (vPart, i) {
switch (typeof vPart) {
case "boolean":
case "number":
case "undefined":
bMergeNeeded = true;
break;
case "string":
vPropertySetting = BindingParser.complexParser(vPart, null, true, true);
if (vPropertySetting !== undefined) {
if (vPropertySetting.functionsNotFound) {
throw new Error("Function name(s) "
+ vPropertySetting.functionsNotFound.join(", ")
+ " not found");
}
aParts[i] = vPart = vPropertySetting;
}
// falls through
case "object":
// merge is needed if some parts are constants or again have parts
// Note: a binding info object has either "path" or "parts"
if (!vPart || typeof vPart !== "object" || !("path" in vPart)) {
bMergeNeeded = true;
}
break;
default:
throw new Error("Unsupported part: " + vPart);
}
});
vPropertySetting = {
formatter : fnRootFormatter,
parts : aParts
};
if (bMergeNeeded) {
BindingParser.mergeParts(vPropertySetting);
}
if (vPropertySetting.parts.length === 0) {
// special case: all parts are constant values, call formatter once
vPropertySetting = vPropertySetting.formatter && vPropertySetting.formatter();
if (typeof vPropertySetting === "string") {
vPropertySetting = BindingParser.complexParser.escape(vPropertySetting);
}
} else if (vPropertySetting.parts.length === 1) {
// special case: a single property setting only
// Note: sap.ui.base.ManagedObject#_bindProperty cannot handle the single-part
// case with two formatters, unless the root formatter is marked with
// "textFragments". We unpack here and chain the formatters ourselves.
fnRootFormatter = vPropertySetting.formatter;
vPropertySetting = vPropertySetting.parts[0];
if (fnRootFormatter) {
vPropertySetting.formatter
= chain(fnRootFormatter, vPropertySetting.formatter);
}
}
return vPropertySetting;
} | javascript | function (aParts, fnRootFormatter) {
var bMergeNeeded = false,
vPropertySetting;
aParts = aParts.slice(); // shallow copy to avoid changes visible to caller
aParts.forEach(function (vPart, i) {
switch (typeof vPart) {
case "boolean":
case "number":
case "undefined":
bMergeNeeded = true;
break;
case "string":
vPropertySetting = BindingParser.complexParser(vPart, null, true, true);
if (vPropertySetting !== undefined) {
if (vPropertySetting.functionsNotFound) {
throw new Error("Function name(s) "
+ vPropertySetting.functionsNotFound.join(", ")
+ " not found");
}
aParts[i] = vPart = vPropertySetting;
}
// falls through
case "object":
// merge is needed if some parts are constants or again have parts
// Note: a binding info object has either "path" or "parts"
if (!vPart || typeof vPart !== "object" || !("path" in vPart)) {
bMergeNeeded = true;
}
break;
default:
throw new Error("Unsupported part: " + vPart);
}
});
vPropertySetting = {
formatter : fnRootFormatter,
parts : aParts
};
if (bMergeNeeded) {
BindingParser.mergeParts(vPropertySetting);
}
if (vPropertySetting.parts.length === 0) {
// special case: all parts are constant values, call formatter once
vPropertySetting = vPropertySetting.formatter && vPropertySetting.formatter();
if (typeof vPropertySetting === "string") {
vPropertySetting = BindingParser.complexParser.escape(vPropertySetting);
}
} else if (vPropertySetting.parts.length === 1) {
// special case: a single property setting only
// Note: sap.ui.base.ManagedObject#_bindProperty cannot handle the single-part
// case with two formatters, unless the root formatter is marked with
// "textFragments". We unpack here and chain the formatters ourselves.
fnRootFormatter = vPropertySetting.formatter;
vPropertySetting = vPropertySetting.parts[0];
if (fnRootFormatter) {
vPropertySetting.formatter
= chain(fnRootFormatter, vPropertySetting.formatter);
}
}
return vPropertySetting;
} | [
"function",
"(",
"aParts",
",",
"fnRootFormatter",
")",
"{",
"var",
"bMergeNeeded",
"=",
"false",
",",
"vPropertySetting",
";",
"aParts",
"=",
"aParts",
".",
"slice",
"(",
")",
";",
"// shallow copy to avoid changes visible to caller",
"aParts",
".",
"forEach",
"(... | Creates a property setting (which is either a constant value or a binding info
object) from the given parts and from the optional root formatter function.
Each part can have one of the following types:
<ul>
<li><code>boolean</code>, <code>number</code>, <code>undefined</code>: The part is
a constant value.
<li><code>string</code>: The part is a data binding expression with complex
binding syntax (for example, as created by {@link #.format format}) and is parsed
accordingly to create either a constant value or a binding info object. Proper
backslash escaping must be used for constant values with curly braces.
<li><code>object</code>: The part is a binding info object if it has a "path" or
"parts" property, otherwise it is a constant value.
</ul>
If a binding info object is not the only part and has a "parts" property itself,
then it must have no other properties except "formatter"; this is the case for
expression bindings and data binding expressions created by {@link #.format format}.
If all parts are constant values, the resulting property setting is also a constant
value computed by applying the root formatter function to the constant parts once.
If at least one part is a binding info object, the resulting property setting is
also a binding info object and the root formatter function will be applied again and
again to the current values of all parts, no matter whether constant or variable.
Note: The root formatter function should not rely on its <code>this</code> value
because it depends on how the function is called.
Note: A single data binding expression can be given directly to
{@link sap.ui.base.ManagedObject#applySettings applySettings}, no need to call this
function first.
Example:
<pre>
function myRootFormatter(oValue1, oValue2, sFullName, sGreeting, iAnswer) {
return ...; //TODO compute something useful from the given values
}
oSupplierContext = oMetaModel.getMetaContext("/ProductSet('HT-1021')/ToSupplier");
oValueContext = oMetaModel.createBindingContext("com.sap.vocabularies.UI.v1.DataPoint/Value", oSupplierContext);
vPropertySetting = sap.ui.model.odata.AnnotationHelper.createPropertySetting([
sap.ui.model.odata.AnnotationHelper.format(oValueContext),
"{path : 'meta>Value', formatter : 'sap.ui.model.odata.AnnotationHelper.simplePath'}",
"{:= 'Mr. ' + ${/FirstName} + ' ' + ${/LastName}}",
"hello, world!",
42
], myRootFormatter);
oControl.applySettings({"someProperty" : vPropertySetting});
</pre>
@param {any[]} aParts
array of parts
@param {function} [fnRootFormatter]
root formatter function; default: <code>Array.prototype.join(., " ")</code>
in case of multiple parts, just like
{@link sap.ui.model.CompositeBinding#getExternalValue getExternalValue}
@returns {any|object}
constant value or binding info object for a property as expected by
{@link sap.ui.base.ManagedObject#applySettings applySettings}
@throws {Error}
if some part has an unsupported type or refers to a function name which is not
found
@public
@since 1.31.0 | [
"Creates",
"a",
"property",
"setting",
"(",
"which",
"is",
"either",
"a",
"constant",
"value",
"or",
"a",
"binding",
"info",
"object",
")",
"from",
"the",
"given",
"parts",
"and",
"from",
"the",
"optional",
"root",
"formatter",
"function",
".",
"Each",
"pa... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationHelper.js#L128-L193 | train | This function is called by the parser to parse a list of parts | [
30522,
3853,
1006,
4237,
2015,
1010,
1042,
16118,
17206,
14192,
20097,
1007,
1063,
13075,
1038,
5017,
6914,
13089,
2098,
1027,
6270,
1010,
21210,
18981,
15010,
21678,
2075,
1025,
4237,
2015,
1027,
4237,
2015,
1012,
14704,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jgraph/mxgraph | javascript/mxClient.js | function(fn, lan)
{
var pending = mxClient.defaultBundles.length;
function callback()
{
if (--pending == 0)
{
fn();
}
}
for (var i = 0; i < mxClient.defaultBundles.length; i++)
{
mxResources.add(mxClient.defaultBundles[i], lan, callback);
}
} | javascript | function(fn, lan)
{
var pending = mxClient.defaultBundles.length;
function callback()
{
if (--pending == 0)
{
fn();
}
}
for (var i = 0; i < mxClient.defaultBundles.length; i++)
{
mxResources.add(mxClient.defaultBundles[i], lan, callback);
}
} | [
"function",
"(",
"fn",
",",
"lan",
")",
"{",
"var",
"pending",
"=",
"mxClient",
".",
"defaultBundles",
".",
"length",
";",
"function",
"callback",
"(",
")",
"{",
"if",
"(",
"--",
"pending",
"==",
"0",
")",
"{",
"fn",
"(",
")",
";",
"}",
"}",
"for... | Function: loadResources
Helper method to load the default bundles if mxLoadResources is false.
Parameters:
fn - Function to call after all resources have been loaded.
lan - Optional string to pass to <mxResources.add>. | [
"Function",
":",
"loadResources"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L310-L326 | train | This function is called when the default bundles are added to the pool | [
30522,
3853,
1006,
1042,
2078,
1010,
17595,
1007,
1063,
13075,
14223,
1027,
25630,
20464,
11638,
1012,
12398,
27265,
4244,
1012,
3091,
1025,
3853,
2655,
5963,
1006,
1007,
1063,
2065,
1006,
1011,
1011,
14223,
1027,
1027,
1014,
1007,
1063,
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-ide | packages/side-recorder/src/content/record-handlers.js | findClickableElement | function findClickableElement(e) {
if (!e.tagName) return null
let tagName = e.tagName.toLowerCase()
let type = e.type
if (
e.hasAttribute('onclick') ||
e.hasAttribute('href') ||
tagName == 'button' ||
(tagName == 'input' &&
(type == 'submit' ||
type == 'button' ||
type == 'image' ||
type == 'radio' ||
type == 'checkbox' ||
type == 'reset'))
) {
return e
} else {
if (e.parentNode != null) {
return findClickableElement(e.parentNode)
} else {
return null
}
}
} | javascript | function findClickableElement(e) {
if (!e.tagName) return null
let tagName = e.tagName.toLowerCase()
let type = e.type
if (
e.hasAttribute('onclick') ||
e.hasAttribute('href') ||
tagName == 'button' ||
(tagName == 'input' &&
(type == 'submit' ||
type == 'button' ||
type == 'image' ||
type == 'radio' ||
type == 'checkbox' ||
type == 'reset'))
) {
return e
} else {
if (e.parentNode != null) {
return findClickableElement(e.parentNode)
} else {
return null
}
}
} | [
"function",
"findClickableElement",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"e",
".",
"tagName",
")",
"return",
"null",
"let",
"tagName",
"=",
"e",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
"let",
"type",
"=",
"e",
".",
"type",
"if",
"(",
"e",
".",... | END | [
"END"
] | 2b7852d2bb0d19cf285bae30e7dce2d250bc54ae | https://github.com/SeleniumHQ/selenium-ide/blob/2b7852d2bb0d19cf285bae30e7dce2d250bc54ae/packages/side-recorder/src/content/record-handlers.js#L670-L694 | train | Find Clickable Element | [
30522,
3853,
2424,
20464,
6799,
3085,
12260,
3672,
1006,
1041,
1007,
1063,
2065,
1006,
999,
1041,
1012,
6415,
18442,
1007,
2709,
19701,
2292,
6415,
18442,
1027,
1041,
1012,
6415,
18442,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
2292,
2828... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ODataMetaModel.js | log | function log(iLevel) {
var sLocation;
if (Log.isLoggable(iLevel, sODataMetaModel)) {
sLocation = Array.isArray(vLocation)
? vLocation.join("/")
: vLocation;
Log[iLevel === DEBUG ? "debug" : "warning"](
Array.prototype.slice.call(arguments, 1).join("")
+ (sLocation ? " at /" + sLocation : ""),
sResolvedPath, sODataMetaModel);
}
if (iLevel === WARNING) {
vResult = undefined;
}
return false;
} | javascript | function log(iLevel) {
var sLocation;
if (Log.isLoggable(iLevel, sODataMetaModel)) {
sLocation = Array.isArray(vLocation)
? vLocation.join("/")
: vLocation;
Log[iLevel === DEBUG ? "debug" : "warning"](
Array.prototype.slice.call(arguments, 1).join("")
+ (sLocation ? " at /" + sLocation : ""),
sResolvedPath, sODataMetaModel);
}
if (iLevel === WARNING) {
vResult = undefined;
}
return false;
} | [
"function",
"log",
"(",
"iLevel",
")",
"{",
"var",
"sLocation",
";",
"if",
"(",
"Log",
".",
"isLoggable",
"(",
"iLevel",
",",
"sODataMetaModel",
")",
")",
"{",
"sLocation",
"=",
"Array",
".",
"isArray",
"(",
"vLocation",
")",
"?",
"vLocation",
".",
"jo... | /*
Outputs a log message for the given level. Leads to an <code>undefined</code> result
in case of a WARNING.
@param {sap.base.Log.Level} iLevel
A log level, either DEBUG or WARNING
@param {...string} aTexts
The main text of the message is constructed from the rest of the arguments by
joining them
@returns {boolean}
<code>false</code> | [
"/",
"*",
"Outputs",
"a",
"log",
"message",
"for",
"the",
"given",
"level",
".",
"Leads",
"to",
"an",
"<code",
">",
"undefined<",
"/",
"code",
">",
"result",
"in",
"case",
"of",
"a",
"WARNING",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1140-L1156 | train | Log the given arguments | [
30522,
3853,
8833,
1006,
17869,
15985,
1007,
1063,
13075,
22889,
23909,
1025,
2065,
1006,
8833,
1012,
2003,
21197,
3654,
3468,
1006,
17869,
15985,
1010,
14904,
15464,
12928,
5302,
9247,
1007,
1007,
1063,
22889,
23909,
1027,
9140,
1012,
18061,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-useless-call.js | isCallOrNonVariadicApply | function isCallOrNonVariadicApply(node) {
return (
node.callee.type === "MemberExpression" &&
node.callee.property.type === "Identifier" &&
node.callee.computed === false &&
(
(node.callee.property.name === "call" && node.arguments.length >= 1) ||
(node.callee.property.name === "apply" && node.arguments.length === 2 && node.arguments[1].type === "ArrayExpression")
)
);
} | javascript | function isCallOrNonVariadicApply(node) {
return (
node.callee.type === "MemberExpression" &&
node.callee.property.type === "Identifier" &&
node.callee.computed === false &&
(
(node.callee.property.name === "call" && node.arguments.length >= 1) ||
(node.callee.property.name === "apply" && node.arguments.length === 2 && node.arguments[1].type === "ArrayExpression")
)
);
} | [
"function",
"isCallOrNonVariadicApply",
"(",
"node",
")",
"{",
"return",
"(",
"node",
".",
"callee",
".",
"type",
"===",
"\"MemberExpression\"",
"&&",
"node",
".",
"callee",
".",
"property",
".",
"type",
"===",
"\"Identifier\"",
"&&",
"node",
".",
"callee",
... | ------------------------------------------------------------------------------ Helpers ------------------------------------------------------------------------------
Checks whether or not a node is a `.call()`/`.apply()`.
@param {ASTNode} node - A CallExpression node to check.
@returns {boolean} Whether or not the node is a `.call()`/`.apply()`. | [
"------------------------------------------------------------------------------",
"Helpers",
"------------------------------------------------------------------------------",
"Checks",
"whether",
"or",
"not",
"a",
"node",
"is",
"a",
".",
"call",
"()",
"/",
".",
"apply",
"()",
"."... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-call.js#L19-L29 | train | Returns true if the node is a call or non - variadic apply | [
30522,
3853,
2003,
9289,
10626,
8540,
10755,
28665,
5555,
9397,
2135,
1006,
13045,
1007,
1063,
2709,
1006,
13045,
1012,
2655,
4402,
1012,
2828,
1027,
1027,
1027,
1000,
2266,
10288,
20110,
3258,
1000,
1004,
1004,
13045,
1012,
2655,
4402,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js | function(oNode) {
var aChildren = [];
var aNodes = oNode.childNodes;
for (var i = 0, n = aNodes.length; i < n; i++) {
if (aNodes[i].nodeType === 1) {
aChildren.push(aNodes[i]);
}
}
return aChildren;
} | javascript | function(oNode) {
var aChildren = [];
var aNodes = oNode.childNodes;
for (var i = 0, n = aNodes.length; i < n; i++) {
if (aNodes[i].nodeType === 1) {
aChildren.push(aNodes[i]);
}
}
return aChildren;
} | [
"function",
"(",
"oNode",
")",
"{",
"var",
"aChildren",
"=",
"[",
"]",
";",
"var",
"aNodes",
"=",
"oNode",
".",
"childNodes",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"n",
"=",
"aNodes",
".",
"length",
";",
"i",
"<",
"n",
";",
"i",
"++",
"... | Gets all the children of an XML Node that are element nodes.
@param {Element} oNode - XML node
@returns {Element[]} Array with the children of the node | [
"Gets",
"all",
"the",
"children",
"of",
"an",
"XML",
"Node",
"that",
"are",
"element",
"nodes",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L248-L257 | train | Returns an array of the children of the given node | [
30522,
3853,
1006,
21058,
3207,
1007,
1063,
13075,
9353,
19466,
16200,
2078,
1027,
1031,
1033,
1025,
13075,
2019,
19847,
1027,
21058,
3207,
1012,
2775,
3630,
6155,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1010,
1050,
1027,
2019,
19847,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/component/marker/MarkLineView.js | function (markLineModel, ecModel, api) {
ecModel.eachSeries(function (seriesModel) {
var mlModel = seriesModel.markLineModel;
if (mlModel) {
var mlData = mlModel.getData();
var fromData = mlModel.__from;
var toData = mlModel.__to;
// Update visual and layout of from symbol and to symbol
fromData.each(function (idx) {
updateSingleMarkerEndLayout(fromData, idx, true, seriesModel, api);
updateSingleMarkerEndLayout(toData, idx, false, seriesModel, api);
});
// Update layout of line
mlData.each(function (idx) {
mlData.setItemLayout(idx, [
fromData.getItemLayout(idx),
toData.getItemLayout(idx)
]);
});
this.markerGroupMap.get(seriesModel.id).updateLayout();
}
}, this);
} | javascript | function (markLineModel, ecModel, api) {
ecModel.eachSeries(function (seriesModel) {
var mlModel = seriesModel.markLineModel;
if (mlModel) {
var mlData = mlModel.getData();
var fromData = mlModel.__from;
var toData = mlModel.__to;
// Update visual and layout of from symbol and to symbol
fromData.each(function (idx) {
updateSingleMarkerEndLayout(fromData, idx, true, seriesModel, api);
updateSingleMarkerEndLayout(toData, idx, false, seriesModel, api);
});
// Update layout of line
mlData.each(function (idx) {
mlData.setItemLayout(idx, [
fromData.getItemLayout(idx),
toData.getItemLayout(idx)
]);
});
this.markerGroupMap.get(seriesModel.id).updateLayout();
}
}, this);
} | [
"function",
"(",
"markLineModel",
",",
"ecModel",
",",
"api",
")",
"{",
"ecModel",
".",
"eachSeries",
"(",
"function",
"(",
"seriesModel",
")",
"{",
"var",
"mlModel",
"=",
"seriesModel",
".",
"markLineModel",
";",
"if",
"(",
"mlModel",
")",
"{",
"var",
"... | } }, this); }, | [
"}",
"}",
"this",
")",
";",
"}"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/marker/MarkLineView.js#L225-L249 | train | Update marker layout of markLineModel | [
30522,
3853,
1006,
2928,
4179,
5302,
9247,
1010,
14925,
5302,
9247,
1010,
17928,
1007,
1063,
14925,
5302,
9247,
1012,
2169,
8043,
3111,
1006,
3853,
1006,
2186,
5302,
9247,
1007,
1063,
13075,
19875,
5302,
9247,
1027,
2186,
5302,
9247,
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... | |
mescroll/mescroll | mescroll.js/dist/mescroll.js | function (mescroll, downwarp) {
// 下拉刷新初始化完毕的回调
mescroll.downTipDom = downwarp.getElementsByClassName('downwarp-tip')[0];
mescroll.downProgressDom = downwarp.getElementsByClassName('downwarp-progress')[0];
} | javascript | function (mescroll, downwarp) {
// 下拉刷新初始化完毕的回调
mescroll.downTipDom = downwarp.getElementsByClassName('downwarp-tip')[0];
mescroll.downProgressDom = downwarp.getElementsByClassName('downwarp-progress')[0];
} | [
"function",
"(",
"mescroll",
",",
"downwarp",
")",
"{",
"// 下拉刷新初始化完毕的回调",
"mescroll",
".",
"downTipDom",
"=",
"downwarp",
".",
"getElementsByClassName",
"(",
"'downwarp-tip'",
")",
"[",
"0",
"]",
";",
"mescroll",
".",
"downProgressDom",
"=",
"downwarp",
".",
... | 布局内容 | [
"布局内容"
] | 43d3dcf3062da0fe95995ddcb5e93f5725792c98 | https://github.com/mescroll/mescroll/blob/43d3dcf3062da0fe95995ddcb5e93f5725792c98/mescroll.js/dist/mescroll.js#L85-L89 | train | init downwarp | [
30522,
3853,
1006,
2033,
11020,
28402,
1010,
2091,
9028,
2361,
1007,
1063,
1013,
1013,
1743,
100,
100,
1862,
100,
100,
100,
100,
100,
1916,
100,
100,
2033,
11020,
28402,
1012,
2091,
25101,
9527,
1027,
2091,
9028,
2361,
1012,
2131,
12260,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
fengyuanchen/cropper | dist/cropper.common.js | setCropBoxData | function setCropBoxData(data) {
var cropBoxData = this.cropBoxData;
var aspectRatio = this.options.aspectRatio;
var widthChanged = void 0;
var heightChanged = void 0;
if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
if (isNumber(data.left)) {
cropBoxData.left = data.left;
}
if (isNumber(data.top)) {
cropBoxData.top = data.top;
}
if (isNumber(data.width) && data.width !== cropBoxData.width) {
widthChanged = true;
cropBoxData.width = data.width;
}
if (isNumber(data.height) && data.height !== cropBoxData.height) {
heightChanged = true;
cropBoxData.height = data.height;
}
if (aspectRatio) {
if (widthChanged) {
cropBoxData.height = cropBoxData.width / aspectRatio;
} else if (heightChanged) {
cropBoxData.width = cropBoxData.height * aspectRatio;
}
}
this.renderCropBox();
}
return this;
} | javascript | function setCropBoxData(data) {
var cropBoxData = this.cropBoxData;
var aspectRatio = this.options.aspectRatio;
var widthChanged = void 0;
var heightChanged = void 0;
if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
if (isNumber(data.left)) {
cropBoxData.left = data.left;
}
if (isNumber(data.top)) {
cropBoxData.top = data.top;
}
if (isNumber(data.width) && data.width !== cropBoxData.width) {
widthChanged = true;
cropBoxData.width = data.width;
}
if (isNumber(data.height) && data.height !== cropBoxData.height) {
heightChanged = true;
cropBoxData.height = data.height;
}
if (aspectRatio) {
if (widthChanged) {
cropBoxData.height = cropBoxData.width / aspectRatio;
} else if (heightChanged) {
cropBoxData.width = cropBoxData.height * aspectRatio;
}
}
this.renderCropBox();
}
return this;
} | [
"function",
"setCropBoxData",
"(",
"data",
")",
"{",
"var",
"cropBoxData",
"=",
"this",
".",
"cropBoxData",
";",
"var",
"aspectRatio",
"=",
"this",
".",
"options",
".",
"aspectRatio",
";",
"var",
"widthChanged",
"=",
"void",
"0",
";",
"var",
"heightChanged",... | Set the crop box position and size with new data.
@param {Object} data - The new crop box data.
@returns {Cropper} this | [
"Set",
"the",
"crop",
"box",
"position",
"and",
"size",
"with",
"new",
"data",
"."
] | 6677332a6a375b647f58808dfc24ea09f5804041 | https://github.com/fengyuanchen/cropper/blob/6677332a6a375b647f58808dfc24ea09f5804041/dist/cropper.common.js#L3011-L3049 | train | set crop box data | [
30522,
3853,
2275,
26775,
7361,
8758,
2850,
2696,
1006,
2951,
1007,
1063,
13075,
10416,
8758,
2850,
2696,
1027,
2023,
1012,
10416,
8758,
2850,
2696,
1025,
13075,
7814,
8609,
3695,
1027,
2023,
1012,
7047,
1012,
7814,
8609,
3695,
1025,
13075,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | ws_get_cell_stub | function ws_get_cell_stub(ws, R, C) {
/* A1 cell address */
if(typeof R == "string") return ws[R] || (ws[R] = {t:'z'});
/* cell address object */
if(typeof R != "number") return ws_get_cell_stub(ws, encode_cell(R));
/* R and C are 0-based indices */
return ws_get_cell_stub(ws, encode_cell({r:R,c:C||0}));
} | javascript | function ws_get_cell_stub(ws, R, C) {
/* A1 cell address */
if(typeof R == "string") return ws[R] || (ws[R] = {t:'z'});
/* cell address object */
if(typeof R != "number") return ws_get_cell_stub(ws, encode_cell(R));
/* R and C are 0-based indices */
return ws_get_cell_stub(ws, encode_cell({r:R,c:C||0}));
} | [
"function",
"ws_get_cell_stub",
"(",
"ws",
",",
"R",
",",
"C",
")",
"{",
"/* A1 cell address */",
"if",
"(",
"typeof",
"R",
"==",
"\"string\"",
")",
"return",
"ws",
"[",
"R",
"]",
"||",
"(",
"ws",
"[",
"R",
"]",
"=",
"{",
"t",
":",
"'z'",
"}",
")... | /* get cell, creating a stub if necessary | [
"/",
"*",
"get",
"cell",
"creating",
"a",
"stub",
"if",
"necessary"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L20765-L20772 | train | Returns a cell stub | [
30522,
3853,
1059,
2015,
1035,
2131,
1035,
3526,
1035,
24646,
2497,
1006,
1059,
2015,
1010,
1054,
1010,
1039,
1007,
1063,
1013,
1008,
17350,
3526,
4769,
1008,
1013,
2065,
1006,
2828,
11253,
1054,
1027,
1027,
1000,
5164,
1000,
1007,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/semi.js | isEndOfArrowBlock | function isEndOfArrowBlock(lastToken) {
if (!astUtils.isClosingBraceToken(lastToken)) {
return false;
}
const node = sourceCode.getNodeByRangeIndex(lastToken.range[0]);
return (
node.type === "BlockStatement" &&
node.parent.type === "ArrowFunctionExpression"
);
} | javascript | function isEndOfArrowBlock(lastToken) {
if (!astUtils.isClosingBraceToken(lastToken)) {
return false;
}
const node = sourceCode.getNodeByRangeIndex(lastToken.range[0]);
return (
node.type === "BlockStatement" &&
node.parent.type === "ArrowFunctionExpression"
);
} | [
"function",
"isEndOfArrowBlock",
"(",
"lastToken",
")",
"{",
"if",
"(",
"!",
"astUtils",
".",
"isClosingBraceToken",
"(",
"lastToken",
")",
")",
"{",
"return",
"false",
";",
"}",
"const",
"node",
"=",
"sourceCode",
".",
"getNodeByRangeIndex",
"(",
"lastToken",... | Check whether a given token is the closing brace of an arrow function.
@param {Token} lastToken A token to check.
@returns {boolean} `true` if the token is the closing brace of an arrow function. | [
"Check",
"whether",
"a",
"given",
"token",
"is",
"the",
"closing",
"brace",
"of",
"an",
"arrow",
"function",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/semi.js#L149-L159 | train | Check if the last token is a closing brace | [
30522,
3853,
2003,
10497,
11253,
2906,
10524,
23467,
1006,
2197,
18715,
2368,
1007,
1063,
2065,
1006,
999,
2004,
8525,
3775,
4877,
1012,
2003,
20464,
18606,
10024,
3401,
18715,
2368,
1006,
2197,
18715,
2368,
1007,
1007,
1063,
2709,
6270,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/QuickOpenCSS/main.js | createSelectorList | function createSelectorList() {
var doc = DocumentManager.getCurrentDocument();
if (!doc) {
return;
}
var docText = doc.getText();
return CSSUtils.extractAllSelectors(docText, doc.getLanguage().getMode());
} | javascript | function createSelectorList() {
var doc = DocumentManager.getCurrentDocument();
if (!doc) {
return;
}
var docText = doc.getText();
return CSSUtils.extractAllSelectors(docText, doc.getLanguage().getMode());
} | [
"function",
"createSelectorList",
"(",
")",
"{",
"var",
"doc",
"=",
"DocumentManager",
".",
"getCurrentDocument",
"(",
")",
";",
"if",
"(",
"!",
"doc",
")",
"{",
"return",
";",
"}",
"var",
"docText",
"=",
"doc",
".",
"getText",
"(",
")",
";",
"return",... | Returns a list of information about selectors for a single document. This array is populated
by createSelectorList()
@return {?Array.<FileLocation>} | [
"Returns",
"a",
"list",
"of",
"information",
"about",
"selectors",
"for",
"a",
"single",
"document",
".",
"This",
"array",
"is",
"populated",
"by",
"createSelectorList",
"()"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/QuickOpenCSS/main.js#L40-L48 | train | Creates a list of selector objects | [
30522,
3853,
9005,
12260,
16761,
9863,
1006,
1007,
1063,
13075,
9986,
1027,
6254,
24805,
4590,
1012,
2131,
10841,
14343,
3372,
3527,
24894,
4765,
1006,
1007,
1025,
2065,
1006,
999,
9986,
1007,
1063,
2709,
1025,
1065,
13075,
9986,
18209,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/progressLinear/progress-linear.js | MdProgressLinearDirective | function MdProgressLinearDirective($mdTheming, $mdUtil, $log) {
var MODE_DETERMINATE = "determinate";
var MODE_INDETERMINATE = "indeterminate";
var MODE_BUFFER = "buffer";
var MODE_QUERY = "query";
var DISABLED_CLASS = "_md-progress-linear-disabled";
return {
restrict: 'E',
template: '<div class="md-container">' +
'<div class="md-dashed"></div>' +
'<div class="md-bar md-bar1"></div>' +
'<div class="md-bar md-bar2"></div>' +
'</div>',
compile: compile
};
function compile(tElement, tAttrs, transclude) {
tElement.attr('aria-valuemin', 0);
tElement.attr('aria-valuemax', 100);
tElement.attr('role', 'progressbar');
return postLink;
}
function postLink(scope, element, attr) {
$mdTheming(element);
var lastMode;
var isDisabled = attr.hasOwnProperty('disabled');
var toVendorCSS = $mdUtil.dom.animator.toCss;
var bar1 = angular.element(element[0].querySelector('.md-bar1'));
var bar2 = angular.element(element[0].querySelector('.md-bar2'));
var container = angular.element(element[0].querySelector('.md-container'));
element
.attr('md-mode', mode())
.toggleClass(DISABLED_CLASS, isDisabled);
validateMode();
watchAttributes();
/**
* Watch the value, md-buffer-value, and md-mode attributes
*/
function watchAttributes() {
attr.$observe('value', function(value) {
var percentValue = clamp(value);
element.attr('aria-valuenow', percentValue);
if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);
});
attr.$observe('mdBufferValue', function(value) {
animateIndicator(bar1, clamp(value));
});
attr.$observe('disabled', function(value) {
if (value === true || value === false) {
isDisabled = !!value;
} else {
isDisabled = angular.isDefined(value);
}
element.toggleClass(DISABLED_CLASS, isDisabled);
container.toggleClass(lastMode, !isDisabled);
});
attr.$observe('mdMode', function(mode) {
if (lastMode) container.removeClass(lastMode);
switch (mode) {
case MODE_QUERY:
case MODE_BUFFER:
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
container.addClass(lastMode = "md-mode-" + mode);
break;
default:
container.addClass(lastMode = "md-mode-" + MODE_INDETERMINATE);
break;
}
});
}
/**
* Auto-defaults the mode to either `determinate` or `indeterminate` mode; if not specified
*/
function validateMode() {
if (angular.isUndefined(attr.mdMode)) {
var hasValue = angular.isDefined(attr.value);
var mode = hasValue ? MODE_DETERMINATE : MODE_INDETERMINATE;
var info = "Auto-adding the missing md-mode='{0}' to the ProgressLinear element";
element.attr("md-mode", mode);
attr.mdMode = mode;
}
}
/**
* Is the md-mode a valid option?
*/
function mode() {
var value = (attr.mdMode || "").trim();
if (value) {
switch (value) {
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
case MODE_BUFFER:
case MODE_QUERY:
break;
default:
value = MODE_INDETERMINATE;
break;
}
}
return value;
}
/**
* Manually set CSS to animate the Determinate indicator based on the specified
* percentage value (0-100).
*/
function animateIndicator(target, value) {
if (isDisabled || !mode()) return;
var to = $mdUtil.supplant("translateX({0}%) scale({1},1)", [(value-100)/2, value/100]);
var styles = toVendorCSS({ transform : to });
angular.element(target).css(styles);
}
}
/**
* Clamps the value to be between 0 and 100.
* @param {number} value The value to clamp.
* @returns {number}
*/
function clamp(value) {
return Math.max(0, Math.min(value || 0, 100));
}
} | javascript | function MdProgressLinearDirective($mdTheming, $mdUtil, $log) {
var MODE_DETERMINATE = "determinate";
var MODE_INDETERMINATE = "indeterminate";
var MODE_BUFFER = "buffer";
var MODE_QUERY = "query";
var DISABLED_CLASS = "_md-progress-linear-disabled";
return {
restrict: 'E',
template: '<div class="md-container">' +
'<div class="md-dashed"></div>' +
'<div class="md-bar md-bar1"></div>' +
'<div class="md-bar md-bar2"></div>' +
'</div>',
compile: compile
};
function compile(tElement, tAttrs, transclude) {
tElement.attr('aria-valuemin', 0);
tElement.attr('aria-valuemax', 100);
tElement.attr('role', 'progressbar');
return postLink;
}
function postLink(scope, element, attr) {
$mdTheming(element);
var lastMode;
var isDisabled = attr.hasOwnProperty('disabled');
var toVendorCSS = $mdUtil.dom.animator.toCss;
var bar1 = angular.element(element[0].querySelector('.md-bar1'));
var bar2 = angular.element(element[0].querySelector('.md-bar2'));
var container = angular.element(element[0].querySelector('.md-container'));
element
.attr('md-mode', mode())
.toggleClass(DISABLED_CLASS, isDisabled);
validateMode();
watchAttributes();
/**
* Watch the value, md-buffer-value, and md-mode attributes
*/
function watchAttributes() {
attr.$observe('value', function(value) {
var percentValue = clamp(value);
element.attr('aria-valuenow', percentValue);
if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);
});
attr.$observe('mdBufferValue', function(value) {
animateIndicator(bar1, clamp(value));
});
attr.$observe('disabled', function(value) {
if (value === true || value === false) {
isDisabled = !!value;
} else {
isDisabled = angular.isDefined(value);
}
element.toggleClass(DISABLED_CLASS, isDisabled);
container.toggleClass(lastMode, !isDisabled);
});
attr.$observe('mdMode', function(mode) {
if (lastMode) container.removeClass(lastMode);
switch (mode) {
case MODE_QUERY:
case MODE_BUFFER:
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
container.addClass(lastMode = "md-mode-" + mode);
break;
default:
container.addClass(lastMode = "md-mode-" + MODE_INDETERMINATE);
break;
}
});
}
/**
* Auto-defaults the mode to either `determinate` or `indeterminate` mode; if not specified
*/
function validateMode() {
if (angular.isUndefined(attr.mdMode)) {
var hasValue = angular.isDefined(attr.value);
var mode = hasValue ? MODE_DETERMINATE : MODE_INDETERMINATE;
var info = "Auto-adding the missing md-mode='{0}' to the ProgressLinear element";
element.attr("md-mode", mode);
attr.mdMode = mode;
}
}
/**
* Is the md-mode a valid option?
*/
function mode() {
var value = (attr.mdMode || "").trim();
if (value) {
switch (value) {
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
case MODE_BUFFER:
case MODE_QUERY:
break;
default:
value = MODE_INDETERMINATE;
break;
}
}
return value;
}
/**
* Manually set CSS to animate the Determinate indicator based on the specified
* percentage value (0-100).
*/
function animateIndicator(target, value) {
if (isDisabled || !mode()) return;
var to = $mdUtil.supplant("translateX({0}%) scale({1},1)", [(value-100)/2, value/100]);
var styles = toVendorCSS({ transform : to });
angular.element(target).css(styles);
}
}
/**
* Clamps the value to be between 0 and 100.
* @param {number} value The value to clamp.
* @returns {number}
*/
function clamp(value) {
return Math.max(0, Math.min(value || 0, 100));
}
} | [
"function",
"MdProgressLinearDirective",
"(",
"$mdTheming",
",",
"$mdUtil",
",",
"$log",
")",
"{",
"var",
"MODE_DETERMINATE",
"=",
"\"determinate\"",
";",
"var",
"MODE_INDETERMINATE",
"=",
"\"indeterminate\"",
";",
"var",
"MODE_BUFFER",
"=",
"\"buffer\"",
";",
"var"... | @ngdoc directive
@name mdProgressLinear
@module material.components.progressLinear
@restrict E
@description
The linear progress directive is used to make loading content
in your app as delightful and painless as possible by minimizing
the amount of visual change a user sees before they can view
and interact with content.
Each operation should only be represented by one activity indicator
For example: one refresh operation should not display both a
refresh bar and an activity circle.
For operations where the percentage of the operation completed
can be determined, use a determinate indicator. They give users
a quick sense of how long an operation will take.
For operations where the user is asked to wait a moment while
something finishes up, and it’s not necessary to expose what's
happening behind the scenes and how long it will take, use an
indeterminate indicator.
@param {string} md-mode Select from one of four modes: determinate, indeterminate, buffer or query.
Note: if the `md-mode` value is set as undefined or specified as 1 of the four (4) valid modes, then `indeterminate`
will be auto-applied as the mode.
Note: if not configured, the `md-mode="indeterminate"` will be auto injected as an attribute. If `value=""` is also specified, however,
then `md-mode="determinate"` would be auto-injected instead.
@param {number=} value In determinate and buffer modes, this number represents the percentage of the primary progress bar. Default: 0
@param {number=} md-buffer-value In the buffer mode, this number represents the percentage of the secondary progress bar. Default: 0
@param {boolean=} ng-disabled Determines whether to disable the progress element.
@usage
<hljs lang="html">
<md-progress-linear md-mode="determinate" value="..."></md-progress-linear>
<md-progress-linear md-mode="determinate" ng-value="..."></md-progress-linear>
<md-progress-linear md-mode="indeterminate"></md-progress-linear>
<md-progress-linear md-mode="buffer" value="..." md-buffer-value="..."></md-progress-linear>
<md-progress-linear md-mode="query"></md-progress-linear>
</hljs> | [
"@ngdoc",
"directive",
"@name",
"mdProgressLinear",
"@module",
"material",
".",
"components",
".",
"progressLinear",
"@restrict",
"E"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/progressLinear/progress-linear.js#L60-L198 | train | A directive that displays a progress linear indicator. | [
30522,
3853,
9108,
21572,
17603,
4757,
4179,
4232,
7442,
15277,
1006,
1002,
9108,
10760,
6562,
1010,
1002,
9108,
21823,
2140,
1010,
1002,
8833,
1007,
1063,
13075,
5549,
1035,
28283,
19269,
1027,
1000,
28283,
19269,
1000,
1025,
13075,
5549,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/LiveDevelopmentUtils.js | isStaticHtmlFileExt | function isStaticHtmlFileExt(filePath) {
if (!filePath) {
return false;
}
return (_staticHtmlFileExts.indexOf(LanguageManager.getLanguageForPath(filePath).getId()) !== -1);
} | javascript | function isStaticHtmlFileExt(filePath) {
if (!filePath) {
return false;
}
return (_staticHtmlFileExts.indexOf(LanguageManager.getLanguageForPath(filePath).getId()) !== -1);
} | [
"function",
"isStaticHtmlFileExt",
"(",
"filePath",
")",
"{",
"if",
"(",
"!",
"filePath",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"_staticHtmlFileExts",
".",
"indexOf",
"(",
"LanguageManager",
".",
"getLanguageForPath",
"(",
"filePath",
")",
".",... | Determine if file extension is a static html file extension.
@param {string} filePath could be a path, a file name or just a file extension
@return {boolean} Returns true if fileExt is in the list | [
"Determine",
"if",
"file",
"extension",
"is",
"a",
"static",
"html",
"file",
"extension",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopmentUtils.js#L45-L51 | train | Check if a file is static | [
30522,
3853,
26354,
29336,
7033,
21246,
10270,
9463,
10288,
2102,
1006,
5371,
15069,
1007,
1063,
2065,
1006,
999,
5371,
15069,
1007,
1063,
2709,
6270,
1025,
1065,
2709,
1006,
1035,
10763,
11039,
19968,
8873,
10559,
30524,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/array-element-newline.js | reportNoLineBreak | function reportNoLineBreak(token) {
const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true });
context.report({
loc: {
start: tokenBefore.loc.end,
end: token.loc.start
},
messageId: "unexpectedLineBreak",
fix(fixer) {
if (astUtils.isCommentToken(tokenBefore)) {
return null;
}
if (!astUtils.isTokenOnSameLine(tokenBefore, token)) {
return fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], " ");
}
/*
* This will check if the comma is on the same line as the next element
* Following array:
* [
* 1
* , 2
* , 3
* ]
*
* will be fixed to:
* [
* 1, 2, 3
* ]
*/
const twoTokensBefore = sourceCode.getTokenBefore(tokenBefore, { includeComments: true });
if (astUtils.isCommentToken(twoTokensBefore)) {
return null;
}
return fixer.replaceTextRange([twoTokensBefore.range[1], tokenBefore.range[0]], "");
}
});
} | javascript | function reportNoLineBreak(token) {
const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true });
context.report({
loc: {
start: tokenBefore.loc.end,
end: token.loc.start
},
messageId: "unexpectedLineBreak",
fix(fixer) {
if (astUtils.isCommentToken(tokenBefore)) {
return null;
}
if (!astUtils.isTokenOnSameLine(tokenBefore, token)) {
return fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], " ");
}
/*
* This will check if the comma is on the same line as the next element
* Following array:
* [
* 1
* , 2
* , 3
* ]
*
* will be fixed to:
* [
* 1, 2, 3
* ]
*/
const twoTokensBefore = sourceCode.getTokenBefore(tokenBefore, { includeComments: true });
if (astUtils.isCommentToken(twoTokensBefore)) {
return null;
}
return fixer.replaceTextRange([twoTokensBefore.range[1], tokenBefore.range[0]], "");
}
});
} | [
"function",
"reportNoLineBreak",
"(",
"token",
")",
"{",
"const",
"tokenBefore",
"=",
"sourceCode",
".",
"getTokenBefore",
"(",
"token",
",",
"{",
"includeComments",
":",
"true",
"}",
")",
";",
"context",
".",
"report",
"(",
"{",
"loc",
":",
"{",
"start",
... | Reports that there shouldn't be a line break after the first token
@param {Token} token - The token to use for the report.
@returns {void} | [
"Reports",
"that",
"there",
"shouldn",
"t",
"be",
"a",
"line",
"break",
"after",
"the",
"first",
"token"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/array-element-newline.js#L108-L150 | train | Reports an unexpected line break. | [
30522,
3853,
3189,
3630,
4179,
23890,
1006,
19204,
1007,
1063,
9530,
3367,
19204,
4783,
29278,
2063,
1027,
3120,
16044,
1012,
2131,
18715,
2368,
4783,
29278,
2063,
1006,
19204,
1010,
1063,
2421,
9006,
8163,
1024,
2995,
1065,
1007,
1025,
612... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-mixed-spaces-and-tabs.js | afterLoc | function afterLoc(loc, line, column) {
if (line > loc.end.line) {
return true;
}
return line === loc.end.line && column > loc.end.column;
} | javascript | function afterLoc(loc, line, column) {
if (line > loc.end.line) {
return true;
}
return line === loc.end.line && column > loc.end.column;
} | [
"function",
"afterLoc",
"(",
"loc",
",",
"line",
",",
"column",
")",
"{",
"if",
"(",
"line",
">",
"loc",
".",
"end",
".",
"line",
")",
"{",
"return",
"true",
";",
"}",
"return",
"line",
"===",
"loc",
".",
"end",
".",
"line",
"&&",
"column",
">",
... | Determines if a given line and column are after a location.
@param {Location} loc The location object from an AST node.
@param {int} line The line to check.
@param {int} column The column to check.
@returns {boolean} True if the line and column are after the location, false if not.
@private | [
"Determines",
"if",
"a",
"given",
"line",
"and",
"column",
"are",
"after",
"a",
"location",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-mixed-spaces-and-tabs.js#L67-L72 | train | returns true if loc is after end | [
30522,
3853,
2044,
4135,
2278,
1006,
8840,
2278,
1010,
2240,
1010,
5930,
1007,
1063,
2065,
1006,
2240,
1028,
8840,
2278,
1012,
2203,
1012,
2240,
1007,
1063,
2709,
2995,
1025,
1065,
2709,
2240,
1027,
1027,
1027,
8840,
2278,
1012,
2203,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/component/visualMap/visualEncoding.js | getColorVisual | function getColorVisual(seriesModel, visualMapModel, value, valueState) {
var mappings = visualMapModel.targetVisuals[valueState];
var visualTypes = VisualMapping.prepareVisualTypes(mappings);
var resultVisual = {
color: seriesModel.getData().getVisual('color') // default color.
};
for (var i = 0, len = visualTypes.length; i < len; i++) {
var type = visualTypes[i];
var mapping = mappings[
type === 'opacity' ? '__alphaForOpacity' : type
];
mapping && mapping.applyVisual(value, getVisual, setVisual);
}
return resultVisual.color;
function getVisual(key) {
return resultVisual[key];
}
function setVisual(key, value) {
resultVisual[key] = value;
}
} | javascript | function getColorVisual(seriesModel, visualMapModel, value, valueState) {
var mappings = visualMapModel.targetVisuals[valueState];
var visualTypes = VisualMapping.prepareVisualTypes(mappings);
var resultVisual = {
color: seriesModel.getData().getVisual('color') // default color.
};
for (var i = 0, len = visualTypes.length; i < len; i++) {
var type = visualTypes[i];
var mapping = mappings[
type === 'opacity' ? '__alphaForOpacity' : type
];
mapping && mapping.applyVisual(value, getVisual, setVisual);
}
return resultVisual.color;
function getVisual(key) {
return resultVisual[key];
}
function setVisual(key, value) {
resultVisual[key] = value;
}
} | [
"function",
"getColorVisual",
"(",
"seriesModel",
",",
"visualMapModel",
",",
"value",
",",
"valueState",
")",
"{",
"var",
"mappings",
"=",
"visualMapModel",
".",
"targetVisuals",
"[",
"valueState",
"]",
";",
"var",
"visualTypes",
"=",
"VisualMapping",
".",
"pre... | FIXME performance and export for heatmap? value can be Infinity or -Infinity | [
"FIXME",
"performance",
"and",
"export",
"for",
"heatmap?",
"value",
"can",
"be",
"Infinity",
"or",
"-",
"Infinity"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/visualMap/visualEncoding.js#L82-L106 | train | Get color visual for a given value | [
30522,
3853,
2131,
18717,
11365,
8787,
1006,
2186,
5302,
9247,
1010,
5107,
2863,
9737,
10244,
2140,
1010,
3643,
1010,
5300,
12259,
1007,
1063,
13075,
12375,
2015,
1027,
5107,
2863,
9737,
10244,
2140,
1012,
4539,
11365,
8787,
2015,
1031,
530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/weex-vue-framework/factory.js | renderStatic | function renderStatic (
index,
isInFor
) {
var tree = this._staticTrees[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
if (tree && !isInFor) {
return Array.isArray(tree)
? cloneVNodes(tree)
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = this._staticTrees[index] =
this.$options.staticRenderFns[index].call(this._renderProxy);
markStatic(tree, ("__static__" + index), false);
return tree
} | javascript | function renderStatic (
index,
isInFor
) {
var tree = this._staticTrees[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
if (tree && !isInFor) {
return Array.isArray(tree)
? cloneVNodes(tree)
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = this._staticTrees[index] =
this.$options.staticRenderFns[index].call(this._renderProxy);
markStatic(tree, ("__static__" + index), false);
return tree
} | [
"function",
"renderStatic",
"(",
"index",
",",
"isInFor",
")",
"{",
"var",
"tree",
"=",
"this",
".",
"_staticTrees",
"[",
"index",
"]",
";",
"// if has already-rendered static tree and not inside v-for,",
"// we can reuse the same tree by doing a shallow clone.",
"if",
"(",... | /*
Runtime helper for rendering static trees. | [
"/",
"*",
"Runtime",
"helper",
"for",
"rendering",
"static",
"trees",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-vue-framework/factory.js#L3459-L3476 | train | render static tree | [
30522,
3853,
17552,
16677,
1006,
5950,
1010,
2003,
2378,
29278,
1007,
1063,
13075,
3392,
1027,
2023,
1012,
1035,
10763,
13334,
2015,
1031,
5950,
1033,
1025,
1013,
1013,
2065,
2038,
2525,
1011,
10155,
10763,
3392,
1998,
2025,
2503,
1058,
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... |
badges/shields | services/nuget/nuget-v3-service-family.js | apiUrl | function apiUrl({ withTenant, apiBaseUrl, apiDomain, tenant, withFeed, feed }) {
let result = withTenant
? `https://${tenant || 'www'}.${apiDomain}`
: apiBaseUrl
if (withFeed) {
result += `/F/${feed}/api/v3`
}
return result
} | javascript | function apiUrl({ withTenant, apiBaseUrl, apiDomain, tenant, withFeed, feed }) {
let result = withTenant
? `https://${tenant || 'www'}.${apiDomain}`
: apiBaseUrl
if (withFeed) {
result += `/F/${feed}/api/v3`
}
return result
} | [
"function",
"apiUrl",
"(",
"{",
"withTenant",
",",
"apiBaseUrl",
",",
"apiDomain",
",",
"tenant",
",",
"withFeed",
",",
"feed",
"}",
")",
"{",
"let",
"result",
"=",
"withTenant",
"?",
"`",
"${",
"tenant",
"||",
"'www'",
"}",
"${",
"apiDomain",
"}",
"`"... | /*
Construct the URL for an individual request.
`apiBaseUrl`, `apiDomain`, `withTenant` and `withFeed` come from the service
configuration. When `withTenant` and `withFeed` are false, return
`apiBaseUrl` for every request.
When `withTenant` and/or `withFeed` are true, `tenant` and `feed` come from the
request, and this returns a different URL for each request.
In practice, `withTenant` and `withFeed` are used together, for MyGet. | [
"/",
"*",
"Construct",
"the",
"URL",
"for",
"an",
"individual",
"request",
"."
] | 283601423f3d1a19aae83bf62032d40683948636 | https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/services/nuget/nuget-v3-service-family.js#L39-L47 | train | Returns the url to the API | [
30522,
3853,
17928,
3126,
2140,
1006,
1063,
2007,
6528,
4630,
1010,
17928,
15058,
3126,
2140,
1010,
17928,
9527,
8113,
1010,
16713,
1010,
2007,
7959,
2098,
1010,
5438,
1065,
1007,
1063,
2292,
2765,
1027,
2007,
6528,
4630,
1029,
1036,
16770,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/search/FindUtils.js | labelForScope | function labelForScope(scope) {
if (scope) {
return StringUtils.format(
Strings.FIND_IN_FILES_SCOPED,
StringUtils.breakableUrl(
ProjectManager.makeProjectRelativeIfPossible(scope.fullPath)
)
);
} else {
return Strings.FIND_IN_FILES_NO_SCOPE;
}
} | javascript | function labelForScope(scope) {
if (scope) {
return StringUtils.format(
Strings.FIND_IN_FILES_SCOPED,
StringUtils.breakableUrl(
ProjectManager.makeProjectRelativeIfPossible(scope.fullPath)
)
);
} else {
return Strings.FIND_IN_FILES_NO_SCOPE;
}
} | [
"function",
"labelForScope",
"(",
"scope",
")",
"{",
"if",
"(",
"scope",
")",
"{",
"return",
"StringUtils",
".",
"format",
"(",
"Strings",
".",
"FIND_IN_FILES_SCOPED",
",",
"StringUtils",
".",
"breakableUrl",
"(",
"ProjectManager",
".",
"makeProjectRelativeIfPossi... | Returns label text to indicate the search scope. Already HTML-escaped.
@param {?Entry} scope
@return {string} | [
"Returns",
"label",
"text",
"to",
"indicate",
"the",
"search",
"scope",
".",
"Already",
"HTML",
"-",
"escaped",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindUtils.js#L286-L297 | train | Returns a label for the given scope | [
30522,
3853,
3830,
29278,
26127,
1006,
9531,
1007,
1063,
2065,
1006,
9531,
1007,
1063,
2709,
5164,
21823,
4877,
1012,
4289,
1006,
7817,
1012,
2424,
1035,
1999,
1035,
6764,
1035,
9531,
2094,
1010,
5164,
21823,
4877,
1012,
3338,
3085,
3126,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/marker/MarkLineView.js | ifMarkLineHasOnlyDim | function ifMarkLineHasOnlyDim(dimIndex, fromCoord, toCoord, coordSys) {
var otherDimIndex = 1 - dimIndex;
var dimName = coordSys.dimensions[dimIndex];
return isInifinity(fromCoord[otherDimIndex]) && isInifinity(toCoord[otherDimIndex])
&& fromCoord[dimIndex] === toCoord[dimIndex] && coordSys.getAxis(dimName).containData(fromCoord[dimIndex]);
} | javascript | function ifMarkLineHasOnlyDim(dimIndex, fromCoord, toCoord, coordSys) {
var otherDimIndex = 1 - dimIndex;
var dimName = coordSys.dimensions[dimIndex];
return isInifinity(fromCoord[otherDimIndex]) && isInifinity(toCoord[otherDimIndex])
&& fromCoord[dimIndex] === toCoord[dimIndex] && coordSys.getAxis(dimName).containData(fromCoord[dimIndex]);
} | [
"function",
"ifMarkLineHasOnlyDim",
"(",
"dimIndex",
",",
"fromCoord",
",",
"toCoord",
",",
"coordSys",
")",
"{",
"var",
"otherDimIndex",
"=",
"1",
"-",
"dimIndex",
";",
"var",
"dimName",
"=",
"coordSys",
".",
"dimensions",
"[",
"dimIndex",
"]",
";",
"return... | If a markLine has one dim | [
"If",
"a",
"markLine",
"has",
"one",
"dim"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/marker/MarkLineView.js#L107-L112 | train | Check if a mark line has only dimIndex | [
30522,
3853,
2065,
10665,
4179,
14949,
2239,
2135,
22172,
1006,
11737,
22254,
10288,
1010,
2013,
3597,
8551,
1010,
2000,
3597,
8551,
1010,
2522,
8551,
6508,
2015,
1007,
1063,
13075,
2060,
22172,
22254,
10288,
1027,
1015,
1011,
11737,
22254,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/radio/radio.js | function(index, state) {
var self = this;
// Highlight/un-highlight the row.
window['station' + index].style.backgroundColor = state ? 'rgba(255, 255, 255, 0.33)' : '';
// Show/hide the "live" marker.
window['live' + index].style.opacity = state ? 1 : 0;
// Show/hide the "playing" animation.
window['playing' + index].style.display = state ? 'block' : 'none';
} | javascript | function(index, state) {
var self = this;
// Highlight/un-highlight the row.
window['station' + index].style.backgroundColor = state ? 'rgba(255, 255, 255, 0.33)' : '';
// Show/hide the "live" marker.
window['live' + index].style.opacity = state ? 1 : 0;
// Show/hide the "playing" animation.
window['playing' + index].style.display = state ? 'block' : 'none';
} | [
"function",
"(",
"index",
",",
"state",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Highlight/un-highlight the row.",
"window",
"[",
"'station'",
"+",
"index",
"]",
".",
"style",
".",
"backgroundColor",
"=",
"state",
"?",
"'rgba(255, 255, 255, 0.33)'",
":",
... | Toggle the display of a station to off/on.
@param {Number} index Index of the station to toggle.
@param {Boolean} state true is on and false is off. | [
"Toggle",
"the",
"display",
"of",
"a",
"station",
"to",
"off",
"/",
"on",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/radio/radio.js#L101-L112 | train | Set the state of a row of the cluster | [
30522,
3853,
1006,
5950,
1010,
2110,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
12944,
1013,
4895,
1011,
12944,
1996,
5216,
1012,
3332,
1031,
1005,
2276,
1005,
1009,
5950,
1033,
1012,
2806,
1012,
4281,
18717,
1027,
2110,
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... | |
adobe/brackets | src/editor/EditorManager.js | _toggleInlineWidget | function _toggleInlineWidget(providers, errorMsg) {
var result = new $.Deferred();
var currentEditor = getCurrentFullEditor();
if (currentEditor) {
var inlineWidget = currentEditor.getFocusedInlineWidget();
if (inlineWidget) {
// an inline widget's editor has focus, so close it
PerfUtils.markStart(PerfUtils.INLINE_WIDGET_CLOSE);
inlineWidget.close().done(function () {
PerfUtils.addMeasurement(PerfUtils.INLINE_WIDGET_CLOSE);
// return a resolved promise to CommandManager
result.resolve(false);
});
} else {
// main editor has focus, so create an inline editor
_openInlineWidget(currentEditor, providers, errorMsg).done(function () {
result.resolve(true);
}).fail(function () {
result.reject();
});
}
} else {
// Can not open an inline editor without a host editor
result.reject();
}
return result.promise();
} | javascript | function _toggleInlineWidget(providers, errorMsg) {
var result = new $.Deferred();
var currentEditor = getCurrentFullEditor();
if (currentEditor) {
var inlineWidget = currentEditor.getFocusedInlineWidget();
if (inlineWidget) {
// an inline widget's editor has focus, so close it
PerfUtils.markStart(PerfUtils.INLINE_WIDGET_CLOSE);
inlineWidget.close().done(function () {
PerfUtils.addMeasurement(PerfUtils.INLINE_WIDGET_CLOSE);
// return a resolved promise to CommandManager
result.resolve(false);
});
} else {
// main editor has focus, so create an inline editor
_openInlineWidget(currentEditor, providers, errorMsg).done(function () {
result.resolve(true);
}).fail(function () {
result.reject();
});
}
} else {
// Can not open an inline editor without a host editor
result.reject();
}
return result.promise();
} | [
"function",
"_toggleInlineWidget",
"(",
"providers",
",",
"errorMsg",
")",
"{",
"var",
"result",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
";",
"var",
"currentEditor",
"=",
"getCurrentFullEditor",
"(",
")",
";",
"if",
"(",
"currentEditor",
")",
"{",
"var... | Closes any focused inline widget. Else, asynchronously asks providers to create one.
@param {Array.<{priority:number, provider:function(...)}>} providers
prioritized list of providers
@param {string=} errorMsg Default message to display if no providers return non-null
@return {!Promise} A promise resolved with true if an inline widget is opened or false
when closed. Rejected if there is neither an existing widget to close nor a provider
willing to create a widget (or if no editor is open). | [
"Closes",
"any",
"focused",
"inline",
"widget",
".",
"Else",
"asynchronously",
"asks",
"providers",
"to",
"create",
"one",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorManager.js#L282-L312 | train | Toggle inline widget | [
30522,
3853,
1035,
2000,
24679,
2378,
4179,
9148,
24291,
1006,
11670,
1010,
7561,
5244,
2290,
1007,
1063,
13075,
2765,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
13075,
2783,
2098,
15660,
1027,
2131,
10841,
14343,
3372,
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... |
postcss/autoprefixer | lib/hacks/grid-utils.js | warnMissedAreas | function warnMissedAreas (areas, decl, result) {
let missed = Object.keys(areas)
decl.root().walkDecls('grid-area', gridArea => {
missed = missed.filter(e => e !== gridArea.value)
})
if (missed.length > 0) {
decl.warn(result, 'Can not find grid areas: ' + missed.join(', '))
}
return undefined
} | javascript | function warnMissedAreas (areas, decl, result) {
let missed = Object.keys(areas)
decl.root().walkDecls('grid-area', gridArea => {
missed = missed.filter(e => e !== gridArea.value)
})
if (missed.length > 0) {
decl.warn(result, 'Can not find grid areas: ' + missed.join(', '))
}
return undefined
} | [
"function",
"warnMissedAreas",
"(",
"areas",
",",
"decl",
",",
"result",
")",
"{",
"let",
"missed",
"=",
"Object",
".",
"keys",
"(",
"areas",
")",
"decl",
".",
"root",
"(",
")",
".",
"walkDecls",
"(",
"'grid-area'",
",",
"gridArea",
"=>",
"{",
"missed"... | Warn user if grid area identifiers are not found
@param {Object} areas
@param {Declaration} decl
@param {Result} result
@return {void} | [
"Warn",
"user",
"if",
"grid",
"area",
"identifiers",
"are",
"not",
"found"
] | 24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32 | https://github.com/postcss/autoprefixer/blob/24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32/lib/hacks/grid-utils.js#L653-L665 | train | Warn if any grid - areas are not present in the declaration | [
30522,
3853,
11582,
15630,
6924,
12069,
3022,
1006,
2752,
1010,
11703,
2140,
1010,
2765,
1007,
1063,
2292,
4771,
1027,
4874,
1012,
6309,
1006,
2752,
1007,
11703,
2140,
1012,
7117,
1006,
1007,
1012,
3328,
3207,
20464,
2015,
1006,
1005,
8370,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tabview.js | tabView_getElement | function tabView_getElement(aSpec) {
var spec = aSpec || { };
var type = spec.type;
var subtype = spec.subtype;
var value = spec.value;
var parent = spec.parent;
var root = parent ? parent.getNode() : this._tabViewDoc;
var nodeCollector = new domUtils.nodeCollector(root);
switch(type) {
// Top level elements
case "tabView":
nodeCollector.root = this._controller.window.document;
nodeCollector.queryNodes("#tab-view");
break;
case "contentArea":
nodeCollector.queryNodes("#content");
break;
case "deck":
nodeCollector.root = this._controller.window.document;
nodeCollector.queryNodes("#tab-view-deck");
break;
case "exitButton":
nodeCollector.queryNodes("#exit-button");
break;
// Group elements
case "group_appTabs":
nodeCollector.queryNodes(".groupItem .appTabIcon");
break;
case "group_closeButton":
nodeCollector.queryNodes(".groupItem .close");
break;
case "group_newTabButton":
nodeCollector.queryNodes(".groupItem .newTabButton");
break;
case "group_resizer":
nodeCollector.queryNodes(".groupItem .iq-resizable-handle");
break;
case "group_stackExpander":
nodeCollector.queryNodes(".groupItem .stackExpander");
break;
case "group_titleBox":
nodeCollector.queryNodes(".groupItem .name");
break;
case "group_undoButton":
// Bug 596504 - No reference to the undo button
nodeCollector.root = this._tabViewDoc;
nodeCollector.queryNodes(".undo").filter(function(node) {
var groups = this._groupItemsObject.groupItems;
for (var i = 0; i < groups.length; i++) {
var group = groups[i];
if (group.container == aSpec.value.getNode() &&
group.$undoContainer.length == 1) {
return true;
}
}
return false;
}, this);
break;
case "groups":
nodeCollector.queryNodes(".groupItem").filter(function(node) {
switch(subtype) {
case "active":
return node.className.indexOf("activeGroup") != -1;
case "title":
// If no title is given the default name is used
if (!value) {
value = utils.getProperty("chrome://browser/locale/tabview.properties",
"tabview.groupItem.defaultName");
}
var title = node.querySelector(".name");
return (value == title.value);
default:
return true;
}
}, this);
break;
// Search elements
case "search_box":
nodeCollector.queryNodes("#searchbox");
break;
case "search_button":
nodeCollector.queryNodes("#searchbutton");
break;
// Tab elements
case "tab_closeButton":
nodeCollector.queryNodes(".tab .close");
break;
case "tab_favicon":
nodeCollector.queryNodes(".tab .favicon");
break;
case "tab_titleBox":
nodeCollector.queryNodes(".tab .tab-title");
break;
case "tabs":
nodeCollector.queryNodes(".tab").filter(function(node) {
switch (subtype) {
case "active":
return (node.className.indexOf("focus") != -1);
case "group":
var group = value ? value.getNode() : null;
if (group) {
var tabs = this._tabItemsObject.getItems();
for (var i = 0; i < tabs.length; i++) {
var tab = tabs[i];
if (tab.parent && tab.parent.container == group) {
return true;
}
}
return false;
} else {
return (node.className.indexOf("tabInGroupItem") == -1);
}
default:
return true;
}
}, this);
break;
default:
throw new Error(arguments.callee.name + ": Unknown element type - " +
aSpec.type);
}
return nodeCollector.elements;
} | javascript | function tabView_getElement(aSpec) {
var spec = aSpec || { };
var type = spec.type;
var subtype = spec.subtype;
var value = spec.value;
var parent = spec.parent;
var root = parent ? parent.getNode() : this._tabViewDoc;
var nodeCollector = new domUtils.nodeCollector(root);
switch(type) {
// Top level elements
case "tabView":
nodeCollector.root = this._controller.window.document;
nodeCollector.queryNodes("#tab-view");
break;
case "contentArea":
nodeCollector.queryNodes("#content");
break;
case "deck":
nodeCollector.root = this._controller.window.document;
nodeCollector.queryNodes("#tab-view-deck");
break;
case "exitButton":
nodeCollector.queryNodes("#exit-button");
break;
// Group elements
case "group_appTabs":
nodeCollector.queryNodes(".groupItem .appTabIcon");
break;
case "group_closeButton":
nodeCollector.queryNodes(".groupItem .close");
break;
case "group_newTabButton":
nodeCollector.queryNodes(".groupItem .newTabButton");
break;
case "group_resizer":
nodeCollector.queryNodes(".groupItem .iq-resizable-handle");
break;
case "group_stackExpander":
nodeCollector.queryNodes(".groupItem .stackExpander");
break;
case "group_titleBox":
nodeCollector.queryNodes(".groupItem .name");
break;
case "group_undoButton":
// Bug 596504 - No reference to the undo button
nodeCollector.root = this._tabViewDoc;
nodeCollector.queryNodes(".undo").filter(function(node) {
var groups = this._groupItemsObject.groupItems;
for (var i = 0; i < groups.length; i++) {
var group = groups[i];
if (group.container == aSpec.value.getNode() &&
group.$undoContainer.length == 1) {
return true;
}
}
return false;
}, this);
break;
case "groups":
nodeCollector.queryNodes(".groupItem").filter(function(node) {
switch(subtype) {
case "active":
return node.className.indexOf("activeGroup") != -1;
case "title":
// If no title is given the default name is used
if (!value) {
value = utils.getProperty("chrome://browser/locale/tabview.properties",
"tabview.groupItem.defaultName");
}
var title = node.querySelector(".name");
return (value == title.value);
default:
return true;
}
}, this);
break;
// Search elements
case "search_box":
nodeCollector.queryNodes("#searchbox");
break;
case "search_button":
nodeCollector.queryNodes("#searchbutton");
break;
// Tab elements
case "tab_closeButton":
nodeCollector.queryNodes(".tab .close");
break;
case "tab_favicon":
nodeCollector.queryNodes(".tab .favicon");
break;
case "tab_titleBox":
nodeCollector.queryNodes(".tab .tab-title");
break;
case "tabs":
nodeCollector.queryNodes(".tab").filter(function(node) {
switch (subtype) {
case "active":
return (node.className.indexOf("focus") != -1);
case "group":
var group = value ? value.getNode() : null;
if (group) {
var tabs = this._tabItemsObject.getItems();
for (var i = 0; i < tabs.length; i++) {
var tab = tabs[i];
if (tab.parent && tab.parent.container == group) {
return true;
}
}
return false;
} else {
return (node.className.indexOf("tabInGroupItem") == -1);
}
default:
return true;
}
}, this);
break;
default:
throw new Error(arguments.callee.name + ": Unknown element type - " +
aSpec.type);
}
return nodeCollector.elements;
} | [
"function",
"tabView_getElement",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"var",
"type",
"=",
"spec",
".",
"type",
";",
"var",
"subtype",
"=",
"spec",
".",
"subtype",
";",
"var",
"value",
"=",
"spec",
".",
"value",
... | Retrieve list of UI elements based on the given specification
@param {object} aSpec
Information of the UI elements which should be retrieved
Elements: type - Identifier of the element
subtype - Attribute of the element to filter
[optional - default: ""]
value - Value of the attribute to filter
[optional - default: ""]
parent - Parent of the to find element
[optional - default: document]
@returns Elements which have been found
@type {array of ElemBase} | [
"Retrieve",
"list",
"of",
"UI",
"elements",
"based",
"on",
"the",
"given",
"specification"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabview.js#L454-L582 | train | Returns the element that contains the specified tabView element. | [
30522,
3853,
21628,
8584,
1035,
2131,
12260,
3672,
1006,
2004,
5051,
2278,
1007,
1063,
13075,
28699,
1027,
2004,
5051,
2278,
1064,
1064,
1063,
1065,
1025,
13075,
2828,
1027,
28699,
1012,
2828,
1025,
13075,
4942,
13874,
1027,
28699,
1012,
49... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/protractor | lib/clientsidescripts.js | findRepeaterElement | function findRepeaterElement(repeater, exact, index, binding, using, rootSelector) {
var matches = [];
using = using || document;
var rows = [];
var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
for (var p = 0; p < prefixes.length; ++p) {
var attr = prefixes[p] + 'repeat';
var repeatElems = using.querySelectorAll('[' + attr + ']');
attr = attr.replace(/\\/g, '');
for (var i = 0; i < repeatElems.length; ++i) {
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
rows.push(repeatElems[i]);
}
}
}
/* multiRows is an array of arrays, where each inner array contains
one row of elements. */
var multiRows = [];
for (var p = 0; p < prefixes.length; ++p) {
var attr = prefixes[p] + 'repeat-start';
var repeatElems = using.querySelectorAll('[' + attr + ']');
attr = attr.replace(/\\/g, '');
for (var i = 0; i < repeatElems.length; ++i) {
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
var elem = repeatElems[i];
var row = [];
while (elem.nodeType != 8 || (elem.nodeValue &&
!repeaterMatch(elem.nodeValue, repeater))) {
if (elem.nodeType == 1) {
row.push(elem);
}
elem = elem.nextSibling;
}
multiRows.push(row);
}
}
}
var row = rows[index];
var multiRow = multiRows[index];
var bindings = [];
if (row) {
if (angular.getTestability) {
matches.push.apply(
matches,
getNg1Hooks(rootSelector).$$testability.findBindings(row, binding));
} else {
if (row.className.indexOf('ng-binding') != -1) {
bindings.push(row);
}
var childBindings = row.getElementsByClassName('ng-binding');
for (var i = 0; i < childBindings.length; ++i) {
bindings.push(childBindings[i]);
}
}
}
if (multiRow) {
for (var i = 0; i < multiRow.length; ++i) {
var rowElem = multiRow[i];
if (angular.getTestability) {
matches.push.apply(
matches,
getNg1Hooks(rootSelector).$$testability.findBindings(rowElem,
binding));
} else {
if (rowElem.className.indexOf('ng-binding') != -1) {
bindings.push(rowElem);
}
var childBindings = rowElem.getElementsByClassName('ng-binding');
for (var j = 0; j < childBindings.length; ++j) {
bindings.push(childBindings[j]);
}
}
}
}
for (var i = 0; i < bindings.length; ++i) {
var dataBinding = angular.element(bindings[i]).data('$binding');
if (dataBinding) {
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
if (bindingName.indexOf(binding) != -1) {
matches.push(bindings[i]);
}
}
}
return matches;
} | javascript | function findRepeaterElement(repeater, exact, index, binding, using, rootSelector) {
var matches = [];
using = using || document;
var rows = [];
var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
for (var p = 0; p < prefixes.length; ++p) {
var attr = prefixes[p] + 'repeat';
var repeatElems = using.querySelectorAll('[' + attr + ']');
attr = attr.replace(/\\/g, '');
for (var i = 0; i < repeatElems.length; ++i) {
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
rows.push(repeatElems[i]);
}
}
}
/* multiRows is an array of arrays, where each inner array contains
one row of elements. */
var multiRows = [];
for (var p = 0; p < prefixes.length; ++p) {
var attr = prefixes[p] + 'repeat-start';
var repeatElems = using.querySelectorAll('[' + attr + ']');
attr = attr.replace(/\\/g, '');
for (var i = 0; i < repeatElems.length; ++i) {
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
var elem = repeatElems[i];
var row = [];
while (elem.nodeType != 8 || (elem.nodeValue &&
!repeaterMatch(elem.nodeValue, repeater))) {
if (elem.nodeType == 1) {
row.push(elem);
}
elem = elem.nextSibling;
}
multiRows.push(row);
}
}
}
var row = rows[index];
var multiRow = multiRows[index];
var bindings = [];
if (row) {
if (angular.getTestability) {
matches.push.apply(
matches,
getNg1Hooks(rootSelector).$$testability.findBindings(row, binding));
} else {
if (row.className.indexOf('ng-binding') != -1) {
bindings.push(row);
}
var childBindings = row.getElementsByClassName('ng-binding');
for (var i = 0; i < childBindings.length; ++i) {
bindings.push(childBindings[i]);
}
}
}
if (multiRow) {
for (var i = 0; i < multiRow.length; ++i) {
var rowElem = multiRow[i];
if (angular.getTestability) {
matches.push.apply(
matches,
getNg1Hooks(rootSelector).$$testability.findBindings(rowElem,
binding));
} else {
if (rowElem.className.indexOf('ng-binding') != -1) {
bindings.push(rowElem);
}
var childBindings = rowElem.getElementsByClassName('ng-binding');
for (var j = 0; j < childBindings.length; ++j) {
bindings.push(childBindings[j]);
}
}
}
}
for (var i = 0; i < bindings.length; ++i) {
var dataBinding = angular.element(bindings[i]).data('$binding');
if (dataBinding) {
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
if (bindingName.indexOf(binding) != -1) {
matches.push(bindings[i]);
}
}
}
return matches;
} | [
"function",
"findRepeaterElement",
"(",
"repeater",
",",
"exact",
",",
"index",
",",
"binding",
",",
"using",
",",
"rootSelector",
")",
"{",
"var",
"matches",
"=",
"[",
"]",
";",
"using",
"=",
"using",
"||",
"document",
";",
"var",
"rows",
"=",
"[",
"]... | Find an element within an ng-repeat by its row and column.
@param {string} repeater The text of the repeater, e.g. 'cat in cats'.
@param {boolean} exact Whether the repeater needs to be matched exactly
@param {number} index The row index.
@param {string} binding The column binding, e.g. '{{cat.name}}'.
@param {Element} using The scope of the search.
@param {string} rootSelector The selector to use for the root app element.
@return {Array.<Element>} The element in an array. | [
"Find",
"an",
"element",
"within",
"an",
"ng",
"-",
"repeat",
"by",
"its",
"row",
"and",
"column",
"."
] | 4f74a4ec753c97adfe955fe468a39286a0a55837 | https://github.com/angular/protractor/blob/4f74a4ec753c97adfe955fe468a39286a0a55837/lib/clientsidescripts.js#L383-L468 | train | Finds an element that matches the specified repeater. | [
30522,
3853,
2424,
2890,
5051,
24932,
12260,
3672,
1006,
9377,
2121,
1010,
6635,
1010,
5950,
1010,
8031,
1010,
2478,
1010,
6147,
12260,
16761,
1007,
1063,
13075,
3503,
1027,
1031,
1033,
1025,
2478,
1027,
2478,
1064,
1064,
6254,
1025,
13075,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/ViewUtils.js | sidebarList | function sidebarList($scrollerElement, selectedClassName, leafClassName) {
var $listElement = $scrollerElement.find("ul"),
$selectionMarker,
$selectionExtension,
$sidebar = $("#sidebar"),
showExtension = true;
// build selectionMarker and position absolute within the scroller
$selectionMarker = $(window.document.createElement("div")).addClass("sidebar-selection");
$scrollerElement.prepend($selectionMarker);
// enable scrolling
$scrollerElement.css("overflow", "auto");
// use relative postioning for clipping the selectionMarker within the scrollElement
$scrollerElement.css("position", "relative");
// build selectionExtension and position fixed to the window
$selectionExtension = $(window.document.createElement("div")).addClass("sidebar-selection-extension");
$scrollerElement.append($selectionExtension);
selectedClassName = "." + (selectedClassName || "selected");
var updateSelectionExtension = function () {
var selectionMarkerHeight = $selectionMarker.height(),
selectionMarkerOffset = $selectionMarker.offset(), // offset relative to *document*
scrollerOffset = $scrollerElement.offset(),
selectionExtensionHeight = $selectionExtension.outerHeight(),
scrollerTop = scrollerOffset.top,
scrollerBottom = scrollerTop + $scrollerElement.outerHeight(),
selectionExtensionTop = selectionMarkerOffset.top;
$selectionExtension.css("top", selectionExtensionTop);
$selectionExtension.css("left", $sidebar.width() - $selectionExtension.outerWidth());
toggleClass($selectionExtension, "selectionExtension-visible", showExtension);
var selectionExtensionClipOffsetYBy = Math.floor((selectionMarkerHeight - selectionExtensionHeight) / 2),
selectionExtensionBottom = selectionExtensionTop + selectionExtensionHeight + selectionExtensionClipOffsetYBy;
if (selectionExtensionTop < scrollerTop || selectionExtensionBottom > scrollerBottom) {
$selectionExtension.css("clip", "rect(" + Math.max(scrollerTop - selectionExtensionTop - selectionExtensionClipOffsetYBy, 0) + "px, auto, " +
(selectionExtensionHeight - Math.max(selectionExtensionBottom - scrollerBottom, 0)) + "px, auto)");
} else {
$selectionExtension.css("clip", "");
}
};
var hideSelectionMarker = function (event) {
$selectionExtension.addClass("forced-hidden");
$selectionMarker.addClass("forced-hidden");
};
var updateSelectionMarker = function (event, reveal) {
// find the selected list item
var $listItem = $listElement.find(selectedClassName).closest("li");
if (leafClassName) {
showExtension = $listItem.hasClass(leafClassName);
}
$selectionExtension.removeClass("forced-hidden");
$selectionMarker.removeClass("forced-hidden");
// always hide selection visuals first to force layout (issue #719)
$selectionExtension.hide();
$selectionMarker.hide();
if ($listItem.length === 1) {
// list item position is relative to scroller
var selectionMarkerTop = $listItem.offset().top - $scrollerElement.offset().top + $scrollerElement.get(0).scrollTop;
// move the selectionMarker position to align with the list item
$selectionMarker.css("top", selectionMarkerTop);
$selectionMarker.show();
updateSelectionExtension();
$selectionExtension.show();
// fully scroll to the selectionMarker if it's not initially in the viewport
var scrollerElement = $scrollerElement.get(0),
scrollerHeight = scrollerElement.clientHeight,
selectionMarkerHeight = $selectionMarker.height(),
selectionMarkerBottom = selectionMarkerTop + selectionMarkerHeight,
currentScrollBottom = scrollerElement.scrollTop + scrollerHeight;
// update scrollTop to reveal the selected list item
if (reveal) {
if (selectionMarkerTop >= currentScrollBottom) {
$listItem.get(0).scrollIntoView(false);
} else if (selectionMarkerBottom <= scrollerElement.scrollTop) {
$listItem.get(0).scrollIntoView(true);
}
}
}
};
$listElement.on("selectionChanged", updateSelectionMarker);
$scrollerElement.on("scroll", updateSelectionExtension);
$scrollerElement.on("selectionRedraw", updateSelectionExtension);
$scrollerElement.on("selectionHide", hideSelectionMarker);
// update immediately
updateSelectionMarker();
// update clipping when the window resizes
_resizeHandlers.push(updateSelectionExtension);
} | javascript | function sidebarList($scrollerElement, selectedClassName, leafClassName) {
var $listElement = $scrollerElement.find("ul"),
$selectionMarker,
$selectionExtension,
$sidebar = $("#sidebar"),
showExtension = true;
// build selectionMarker and position absolute within the scroller
$selectionMarker = $(window.document.createElement("div")).addClass("sidebar-selection");
$scrollerElement.prepend($selectionMarker);
// enable scrolling
$scrollerElement.css("overflow", "auto");
// use relative postioning for clipping the selectionMarker within the scrollElement
$scrollerElement.css("position", "relative");
// build selectionExtension and position fixed to the window
$selectionExtension = $(window.document.createElement("div")).addClass("sidebar-selection-extension");
$scrollerElement.append($selectionExtension);
selectedClassName = "." + (selectedClassName || "selected");
var updateSelectionExtension = function () {
var selectionMarkerHeight = $selectionMarker.height(),
selectionMarkerOffset = $selectionMarker.offset(), // offset relative to *document*
scrollerOffset = $scrollerElement.offset(),
selectionExtensionHeight = $selectionExtension.outerHeight(),
scrollerTop = scrollerOffset.top,
scrollerBottom = scrollerTop + $scrollerElement.outerHeight(),
selectionExtensionTop = selectionMarkerOffset.top;
$selectionExtension.css("top", selectionExtensionTop);
$selectionExtension.css("left", $sidebar.width() - $selectionExtension.outerWidth());
toggleClass($selectionExtension, "selectionExtension-visible", showExtension);
var selectionExtensionClipOffsetYBy = Math.floor((selectionMarkerHeight - selectionExtensionHeight) / 2),
selectionExtensionBottom = selectionExtensionTop + selectionExtensionHeight + selectionExtensionClipOffsetYBy;
if (selectionExtensionTop < scrollerTop || selectionExtensionBottom > scrollerBottom) {
$selectionExtension.css("clip", "rect(" + Math.max(scrollerTop - selectionExtensionTop - selectionExtensionClipOffsetYBy, 0) + "px, auto, " +
(selectionExtensionHeight - Math.max(selectionExtensionBottom - scrollerBottom, 0)) + "px, auto)");
} else {
$selectionExtension.css("clip", "");
}
};
var hideSelectionMarker = function (event) {
$selectionExtension.addClass("forced-hidden");
$selectionMarker.addClass("forced-hidden");
};
var updateSelectionMarker = function (event, reveal) {
// find the selected list item
var $listItem = $listElement.find(selectedClassName).closest("li");
if (leafClassName) {
showExtension = $listItem.hasClass(leafClassName);
}
$selectionExtension.removeClass("forced-hidden");
$selectionMarker.removeClass("forced-hidden");
// always hide selection visuals first to force layout (issue #719)
$selectionExtension.hide();
$selectionMarker.hide();
if ($listItem.length === 1) {
// list item position is relative to scroller
var selectionMarkerTop = $listItem.offset().top - $scrollerElement.offset().top + $scrollerElement.get(0).scrollTop;
// move the selectionMarker position to align with the list item
$selectionMarker.css("top", selectionMarkerTop);
$selectionMarker.show();
updateSelectionExtension();
$selectionExtension.show();
// fully scroll to the selectionMarker if it's not initially in the viewport
var scrollerElement = $scrollerElement.get(0),
scrollerHeight = scrollerElement.clientHeight,
selectionMarkerHeight = $selectionMarker.height(),
selectionMarkerBottom = selectionMarkerTop + selectionMarkerHeight,
currentScrollBottom = scrollerElement.scrollTop + scrollerHeight;
// update scrollTop to reveal the selected list item
if (reveal) {
if (selectionMarkerTop >= currentScrollBottom) {
$listItem.get(0).scrollIntoView(false);
} else if (selectionMarkerBottom <= scrollerElement.scrollTop) {
$listItem.get(0).scrollIntoView(true);
}
}
}
};
$listElement.on("selectionChanged", updateSelectionMarker);
$scrollerElement.on("scroll", updateSelectionExtension);
$scrollerElement.on("selectionRedraw", updateSelectionExtension);
$scrollerElement.on("selectionHide", hideSelectionMarker);
// update immediately
updateSelectionMarker();
// update clipping when the window resizes
_resizeHandlers.push(updateSelectionExtension);
} | [
"function",
"sidebarList",
"(",
"$scrollerElement",
",",
"selectedClassName",
",",
"leafClassName",
")",
"{",
"var",
"$listElement",
"=",
"$scrollerElement",
".",
"find",
"(",
"\"ul\"",
")",
",",
"$selectionMarker",
",",
"$selectionExtension",
",",
"$sidebar",
"=",
... | Within a scrolling DOMElement, creates and positions a styled selection
div to align a single selected list item from a ul list element.
Assumptions:
- scrollerElement is a child of the #sidebar div
- ul list element fires a "selectionChanged" event after the
selectedClassName is assigned to a new list item
@param {!DOMElement} scrollElement A DOMElement containing a ul list element
@param {!string} selectedClassName A CSS class name on at most one list item in the contained list | [
"Within",
"a",
"scrolling",
"DOMElement",
"creates",
"and",
"positions",
"a",
"styled",
"selection",
"div",
"to",
"align",
"a",
"single",
"selected",
"list",
"item",
"from",
"a",
"ul",
"list",
"element",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ViewUtils.js#L186-L293 | train | Creates sidebar list | [
30522,
3853,
2217,
8237,
9863,
1006,
1002,
17186,
7869,
16930,
4765,
1010,
3479,
26266,
18442,
1010,
7053,
26266,
18442,
1007,
1063,
13075,
1002,
2862,
12260,
3672,
1027,
1002,
17186,
7869,
16930,
4765,
1012,
2424,
1006,
1000,
17359,
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... |
GitbookIO/gitbook | lib/api/encodeSummary.js | encodeSummary | function encodeSummary(output, summary) {
var result = {
/**
Iterate over the summary, it stops when the "iter" returns false
@param {Function} iter
*/
walk: function (iter) {
summary.getArticle(function(article) {
var jsonArticle = encodeSummaryArticle(article, false);
return iter(jsonArticle);
});
},
/**
Get an article by its level
@param {String} level
@return {Object}
*/
getArticleByLevel: function(level) {
var article = summary.getByLevel(level);
return (article? encodeSummaryArticle(article) : undefined);
},
/**
Get an article by its path
@param {String} level
@return {Object}
*/
getArticleByPath: function(level) {
var article = summary.getByPath(level);
return (article? encodeSummaryArticle(article) : undefined);
}
};
return result;
} | javascript | function encodeSummary(output, summary) {
var result = {
/**
Iterate over the summary, it stops when the "iter" returns false
@param {Function} iter
*/
walk: function (iter) {
summary.getArticle(function(article) {
var jsonArticle = encodeSummaryArticle(article, false);
return iter(jsonArticle);
});
},
/**
Get an article by its level
@param {String} level
@return {Object}
*/
getArticleByLevel: function(level) {
var article = summary.getByLevel(level);
return (article? encodeSummaryArticle(article) : undefined);
},
/**
Get an article by its path
@param {String} level
@return {Object}
*/
getArticleByPath: function(level) {
var article = summary.getByPath(level);
return (article? encodeSummaryArticle(article) : undefined);
}
};
return result;
} | [
"function",
"encodeSummary",
"(",
"output",
",",
"summary",
")",
"{",
"var",
"result",
"=",
"{",
"/**\n Iterate over the summary, it stops when the \"iter\" returns false\n\n @param {Function} iter\n */",
"walk",
":",
"function",
"(",
"iter",
")",
"... | Encode summary to provide an API to plugin
@param {Output} output
@param {Config} config
@return {Object} | [
"Encode",
"summary",
"to",
"provide",
"an",
"API",
"to",
"plugin"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/api/encodeSummary.js#L10-L49 | train | Encode summary | [
30522,
3853,
4372,
30524,
1006,
2009,
2121,
1007,
1063,
12654,
1012,
2131,
8445,
25128,
1006,
3853,
1006,
3720,
1007,
1063,
13075,
1046,
3385,
8445,
25128,
1027,
4372,
23237,
2819,
7849,
13380,
4588,
2571,
1006,
3720,
1010,
6270,
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... |
adobe/brackets | src/utils/PerfUtils.js | updateMeasurement | function updateMeasurement(id) {
var elapsedTime = brackets.app.getElapsedMilliseconds();
if (updatableTests[id.id]) {
// update existing measurement
elapsedTime -= updatableTests[id].startTime;
// update
if (perfData[id] && Array.isArray(perfData[id])) {
// We have existing data and it's an array, so update the last entry
perfData[id][perfData[id].length - 1] = elapsedTime;
} else {
// No current data or a single entry, so set/update it
perfData[id] = elapsedTime;
}
} else {
// not yet in updatable list
if (activeTests[id.id]) {
// save startTime in updatable list before addMeasurement() deletes it
updatableTests[id.id] = { startTime: activeTests[id.id].startTime };
}
// let addMeasurement() handle the initial case
addMeasurement(id);
}
} | javascript | function updateMeasurement(id) {
var elapsedTime = brackets.app.getElapsedMilliseconds();
if (updatableTests[id.id]) {
// update existing measurement
elapsedTime -= updatableTests[id].startTime;
// update
if (perfData[id] && Array.isArray(perfData[id])) {
// We have existing data and it's an array, so update the last entry
perfData[id][perfData[id].length - 1] = elapsedTime;
} else {
// No current data or a single entry, so set/update it
perfData[id] = elapsedTime;
}
} else {
// not yet in updatable list
if (activeTests[id.id]) {
// save startTime in updatable list before addMeasurement() deletes it
updatableTests[id.id] = { startTime: activeTests[id.id].startTime };
}
// let addMeasurement() handle the initial case
addMeasurement(id);
}
} | [
"function",
"updateMeasurement",
"(",
"id",
")",
"{",
"var",
"elapsedTime",
"=",
"brackets",
".",
"app",
".",
"getElapsedMilliseconds",
"(",
")",
";",
"if",
"(",
"updatableTests",
"[",
"id",
".",
"id",
"]",
")",
"{",
"// update existing measurement",
"elapsedT... | This function is similar to addMeasurement(), but it allows timing the
*last* event, when you don't know which event will be the last one.
Tests that are in the activeTests list, have not yet been added, so add
measurements to the performance data, and move test to updatableTests list.
A test is moved to the updatable list so that it no longer passes isActive().
Tests that are already in the updatableTests list are updated.
Caller must explicitly remove test from the updatableTests list using
finalizeMeasurement().
If markStart() was not called for the specified timer, there is no way to
determine if this is the first or subsequent call, so the measurement is
not updatable, and it is handled in addMeasurement().
@param {Object} id Timer id. | [
"This",
"function",
"is",
"similar",
"to",
"addMeasurement",
"()",
"but",
"it",
"allows",
"timing",
"the",
"*",
"last",
"*",
"event",
"when",
"you",
"don",
"t",
"know",
"which",
"event",
"will",
"be",
"the",
"last",
"one",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/PerfUtils.js#L244-L271 | train | update measurement for a test | [
30522,
3853,
10651,
4168,
3022,
5397,
3672,
1006,
8909,
1007,
1063,
13075,
3449,
9331,
6924,
7292,
1027,
19719,
1012,
10439,
1012,
2131,
10581,
29251,
22117,
8591,
5562,
8663,
5104,
1006,
1007,
1025,
2065,
1006,
2039,
2850,
10880,
22199,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/EventDispatcher.js | function (eventName) {
var event = { type: eventName, target: this },
handlerList = this._eventHandlers && this._eventHandlers[eventName],
i;
if (!handlerList) {
return;
}
// Use a clone of the list in case handlers call on()/off() while we're still in the loop
handlerList = handlerList.slice();
// Pass 'event' object followed by any additional args trigger() was given
var applyArgs = Array.prototype.slice.call(arguments, 1);
applyArgs.unshift(event);
for (i = 0; i < handlerList.length; i++) {
try {
// Call one handler
handlerList[i].handler.apply(null, applyArgs);
} catch (err) {
console.error("Exception in '" + eventName + "' listener on", this, String(err), err.stack);
console.assert(); // causes dev tools to pause, just like an uncaught exception
}
}
} | javascript | function (eventName) {
var event = { type: eventName, target: this },
handlerList = this._eventHandlers && this._eventHandlers[eventName],
i;
if (!handlerList) {
return;
}
// Use a clone of the list in case handlers call on()/off() while we're still in the loop
handlerList = handlerList.slice();
// Pass 'event' object followed by any additional args trigger() was given
var applyArgs = Array.prototype.slice.call(arguments, 1);
applyArgs.unshift(event);
for (i = 0; i < handlerList.length; i++) {
try {
// Call one handler
handlerList[i].handler.apply(null, applyArgs);
} catch (err) {
console.error("Exception in '" + eventName + "' listener on", this, String(err), err.stack);
console.assert(); // causes dev tools to pause, just like an uncaught exception
}
}
} | [
"function",
"(",
"eventName",
")",
"{",
"var",
"event",
"=",
"{",
"type",
":",
"eventName",
",",
"target",
":",
"this",
"}",
",",
"handlerList",
"=",
"this",
".",
"_eventHandlers",
"&&",
"this",
".",
"_eventHandlers",
"[",
"eventName",
"]",
",",
"i",
"... | Invokes all handlers for the given event (in the order they were added).
@param {string} eventName
@param {*} ... Any additional args are passed to the event handler after the event object | [
"Invokes",
"all",
"handlers",
"for",
"the",
"given",
"event",
"(",
"in",
"the",
"order",
"they",
"were",
"added",
")",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/EventDispatcher.js#L210-L235 | train | Trigger an event | [
30522,
3853,
1006,
2724,
18442,
1007,
1063,
13075,
2724,
1027,
1063,
2828,
1024,
2724,
18442,
1010,
4539,
1024,
2023,
1065,
1010,
28213,
9863,
1027,
2023,
1012,
1035,
2724,
11774,
12910,
1004,
1004,
2023,
1012,
1035,
2724,
11774,
12910,
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... | |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/addons.js | useAmoPreviewUrls | function useAmoPreviewUrls() {
var prefSrv = prefs.preferences;
for each (var preference in AMO_PREFERENCES) {
var pref = prefSrv.getPref(preference.name, "");
prefSrv.setPref(preference.name,
pref.replace(preference.old, preference.new));
}
} | javascript | function useAmoPreviewUrls() {
var prefSrv = prefs.preferences;
for each (var preference in AMO_PREFERENCES) {
var pref = prefSrv.getPref(preference.name, "");
prefSrv.setPref(preference.name,
pref.replace(preference.old, preference.new));
}
} | [
"function",
"useAmoPreviewUrls",
"(",
")",
"{",
"var",
"prefSrv",
"=",
"prefs",
".",
"preferences",
";",
"for",
"each",
"(",
"var",
"preference",
"in",
"AMO_PREFERENCES",
")",
"",
"{",
"var",
"pref",
"=",
"prefSrv",
".",
"getPref",
"(",
"preference",
".",
... | Updates all necessary preferences to the preview sub domain | [
"Updates",
"all",
"necessary",
"preferences",
"to",
"the",
"preview",
"sub",
"domain"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L1263-L1271 | train | Use AMO preview urls | [
30522,
3853,
2224,
22591,
28139,
8584,
3126,
4877,
1006,
1007,
1063,
13075,
3653,
10343,
2099,
2615,
1027,
3653,
10343,
1012,
18394,
1025,
2005,
2169,
1006,
13075,
12157,
1999,
2572,
2080,
1035,
18394,
1007,
1063,
13075,
3653,
2546,
1027,
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... |
Microsoft/vscode | build/gulpfile.editor.js | createTscCompileTask | function createTscCompileTask(watch) {
return () => {
const createReporter = require('./lib/reporter').createReporter;
return new Promise((resolve, reject) => {
const args = ['./node_modules/.bin/tsc', '-p', './src/tsconfig.monaco.json', '--noEmit'];
if (watch) {
args.push('-w');
}
const child = cp.spawn(`node`, args, {
cwd: path.join(__dirname, '..'),
// stdio: [null, 'pipe', 'inherit']
});
let errors = [];
let reporter = createReporter();
let report;
// eslint-disable-next-line no-control-regex
let magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings
child.stdout.on('data', data => {
let str = String(data);
str = str.replace(magic, '').trim();
if (str.indexOf('Starting compilation') >= 0 || str.indexOf('File change detected') >= 0) {
errors.length = 0;
report = reporter.end(false);
} else if (str.indexOf('Compilation complete') >= 0) {
report.end();
} else if (str) {
let match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str);
if (match) {
// trying to massage the message so that it matches the gulp-tsb error messages
// e.g. src/vs/base/common/strings.ts(663,5): error TS2322: Type '1234' is not assignable to type 'string'.
let fullpath = path.join(root, match[1]);
let message = match[3];
// @ts-ignore
reporter(fullpath + message);
} else {
// @ts-ignore
reporter(str);
}
}
});
child.on('exit', resolve);
child.on('error', reject);
});
};
} | javascript | function createTscCompileTask(watch) {
return () => {
const createReporter = require('./lib/reporter').createReporter;
return new Promise((resolve, reject) => {
const args = ['./node_modules/.bin/tsc', '-p', './src/tsconfig.monaco.json', '--noEmit'];
if (watch) {
args.push('-w');
}
const child = cp.spawn(`node`, args, {
cwd: path.join(__dirname, '..'),
// stdio: [null, 'pipe', 'inherit']
});
let errors = [];
let reporter = createReporter();
let report;
// eslint-disable-next-line no-control-regex
let magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings
child.stdout.on('data', data => {
let str = String(data);
str = str.replace(magic, '').trim();
if (str.indexOf('Starting compilation') >= 0 || str.indexOf('File change detected') >= 0) {
errors.length = 0;
report = reporter.end(false);
} else if (str.indexOf('Compilation complete') >= 0) {
report.end();
} else if (str) {
let match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str);
if (match) {
// trying to massage the message so that it matches the gulp-tsb error messages
// e.g. src/vs/base/common/strings.ts(663,5): error TS2322: Type '1234' is not assignable to type 'string'.
let fullpath = path.join(root, match[1]);
let message = match[3];
// @ts-ignore
reporter(fullpath + message);
} else {
// @ts-ignore
reporter(str);
}
}
});
child.on('exit', resolve);
child.on('error', reject);
});
};
} | [
"function",
"createTscCompileTask",
"(",
"watch",
")",
"{",
"return",
"(",
")",
"=>",
"{",
"const",
"createReporter",
"=",
"require",
"(",
"'./lib/reporter'",
")",
".",
"createReporter",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")... | #region monaco type checking | [
"#region",
"monaco",
"type",
"checking"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/gulpfile.editor.js#L322-L370 | train | Creates a task that runs the tsc - p tsc - p src / tsconfig. monaco. json and then reports the error to the console. | [
30522,
3853,
3443,
3215,
21408,
8737,
9463,
10230,
2243,
1006,
3422,
1007,
1063,
2709,
1006,
1007,
1027,
1028,
1063,
9530,
3367,
3443,
2890,
6442,
2121,
1027,
5478,
1006,
1005,
1012,
1013,
5622,
2497,
1013,
6398,
1005,
1007,
1012,
3443,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | examples/wms-custom-proj.js | WGStoCHy | function WGStoCHy(lat, lng) {
// Converts degrees dec to sex
lat = DECtoSEX(lat);
lng = DECtoSEX(lng);
// Converts degrees to seconds (sex)
lat = DEGtoSEC(lat);
lng = DEGtoSEC(lng);
// Axiliary values (% Bern)
const lat_aux = (lat - 169028.66) / 10000;
const lng_aux = (lng - 26782.5) / 10000;
// Process Y
const y = 600072.37 +
211455.93 * lng_aux -
10938.51 * lng_aux * lat_aux -
0.36 * lng_aux * Math.pow(lat_aux, 2) -
44.54 * Math.pow(lng_aux, 3);
return y;
} | javascript | function WGStoCHy(lat, lng) {
// Converts degrees dec to sex
lat = DECtoSEX(lat);
lng = DECtoSEX(lng);
// Converts degrees to seconds (sex)
lat = DEGtoSEC(lat);
lng = DEGtoSEC(lng);
// Axiliary values (% Bern)
const lat_aux = (lat - 169028.66) / 10000;
const lng_aux = (lng - 26782.5) / 10000;
// Process Y
const y = 600072.37 +
211455.93 * lng_aux -
10938.51 * lng_aux * lat_aux -
0.36 * lng_aux * Math.pow(lat_aux, 2) -
44.54 * Math.pow(lng_aux, 3);
return y;
} | [
"function",
"WGStoCHy",
"(",
"lat",
",",
"lng",
")",
"{",
"// Converts degrees dec to sex",
"lat",
"=",
"DECtoSEX",
"(",
"lat",
")",
";",
"lng",
"=",
"DECtoSEX",
"(",
"lng",
")",
";",
"// Converts degrees to seconds (sex)",
"lat",
"=",
"DEGtoSEC",
"(",
"lat",
... | /*
Swiss projection transform functions downloaded from
http://www.swisstopo.admin.ch/internet/swisstopo/en/home/products/software/products/skripts.html
Convert WGS lat/long (° dec) to CH y | [
"/",
"*",
"Swiss",
"projection",
"transform",
"functions",
"downloaded",
"from",
"http",
":",
"//",
"www",
".",
"swisstopo",
".",
"admin",
".",
"ch",
"/",
"internet",
"/",
"swisstopo",
"/",
"en",
"/",
"home",
"/",
"products",
"/",
"software",
"/",
"produ... | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/wms-custom-proj.js#L94-L116 | train | Calculate the WGStoCHy of the given LatLon | [
30522,
3853,
1059,
5620,
3406,
11714,
1006,
2474,
2102,
1010,
1048,
3070,
1007,
1063,
1013,
1013,
19884,
5445,
11703,
2000,
3348,
2474,
2102,
1027,
11703,
22282,
2595,
1006,
2474,
2102,
1007,
1025,
1048,
3070,
1027,
11703,
22282,
2595,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js | sanitizeAttribs | function sanitizeAttribs(
tagName, attribs, opt_naiveUriRewriter, opt_nmTokenPolicy) {
for (var i = 0; i < attribs.length; i += 2) {
var attribName = attribs[i];
var value = attribs[i + 1];
var atype = null, attribKey;
if ((attribKey = tagName + '::' + attribName,
html4.ATTRIBS.hasOwnProperty(attribKey)) ||
(attribKey = '*::' + attribName,
html4.ATTRIBS.hasOwnProperty(attribKey))) {
atype = html4.ATTRIBS[attribKey];
}
if (atype !== null) {
switch (atype) {
case html4.atype.NONE: break;
case html4.atype.SCRIPT:
value = null;
break;
case html4.atype.STYLE:
if ('undefined' === typeof parseCssDeclarations) {
value = null;
break;
}
var sanitizedDeclarations = [];
parseCssDeclarations(
value,
{
declaration: function (property, tokens) {
var normProp = property.toLowerCase();
var schema = cssSchema[normProp];
if (!schema) {
return;
}
sanitizeCssProperty(
normProp, schema, tokens,
opt_naiveUriRewriter);
sanitizedDeclarations.push(property + ': ' + tokens.join(' '));
}
});
value = sanitizedDeclarations.length > 0 ? sanitizedDeclarations.join(' ; ') : null;
break;
case html4.atype.ID:
case html4.atype.IDREF:
case html4.atype.IDREFS:
case html4.atype.GLOBAL_NAME:
case html4.atype.LOCAL_NAME:
case html4.atype.CLASSES:
value = opt_nmTokenPolicy ? opt_nmTokenPolicy(value) : value;
break;
case html4.atype.URI:
value = safeUri(value, opt_naiveUriRewriter);
break;
case html4.atype.URI_FRAGMENT:
if (value && '#' === value.charAt(0)) {
value = value.substring(1); // remove the leading '#'
value = opt_nmTokenPolicy ? opt_nmTokenPolicy(value) : value;
if (value !== null && value !== void 0) {
value = '#' + value; // restore the leading '#'
}
} else {
value = null;
}
break;
default:
value = null;
break;
}
} else {
value = null;
}
attribs[i + 1] = value;
}
return attribs;
} | javascript | function sanitizeAttribs(
tagName, attribs, opt_naiveUriRewriter, opt_nmTokenPolicy) {
for (var i = 0; i < attribs.length; i += 2) {
var attribName = attribs[i];
var value = attribs[i + 1];
var atype = null, attribKey;
if ((attribKey = tagName + '::' + attribName,
html4.ATTRIBS.hasOwnProperty(attribKey)) ||
(attribKey = '*::' + attribName,
html4.ATTRIBS.hasOwnProperty(attribKey))) {
atype = html4.ATTRIBS[attribKey];
}
if (atype !== null) {
switch (atype) {
case html4.atype.NONE: break;
case html4.atype.SCRIPT:
value = null;
break;
case html4.atype.STYLE:
if ('undefined' === typeof parseCssDeclarations) {
value = null;
break;
}
var sanitizedDeclarations = [];
parseCssDeclarations(
value,
{
declaration: function (property, tokens) {
var normProp = property.toLowerCase();
var schema = cssSchema[normProp];
if (!schema) {
return;
}
sanitizeCssProperty(
normProp, schema, tokens,
opt_naiveUriRewriter);
sanitizedDeclarations.push(property + ': ' + tokens.join(' '));
}
});
value = sanitizedDeclarations.length > 0 ? sanitizedDeclarations.join(' ; ') : null;
break;
case html4.atype.ID:
case html4.atype.IDREF:
case html4.atype.IDREFS:
case html4.atype.GLOBAL_NAME:
case html4.atype.LOCAL_NAME:
case html4.atype.CLASSES:
value = opt_nmTokenPolicy ? opt_nmTokenPolicy(value) : value;
break;
case html4.atype.URI:
value = safeUri(value, opt_naiveUriRewriter);
break;
case html4.atype.URI_FRAGMENT:
if (value && '#' === value.charAt(0)) {
value = value.substring(1); // remove the leading '#'
value = opt_nmTokenPolicy ? opt_nmTokenPolicy(value) : value;
if (value !== null && value !== void 0) {
value = '#' + value; // restore the leading '#'
}
} else {
value = null;
}
break;
default:
value = null;
break;
}
} else {
value = null;
}
attribs[i + 1] = value;
}
return attribs;
} | [
"function",
"sanitizeAttribs",
"(",
"tagName",
",",
"attribs",
",",
"opt_naiveUriRewriter",
",",
"opt_nmTokenPolicy",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"attribs",
".",
"length",
";",
"i",
"+=",
"2",
")",
"{",
"var",
"attribName",... | Sanitizes attributes on an HTML tag.
@param {string} tagName An HTML tag name in lowercase.
@param {Array.<?string>} attribs An array of alternating names and values.
@param {?function(?string): ?string} opt_naiveUriRewriter A transform to
apply to URI attributes; it can return a new string value, or null to
delete the attribute. If unspecified, URI attributes are deleted.
@param {function(?string): ?string} opt_nmTokenPolicy A transform to apply
to attributes containing HTML names, element IDs, and space-separated
lists of classes; it can return a new string value, or null to delete
the attribute. If unspecified, these attributes are kept unchanged.
@return {Array.<?string>} The sanitized attributes as a list of alternating
names and values, where a null value means to omit the attribute. | [
"Sanitizes",
"attributes",
"on",
"an",
"HTML",
"tag",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js#L3433-L3506 | train | Sanitize attributes | [
30522,
3853,
2624,
25090,
4371,
19321,
3089,
5910,
1006,
6415,
18442,
1010,
2012,
18886,
5910,
1010,
23569,
1035,
15743,
9496,
15603,
17625,
2099,
1010,
23569,
1035,
13221,
18715,
2368,
18155,
2594,
2100,
1007,
1063,
2005,
1006,
13075,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeekyAnts/vue-native-core | dist/vue.common.js | genOnce | function genOnce (el) {
el.onceProcessed = true;
if (el.if && !el.ifProcessed) {
return genIf(el)
} else if (el.staticInFor) {
var key = '';
var parent = el.parent;
while (parent) {
if (parent.for) {
key = parent.key;
break
}
parent = parent.parent;
}
if (!key) {
process.env.NODE_ENV !== 'production' && warn$3(
"v-once can only be used inside v-for that is keyed. "
);
return genElement(el)
}
return ("_o(" + (genElement(el)) + "," + (onceCount++) + (key ? ("," + key) : "") + ")")
} else {
return genStatic(el)
}
} | javascript | function genOnce (el) {
el.onceProcessed = true;
if (el.if && !el.ifProcessed) {
return genIf(el)
} else if (el.staticInFor) {
var key = '';
var parent = el.parent;
while (parent) {
if (parent.for) {
key = parent.key;
break
}
parent = parent.parent;
}
if (!key) {
process.env.NODE_ENV !== 'production' && warn$3(
"v-once can only be used inside v-for that is keyed. "
);
return genElement(el)
}
return ("_o(" + (genElement(el)) + "," + (onceCount++) + (key ? ("," + key) : "") + ")")
} else {
return genStatic(el)
}
} | [
"function",
"genOnce",
"(",
"el",
")",
"{",
"el",
".",
"onceProcessed",
"=",
"true",
";",
"if",
"(",
"el",
".",
"if",
"&&",
"!",
"el",
".",
"ifProcessed",
")",
"{",
"return",
"genIf",
"(",
"el",
")",
"}",
"else",
"if",
"(",
"el",
".",
"staticInFo... | v-once | [
"v",
"-",
"once"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.common.js#L8408-L8432 | train | Generate once element | [
30522,
3853,
8991,
2239,
3401,
1006,
3449,
1007,
1063,
3449,
1012,
2320,
21572,
9623,
6924,
1027,
2995,
1025,
2065,
1006,
3449,
1012,
2065,
1004,
1004,
999,
3449,
1012,
2065,
21572,
9623,
6924,
1007,
1063,
2709,
8991,
10128,
1006,
3449,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/RoadMap.js | function(oThis, sDir, bUpdateFocus){
RoadMapRenderer.scrollToNextStep(oThis, sDir, function(sFirstVisibleNodeId){
var iIdx = sFirstVisibleNodeId.lastIndexOf("-expandend");
if (iIdx != -1) {
sFirstVisibleNodeId = sFirstVisibleNodeId.substring(0, iIdx);
}
oThis.setProperty("firstVisibleStep", sFirstVisibleNodeId, true);
if (bUpdateFocus) {
refreshFocus(oThis, sDir);
}
});
} | javascript | function(oThis, sDir, bUpdateFocus){
RoadMapRenderer.scrollToNextStep(oThis, sDir, function(sFirstVisibleNodeId){
var iIdx = sFirstVisibleNodeId.lastIndexOf("-expandend");
if (iIdx != -1) {
sFirstVisibleNodeId = sFirstVisibleNodeId.substring(0, iIdx);
}
oThis.setProperty("firstVisibleStep", sFirstVisibleNodeId, true);
if (bUpdateFocus) {
refreshFocus(oThis, sDir);
}
});
} | [
"function",
"(",
"oThis",
",",
"sDir",
",",
"bUpdateFocus",
")",
"{",
"RoadMapRenderer",
".",
"scrollToNextStep",
"(",
"oThis",
",",
"sDir",
",",
"function",
"(",
"sFirstVisibleNodeId",
")",
"{",
"var",
"iIdx",
"=",
"sFirstVisibleNodeId",
".",
"lastIndexOf",
"... | Helper function to scroll to following step (optionally with updating the focus (see focusStep)). Allowed directions are: next, prev, first, last. | [
"Helper",
"function",
"to",
"scroll",
"to",
"following",
"step",
"(",
"optionally",
"with",
"updating",
"the",
"focus",
"(",
"see",
"focusStep",
"))",
".",
"Allowed",
"directions",
"are",
":",
"next",
"prev",
"first",
"last",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMap.js#L467-L479 | train | Scrolls to the next step in the page | [
30522,
3853,
1006,
27178,
24158,
1010,
17371,
4313,
1010,
20934,
17299,
3686,
14876,
7874,
1007,
1063,
2346,
2863,
28139,
11563,
2121,
1012,
17186,
5524,
18413,
13473,
2361,
1006,
27178,
24158,
1010,
17371,
4313,
1010,
3853,
1006,
16420,
1889... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
facebook/relay | packages/relay-compiler/transforms/RelayRefetchableFragmentTransform.js | extractConnectionMetadata | function extractConnectionMetadata(
fragment: Fragment,
): ReaderPaginationMetadata | void {
const fields = [];
let connectionField = null;
let path = null;
GraphQLIRVisitor.visit(fragment, {
LinkedField: {
enter(field) {
fields.push(field);
if (
(field.handles &&
field.handles.some(handle => handle.name === 'connection')) ||
field.directives.some(directive => directive.name === 'connection')
) {
// Disallow multiple @connections
if (connectionField != null) {
throw createUserError(
`Invalid use of @refetchable with @connection in fragment '${
fragment.name
}', at most once @connection can appear in a refetchable fragment.`,
[field.loc],
);
}
// Disallow connections within plurals
const pluralOnPath = fields.find(
pathField => getNullableType(pathField.type) instanceof GraphQLList,
);
if (pluralOnPath) {
throw createUserError(
`Invalid use of @refetchable with @connection in fragment '${
fragment.name
}', refetchable connections cannot appear inside plural fields.`,
[field.loc, pluralOnPath.loc],
);
}
connectionField = field;
path = fields.map(pathField => pathField.alias ?? pathField.name);
}
},
leave() {
fields.pop();
},
},
});
if (connectionField == null || path == null) {
return;
}
// Validate arguments: if either of before/last appear they must both appear
// and use variables (not scalar values)
let backward = null;
const before = findArgument(connectionField, 'before');
const last = findArgument(connectionField, 'last');
if (before || last) {
if (
!before ||
!last ||
before.value.kind !== 'Variable' ||
last.value.kind !== 'Variable'
) {
throw createUserError(
`Invalid use of @refetchable with @connection in fragment '${
fragment.name
}', refetchable connections must use variables for the before and last arguments.`,
[
connectionField.loc,
before && before.value.kind !== 'Variable' ? before.value.loc : null,
last && last.value.kind !== 'Variable' ? last.value.loc : null,
].filter(Boolean),
);
}
backward = {
count: last.value.variableName,
cursor: before.value.variableName,
};
}
// Validate arguments: if either of after/first appear they must both appear
// and use variables (not scalar values)
let forward = null;
const after = findArgument(connectionField, 'after');
const first = findArgument(connectionField, 'first');
if (after || first) {
if (
!after ||
!first ||
after.value.kind !== 'Variable' ||
first.value.kind !== 'Variable'
) {
throw createUserError(
`Invalid use of @refetchable with @connection in fragment '${
fragment.name
}', refetchable connections must use variables for the after and first arguments.`,
[
connectionField.loc,
after && after.value.kind !== 'Variable' ? after.value.loc : null,
first && first.value.kind !== 'Variable' ? first.value.loc : null,
].filter(Boolean),
);
}
forward = {
count: first.value.variableName,
cursor: after.value.variableName,
};
}
return {forward, backward, path};
} | javascript | function extractConnectionMetadata(
fragment: Fragment,
): ReaderPaginationMetadata | void {
const fields = [];
let connectionField = null;
let path = null;
GraphQLIRVisitor.visit(fragment, {
LinkedField: {
enter(field) {
fields.push(field);
if (
(field.handles &&
field.handles.some(handle => handle.name === 'connection')) ||
field.directives.some(directive => directive.name === 'connection')
) {
// Disallow multiple @connections
if (connectionField != null) {
throw createUserError(
`Invalid use of @refetchable with @connection in fragment '${
fragment.name
}', at most once @connection can appear in a refetchable fragment.`,
[field.loc],
);
}
// Disallow connections within plurals
const pluralOnPath = fields.find(
pathField => getNullableType(pathField.type) instanceof GraphQLList,
);
if (pluralOnPath) {
throw createUserError(
`Invalid use of @refetchable with @connection in fragment '${
fragment.name
}', refetchable connections cannot appear inside plural fields.`,
[field.loc, pluralOnPath.loc],
);
}
connectionField = field;
path = fields.map(pathField => pathField.alias ?? pathField.name);
}
},
leave() {
fields.pop();
},
},
});
if (connectionField == null || path == null) {
return;
}
// Validate arguments: if either of before/last appear they must both appear
// and use variables (not scalar values)
let backward = null;
const before = findArgument(connectionField, 'before');
const last = findArgument(connectionField, 'last');
if (before || last) {
if (
!before ||
!last ||
before.value.kind !== 'Variable' ||
last.value.kind !== 'Variable'
) {
throw createUserError(
`Invalid use of @refetchable with @connection in fragment '${
fragment.name
}', refetchable connections must use variables for the before and last arguments.`,
[
connectionField.loc,
before && before.value.kind !== 'Variable' ? before.value.loc : null,
last && last.value.kind !== 'Variable' ? last.value.loc : null,
].filter(Boolean),
);
}
backward = {
count: last.value.variableName,
cursor: before.value.variableName,
};
}
// Validate arguments: if either of after/first appear they must both appear
// and use variables (not scalar values)
let forward = null;
const after = findArgument(connectionField, 'after');
const first = findArgument(connectionField, 'first');
if (after || first) {
if (
!after ||
!first ||
after.value.kind !== 'Variable' ||
first.value.kind !== 'Variable'
) {
throw createUserError(
`Invalid use of @refetchable with @connection in fragment '${
fragment.name
}', refetchable connections must use variables for the after and first arguments.`,
[
connectionField.loc,
after && after.value.kind !== 'Variable' ? after.value.loc : null,
first && first.value.kind !== 'Variable' ? first.value.loc : null,
].filter(Boolean),
);
}
forward = {
count: first.value.variableName,
cursor: after.value.variableName,
};
}
return {forward, backward, path};
} | [
"function",
"extractConnectionMetadata",
"(",
"fragment",
":",
"Fragment",
",",
")",
":",
"ReaderPaginationMetadata",
"|",
"void",
"{",
"const",
"fields",
"=",
"[",
"]",
";",
"let",
"connectionField",
"=",
"null",
";",
"let",
"path",
"=",
"null",
";",
"Graph... | Validate that any @connection usage is valid for refetching:
- Variables are used for both the "count" and "cursor" arguments
(after/first or before/last)
- Exactly one connection
- Has a stable path to the connection data
Returns connection metadata to add to the transformed fragment or undefined
if there is no connection. | [
"Validate",
"that",
"any",
"@connection",
"usage",
"is",
"valid",
"for",
"refetching",
":",
"-",
"Variables",
"are",
"used",
"for",
"both",
"the",
"count",
"and",
"cursor",
"arguments",
"(",
"after",
"/",
"first",
"or",
"before",
"/",
"last",
")",
"-",
"... | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/transforms/RelayRefetchableFragmentTransform.js#L213-L318 | train | Extract connection metadata from a fragment | [
30522,
3853,
14817,
8663,
2638,
7542,
11368,
8447,
2696,
1006,
15778,
1024,
15778,
1010,
1007,
1024,
8068,
4502,
20876,
3508,
11368,
8447,
2696,
1064,
11675,
1063,
9530,
3367,
4249,
1027,
1031,
1033,
1025,
2292,
4434,
3790,
1027,
19701,
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... |
SheetJS/js-xlsx | xlsx.js | parse_ExternName | function parse_ExternName(blob, length, opts) {
var flags = blob.read_shift(2);
var body;
var o = ({
fBuiltIn: flags & 0x01,
fWantAdvise: (flags >>> 1) & 0x01,
fWantPict: (flags >>> 2) & 0x01,
fOle: (flags >>> 3) & 0x01,
fOleLink: (flags >>> 4) & 0x01,
cf: (flags >>> 5) & 0x3FF,
fIcon: flags >>> 15 & 0x01
});
if(opts.sbcch === 0x3A01) body = parse_AddinUdf(blob, length-2, opts);
//else throw new Error("unsupported SupBook cch: " + opts.sbcch);
o.body = body || blob.read_shift(length-2);
if(typeof body === "string") o.Name = body;
return o;
} | javascript | function parse_ExternName(blob, length, opts) {
var flags = blob.read_shift(2);
var body;
var o = ({
fBuiltIn: flags & 0x01,
fWantAdvise: (flags >>> 1) & 0x01,
fWantPict: (flags >>> 2) & 0x01,
fOle: (flags >>> 3) & 0x01,
fOleLink: (flags >>> 4) & 0x01,
cf: (flags >>> 5) & 0x3FF,
fIcon: flags >>> 15 & 0x01
});
if(opts.sbcch === 0x3A01) body = parse_AddinUdf(blob, length-2, opts);
//else throw new Error("unsupported SupBook cch: " + opts.sbcch);
o.body = body || blob.read_shift(length-2);
if(typeof body === "string") o.Name = body;
return o;
} | [
"function",
"parse_ExternName",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"flags",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"var",
"body",
";",
"var",
"o",
"=",
"(",
"{",
"fBuiltIn",
":",
"flags",
"&",
"0x01",
",",
"fWant... | /* [MS-XLS] 2.4.105 TODO | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"105",
"TODO"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6198-L6215 | train | Parse an extern name | [
30522,
3853,
11968,
3366,
1035,
4654,
16451,
18442,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
9245,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1016,
1007,
1025,
13075,
2303,
1025,
13075,
1051,
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... |
facebook/flow | packages/flow-upgrade/src/findFlowFiles.js | processDirectory | function processDirectory(directory: string) {
// If we were rejected then we should not continue.
if (rejected === true) {
return;
}
// We are now waiting on this asynchronous task.
waiting++;
// Read the directory...
fs.readdir(directory, (error, fileNames) => {
if (error) {
return reject(error);
}
// Process every file name that we got from reading the directory.
for (let i = 0; i < fileNames.length; i++) {
processFilePath(directory, fileNames[i]);
}
// We are done with this async task.
done();
});
} | javascript | function processDirectory(directory: string) {
// If we were rejected then we should not continue.
if (rejected === true) {
return;
}
// We are now waiting on this asynchronous task.
waiting++;
// Read the directory...
fs.readdir(directory, (error, fileNames) => {
if (error) {
return reject(error);
}
// Process every file name that we got from reading the directory.
for (let i = 0; i < fileNames.length; i++) {
processFilePath(directory, fileNames[i]);
}
// We are done with this async task.
done();
});
} | [
"function",
"processDirectory",
"(",
"directory",
":",
"string",
")",
"{",
"// If we were rejected then we should not continue.",
"if",
"(",
"rejected",
"===",
"true",
")",
"{",
"return",
";",
"}",
"// We are now waiting on this asynchronous task.",
"waiting",
"++",
";",
... | Process a directory by looking at all of its entries and recursing
through child directories as is appropriate. | [
"Process",
"a",
"directory",
"by",
"looking",
"at",
"all",
"of",
"its",
"entries",
"and",
"recursing",
"through",
"child",
"directories",
"as",
"is",
"appropriate",
"."
] | 25bc6aba258658eaf21ccc4722ef7124724a1d2b | https://github.com/facebook/flow/blob/25bc6aba258658eaf21ccc4722ef7124724a1d2b/packages/flow-upgrade/src/findFlowFiles.js#L39-L58 | train | Process a directory | [
30522,
3853,
2832,
4305,
2890,
16761,
2100,
1006,
14176,
1024,
5164,
1007,
1063,
1013,
1013,
2065,
2057,
2020,
5837,
2059,
2057,
2323,
2025,
3613,
1012,
2065,
1006,
5837,
1027,
1027,
1027,
2995,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
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... |
statsd/statsd | backends/graphite.js | sk | function sk(key) {
if (globalKeySanitize) {
return key;
} else {
return key.replace(/\s+/g, '_')
.replace(/\//g, '-')
.replace(/[^a-zA-Z_\-0-9\.]/g, '');
}
} | javascript | function sk(key) {
if (globalKeySanitize) {
return key;
} else {
return key.replace(/\s+/g, '_')
.replace(/\//g, '-')
.replace(/[^a-zA-Z_\-0-9\.]/g, '');
}
} | [
"function",
"sk",
"(",
"key",
")",
"{",
"if",
"(",
"globalKeySanitize",
")",
"{",
"return",
"key",
";",
"}",
"else",
"{",
"return",
"key",
".",
"replace",
"(",
"/",
"\\s+",
"/",
"g",
",",
"'_'",
")",
".",
"replace",
"(",
"/",
"\\/",
"/",
"g",
"... | Sanitize key for graphite if not done globally | [
"Sanitize",
"key",
"for",
"graphite",
"if",
"not",
"done",
"globally"
] | ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9 | https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/backends/graphite.js#L164-L172 | train | Returns the key for the key | [
30522,
3853,
15315,
1006,
3145,
1007,
1063,
2065,
1006,
3795,
14839,
8791,
25090,
4371,
1007,
1063,
2709,
3145,
1025,
1065,
2842,
1063,
2709,
3145,
1012,
5672,
1006,
1013,
1032,
1055,
1009,
1013,
1043,
1010,
1005,
1035,
1005,
1007,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/addons.js | addonsManager_waitForDownloaded | function addonsManager_waitForDownloaded(aSpec) {
var spec = aSpec || { };
var addon = spec.addon;
var timeout = (spec.timeout == undefined) ? TIMEOUT_DOWNLOAD : spec.timeout;
if (!addon)
throw new Error(arguments.callee.name + ": Add-on not specified.");
var self = this;
var node = addon.getNode();
// TODO: restore after 1.5.1 has landed
// mozmill.utils.waitFor(function () {
// return node.getAttribute("pending") == "install" &&
// node.getAttribute("status") != "installing";
// }, timeout, 100, "'" + node.getAttribute("name") + "' has been downloaded");
mozmill.utils.waitForEval("subject.getAttribute('pending') == 'install' &&" +
"subject.getAttribute('status') != 'installing'",
timeout, 100, node);
} | javascript | function addonsManager_waitForDownloaded(aSpec) {
var spec = aSpec || { };
var addon = spec.addon;
var timeout = (spec.timeout == undefined) ? TIMEOUT_DOWNLOAD : spec.timeout;
if (!addon)
throw new Error(arguments.callee.name + ": Add-on not specified.");
var self = this;
var node = addon.getNode();
// TODO: restore after 1.5.1 has landed
// mozmill.utils.waitFor(function () {
// return node.getAttribute("pending") == "install" &&
// node.getAttribute("status") != "installing";
// }, timeout, 100, "'" + node.getAttribute("name") + "' has been downloaded");
mozmill.utils.waitForEval("subject.getAttribute('pending') == 'install' &&" +
"subject.getAttribute('status') != 'installing'",
timeout, 100, node);
} | [
"function",
"addonsManager_waitForDownloaded",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"var",
"addon",
"=",
"spec",
".",
"addon",
";",
"var",
"timeout",
"=",
"(",
"spec",
".",
"timeout",
"==",
"undefined",
")",
"?",
"T... | Wait until the specified add-on has been downloaded
@param {object} aSpec
Object with parameters for customization
Elements: addon - Add-on element to wait for being downloaded
timeout - Duration to wait for the target state
[optional - default: 15s] | [
"Wait",
"until",
"the",
"specified",
"add",
"-",
"on",
"has",
"been",
"downloaded"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L579-L599 | train | Wait until the add - on has been downloaded | [
30522,
3853,
5587,
5644,
24805,
4590,
1035,
3524,
3877,
12384,
17468,
1006,
2004,
5051,
2278,
1007,
1063,
13075,
28699,
1027,
2004,
5051,
2278,
1064,
1064,
1063,
1065,
1025,
13075,
5587,
2239,
1027,
28699,
1012,
5587,
2239,
1025,
13075,
205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
thomaspark/bootswatch | docs/_vendor/popper.js/dist/popper.js | getOuterSizes | function getOuterSizes(element) {
const window = element.ownerDocument.defaultView;
const styles = window.getComputedStyle(element);
const x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
const y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
const result = {
width: element.offsetWidth + y,
height: element.offsetHeight + x
};
return result;
} | javascript | function getOuterSizes(element) {
const window = element.ownerDocument.defaultView;
const styles = window.getComputedStyle(element);
const x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
const y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
const result = {
width: element.offsetWidth + y,
height: element.offsetHeight + x
};
return result;
} | [
"function",
"getOuterSizes",
"(",
"element",
")",
"{",
"const",
"window",
"=",
"element",
".",
"ownerDocument",
".",
"defaultView",
";",
"const",
"styles",
"=",
"window",
".",
"getComputedStyle",
"(",
"element",
")",
";",
"const",
"x",
"=",
"parseFloat",
"("... | Get the outer sizes of the given element (offset size + margins)
@method
@memberof Popper.Utils
@argument {Element} element
@returns {Object} object containing width and height properties | [
"Get",
"the",
"outer",
"sizes",
"of",
"the",
"given",
"element",
"(",
"offset",
"size",
"+",
"margins",
")"
] | a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd | https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/_vendor/popper.js/dist/popper.js#L676-L686 | train | Get the outer sizes of an element | [
30522,
3853,
2131,
5833,
2545,
10057,
1006,
5783,
1007,
1063,
9530,
3367,
3332,
1027,
5783,
1012,
3954,
3527,
24894,
4765,
1012,
12398,
8584,
1025,
9530,
3367,
6782,
1027,
3332,
1012,
2131,
9006,
29462,
21756,
2571,
1006,
5783,
30524,
3367,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(s, newline)
{
s = String(s || '');
s = s.replace(/&/g,'&'); // 38 26
s = s.replace(/"/g,'"'); // 34 22
s = s.replace(/\'/g,'''); // 39 27
s = s.replace(/</g,'<'); // 60 3C
s = s.replace(/>/g,'>'); // 62 3E
if (newline == null || newline)
{
s = s.replace(/\n/g, '
');
}
return s;
} | javascript | function(s, newline)
{
s = String(s || '');
s = s.replace(/&/g,'&'); // 38 26
s = s.replace(/"/g,'"'); // 34 22
s = s.replace(/\'/g,'''); // 39 27
s = s.replace(/</g,'<'); // 60 3C
s = s.replace(/>/g,'>'); // 62 3E
if (newline == null || newline)
{
s = s.replace(/\n/g, '
');
}
return s;
} | [
"function",
"(",
"s",
",",
"newline",
")",
"{",
"s",
"=",
"String",
"(",
"s",
"||",
"''",
")",
";",
"s",
"=",
"s",
".",
"replace",
"(",
"/",
"&",
"/",
"g",
",",
"'&'",
")",
";",
"// 38 26",
"s",
"=",
"s",
".",
"replace",
"(",
"/",
"\"",... | Function: htmlEntities
Replaces characters (less than, greater than, newlines and quotes) with
their HTML entities in the given string and returns the result.
Parameters:
s - String that contains the characters to be converted.
newline - If newlines should be replaced. Default is true. | [
"Function",
":",
"htmlEntities"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L2928-L2944 | train | Unescape the given string | [
30522,
3853,
1006,
1055,
1010,
2047,
4179,
1007,
1063,
1055,
1027,
5164,
1006,
1055,
1064,
1064,
1005,
1005,
1007,
1025,
1055,
1027,
1055,
1012,
5672,
1006,
1013,
1004,
1013,
1043,
1010,
1005,
1004,
23713,
1025,
1005,
1007,
1025,
1013,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js | _showMonthPicker | function _showMonthPicker(){
if (this._iMode == 1) {
_hideDayPicker.call(this, true);
}else if (this._iMode == 3) {
_hideYearPicker.call(this, true);
}
var oDate = this._getFocusedDate();
var oMonthPicker = this.getAggregation("monthPicker");
if (oMonthPicker.getDomRef()) {
// already rendered
oMonthPicker.$().css("display", "");
} else {
var oRm = sap.ui.getCore().createRenderManager();
var $Container = this.$("content");
oRm.renderControl(oMonthPicker);
oRm.flush($Container[0], false, true); // insert it
oRm.destroy();
}
this._showOverlay();
oMonthPicker.setMonth(oDate.getUTCMonth());
_setDisabledMonths.call(this, oDate.getUTCFullYear(), oMonthPicker);
if (this._iMode == 0) {
// remove tabindex from item
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1");
}
this._iMode = 2;
_togglePrevNext.call(this);
} | javascript | function _showMonthPicker(){
if (this._iMode == 1) {
_hideDayPicker.call(this, true);
}else if (this._iMode == 3) {
_hideYearPicker.call(this, true);
}
var oDate = this._getFocusedDate();
var oMonthPicker = this.getAggregation("monthPicker");
if (oMonthPicker.getDomRef()) {
// already rendered
oMonthPicker.$().css("display", "");
} else {
var oRm = sap.ui.getCore().createRenderManager();
var $Container = this.$("content");
oRm.renderControl(oMonthPicker);
oRm.flush($Container[0], false, true); // insert it
oRm.destroy();
}
this._showOverlay();
oMonthPicker.setMonth(oDate.getUTCMonth());
_setDisabledMonths.call(this, oDate.getUTCFullYear(), oMonthPicker);
if (this._iMode == 0) {
// remove tabindex from item
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1");
}
this._iMode = 2;
_togglePrevNext.call(this);
} | [
"function",
"_showMonthPicker",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_iMode",
"==",
"1",
")",
"{",
"_hideDayPicker",
".",
"call",
"(",
"this",
",",
"true",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"_iMode",
"==",
"3",
")",
"{",
"_hideYearP... | Shows an embedded month Picker.
This function assumes there is a "monthPicker" aggregation.
So callers must take care.
@return {void}
@private | [
"Shows",
"an",
"embedded",
"month",
"Picker",
".",
"This",
"function",
"assumes",
"there",
"is",
"a",
"monthPicker",
"aggregation",
".",
"So",
"callers",
"must",
"take",
"care",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1454-L1492 | train | Show the month picker | [
30522,
3853,
1035,
2265,
9629,
22269,
6799,
2121,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
10047,
10244,
1027,
1027,
1015,
1007,
1063,
1035,
5342,
10259,
24330,
5484,
1012,
2655,
1006,
2023,
1010,
2995,
1007,
1025,
1065,
2842,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zloirock/core-js | packages/core-js-pure/override/modules/es.date.to-json.js | toJSON | function toJSON(key) {
var O = toObject(this);
var pv = toPrimitive(O);
return typeof pv == 'number' && !isFinite(pv) ? null :
(!('toISOString' in O) && classof(O) == 'Date') ? toISOString.call(O) : O.toISOString();
} | javascript | function toJSON(key) {
var O = toObject(this);
var pv = toPrimitive(O);
return typeof pv == 'number' && !isFinite(pv) ? null :
(!('toISOString' in O) && classof(O) == 'Date') ? toISOString.call(O) : O.toISOString();
} | [
"function",
"toJSON",
"(",
"key",
")",
"{",
"var",
"O",
"=",
"toObject",
"(",
"this",
")",
";",
"var",
"pv",
"=",
"toPrimitive",
"(",
"O",
")",
";",
"return",
"typeof",
"pv",
"==",
"'number'",
"&&",
"!",
"isFinite",
"(",
"pv",
")",
"?",
"null",
"... | eslint-disable-next-line no-unused-vars | [
"eslint",
"-",
"disable",
"-",
"next",
"-",
"line",
"no",
"-",
"unused",
"-",
"vars"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js-pure/override/modules/es.date.to-json.js#L14-L19 | train | Returns the JSON representation of the object. | [
30522,
3853,
2000,
22578,
2239,
1006,
3145,
1007,
1063,
13075,
1051,
1027,
2205,
2497,
20614,
1006,
2023,
1007,
1025,
13075,
26189,
1027,
2327,
20026,
13043,
1006,
1051,
1007,
1025,
2709,
2828,
11253,
26189,
1027,
1027,
1005,
2193,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | examples/3d/js/map.js | function() {
// Loop through the tiles and setup the audio listeners.
for (var i=0; i<this.grid.length; i++) {
if (this.grid[i] === 2) {
var y = Math.floor(i / this.size);
var x = i % this.size;
game.audio.speaker(x, y);
}
}
} | javascript | function() {
// Loop through the tiles and setup the audio listeners.
for (var i=0; i<this.grid.length; i++) {
if (this.grid[i] === 2) {
var y = Math.floor(i / this.size);
var x = i % this.size;
game.audio.speaker(x, y);
}
}
} | [
"function",
"(",
")",
"{",
"// Loop through the tiles and setup the audio listeners.",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"grid",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"grid",
"[",
"i",
"]",
"===",
... | Sets up the map including the speaker audio points. | [
"Sets",
"up",
"the",
"map",
"including",
"the",
"speaker",
"audio",
"points",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/3d/js/map.js#L32-L41 | train | Setup the audio listeners for the next tile | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
7077,
2083,
1996,
13262,
1998,
16437,
1996,
5746,
13810,
1012,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
2023,
1012,
8370,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/quotes.js | isUsingFeatureOfTemplateLiteral | function isUsingFeatureOfTemplateLiteral(node) {
const hasTag = node.parent.type === "TaggedTemplateExpression" && node === node.parent.quasi;
if (hasTag) {
return true;
}
const hasStringInterpolation = node.expressions.length > 0;
if (hasStringInterpolation) {
return true;
}
const isMultilineString = node.quasis.length >= 1 && UNESCAPED_LINEBREAK_PATTERN.test(node.quasis[0].value.raw);
if (isMultilineString) {
return true;
}
return false;
} | javascript | function isUsingFeatureOfTemplateLiteral(node) {
const hasTag = node.parent.type === "TaggedTemplateExpression" && node === node.parent.quasi;
if (hasTag) {
return true;
}
const hasStringInterpolation = node.expressions.length > 0;
if (hasStringInterpolation) {
return true;
}
const isMultilineString = node.quasis.length >= 1 && UNESCAPED_LINEBREAK_PATTERN.test(node.quasis[0].value.raw);
if (isMultilineString) {
return true;
}
return false;
} | [
"function",
"isUsingFeatureOfTemplateLiteral",
"(",
"node",
")",
"{",
"const",
"hasTag",
"=",
"node",
".",
"parent",
".",
"type",
"===",
"\"TaggedTemplateExpression\"",
"&&",
"node",
"===",
"node",
".",
"parent",
".",
"quasi",
";",
"if",
"(",
"hasTag",
")",
... | Checks whether or not a given TemplateLiteral node is actually using any of the special features provided by template literal strings.
@param {ASTNode} node - A TemplateLiteral node to check.
@returns {boolean} Whether or not the TemplateLiteral node is using any of the special features provided by template literal strings.
@private | [
"Checks",
"whether",
"or",
"not",
"a",
"given",
"TemplateLiteral",
"node",
"is",
"actually",
"using",
"any",
"of",
"the",
"special",
"features",
"provided",
"by",
"template",
"literal",
"strings",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/quotes.js#L237-L257 | train | returns true if node is using a feature of template literal | [
30522,
3853,
2003,
18161,
7959,
4017,
5397,
15794,
6633,
15725,
22779,
7941,
1006,
13045,
1007,
1063,
9530,
3367,
2038,
15900,
1027,
13045,
1012,
6687,
1012,
2828,
1027,
1027,
1027,
1000,
26610,
18532,
15725,
10288,
20110,
3258,
1000,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
caolan/async | lib/eachOf.js | eachOfArrayLike | function eachOfArrayLike(coll, iteratee, callback) {
callback = once(callback);
var index = 0,
completed = 0,
{length} = coll,
canceled = false;
if (length === 0) {
callback(null);
}
function iteratorCallback(err, value) {
if (err === false) {
canceled = true
}
if (canceled === true) return
if (err) {
callback(err);
} else if ((++completed === length) || value === breakLoop) {
callback(null);
}
}
for (; index < length; index++) {
iteratee(coll[index], index, onlyOnce(iteratorCallback));
}
} | javascript | function eachOfArrayLike(coll, iteratee, callback) {
callback = once(callback);
var index = 0,
completed = 0,
{length} = coll,
canceled = false;
if (length === 0) {
callback(null);
}
function iteratorCallback(err, value) {
if (err === false) {
canceled = true
}
if (canceled === true) return
if (err) {
callback(err);
} else if ((++completed === length) || value === breakLoop) {
callback(null);
}
}
for (; index < length; index++) {
iteratee(coll[index], index, onlyOnce(iteratorCallback));
}
} | [
"function",
"eachOfArrayLike",
"(",
"coll",
",",
"iteratee",
",",
"callback",
")",
"{",
"callback",
"=",
"once",
"(",
"callback",
")",
";",
"var",
"index",
"=",
"0",
",",
"completed",
"=",
"0",
",",
"{",
"length",
"}",
"=",
"coll",
",",
"canceled",
"... | eachOf implementation optimized for array-likes | [
"eachOf",
"implementation",
"optimized",
"for",
"array",
"-",
"likes"
] | 4330d536c106592139fa82062494c9dba0da1fdb | https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/eachOf.js#L10-L35 | train | Alien array - like function that iterates over an array of objects and invokes a callback function for each object. | [
30522,
3853,
2169,
11253,
2906,
9447,
10359,
1006,
8902,
2140,
1010,
2009,
22139,
2063,
1010,
2655,
5963,
1007,
1063,
2655,
5963,
1027,
2320,
1006,
2655,
5963,
1007,
1025,
13075,
5950,
1027,
1014,
1010,
2949,
1027,
1014,
1010,
1063,
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... |
muaz-khan/RTCMultiConnection | dev/XHRConnection.js | xhr | function xhr(url, callback, data) {
if (!window.XMLHttpRequest || !window.JSON) return;
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (callback && request.readyState == 4 && request.status == 200) {
// server MUST return JSON text
callback(JSON.parse(request.responseText));
}
};
request.open('POST', url);
var formData = new FormData();
// you're passing "message" parameter
formData.append('message', data);
request.send(formData);
} | javascript | function xhr(url, callback, data) {
if (!window.XMLHttpRequest || !window.JSON) return;
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (callback && request.readyState == 4 && request.status == 200) {
// server MUST return JSON text
callback(JSON.parse(request.responseText));
}
};
request.open('POST', url);
var formData = new FormData();
// you're passing "message" parameter
formData.append('message', data);
request.send(formData);
} | [
"function",
"xhr",
"(",
"url",
",",
"callback",
",",
"data",
")",
"{",
"if",
"(",
"!",
"window",
".",
"XMLHttpRequest",
"||",
"!",
"window",
".",
"JSON",
")",
"return",
";",
"var",
"request",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"request",
".... | a simple function to make XMLHttpRequests | [
"a",
"simple",
"function",
"to",
"make",
"XMLHttpRequests"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/XHRConnection.js#L16-L34 | train | XHR request | [
30522,
3853,
1060,
8093,
1006,
24471,
2140,
1010,
2655,
5963,
1010,
2951,
1007,
1063,
2065,
1006,
999,
3332,
1012,
20950,
11039,
25856,
2890,
15500,
1064,
1064,
999,
3332,
1012,
1046,
3385,
1007,
2709,
1025,
13075,
5227,
1027,
2047,
20950,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netlify/netlify-cms | packages/netlify-cms-core/src/actions/editorialWorkflow.js | unpublishedEntryLoading | function unpublishedEntryLoading(collection, slug) {
return {
type: UNPUBLISHED_ENTRY_REQUEST,
payload: {
collection: collection.get('name'),
slug,
},
};
} | javascript | function unpublishedEntryLoading(collection, slug) {
return {
type: UNPUBLISHED_ENTRY_REQUEST,
payload: {
collection: collection.get('name'),
slug,
},
};
} | [
"function",
"unpublishedEntryLoading",
"(",
"collection",
",",
"slug",
")",
"{",
"return",
"{",
"type",
":",
"UNPUBLISHED_ENTRY_REQUEST",
",",
"payload",
":",
"{",
"collection",
":",
"collection",
".",
"get",
"(",
"'name'",
")",
",",
"slug",
",",
"}",
",",
... | /*
Simple Action Creators (Internal) | [
"/",
"*",
"Simple",
"Action",
"Creators",
"(",
"Internal",
")"
] | 2488556590cbfdcefa626f2f2de01e7a160cf6ee | https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-core/src/actions/editorialWorkflow.js#L46-L54 | train | Unpublished entry loading | [
30522,
3853,
19106,
4765,
23320,
10441,
4667,
1006,
3074,
1010,
23667,
1007,
1063,
2709,
1063,
2828,
1024,
19106,
1035,
4443,
1035,
5227,
1010,
18093,
1024,
1063,
3074,
1024,
3074,
1012,
2131,
1006,
1005,
2171,
1005,
1007,
1010,
23667,
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... |
firebase/firebaseui-web | javascript/widgets/handler/passwordsignup.js | function() {
var errorMessage =
firebaseui.auth.widget.handler.common.getErrorMessage(emailExistsError);
firebaseui.auth.ui.element.setValid(component.getEmailElement(), false);
firebaseui.auth.ui.element.show(
component.getEmailErrorElement(), errorMessage);
component.getEmailElement().focus();
} | javascript | function() {
var errorMessage =
firebaseui.auth.widget.handler.common.getErrorMessage(emailExistsError);
firebaseui.auth.ui.element.setValid(component.getEmailElement(), false);
firebaseui.auth.ui.element.show(
component.getEmailErrorElement(), errorMessage);
component.getEmailElement().focus();
} | [
"function",
"(",
")",
"{",
"var",
"errorMessage",
"=",
"firebaseui",
".",
"auth",
".",
"widget",
".",
"handler",
".",
"common",
".",
"getErrorMessage",
"(",
"emailExistsError",
")",
";",
"firebaseui",
".",
"auth",
".",
"ui",
".",
"element",
".",
"setValid"... | If a provider already exists, just display the error and focus the email element. | [
"If",
"a",
"provider",
"already",
"exists",
"just",
"display",
"the",
"error",
"and",
"focus",
"the",
"email",
"element",
"."
] | c10aa51e38aeb38dc63baa22b48cd6690c2be087 | https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/javascript/widgets/handler/passwordsignup.js#L192-L199 | train | Show the error message if the user already exists. | [
30522,
3853,
1006,
1007,
1063,
13075,
7561,
7834,
3736,
3351,
1027,
2543,
15058,
10179,
1012,
8740,
2705,
1012,
15536,
24291,
1012,
28213,
1012,
2691,
1012,
2131,
2121,
29165,
7834,
3736,
3351,
1006,
10373,
10288,
5130,
2121,
29165,
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... | |
expressjs/express | examples/params/index.js | createError | function createError(status, message) {
var err = new Error(message);
err.status = status;
return err;
} | javascript | function createError(status, message) {
var err = new Error(message);
err.status = status;
return err;
} | [
"function",
"createError",
"(",
"status",
",",
"message",
")",
"{",
"var",
"err",
"=",
"new",
"Error",
"(",
"message",
")",
";",
"err",
".",
"status",
"=",
"status",
";",
"return",
"err",
";",
"}"
] | Create HTTP error | [
"Create",
"HTTP",
"error"
] | dc538f6e810bd462c98ee7e6aae24c64d4b1da93 | https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/examples/params/index.js#L20-L24 | train | Create an error object | [
30522,
3853,
3443,
2121,
29165,
1006,
3570,
1010,
4471,
1007,
1063,
13075,
9413,
2099,
1027,
2047,
7561,
1006,
4471,
1007,
1025,
9413,
2099,
1012,
3570,
1027,
3570,
1025,
2709,
9413,
2099,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/config.js | Config | function Config(options) {
if (options === undefined) options = {};
options = this.extractCredentials(options);
AWS.util.each.call(this, this.keys, function (key, value) {
this.set(key, options[key], value);
});
} | javascript | function Config(options) {
if (options === undefined) options = {};
options = this.extractCredentials(options);
AWS.util.each.call(this, this.keys, function (key, value) {
this.set(key, options[key], value);
});
} | [
"function",
"Config",
"(",
"options",
")",
"{",
"if",
"(",
"options",
"===",
"undefined",
")",
"options",
"=",
"{",
"}",
";",
"options",
"=",
"this",
".",
"extractCredentials",
"(",
"options",
")",
";",
"AWS",
".",
"util",
".",
"each",
".",
"call",
"... | @!endgroup
Creates a new configuration object. This is the object that passes
option data along to service requests, including credentials, security,
region information, and some service specific settings.
@example Creating a new configuration object with credentials and region
var config = new AWS.Config({
accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2'
});
@option options accessKeyId [String] your AWS access key ID.
@option options secretAccessKey [String] your AWS secret access key.
@option options sessionToken [AWS.Credentials] the optional AWS
session token to sign requests with.
@option options credentials [AWS.Credentials] the AWS credentials
to sign requests with. You can either specify this object, or
specify the accessKeyId and secretAccessKey options directly.
@option options credentialProvider [AWS.CredentialProviderChain] the
provider chain used to resolve credentials if no static `credentials`
property is set.
@option options region [String] the region to send service requests to.
See {region} for more information.
@option options maxRetries [Integer] the maximum amount of retries to
attempt with a request. See {maxRetries} for more information.
@option options maxRedirects [Integer] the maximum amount of redirects to
follow with a request. See {maxRedirects} for more information.
@option options sslEnabled [Boolean] whether to enable SSL for
requests.
@option options paramValidation [Boolean|map] whether input parameters
should be validated against the operation description before sending
the request. Defaults to true. Pass a map to enable any of the
following specific validation features:
* **min** [Boolean] — Validates that a value meets the min
constraint. This is enabled by default when paramValidation is set
to `true`.
* **max** [Boolean] — Validates that a value meets the max
constraint.
* **pattern** [Boolean] — Validates that a string value matches a
regular expression.
* **enum** [Boolean] — Validates that a string value matches one
of the allowable enum values.
@option options computeChecksums [Boolean] whether to compute checksums
for payload bodies when the service accepts it (currently supported
in S3 only)
@option options convertResponseTypes [Boolean] whether types are converted
when parsing response data. Currently only supported for JSON based
services. Turning this off may improve performance on large response
payloads. Defaults to `true`.
@option options correctClockSkew [Boolean] whether to apply a clock skew
correction and retry requests that fail because of an skewed client
clock. Defaults to `false`.
@option options s3ForcePathStyle [Boolean] whether to force path
style URLs for S3 objects.
@option options s3BucketEndpoint [Boolean] whether the provided endpoint
addresses an individual bucket (false if it addresses the root API
endpoint). Note that setting this configuration option requires an
`endpoint` to be provided explicitly to the service constructor.
@option options s3DisableBodySigning [Boolean] whether S3 body signing
should be disabled when using signature version `v4`. Body signing
can only be disabled when using https. Defaults to `true`.
@option options retryDelayOptions [map] A set of options to configure
the retry delay on retryable errors. Currently supported options are:
* **base** [Integer] — The base number of milliseconds to use in the
exponential backoff for operation retries. Defaults to 100 ms for all
services except DynamoDB, where it defaults to 50ms.
* **customBackoff ** [function] — A custom function that accepts a retry count
and returns the amount of time to delay in milliseconds. The `base` option will be
ignored if this option is supplied.
@option options httpOptions [map] A set of options to pass to the low-level
HTTP request. Currently supported options are:
* **proxy** [String] — the URL to proxy requests through
* **agent** [http.Agent, https.Agent] — the Agent object to perform
HTTP requests with. Used for connection pooling. Defaults to the global
agent (`http.globalAgent`) for non-SSL connections. Note that for
SSL connections, a special Agent object is used in order to enable
peer certificate verification. This feature is only available in the
Node.js environment.
* **connectTimeout** [Integer] — Sets the socket to timeout after
failing to establish a connection with the server after
`connectTimeout` milliseconds. This timeout has no effect once a socket
connection has been established.
* **timeout** [Integer] — Sets the socket to timeout after timeout
milliseconds of inactivity on the socket. Defaults to two minutes
(120000).
* **xhrAsync** [Boolean] — Whether the SDK will send asynchronous
HTTP requests. Used in the browser environment only. Set to false to
send requests synchronously. Defaults to true (async on).
* **xhrWithCredentials** [Boolean] — Sets the "withCredentials"
property of an XMLHttpRequest object. Used in the browser environment
only. Defaults to false.
@option options apiVersion [String, Date] a String in YYYY-MM-DD format
(or a date) that represents the latest possible API version that can be
used in all services (unless overridden by `apiVersions`). Specify
'latest' to use the latest possible version.
@option options apiVersions [map<String, String|Date>] a map of service
identifiers (the lowercase service class name) with the API version to
use when instantiating a service. Specify 'latest' for each individual
that can use the latest available version.
@option options logger [#write,#log] an object that responds to .write()
(like a stream) or .log() (like the console object) in order to log
information about requests
@option options systemClockOffset [Number] an offset value in milliseconds
to apply to all signing times. Use this to compensate for clock skew
when your system may be out of sync with the service time. Note that
this configuration option can only be applied to the global `AWS.config`
object and cannot be overridden in service-specific configuration.
Defaults to 0 milliseconds.
@option options signatureVersion [String] the signature version to sign
requests with (overriding the API configuration). Possible values are:
'v2', 'v3', 'v4'.
@option options signatureCache [Boolean] whether the signature to sign
requests with (overriding the API configuration) is cached. Only applies
to the signature version 'v4'. Defaults to `true`.
@option options dynamoDbCrc32 [Boolean] whether to validate the CRC32
checksum of HTTP response bodies returned by DynamoDB. Default: `true`.
@option options useAccelerateEndpoint [Boolean] Whether to use the
S3 Transfer Acceleration endpoint with the S3 service. Default: `false`.
@option options clientSideMonitoring [Boolean] whether to collect and
publish this client's performance metrics of all its API requests.
@option options endpointDiscoveryEnabled [Boolean] whether to enable endpoint
discovery for operations that allow optionally using an endpoint returned by
the service.
Defaults to 'false'
@option options endpointCacheSize [Number] the size of the global cache storing
endpoints from endpoint discovery operations. Once endpoint cache is created,
updating this setting cannot change existing cache size.
Defaults to 1000
@option options hostPrefixEnabled [Boolean] whether to marshal request
parameters to the prefix of hostname.
Defaults to `true`. | [
"@!endgroup",
"Creates",
"a",
"new",
"configuration",
"object",
".",
"This",
"is",
"the",
"object",
"that",
"passes",
"option",
"data",
"along",
"to",
"service",
"requests",
"including",
"credentials",
"security",
"region",
"information",
"and",
"some",
"service",... | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/config.js#L308-L315 | train | Config constructor. | [
30522,
3853,
9530,
8873,
2290,
1006,
7047,
1007,
1063,
2065,
1006,
7047,
1027,
1027,
1027,
6151,
28344,
1007,
7047,
1027,
1063,
1065,
1025,
7047,
1027,
2023,
1012,
14817,
16748,
16454,
26340,
1006,
7047,
1007,
1025,
22091,
2015,
1012,
21183... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 () {
var o = this.options,
c = this.$cache,
is_from_min = typeof o.from_min === "number" && !isNaN(o.from_min),
is_from_max = typeof o.from_max === "number" && !isNaN(o.from_max),
is_to_min = typeof o.to_min === "number" && !isNaN(o.to_min),
is_to_max = typeof o.to_max === "number" && !isNaN(o.to_max),
from_min,
from_max,
to_min,
to_max;
if (o.type === "single") {
if (o.from_shadow && (is_from_min || is_from_max)) {
from_min = this.convertToPercent(is_from_min ? o.from_min : o.min);
from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min;
from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min));
from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max));
from_min = from_min + (this.coords.p_handle / 2);
c.shad_single[0].style.display = "block";
c.shad_single[0].style.left = from_min + "%";
c.shad_single[0].style.width = from_max + "%";
} else {
c.shad_single[0].style.display = "none";
}
} else {
if (o.from_shadow && (is_from_min || is_from_max)) {
from_min = this.convertToPercent(is_from_min ? o.from_min : o.min);
from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min;
from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min));
from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max));
from_min = from_min + (this.coords.p_handle / 2);
c.shad_from[0].style.display = "block";
c.shad_from[0].style.left = from_min + "%";
c.shad_from[0].style.width = from_max + "%";
} else {
c.shad_from[0].style.display = "none";
}
if (o.to_shadow && (is_to_min || is_to_max)) {
to_min = this.convertToPercent(is_to_min ? o.to_min : o.min);
to_max = this.convertToPercent(is_to_max ? o.to_max : o.max) - to_min;
to_min = this.toFixed(to_min - (this.coords.p_handle / 100 * to_min));
to_max = this.toFixed(to_max - (this.coords.p_handle / 100 * to_max));
to_min = to_min + (this.coords.p_handle / 2);
c.shad_to[0].style.display = "block";
c.shad_to[0].style.left = to_min + "%";
c.shad_to[0].style.width = to_max + "%";
} else {
c.shad_to[0].style.display = "none";
}
}
} | javascript | function () {
var o = this.options,
c = this.$cache,
is_from_min = typeof o.from_min === "number" && !isNaN(o.from_min),
is_from_max = typeof o.from_max === "number" && !isNaN(o.from_max),
is_to_min = typeof o.to_min === "number" && !isNaN(o.to_min),
is_to_max = typeof o.to_max === "number" && !isNaN(o.to_max),
from_min,
from_max,
to_min,
to_max;
if (o.type === "single") {
if (o.from_shadow && (is_from_min || is_from_max)) {
from_min = this.convertToPercent(is_from_min ? o.from_min : o.min);
from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min;
from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min));
from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max));
from_min = from_min + (this.coords.p_handle / 2);
c.shad_single[0].style.display = "block";
c.shad_single[0].style.left = from_min + "%";
c.shad_single[0].style.width = from_max + "%";
} else {
c.shad_single[0].style.display = "none";
}
} else {
if (o.from_shadow && (is_from_min || is_from_max)) {
from_min = this.convertToPercent(is_from_min ? o.from_min : o.min);
from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min;
from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min));
from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max));
from_min = from_min + (this.coords.p_handle / 2);
c.shad_from[0].style.display = "block";
c.shad_from[0].style.left = from_min + "%";
c.shad_from[0].style.width = from_max + "%";
} else {
c.shad_from[0].style.display = "none";
}
if (o.to_shadow && (is_to_min || is_to_max)) {
to_min = this.convertToPercent(is_to_min ? o.to_min : o.min);
to_max = this.convertToPercent(is_to_max ? o.to_max : o.max) - to_min;
to_min = this.toFixed(to_min - (this.coords.p_handle / 100 * to_min));
to_max = this.toFixed(to_max - (this.coords.p_handle / 100 * to_max));
to_min = to_min + (this.coords.p_handle / 2);
c.shad_to[0].style.display = "block";
c.shad_to[0].style.left = to_min + "%";
c.shad_to[0].style.width = to_max + "%";
} else {
c.shad_to[0].style.display = "none";
}
}
} | [
"function",
"(",
")",
"{",
"var",
"o",
"=",
"this",
".",
"options",
",",
"c",
"=",
"this",
".",
"$cache",
",",
"is_from_min",
"=",
"typeof",
"o",
".",
"from_min",
"===",
"\"number\"",
"&&",
"!",
"isNaN",
"(",
"o",
".",
"from_min",
")",
",",
"is_fro... | Draw shadow intervals | [
"Draw",
"shadow",
"intervals"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1585-L1642 | train | set the style of the shad_single | [
30522,
3853,
1006,
1007,
1063,
13075,
1051,
1027,
2023,
1012,
7047,
1010,
1039,
1027,
2023,
1012,
1002,
17053,
1010,
2003,
1035,
2013,
1035,
8117,
1027,
2828,
11253,
1051,
1012,
2013,
1035,
8117,
1027,
1027,
1027,
1000,
2193,
1000,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jhipster/generator-jhipster | generators/utils.js | rewriteFile | function rewriteFile(args, generator) {
args.path = args.path || process.cwd();
const fullPath = path.join(args.path, args.file);
args.haystack = generator.fs.read(fullPath);
const body = rewrite(args);
generator.fs.write(fullPath, body);
} | javascript | function rewriteFile(args, generator) {
args.path = args.path || process.cwd();
const fullPath = path.join(args.path, args.file);
args.haystack = generator.fs.read(fullPath);
const body = rewrite(args);
generator.fs.write(fullPath, body);
} | [
"function",
"rewriteFile",
"(",
"args",
",",
"generator",
")",
"{",
"args",
".",
"path",
"=",
"args",
".",
"path",
"||",
"process",
".",
"cwd",
"(",
")",
";",
"const",
"fullPath",
"=",
"path",
".",
"join",
"(",
"args",
".",
"path",
",",
"args",
"."... | Rewrite file with passed arguments
@param {object} args argument object (containing path, file, haystack, etc properties)
@param {object} generator reference to the generator | [
"Rewrite",
"file",
"with",
"passed",
"arguments"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/utils.js#L57-L64 | train | Rewrite a file | [
30522,
3853,
2128,
26373,
8873,
2571,
1006,
12098,
5620,
1010,
13103,
1007,
1063,
12098,
5620,
1012,
4130,
1027,
12098,
5620,
1012,
4130,
1064,
1064,
2832,
1012,
19296,
2094,
1006,
1007,
1025,
9530,
3367,
2440,
15069,
1027,
4130,
1012,
3693... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 (binarray) {
var hex_tab = "0123456789abcdef";
var str = "";
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
}
return str;
} | javascript | function (binarray) {
var hex_tab = "0123456789abcdef";
var str = "";
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
}
return str;
} | [
"function",
"(",
"binarray",
")",
"{",
"var",
"hex_tab",
"=",
"\"0123456789abcdef\"",
";",
"var",
"str",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"binarray",
".",
"length",
"*",
"4",
";",
"i",
"++",
")",
"{",
"str",
"+="... | /*
Convert an array of little-endian words to a hex string. | [
"/",
"*",
"Convert",
"an",
"array",
"of",
"little",
"-",
"endian",
"words",
"to",
"a",
"hex",
"string",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L328-L337 | train | Returns the string of the last 4 bytes of the array | [
30522,
3853,
1006,
8026,
2906,
9447,
1007,
1063,
13075,
2002,
2595,
1035,
21628,
1027,
1000,
5890,
21926,
19961,
2575,
2581,
2620,
2683,
7875,
19797,
12879,
1000,
1025,
13075,
2358,
2099,
1027,
1000,
1000,
1025,
2005,
1006,
13075,
1045,
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... | |
adobe/brackets | src/extensions/default/NoDistractions/main.js | _showPanelsIfRequired | function _showPanelsIfRequired() {
var panelIDs = _previouslyOpenPanelIDs;
panelIDs.forEach(function (panelID) {
var panel = WorkspaceManager.getPanelForID(panelID);
if (panel) {
panel.show();
}
});
_previouslyOpenPanelIDs = [];
} | javascript | function _showPanelsIfRequired() {
var panelIDs = _previouslyOpenPanelIDs;
panelIDs.forEach(function (panelID) {
var panel = WorkspaceManager.getPanelForID(panelID);
if (panel) {
panel.show();
}
});
_previouslyOpenPanelIDs = [];
} | [
"function",
"_showPanelsIfRequired",
"(",
")",
"{",
"var",
"panelIDs",
"=",
"_previouslyOpenPanelIDs",
";",
"panelIDs",
".",
"forEach",
"(",
"function",
"(",
"panelID",
")",
"{",
"var",
"panel",
"=",
"WorkspaceManager",
".",
"getPanelForID",
"(",
"panelID",
")",... | show all open panels that was previously hidden by _hidePanelsIfRequired() | [
"show",
"all",
"open",
"panels",
"that",
"was",
"previously",
"hidden",
"by",
"_hidePanelsIfRequired",
"()"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NoDistractions/main.js#L92-L101 | train | show all panels | [
30522,
3853,
1035,
2265,
9739,
9050,
10128,
2890,
15549,
5596,
1006,
1007,
1063,
13075,
5997,
9821,
1027,
1035,
3130,
26915,
9739,
20806,
5104,
1025,
5997,
9821,
1012,
18921,
6776,
1006,
3853,
1006,
5997,
3593,
1007,
1063,
13075,
5997,
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... |
PrismJS/prism | plugins/line-highlight/prism-line-highlight.js | highlightLines | function highlightLines(pre, lines, classes) {
lines = typeof lines === 'string' ? lines : pre.getAttribute('data-line');
var ranges = lines.replace(/\s+/g, '').split(',');
var offset = +pre.getAttribute('data-line-offset') || 0;
var parseMethod = isLineHeightRounded() ? parseInt : parseFloat;
var lineHeight = parseMethod(getComputedStyle(pre).lineHeight);
var hasLineNumbers = hasClass(pre, 'line-numbers');
var parentElement = hasLineNumbers ? pre : pre.querySelector('code') || pre;
var mutateActions = /** @type {(() => void)[]} */ ([]);
ranges.forEach(function (currentRange) {
var range = currentRange.split('-');
var start = +range[0];
var end = +range[1] || start;
var line = pre.querySelector('.line-highlight[data-range="' + currentRange + '"]') || document.createElement('div');
mutateActions.push(function () {
line.setAttribute('aria-hidden', 'true');
line.setAttribute('data-range', currentRange);
line.className = (classes || '') + ' line-highlight';
});
// if the line-numbers plugin is enabled, then there is no reason for this plugin to display the line numbers
if (hasLineNumbers && Prism.plugins.lineNumbers) {
var startNode = Prism.plugins.lineNumbers.getLine(pre, start);
var endNode = Prism.plugins.lineNumbers.getLine(pre, end);
if (startNode) {
var top = startNode.offsetTop + 'px';
mutateActions.push(function () {
line.style.top = top;
});
}
if (endNode) {
var height = (endNode.offsetTop - startNode.offsetTop) + endNode.offsetHeight + 'px';
mutateActions.push(function () {
line.style.height = height;
});
}
} else {
mutateActions.push(function () {
line.setAttribute('data-start', start);
if (end > start) {
line.setAttribute('data-end', end);
}
line.style.top = (start - offset - 1) * lineHeight + 'px';
line.textContent = new Array(end - start + 2).join(' \n');
});
}
mutateActions.push(function () {
// allow this to play nicely with the line-numbers plugin
// need to attack to pre as when line-numbers is enabled, the code tag is relatively which screws up the positioning
parentElement.appendChild(line);
});
});
return function () {
mutateActions.forEach(callFunction);
};
} | javascript | function highlightLines(pre, lines, classes) {
lines = typeof lines === 'string' ? lines : pre.getAttribute('data-line');
var ranges = lines.replace(/\s+/g, '').split(',');
var offset = +pre.getAttribute('data-line-offset') || 0;
var parseMethod = isLineHeightRounded() ? parseInt : parseFloat;
var lineHeight = parseMethod(getComputedStyle(pre).lineHeight);
var hasLineNumbers = hasClass(pre, 'line-numbers');
var parentElement = hasLineNumbers ? pre : pre.querySelector('code') || pre;
var mutateActions = /** @type {(() => void)[]} */ ([]);
ranges.forEach(function (currentRange) {
var range = currentRange.split('-');
var start = +range[0];
var end = +range[1] || start;
var line = pre.querySelector('.line-highlight[data-range="' + currentRange + '"]') || document.createElement('div');
mutateActions.push(function () {
line.setAttribute('aria-hidden', 'true');
line.setAttribute('data-range', currentRange);
line.className = (classes || '') + ' line-highlight';
});
// if the line-numbers plugin is enabled, then there is no reason for this plugin to display the line numbers
if (hasLineNumbers && Prism.plugins.lineNumbers) {
var startNode = Prism.plugins.lineNumbers.getLine(pre, start);
var endNode = Prism.plugins.lineNumbers.getLine(pre, end);
if (startNode) {
var top = startNode.offsetTop + 'px';
mutateActions.push(function () {
line.style.top = top;
});
}
if (endNode) {
var height = (endNode.offsetTop - startNode.offsetTop) + endNode.offsetHeight + 'px';
mutateActions.push(function () {
line.style.height = height;
});
}
} else {
mutateActions.push(function () {
line.setAttribute('data-start', start);
if (end > start) {
line.setAttribute('data-end', end);
}
line.style.top = (start - offset - 1) * lineHeight + 'px';
line.textContent = new Array(end - start + 2).join(' \n');
});
}
mutateActions.push(function () {
// allow this to play nicely with the line-numbers plugin
// need to attack to pre as when line-numbers is enabled, the code tag is relatively which screws up the positioning
parentElement.appendChild(line);
});
});
return function () {
mutateActions.forEach(callFunction);
};
} | [
"function",
"highlightLines",
"(",
"pre",
",",
"lines",
",",
"classes",
")",
"{",
"lines",
"=",
"typeof",
"lines",
"===",
"'string'",
"?",
"lines",
":",
"pre",
".",
"getAttribute",
"(",
"'data-line'",
")",
";",
"var",
"ranges",
"=",
"lines",
".",
"replac... | Highlights the lines of the given pre.
This function is split into a DOM measuring and mutate phase to improve performance.
The returned function mutates the DOM when called.
@param {HTMLElement} pre
@param {string} [lines]
@param {string} [classes='']
@returns {() => void} | [
"Highlights",
"the",
"lines",
"of",
"the",
"given",
"pre",
"."
] | acceb3b56f0e8362a7ef274dbd85b17611df2ec4 | https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/plugins/line-highlight/prism-line-highlight.js#L53-L121 | train | Highlights the given lines. | [
30522,
3853,
12944,
12735,
1006,
3653,
1010,
3210,
1010,
4280,
1007,
1063,
3210,
1027,
2828,
11253,
3210,
1027,
1027,
1027,
1005,
5164,
1005,
1029,
3210,
1024,
3653,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
1005,
2951,
1011,
2240,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js | function(iRequestType, sGroupId, iLevel, oGroupContextFilter,
iStartIndex, iLength, bAvoidLengthUpdate, bUseStartIndexForSkip) {
var aHierarchyLevelFilters;
// (1) set up analytical OData request object
var oAnalyticalQueryRequest = new odata4analytics.QueryResultRequest(that.oAnalyticalQueryResult);
oAnalyticalQueryRequest.setResourcePath(that._getResourcePath());
oAnalyticalQueryRequest.getSortExpression().clear();
// (2) analyze aggregation level of sGroupId
// indexes to elements of this.aMaxAggregationLevel marking begin and end of the requested child level
var iChildGroupFromLevel = 0, iChildGroupToLevel = -1;
iChildGroupFromLevel = iChildGroupToLevel = iLevel - 1;
var iUngroupedParentLevelCount = 0;
// determine offset for child level (depends on grouped column property of higher aggregation levels)
// Ex: Assume aMaxAggregationLevel with (G=grouped,U=ungrouped): [ G1 U1 U2 G2 U3 U4 G3 F5 F6 ... ]
// For sGroupId = "G1/G2", initial iChildGroupFromLevel is 2. The following loop will increment it to 4
// and consequently point to U3
for (var i = 0, iParentLevel = 0; i < iChildGroupFromLevel; iParentLevel++) {
if (that.oDimensionDetailsSet[that.aMaxAggregationLevel[iParentLevel]].grouped == false) {
++iUngroupedParentLevelCount;
} else {
++i;
}
}
// adjust child levels by number of ungrouped parent levels!
iChildGroupFromLevel = iChildGroupToLevel = iChildGroupFromLevel + iUngroupedParentLevelCount;
// determine index range for aggregation levels included in child level
// (rule: take all lower levels up to and including the first grouped level; G3 in above example
if (that.aMaxAggregationLevel.length > 0) {
while (that.oDimensionDetailsSet[that.aMaxAggregationLevel[iChildGroupToLevel]].grouped == false) {
if (++iChildGroupToLevel == that.aMaxAggregationLevel.length) {
break;
}
}
}
// determine if the sub groups will effectively represent leafs (relevant for un-"total"ed columns, see below)
var bIsLeafGroupsRequest = iChildGroupToLevel >= that.aMaxAggregationLevel.length - 1;
// (3) set aggregation level for child nodes
aHierarchyLevelFilters
= that._getHierarchyLevelFiltersAndAddRecursiveHierarchy(oAnalyticalQueryRequest,
sGroupId);
var aAggregationLevel = that.aMaxAggregationLevel.slice(0, iChildGroupToLevel + 1);
oAnalyticalQueryRequest.setAggregationLevel(aAggregationLevel);
for (var l = 0; l < aAggregationLevel.length; l++) {
var oDimensionDetails = that.oDimensionDetailsSet[aAggregationLevel[l]];
var bIncludeText = (oDimensionDetails.textPropertyName != undefined);
oAnalyticalQueryRequest.includeDimensionKeyTextAttributes(oDimensionDetails.name, // bIncludeKey: No, always needed!
true, bIncludeText, oDimensionDetails.aAttributeName);
// define a default sort order in case no sort criteria have been provided externally
if (oDimensionDetails.grouped) {
oAnalyticalQueryRequest.getSortExpression().addSorter(aAggregationLevel[l], odata4analytics.SortOrder.Ascending);
}
}
// (4) set filter
var oFilterExpression = oAnalyticalQueryRequest.getFilterExpression();
oFilterExpression.clear();
if (that.aApplicationFilter) {
oFilterExpression.addUI5FilterConditions(that.aApplicationFilter);
}
if (that.aControlFilter) {
oFilterExpression.addUI5FilterConditions(that.aControlFilter);
}
if (oGroupContextFilter) {
oFilterExpression.addUI5FilterConditions([oGroupContextFilter]);
}
AnalyticalBinding._addHierarchyLevelFilters(aHierarchyLevelFilters, oFilterExpression);
// (5) set measures as requested per column
var bIncludeRawValue;
var bIncludeFormattedValue;
var bIncludeUnitProperty;
var oMeasureDetails;
var aSelectedUnitPropertyName = [];
// select measures if the requested group is not the root context i.e. the grand totals row, or grand totals shall be determined
oAnalyticalQueryRequest.setMeasures(that.aMeasureName);
for ( var sMeasureName in that.oMeasureDetailsSet) {
oMeasureDetails = that.oMeasureDetailsSet[sMeasureName];
if (!bIsLeafGroupsRequest && that.mAnalyticalInfoByProperty[sMeasureName].total == false) {
bIncludeRawValue = false;
bIncludeFormattedValue = false;
bIncludeUnitProperty = false;
} else {
bIncludeRawValue = (oMeasureDetails.rawValuePropertyName != undefined);
bIncludeFormattedValue = (oMeasureDetails.formattedValuePropertyName != undefined);
bIncludeUnitProperty = (oMeasureDetails.unitPropertyName != undefined);
if (bIncludeUnitProperty) {
// remember unit property together with using measure raw value property for response analysis in success handler
if (aSelectedUnitPropertyName.indexOf(oMeasureDetails.unitPropertyName) == -1) {
aSelectedUnitPropertyName.push(oMeasureDetails.unitPropertyName);
}
}
}
oAnalyticalQueryRequest.includeMeasureRawFormattedValueUnit(oMeasureDetails.name, bIncludeRawValue,
bIncludeFormattedValue, bIncludeUnitProperty);
}
// exclude those unit properties from the selected that are included in the current aggregation level
for ( var j in aAggregationLevel) {
var iMatchingIndex;
if ((iMatchingIndex = aSelectedUnitPropertyName.indexOf(aAggregationLevel[j])) != -1) {
aSelectedUnitPropertyName.splice(iMatchingIndex, 1);
}
}
// (6) set sort order
var oSorter = oAnalyticalQueryRequest.getSortExpression();
for (var k = 0; k < that.aSorter.length; k++) {
if (that.aSorter[k]) {
oSorter.addSorter(that.aSorter[k].sPath, that.aSorter[k].bDescending ? odata4analytics.SortOrder.Descending : odata4analytics.SortOrder.Ascending);
}
}
// (7) set result page boundaries
if (iLength == 0) {
oLogger.fatal("unhandled case: load 0 entities of sub group");
}
var iEffectiveStartIndex = iStartIndex;
if (!bUseStartIndexForSkip) {
iEffectiveStartIndex = 0; // and the skip-value is encoded in the filter expression; still the start index is relevant and kept (see below) for booking the result entries
} else {
// when bUseStartIndexForSkip is set and no filter conditions are given, the top level must also be paged
// calculate the number of loaded entries per level
var iServiceLengthForGroupIdMissing = 0;
for (var sGID in that.mServiceKey) {
if (sGID.split("/").length === iLevel + 1) {
iServiceLengthForGroupIdMissing += that.mServiceKey[sGID].length;
}
}
iEffectiveStartIndex = Math.max(iEffectiveStartIndex, iServiceLengthForGroupIdMissing);
}
if (!that.bNoPaging) {
oAnalyticalQueryRequest.setResultPageBoundaries(iEffectiveStartIndex + 1, iLength);
}
return {
iRequestType : iRequestType,
sRequestId : null, // set by caller
oAnalyticalQueryRequest : oAnalyticalQueryRequest,
iLevel : iLevel,
aSelectedUnitPropertyName : aSelectedUnitPropertyName,
aAggregationLevel : aAggregationLevel,
bIsFlatListRequest : bIsLeafGroupsRequest,
bIsLeafGroupsRequest : bIsLeafGroupsRequest,
iStartIndex : iStartIndex,
iLength : iLength,
bAvoidLengthUpdate : bAvoidLengthUpdate
};
} | javascript | function(iRequestType, sGroupId, iLevel, oGroupContextFilter,
iStartIndex, iLength, bAvoidLengthUpdate, bUseStartIndexForSkip) {
var aHierarchyLevelFilters;
// (1) set up analytical OData request object
var oAnalyticalQueryRequest = new odata4analytics.QueryResultRequest(that.oAnalyticalQueryResult);
oAnalyticalQueryRequest.setResourcePath(that._getResourcePath());
oAnalyticalQueryRequest.getSortExpression().clear();
// (2) analyze aggregation level of sGroupId
// indexes to elements of this.aMaxAggregationLevel marking begin and end of the requested child level
var iChildGroupFromLevel = 0, iChildGroupToLevel = -1;
iChildGroupFromLevel = iChildGroupToLevel = iLevel - 1;
var iUngroupedParentLevelCount = 0;
// determine offset for child level (depends on grouped column property of higher aggregation levels)
// Ex: Assume aMaxAggregationLevel with (G=grouped,U=ungrouped): [ G1 U1 U2 G2 U3 U4 G3 F5 F6 ... ]
// For sGroupId = "G1/G2", initial iChildGroupFromLevel is 2. The following loop will increment it to 4
// and consequently point to U3
for (var i = 0, iParentLevel = 0; i < iChildGroupFromLevel; iParentLevel++) {
if (that.oDimensionDetailsSet[that.aMaxAggregationLevel[iParentLevel]].grouped == false) {
++iUngroupedParentLevelCount;
} else {
++i;
}
}
// adjust child levels by number of ungrouped parent levels!
iChildGroupFromLevel = iChildGroupToLevel = iChildGroupFromLevel + iUngroupedParentLevelCount;
// determine index range for aggregation levels included in child level
// (rule: take all lower levels up to and including the first grouped level; G3 in above example
if (that.aMaxAggregationLevel.length > 0) {
while (that.oDimensionDetailsSet[that.aMaxAggregationLevel[iChildGroupToLevel]].grouped == false) {
if (++iChildGroupToLevel == that.aMaxAggregationLevel.length) {
break;
}
}
}
// determine if the sub groups will effectively represent leafs (relevant for un-"total"ed columns, see below)
var bIsLeafGroupsRequest = iChildGroupToLevel >= that.aMaxAggregationLevel.length - 1;
// (3) set aggregation level for child nodes
aHierarchyLevelFilters
= that._getHierarchyLevelFiltersAndAddRecursiveHierarchy(oAnalyticalQueryRequest,
sGroupId);
var aAggregationLevel = that.aMaxAggregationLevel.slice(0, iChildGroupToLevel + 1);
oAnalyticalQueryRequest.setAggregationLevel(aAggregationLevel);
for (var l = 0; l < aAggregationLevel.length; l++) {
var oDimensionDetails = that.oDimensionDetailsSet[aAggregationLevel[l]];
var bIncludeText = (oDimensionDetails.textPropertyName != undefined);
oAnalyticalQueryRequest.includeDimensionKeyTextAttributes(oDimensionDetails.name, // bIncludeKey: No, always needed!
true, bIncludeText, oDimensionDetails.aAttributeName);
// define a default sort order in case no sort criteria have been provided externally
if (oDimensionDetails.grouped) {
oAnalyticalQueryRequest.getSortExpression().addSorter(aAggregationLevel[l], odata4analytics.SortOrder.Ascending);
}
}
// (4) set filter
var oFilterExpression = oAnalyticalQueryRequest.getFilterExpression();
oFilterExpression.clear();
if (that.aApplicationFilter) {
oFilterExpression.addUI5FilterConditions(that.aApplicationFilter);
}
if (that.aControlFilter) {
oFilterExpression.addUI5FilterConditions(that.aControlFilter);
}
if (oGroupContextFilter) {
oFilterExpression.addUI5FilterConditions([oGroupContextFilter]);
}
AnalyticalBinding._addHierarchyLevelFilters(aHierarchyLevelFilters, oFilterExpression);
// (5) set measures as requested per column
var bIncludeRawValue;
var bIncludeFormattedValue;
var bIncludeUnitProperty;
var oMeasureDetails;
var aSelectedUnitPropertyName = [];
// select measures if the requested group is not the root context i.e. the grand totals row, or grand totals shall be determined
oAnalyticalQueryRequest.setMeasures(that.aMeasureName);
for ( var sMeasureName in that.oMeasureDetailsSet) {
oMeasureDetails = that.oMeasureDetailsSet[sMeasureName];
if (!bIsLeafGroupsRequest && that.mAnalyticalInfoByProperty[sMeasureName].total == false) {
bIncludeRawValue = false;
bIncludeFormattedValue = false;
bIncludeUnitProperty = false;
} else {
bIncludeRawValue = (oMeasureDetails.rawValuePropertyName != undefined);
bIncludeFormattedValue = (oMeasureDetails.formattedValuePropertyName != undefined);
bIncludeUnitProperty = (oMeasureDetails.unitPropertyName != undefined);
if (bIncludeUnitProperty) {
// remember unit property together with using measure raw value property for response analysis in success handler
if (aSelectedUnitPropertyName.indexOf(oMeasureDetails.unitPropertyName) == -1) {
aSelectedUnitPropertyName.push(oMeasureDetails.unitPropertyName);
}
}
}
oAnalyticalQueryRequest.includeMeasureRawFormattedValueUnit(oMeasureDetails.name, bIncludeRawValue,
bIncludeFormattedValue, bIncludeUnitProperty);
}
// exclude those unit properties from the selected that are included in the current aggregation level
for ( var j in aAggregationLevel) {
var iMatchingIndex;
if ((iMatchingIndex = aSelectedUnitPropertyName.indexOf(aAggregationLevel[j])) != -1) {
aSelectedUnitPropertyName.splice(iMatchingIndex, 1);
}
}
// (6) set sort order
var oSorter = oAnalyticalQueryRequest.getSortExpression();
for (var k = 0; k < that.aSorter.length; k++) {
if (that.aSorter[k]) {
oSorter.addSorter(that.aSorter[k].sPath, that.aSorter[k].bDescending ? odata4analytics.SortOrder.Descending : odata4analytics.SortOrder.Ascending);
}
}
// (7) set result page boundaries
if (iLength == 0) {
oLogger.fatal("unhandled case: load 0 entities of sub group");
}
var iEffectiveStartIndex = iStartIndex;
if (!bUseStartIndexForSkip) {
iEffectiveStartIndex = 0; // and the skip-value is encoded in the filter expression; still the start index is relevant and kept (see below) for booking the result entries
} else {
// when bUseStartIndexForSkip is set and no filter conditions are given, the top level must also be paged
// calculate the number of loaded entries per level
var iServiceLengthForGroupIdMissing = 0;
for (var sGID in that.mServiceKey) {
if (sGID.split("/").length === iLevel + 1) {
iServiceLengthForGroupIdMissing += that.mServiceKey[sGID].length;
}
}
iEffectiveStartIndex = Math.max(iEffectiveStartIndex, iServiceLengthForGroupIdMissing);
}
if (!that.bNoPaging) {
oAnalyticalQueryRequest.setResultPageBoundaries(iEffectiveStartIndex + 1, iLength);
}
return {
iRequestType : iRequestType,
sRequestId : null, // set by caller
oAnalyticalQueryRequest : oAnalyticalQueryRequest,
iLevel : iLevel,
aSelectedUnitPropertyName : aSelectedUnitPropertyName,
aAggregationLevel : aAggregationLevel,
bIsFlatListRequest : bIsLeafGroupsRequest,
bIsLeafGroupsRequest : bIsLeafGroupsRequest,
iStartIndex : iStartIndex,
iLength : iLength,
bAvoidLengthUpdate : bAvoidLengthUpdate
};
} | [
"function",
"(",
"iRequestType",
",",
"sGroupId",
",",
"iLevel",
",",
"oGroupContextFilter",
",",
"iStartIndex",
",",
"iLength",
",",
"bAvoidLengthUpdate",
",",
"bUseStartIndexForSkip",
")",
"{",
"var",
"aHierarchyLevelFilters",
";",
"// (1) set up analytical OData reques... | local helper function for requesting members of a given level (across groups) - copied from _prepareGroupMembersQueryRequest & adapted | [
"local",
"helper",
"function",
"for",
"requesting",
"members",
"of",
"a",
"given",
"level",
"(",
"across",
"groups",
")",
"-",
"copied",
"from",
"_prepareGroupMembersQueryRequest",
"&",
"adapted"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js#L2171-L2331 | train | Analytical query request | [
30522,
3853,
1006,
20868,
2063,
15500,
13874,
1010,
22214,
22107,
3593,
1010,
17869,
15985,
1010,
13958,
22107,
8663,
18209,
8873,
21928,
1010,
21541,
8445,
22254,
30524,
1010,
7793,
7559,
7629,
3207,
2595,
29278,
5488,
2361,
1007,
1063,
1307... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensibility/Package.js | installFromPath | function installFromPath(path, filenameHint) {
var d = new $.Deferred();
install(path, filenameHint)
.done(function (result) {
result.keepFile = true;
var installationStatus = result.installationStatus;
if (installationStatus === InstallationStatuses.ALREADY_INSTALLED ||
installationStatus === InstallationStatuses.NEEDS_UPDATE ||
installationStatus === InstallationStatuses.SAME_VERSION ||
installationStatus === InstallationStatuses.OLDER_VERSION) {
d.resolve(result);
} else {
if (result.errors && result.errors.length > 0) {
// Validation errors - for now, only return the first one
d.reject(result.errors[0]);
} else if (result.disabledReason) {
// Extension valid but left disabled (wrong API version, extension name collision, etc.)
d.reject(result.disabledReason);
} else {
// Success! Extension is now running in Brackets
d.resolve(result);
}
}
})
.fail(function (err) {
d.reject(err);
});
return d.promise();
} | javascript | function installFromPath(path, filenameHint) {
var d = new $.Deferred();
install(path, filenameHint)
.done(function (result) {
result.keepFile = true;
var installationStatus = result.installationStatus;
if (installationStatus === InstallationStatuses.ALREADY_INSTALLED ||
installationStatus === InstallationStatuses.NEEDS_UPDATE ||
installationStatus === InstallationStatuses.SAME_VERSION ||
installationStatus === InstallationStatuses.OLDER_VERSION) {
d.resolve(result);
} else {
if (result.errors && result.errors.length > 0) {
// Validation errors - for now, only return the first one
d.reject(result.errors[0]);
} else if (result.disabledReason) {
// Extension valid but left disabled (wrong API version, extension name collision, etc.)
d.reject(result.disabledReason);
} else {
// Success! Extension is now running in Brackets
d.resolve(result);
}
}
})
.fail(function (err) {
d.reject(err);
});
return d.promise();
} | [
"function",
"installFromPath",
"(",
"path",
",",
"filenameHint",
")",
"{",
"var",
"d",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
";",
"install",
"(",
"path",
",",
"filenameHint",
")",
".",
"done",
"(",
"function",
"(",
"result",
")",
"{",
"result",
... | On success, resolves with an extension metadata object; at that point, the extension has already
started running in Brackets. On failure (including validation errors), rejects with an error object.
An error object consists of either a string error code OR an array where the first entry is the error
code and the remaining entries are further info. The error code string is one of either
ExtensionsDomain.Errors or Package.Errors. Use formatError() to convert an error object to a friendly,
localized error message.
@param {string} path Absolute path to the package zip file
@param {?string} filenameHint Hint for the extension folder's name (used in favor of
path's filename if present, and if no package metadata present).
@return {$.Promise} A promise that is rejected if there are errors during
install or the extension is disabled. | [
"On",
"success",
"resolves",
"with",
"an",
"extension",
"metadata",
"object",
";",
"at",
"that",
"point",
"the",
"extension",
"has",
"already",
"started",
"running",
"in",
"Brackets",
".",
"On",
"failure",
"(",
"including",
"validation",
"errors",
")",
"reject... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/Package.js#L304-L335 | train | Installs the extension from the given path. | [
30522,
3853,
16500,
19699,
25377,
8988,
1006,
4130,
1010,
5371,
18442,
10606,
2102,
1007,
1063,
13075,
1040,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1025,
16500,
1006,
4130,
1010,
5371,
18442,
10606,
2102,
1007,
1012,
2589,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/TimePickerSlider.js | function (oEvent) {
var iPageY = oEvent.changedTouches && oEvent.changedTouches.length ? oEvent.changedTouches[0].pageY : oEvent.pageY;
if (this._bIsDrag === false) {
this.fireTap(oEvent);
this._dragSession = null;
}
this._bIsDrag = true;
if (!this.getIsExpanded()) {
this._dragSession = null;
return;
}
this._endDrag(iPageY, oEvent.timeStamp);
this._mousedown = false;
} | javascript | function (oEvent) {
var iPageY = oEvent.changedTouches && oEvent.changedTouches.length ? oEvent.changedTouches[0].pageY : oEvent.pageY;
if (this._bIsDrag === false) {
this.fireTap(oEvent);
this._dragSession = null;
}
this._bIsDrag = true;
if (!this.getIsExpanded()) {
this._dragSession = null;
return;
}
this._endDrag(iPageY, oEvent.timeStamp);
this._mousedown = false;
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"iPageY",
"=",
"oEvent",
".",
"changedTouches",
"&&",
"oEvent",
".",
"changedTouches",
".",
"length",
"?",
"oEvent",
".",
"changedTouches",
"[",
"0",
"]",
".",
"pageY",
":",
"oEvent",
".",
"pageY",
";",
"if",
... | Default onTouchEnd handler.
@param {jQuery.Event} oEvent Event object | [
"Default",
"onTouchEnd",
"handler",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1282-L1300 | train | Handles the touchend event | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
13075,
24531,
3351,
2100,
1027,
1051,
18697,
3372,
1012,
2904,
24826,
8376,
1004,
1004,
1051,
18697,
3372,
1012,
2904,
24826,
8376,
1012,
3091,
1029,
1051,
18697,
3372,
1012,
2904,
24826,
83... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ccxt/ccxt | build/transpile.js | transpileDerivedExchangeClass | function transpileDerivedExchangeClass (contents) {
let exchangeClassDeclarationMatches = contents.match (/^module\.exports\s*=\s*class\s+([\S]+)\s+extends\s+([\S]+)\s+{([\s\S]+?)^};*/m)
// log.green (file, exchangeClassDeclarationMatches[3])
let className = exchangeClassDeclarationMatches[1]
let baseClass = exchangeClassDeclarationMatches[2]
let methods = exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/)
let python2 = []
let python3 = []
let php = []
let methodNames = []
// run through all methods
for (let i = 0; i < methods.length; i++) {
// parse the method signature
let part = methods[i].trim ()
let lines = part.split ("\n")
let signature = lines[0].trim ()
let methodSignatureRegex = /(async |)([\S]+)\s\(([^)]*)\)\s*{/ // signature line
let matches = methodSignatureRegex.exec (signature)
if (!matches) {
log.red (methods[i])
log.yellow.bright ("\nMake sure your methods don't have empty lines!\n")
}
// async or not
let keyword = matches[1]
// try {
// keyword = matches[1]
// } catch (e) {
// log.red (e)
// log.green (methods[i])
// log.yellow (exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/))
// process.exit ()
// }
// method name
let method = matches[2]
methodNames.push (method)
method = unCamelCase (method)
// method arguments
let args = matches[3].trim ()
// extract argument names and local variables
args = args.length ? args.split (',').map (x => x.trim ()) : []
// get names of all method arguments for later substitutions
let variables = args.map (arg => arg.split ('=').map (x => x.trim ()) [0])
// add $ to each argument name in PHP method signature
let phpArgs = args.join (', $').trim ().replace (/undefined/g, 'null').replace ('{}', 'array ()')
phpArgs = phpArgs.length ? ('$' + phpArgs) : ''
// remove excessive spacing from argument defaults in Python method signature
let pythonArgs = args.map (x => x.replace (' = ', '='))
.join (', ')
.replace (/undefined/g, 'None')
.replace (/false/g, 'False')
.replace (/true/g, 'True')
// method body without the signature (first line)
// and without the closing bracket (last line)
let js = lines.slice (1, -1).join ("\n")
// transpile everything
let { python3Body, python2Body, phpBody } = transpileJavaScriptToPythonAndPHP ({ js, className, variables, removeEmptyLines: true })
// compile the final Python code for the method signature
let pythonString = 'def ' + method + '(self' + (pythonArgs.length ? ', ' + pythonArgs : '') + '):'
// compile signature + body for Python 2
python2.push ('');
python2.push (' ' + pythonString);
python2.push (python2Body);
// compile signature + body for Python 3
python3.push ('');
python3.push (' ' + keyword + pythonString);
python3.push (python3Body);
// compile signature + body for PHP
php.push ('');
php.push (' public function ' + method + ' (' + phpArgs + ') {');
php.push (phpBody);
php.push (' }')
}
return {
// altogether in PHP, Python 2 and 3
python2: createPythonClass (className, baseClass, python2, methodNames),
python3: createPythonClass (className, baseClass, python3, methodNames, true),
php: createPHPClass (className, baseClass, php, methodNames),
className,
baseClass,
}
} | javascript | function transpileDerivedExchangeClass (contents) {
let exchangeClassDeclarationMatches = contents.match (/^module\.exports\s*=\s*class\s+([\S]+)\s+extends\s+([\S]+)\s+{([\s\S]+?)^};*/m)
// log.green (file, exchangeClassDeclarationMatches[3])
let className = exchangeClassDeclarationMatches[1]
let baseClass = exchangeClassDeclarationMatches[2]
let methods = exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/)
let python2 = []
let python3 = []
let php = []
let methodNames = []
// run through all methods
for (let i = 0; i < methods.length; i++) {
// parse the method signature
let part = methods[i].trim ()
let lines = part.split ("\n")
let signature = lines[0].trim ()
let methodSignatureRegex = /(async |)([\S]+)\s\(([^)]*)\)\s*{/ // signature line
let matches = methodSignatureRegex.exec (signature)
if (!matches) {
log.red (methods[i])
log.yellow.bright ("\nMake sure your methods don't have empty lines!\n")
}
// async or not
let keyword = matches[1]
// try {
// keyword = matches[1]
// } catch (e) {
// log.red (e)
// log.green (methods[i])
// log.yellow (exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/))
// process.exit ()
// }
// method name
let method = matches[2]
methodNames.push (method)
method = unCamelCase (method)
// method arguments
let args = matches[3].trim ()
// extract argument names and local variables
args = args.length ? args.split (',').map (x => x.trim ()) : []
// get names of all method arguments for later substitutions
let variables = args.map (arg => arg.split ('=').map (x => x.trim ()) [0])
// add $ to each argument name in PHP method signature
let phpArgs = args.join (', $').trim ().replace (/undefined/g, 'null').replace ('{}', 'array ()')
phpArgs = phpArgs.length ? ('$' + phpArgs) : ''
// remove excessive spacing from argument defaults in Python method signature
let pythonArgs = args.map (x => x.replace (' = ', '='))
.join (', ')
.replace (/undefined/g, 'None')
.replace (/false/g, 'False')
.replace (/true/g, 'True')
// method body without the signature (first line)
// and without the closing bracket (last line)
let js = lines.slice (1, -1).join ("\n")
// transpile everything
let { python3Body, python2Body, phpBody } = transpileJavaScriptToPythonAndPHP ({ js, className, variables, removeEmptyLines: true })
// compile the final Python code for the method signature
let pythonString = 'def ' + method + '(self' + (pythonArgs.length ? ', ' + pythonArgs : '') + '):'
// compile signature + body for Python 2
python2.push ('');
python2.push (' ' + pythonString);
python2.push (python2Body);
// compile signature + body for Python 3
python3.push ('');
python3.push (' ' + keyword + pythonString);
python3.push (python3Body);
// compile signature + body for PHP
php.push ('');
php.push (' public function ' + method + ' (' + phpArgs + ') {');
php.push (phpBody);
php.push (' }')
}
return {
// altogether in PHP, Python 2 and 3
python2: createPythonClass (className, baseClass, python2, methodNames),
python3: createPythonClass (className, baseClass, python3, methodNames, true),
php: createPHPClass (className, baseClass, php, methodNames),
className,
baseClass,
}
} | [
"function",
"transpileDerivedExchangeClass",
"(",
"contents",
")",
"{",
"let",
"exchangeClassDeclarationMatches",
"=",
"contents",
".",
"match",
"(",
"/",
"^module\\.exports\\s*=\\s*class\\s+([\\S]+)\\s+extends\\s+([\\S]+)\\s+{([\\s\\S]+?)^};*",
"/",
"m",
")",
"// log.green (file... | ---------------------------------------------------------------------------- | [
"----------------------------------------------------------------------------"
] | 8168069b9180a465532905e225586215e115a565 | https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/build/transpile.js#L587-L694 | train | transpileDerivedExchangeClass - Transpiles a class declaration into a derived class | [
30522,
3853,
9099,
22090,
4063,
3512,
3207,
2595,
22305,
8586,
27102,
1006,
8417,
1007,
1063,
2292,
3863,
26266,
3207,
20464,
25879,
3258,
18900,
8376,
1027,
8417,
1012,
2674,
1006,
1013,
1034,
11336,
1032,
1012,
14338,
1032,
1055,
1008,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/comma-spacing.js | report | function report(node, loc, otherNode) {
context.report({
node,
fix(fixer) {
if (options[loc]) {
if (loc === "before") {
return fixer.insertTextBefore(node, " ");
}
return fixer.insertTextAfter(node, " ");
}
let start, end;
const newText = "";
if (loc === "before") {
start = otherNode.range[1];
end = node.range[0];
} else {
start = node.range[1];
end = otherNode.range[0];
}
return fixer.replaceTextRange([start, end], newText);
},
messageId: options[loc] ? "missing" : "unexpected",
data: {
loc
}
});
} | javascript | function report(node, loc, otherNode) {
context.report({
node,
fix(fixer) {
if (options[loc]) {
if (loc === "before") {
return fixer.insertTextBefore(node, " ");
}
return fixer.insertTextAfter(node, " ");
}
let start, end;
const newText = "";
if (loc === "before") {
start = otherNode.range[1];
end = node.range[0];
} else {
start = node.range[1];
end = otherNode.range[0];
}
return fixer.replaceTextRange([start, end], newText);
},
messageId: options[loc] ? "missing" : "unexpected",
data: {
loc
}
});
} | [
"function",
"report",
"(",
"node",
",",
"loc",
",",
"otherNode",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
",",
"fix",
"(",
"fixer",
")",
"{",
"if",
"(",
"options",
"[",
"loc",
"]",
")",
"{",
"if",
"(",
"loc",
"===",
"\"before\"",
")"... | Reports a spacing error with an appropriate message.
@param {ASTNode} node The binary expression node to report.
@param {string} loc Is the error "before" or "after" the comma?
@param {ASTNode} otherNode The node at the left or right of `node`
@returns {void}
@private | [
"Reports",
"a",
"spacing",
"error",
"with",
"an",
"appropriate",
"message",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/comma-spacing.js#L74-L104 | train | Reports a node with an error message. | [
30522,
3853,
3189,
1006,
13045,
1010,
8840,
2278,
1010,
2060,
3630,
3207,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1010,
8081,
1006,
8081,
2121,
1007,
1063,
2065,
1006,
7047,
1031,
8840,
2278,
1033,
1007,
1063,
2065,
1006,
8840,
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... |
jhipster/generator-jhipster | generators/aws-containers/aws-client.js | _getAuthorizationToken | function _getAuthorizationToken() {
return spinner(
new Promise((resolve, reject) =>
ECR.sdk
.getAuthorizationToken({})
.promise()
.then(data => {
if (!_.has(data, 'authorizationData.0')) {
reject(new Error('No authorization data found.'));
return;
}
resolve(data.authorizationData[0]);
})
)
);
} | javascript | function _getAuthorizationToken() {
return spinner(
new Promise((resolve, reject) =>
ECR.sdk
.getAuthorizationToken({})
.promise()
.then(data => {
if (!_.has(data, 'authorizationData.0')) {
reject(new Error('No authorization data found.'));
return;
}
resolve(data.authorizationData[0]);
})
)
);
} | [
"function",
"_getAuthorizationToken",
"(",
")",
"{",
"return",
"spinner",
"(",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"ECR",
".",
"sdk",
".",
"getAuthorizationToken",
"(",
"{",
"}",
")",
".",
"promise",
"(",
")",
".",
"then",
... | Fetch Authentication token from AWS to authenticate with Docker
@returns {Promise} Returns a promise that resolves when the informations are retrieved.
@private | [
"Fetch",
"Authentication",
"token",
"from",
"AWS",
"to",
"authenticate",
"with",
"Docker"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/aws-client.js#L240-L255 | train | Get the authorization token from the SDK | [
30522,
3853,
1035,
2131,
4887,
27844,
3989,
18715,
2368,
1006,
1007,
1063,
2709,
6714,
3678,
1006,
2047,
4872,
1006,
1006,
10663,
1010,
15454,
1007,
1027,
1028,
14925,
2099,
1012,
17371,
2243,
1012,
2131,
4887,
27844,
3989,
18715,
2368,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | src/components/range/lib/events.js | Events | function Events (el, obj) {
if (!(this instanceof Events)) return new Events(el, obj)
if (!el) throw new Error('element required')
if (!obj) throw new Error('object required')
this.el = el
this.obj = obj
this._events = {}
} | javascript | function Events (el, obj) {
if (!(this instanceof Events)) return new Events(el, obj)
if (!el) throw new Error('element required')
if (!obj) throw new Error('object required')
this.el = el
this.obj = obj
this._events = {}
} | [
"function",
"Events",
"(",
"el",
",",
"obj",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Events",
")",
")",
"return",
"new",
"Events",
"(",
"el",
",",
"obj",
")",
"if",
"(",
"!",
"el",
")",
"throw",
"new",
"Error",
"(",
"'element required... | Initialize an `Events` with the given
`el` object which events will be bound to,
and the `obj` which will receive method calls.
@param {Object} el
@param {Object} obj
@api public | [
"Initialize",
"an",
"Events",
"with",
"the",
"given",
"el",
"object",
"which",
"events",
"will",
"be",
"bound",
"to",
"and",
"the",
"obj",
"which",
"will",
"receive",
"method",
"calls",
"."
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/range/lib/events.js#L24-L31 | train | Event object. | [
30522,
3853,
2824,
1006,
3449,
1010,
27885,
3501,
1007,
1063,
2065,
1006,
999,
1006,
2023,
6013,
11253,
2824,
1007,
1007,
2709,
2047,
2824,
1006,
3449,
1010,
27885,
3501,
1007,
2065,
1006,
999,
3449,
1007,
5466,
2047,
7561,
1006,
1005,
57... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.